test_HeapSnapshot_takeCensus_05.js 793 B

12345678910111213141516171819202122232425
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. // Test that HeapSnapshot.prototype.takeCensus finds cross compartment
  4. // wrapper GC roots.
  5. //
  6. // Ported from js/src/jit-test/tests/debug/Memory-takeCensus-05.js
  7. function run_test() {
  8. var g = newGlobal();
  9. var dbg = new Debugger(g);
  10. equal("AllocationMarker" in saveHeapSnapshotAndTakeCensus(dbg).objects, false,
  11. "No allocation markers should exist in the census.");
  12. this.ccw = g.allocationMarker();
  13. const census = saveHeapSnapshotAndTakeCensus(dbg);
  14. equal(census.objects.AllocationMarker.count, 1,
  15. "Should have one allocation marker in the census, because there " +
  16. "is one cross-compartment wrapper referring to it.");
  17. do_test_finished();
  18. }