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