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

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:2fdfb0794938
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 /**
5 * This test checks that sealed objects report themselves as sealed in their
6 * grip.
7 */
8
9 var gDebuggee;
10 var gClient;
11 var gThreadClient;
12
13 function run_test()
14 {
15 initTestDebuggerServer();
16 gDebuggee = addTestGlobal("test-grips");
17 gDebuggee.eval(function stopMe(arg1, arg2) {
18 debugger;
19 }.toString());
20
21 gClient = new DebuggerClient(DebuggerServer.connectPipe());
22 gClient.connect(function() {
23 attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) {
24 gThreadClient = aThreadClient;
25 test_object_grip();
26 });
27 });
28 do_test_pending();
29 }
30
31 function test_object_grip()
32 {
33 gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) {
34 let obj1 = aPacket.frame.arguments[0];
35 do_check_true(obj1.sealed);
36
37 let obj1Client = gThreadClient.pauseGrip(obj1);
38 do_check_true(obj1Client.isSealed);
39
40 let obj2 = aPacket.frame.arguments[1];
41 do_check_false(obj2.sealed);
42
43 let obj2Client = gThreadClient.pauseGrip(obj2);
44 do_check_false(obj2Client.isSealed);
45
46 gThreadClient.resume(_ => {
47 finishClient(gClient);
48 });
49 });
50
51 gDebuggee.eval("(" + function () {
52 let obj1 = {};
53 Object.seal(obj1);
54 stopMe(obj1, {});
55 } + "())");
56 }
57

mercurial