|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 /** |
|
5 * This test checks that objects which are not extensible report themselves as |
|
6 * such. |
|
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, arg3, arg4) { |
|
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 [f, s, ne, e] = aPacket.frame.arguments; |
|
35 let [fClient, sClient, neClient, eClient] = aPacket.frame.arguments.map( |
|
36 a => gThreadClient.pauseGrip(a)); |
|
37 |
|
38 do_check_false(f.extensible); |
|
39 do_check_false(fClient.isExtensible); |
|
40 |
|
41 do_check_false(s.extensible); |
|
42 do_check_false(sClient.isExtensible); |
|
43 |
|
44 do_check_false(ne.extensible); |
|
45 do_check_false(neClient.isExtensible); |
|
46 |
|
47 do_check_true(e.extensible); |
|
48 do_check_true(eClient.isExtensible); |
|
49 |
|
50 gThreadClient.resume(_ => { |
|
51 finishClient(gClient); |
|
52 }); |
|
53 }); |
|
54 |
|
55 gDebuggee.eval("(" + function () { |
|
56 let f = {}; |
|
57 Object.freeze(f); |
|
58 let s = {}; |
|
59 Object.seal(s); |
|
60 let ne = {}; |
|
61 Object.preventExtensions(ne); |
|
62 stopMe(f, s, ne, {}); |
|
63 } + "())"); |
|
64 } |
|
65 |