test_objectgrips-24.js (1384B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 // Test that ES6 classes grip have the expected properties. 5 6 "use strict"; 7 8 Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true); 9 registerCleanupFunction(() => { 10 Services.prefs.clearUserPref("security.allow_eval_with_system_principal"); 11 }); 12 13 add_task( 14 threadFrontTest(async ({ threadFront, debuggee }) => { 15 debuggee.eval( 16 function stopMe() { 17 debugger; 18 }.toString() 19 ); 20 21 const tests = [ 22 { 23 fn: `function(){}`, 24 isAsync: false, 25 isGenerator: false, 26 }, 27 { 28 fn: `async function(){}`, 29 isAsync: true, 30 isGenerator: false, 31 }, 32 { 33 fn: `function *(){}`, 34 isAsync: false, 35 isGenerator: true, 36 }, 37 { 38 fn: `async function *(){}`, 39 isAsync: true, 40 isGenerator: true, 41 }, 42 ]; 43 44 for (const { fn, isAsync, isGenerator } of tests) { 45 const packet = await executeOnNextTickAndWaitForPause( 46 () => debuggee.eval(`stopMe(${fn})`), 47 threadFront 48 ); 49 const [grip] = packet.frame.arguments; 50 strictEqual(grip.class, "Function"); 51 strictEqual(grip.isAsync, isAsync); 52 strictEqual(grip.isGenerator, isGenerator); 53 54 await threadFront.resume(); 55 } 56 }) 57 );