tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_HeapSnapshot_takeCensus_03.js (1154B)


      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 behaves plausibly as we add and remove
      6 // debuggees.
      7 //
      8 // Ported from js/src/jit-test/tests/debug/Memory-takeCensus-03.js
      9 
     10 function run_test() {
     11  const dbg = new Debugger();
     12 
     13  const census0 = saveHeapSnapshotAndTakeCensus(dbg);
     14  Census.walkCensus(census0, "census0", Census.assertAllZeros);
     15 
     16  const g1 = newGlobal();
     17  dbg.addDebuggee(g1);
     18  const census1 = saveHeapSnapshotAndTakeCensus(dbg);
     19  Census.walkCensus(census1, "census1", Census.assertAllNotLessThan(census0));
     20 
     21  const g2 = newGlobal();
     22  dbg.addDebuggee(g2);
     23  const census2 = saveHeapSnapshotAndTakeCensus(dbg);
     24  Census.walkCensus(census2, "census2", Census.assertAllNotLessThan(census1));
     25 
     26  dbg.removeDebuggee(g2);
     27  const census3 = saveHeapSnapshotAndTakeCensus(dbg);
     28  Census.walkCensus(census3, "census3", Census.assertAllEqual(census1));
     29 
     30  dbg.removeDebuggee(g1);
     31  const census4 = saveHeapSnapshotAndTakeCensus(dbg);
     32  Census.walkCensus(census4, "census4", Census.assertAllEqual(census0));
     33 
     34  do_test_finished();
     35 }