test_objectgrips-sparse-array.js (1134B)
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 await threadFront.resume(); 20 21 strictEqual(grip.class, "Array", "The grip has an Array class"); 22 23 const { items } = grip.preview; 24 strictEqual(items[0], null, "The empty slot has null as grip preview"); 25 deepEqual( 26 items[1], 27 { type: "undefined" }, 28 "The undefined value has grip value of type undefined" 29 ); 30 }) 31 ); 32 33 function evalCode(debuggee) { 34 debuggee.eval( 35 // These arguments are tested. 36 // eslint-disable-next-line no-unused-vars 37 function stopMe(arr) { 38 debugger; 39 }.toString() 40 ); 41 debuggee.eval("stopMe([, undefined])"); 42 }