test_framebindings-08.js (1743B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Check that we're getting arg / variable named "__proto__" (See Bug 1980263) 7 8 add_task( 9 threadFrontTest(async ({ threadFront, debuggee }) => { 10 const packet = await executeOnNextTickAndWaitForPause( 11 () => 12 debuggee.eval(` 13 function foo(__proto__){ 14 debugger; 15 } 16 foo("bar") 17 `), 18 threadFront 19 ); 20 21 const environment = await packet.frame.getEnvironment(); 22 Assert.equal(environment.type, "function"); 23 Assert.equal( 24 // The original bug is only reproducible in the test when cloning the result, since 25 // threadFrontTest uses a direct transport that gets us the object returned from 26 // the actor. 27 // eslint-disable-next-line no-proto 28 structuredClone(environment).bindings.arguments[0].__proto__.value, 29 "bar" 30 ); 31 32 await threadFront.resume(); 33 }) 34 ); 35 36 add_task( 37 threadFrontTest(async ({ threadFront, debuggee }) => { 38 const packet = await executeOnNextTickAndWaitForPause( 39 () => 40 debuggee.eval(` 41 (function() { 42 const __proto__ = "foo"; 43 debugger; 44 })() 45 `), 46 threadFront 47 ); 48 49 const environment = await packet.frame.getEnvironment(); 50 Assert.equal( 51 // The original bug is only reproducible in the test when cloning the result, since 52 // threadFrontTest uses a direct transport that gets us the object returned from 53 // the actor. 54 // eslint-disable-next-line no-proto 55 structuredClone(environment).bindings.variables.__proto__.value, 56 "foo" 57 ); 58 await threadFront.resume(); 59 }) 60 );