test_objectgrips-nested-proxy.js (1342B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true); 7 registerCleanupFunction(() => { 8 Services.prefs.clearUserPref("security.allow_eval_with_system_principal"); 9 }); 10 11 add_task( 12 threadFrontTest(async ({ threadFront, debuggee }) => { 13 const packet = await executeOnNextTickAndWaitForPause( 14 () => evalCode(debuggee), 15 threadFront 16 ); 17 18 const [grip] = packet.frame.arguments; 19 const objClient = threadFront.pauseGrip(grip); 20 const { proxyTarget, proxyHandler } = await objClient.getProxySlots(); 21 22 strictEqual(grip.class, "Proxy", "Its a proxy grip."); 23 strictEqual( 24 proxyTarget.getGrip().class, 25 "Proxy", 26 "The target is also a proxy." 27 ); 28 strictEqual( 29 proxyHandler.getGrip().class, 30 "Proxy", 31 "The handler is also a proxy." 32 ); 33 34 await threadFront.resume(); 35 }) 36 ); 37 38 function evalCode(debuggee) { 39 debuggee.eval( 40 // These arguments are tested. 41 // eslint-disable-next-line no-unused-vars 42 function stopMe(arg) { 43 debugger; 44 }.toString() 45 ); 46 47 debuggee.eval(` 48 var proxy = new Proxy({}, {}); 49 for (let i = 0; i < 1e5; ++i) 50 proxy = new Proxy(proxy, proxy); 51 stopMe(proxy); 52 `); 53 }