test_HeapSnapshot_takeCensus_01.js (967B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 "use strict"; 4 5 // HeapSnapshot.prototype.takeCensus returns a value of an appropriate 6 // shape. Ported from js/src/jit-tests/debug/Memory-takeCensus-01.js 7 8 function run_test() { 9 const dbg = new Debugger(); 10 11 function checkProperties(census) { 12 equal(typeof census, "object"); 13 for (const prop of Object.getOwnPropertyNames(census)) { 14 const desc = Object.getOwnPropertyDescriptor(census, prop); 15 equal(desc.enumerable, true); 16 equal(desc.configurable, true); 17 equal(desc.writable, true); 18 if (typeof desc.value === "object") { 19 checkProperties(desc.value); 20 } else { 21 equal(typeof desc.value, "number"); 22 } 23 } 24 } 25 26 checkProperties(saveHeapSnapshotAndTakeCensus(dbg)); 27 28 const g = newGlobal(); 29 dbg.addDebuggee(g); 30 checkProperties(saveHeapSnapshotAndTakeCensus(dbg)); 31 32 do_test_finished(); 33 }