toolkit/devtools/server/tests/unit/test_objectgrips-09.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:223122af13e7
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3 /**
4 * This tests exercises getProtypesAndProperties message accepted
5 * by a thread actor.
6 */
7
8 var gDebuggee;
9 var gClient;
10 var gThreadClient;
11
12 function run_test()
13 {
14 initTestDebuggerServer();
15 gDebuggee = addTestGlobal("test-grips");
16 gDebuggee.eval(function stopMe(arg1, arg2) {
17 debugger;
18 }.toString());
19
20 gClient = new DebuggerClient(DebuggerServer.connectPipe());
21 gClient.connect(function() {
22 attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) {
23 gThreadClient = aThreadClient;
24 test_object_grip();
25 });
26 });
27 do_test_pending();
28 }
29
30 function test_object_grip()
31 {
32 gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) {
33 let args = aPacket.frame.arguments;
34
35 gThreadClient.getPrototypesAndProperties([args[0].actor, args[1].actor], function(aResponse) {
36 let obj1 = aResponse.actors[args[0].actor];
37 let obj2 = aResponse.actors[args[1].actor];
38 do_check_eq(obj1.ownProperties.x.configurable, true);
39 do_check_eq(obj1.ownProperties.x.enumerable, true);
40 do_check_eq(obj1.ownProperties.x.writable, true);
41 do_check_eq(obj1.ownProperties.x.value, 10);
42
43 do_check_eq(obj1.ownProperties.y.configurable, true);
44 do_check_eq(obj1.ownProperties.y.enumerable, true);
45 do_check_eq(obj1.ownProperties.y.writable, true);
46 do_check_eq(obj1.ownProperties.y.value, "kaiju");
47
48 do_check_eq(obj2.ownProperties.z.configurable, true);
49 do_check_eq(obj2.ownProperties.z.enumerable, true);
50 do_check_eq(obj2.ownProperties.z.writable, true);
51 do_check_eq(obj2.ownProperties.z.value, 123);
52
53 do_check_true(obj1.prototype != undefined);
54 do_check_true(obj2.prototype != undefined);
55
56 gThreadClient.resume(function() {
57 finishClient(gClient);
58 });
59 });
60
61 });
62
63 gDebuggee.eval("stopMe({ x: 10, y: 'kaiju'}, { z: 123 })");
64 }
65

mercurial