delazify-findScript-parameterNames.js (911B)
1 function testDelazify(i) { 2 var g = newGlobal({ newCompartment: true }); 3 var dbg = new Debugger(g); 4 5 dbg.onDebuggerStatement = (frame) => { 6 var allScripts = dbg.findScripts(); 7 var j = 0; 8 for (let script of allScripts) { 9 if (i == -1 || i == j) { 10 // Delazify. 11 try { 12 script.parameterNames; 13 } catch (e) { 14 } 15 } 16 j++; 17 } 18 }; 19 20 var cache = cacheEntry(` 21 function f( 22 a = ( 23 b = ( 24 c = function g() { 25 }, 26 ) => { 27 }, 28 d = ( 29 e = ( 30 f = ( 31 ) => { 32 }, 33 ) => { 34 }, 35 ) => { 36 }, 37 ) => { 38 }, 39 ) { 40 } 41 debugger; 42 `); 43 44 evaluate(cache, { global: g, saveBytecodeWithDelazifications: true }); 45 evaluate(cache, { global: g, loadBytecode: true }); 46 } 47 48 // Delazify all. 49 testDelazify(-1); 50 51 // Delazify specific function and its ancestor. 52 for (var i = 0; i < 30; i++) { 53 testDelazify(i); 54 }