Memory-drainAllocationsLog-15.js (853B)
1 // Test drainAllocationsLog() and [[Class]] names. 2 const root = newGlobal({newCompartment: true}); 3 const dbg = new Debugger(); 4 const wrappedRoot = dbg.addDebuggee(root) 5 6 root.eval( 7 ` 8 this.tests = [ 9 { expected: "Object", test: () => new Object }, 10 { expected: "Array", test: () => [] }, 11 { expected: "Date", test: () => new Date }, 12 { expected: "RegExp", test: () => /problems/ }, 13 { expected: "Int8Array", test: () => new Int8Array }, 14 { expected: "Promise", test: () => new Promise(function (){})}, 15 ]; 16 ` 17 ); 18 19 20 for (let { expected, test } of root.tests) { 21 print(expected); 22 23 dbg.memory.trackingAllocationSites = true; 24 test(); 25 let allocs = dbg.memory.drainAllocationsLog(); 26 dbg.memory.trackingAllocationSites = false; 27 28 assertEq(allocs.some(a => a.class === expected), true); 29 }