michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: var gDebuggee; michael@0: var gClient; michael@0: var gThreadClient; michael@0: michael@0: function run_test() michael@0: { michael@0: initTestDebuggerServer(); michael@0: gDebuggee = addTestGlobal("test-grips"); michael@0: gDebuggee.eval(function stopMe(arg1) { michael@0: debugger; michael@0: }.toString()); michael@0: michael@0: gClient = new DebuggerClient(DebuggerServer.connectPipe()); michael@0: gClient.connect(function() { michael@0: attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { michael@0: gThreadClient = aThreadClient; michael@0: test_object_grip(); michael@0: }); michael@0: }); michael@0: do_test_pending(); michael@0: } michael@0: michael@0: function test_object_grip() michael@0: { michael@0: gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) { michael@0: let args = aPacket.frame.arguments; michael@0: michael@0: do_check_eq(args[0].class, "Object"); michael@0: michael@0: let objClient = gThreadClient.pauseGrip(args[0]); michael@0: objClient.getPrototypeAndProperties(function(aResponse) { michael@0: do_check_eq(aResponse.ownProperties.x.configurable, true); michael@0: do_check_eq(aResponse.ownProperties.x.enumerable, true); michael@0: do_check_eq(aResponse.ownProperties.x.writable, true); michael@0: do_check_eq(aResponse.ownProperties.x.value, 10); michael@0: michael@0: do_check_eq(aResponse.ownProperties.y.configurable, true); michael@0: do_check_eq(aResponse.ownProperties.y.enumerable, true); michael@0: do_check_eq(aResponse.ownProperties.y.writable, true); michael@0: do_check_eq(aResponse.ownProperties.y.value, "kaiju"); michael@0: michael@0: do_check_eq(aResponse.ownProperties.a.configurable, true); michael@0: do_check_eq(aResponse.ownProperties.a.enumerable, true); michael@0: do_check_eq(aResponse.ownProperties.a.get.type, "object"); michael@0: do_check_eq(aResponse.ownProperties.a.get.class, "Function"); michael@0: do_check_eq(aResponse.ownProperties.a.set.type, "undefined"); michael@0: michael@0: do_check_true(aResponse.prototype != undefined); michael@0: michael@0: let protoClient = gThreadClient.pauseGrip(aResponse.prototype); michael@0: protoClient.getOwnPropertyNames(function(aResponse) { michael@0: do_check_true(aResponse.ownPropertyNames.toString != undefined); michael@0: michael@0: gThreadClient.resume(function() { michael@0: finishClient(gClient); michael@0: }); michael@0: }); michael@0: }); michael@0: michael@0: }); michael@0: michael@0: gDebuggee.eval("stopMe({ x: 10, y: 'kaiju', get a() { return 42; } })"); michael@0: } michael@0: