Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | /** |
michael@0 | 5 | * This test checks that objects which are not extensible report themselves as |
michael@0 | 6 | * such. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | var gDebuggee; |
michael@0 | 10 | var gClient; |
michael@0 | 11 | var gThreadClient; |
michael@0 | 12 | |
michael@0 | 13 | function run_test() |
michael@0 | 14 | { |
michael@0 | 15 | initTestDebuggerServer(); |
michael@0 | 16 | gDebuggee = addTestGlobal("test-grips"); |
michael@0 | 17 | gDebuggee.eval(function stopMe(arg1, arg2, arg3, arg4) { |
michael@0 | 18 | debugger; |
michael@0 | 19 | }.toString()); |
michael@0 | 20 | |
michael@0 | 21 | gClient = new DebuggerClient(DebuggerServer.connectPipe()); |
michael@0 | 22 | gClient.connect(function() { |
michael@0 | 23 | attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { |
michael@0 | 24 | gThreadClient = aThreadClient; |
michael@0 | 25 | test_object_grip(); |
michael@0 | 26 | }); |
michael@0 | 27 | }); |
michael@0 | 28 | do_test_pending(); |
michael@0 | 29 | } |
michael@0 | 30 | |
michael@0 | 31 | function test_object_grip() |
michael@0 | 32 | { |
michael@0 | 33 | gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) { |
michael@0 | 34 | let [f, s, ne, e] = aPacket.frame.arguments; |
michael@0 | 35 | let [fClient, sClient, neClient, eClient] = aPacket.frame.arguments.map( |
michael@0 | 36 | a => gThreadClient.pauseGrip(a)); |
michael@0 | 37 | |
michael@0 | 38 | do_check_false(f.extensible); |
michael@0 | 39 | do_check_false(fClient.isExtensible); |
michael@0 | 40 | |
michael@0 | 41 | do_check_false(s.extensible); |
michael@0 | 42 | do_check_false(sClient.isExtensible); |
michael@0 | 43 | |
michael@0 | 44 | do_check_false(ne.extensible); |
michael@0 | 45 | do_check_false(neClient.isExtensible); |
michael@0 | 46 | |
michael@0 | 47 | do_check_true(e.extensible); |
michael@0 | 48 | do_check_true(eClient.isExtensible); |
michael@0 | 49 | |
michael@0 | 50 | gThreadClient.resume(_ => { |
michael@0 | 51 | finishClient(gClient); |
michael@0 | 52 | }); |
michael@0 | 53 | }); |
michael@0 | 54 | |
michael@0 | 55 | gDebuggee.eval("(" + function () { |
michael@0 | 56 | let f = {}; |
michael@0 | 57 | Object.freeze(f); |
michael@0 | 58 | let s = {}; |
michael@0 | 59 | Object.seal(s); |
michael@0 | 60 | let ne = {}; |
michael@0 | 61 | Object.preventExtensions(ne); |
michael@0 | 62 | stopMe(f, s, ne, {}); |
michael@0 | 63 | } + "())"); |
michael@0 | 64 | } |
michael@0 | 65 |