test_HeapSnapshot_takeCensus_01.js 925 B

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