1 // Test that the onGarbageCollection hook reports its gc cycle's number (aka the
2 // major GC number) and that it is monotonically increasing.
4 const root = newGlobal();
5 const dbg = new Debugger();
6 const wrappedRoot = dbg.addDebuggee(root)
8 Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);
9 registerCleanupFunction(() => {
10 Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
17 let lastGCCycleNumber = undefined;
21 dbg.memory.onGarbageCollection = undefined;
23 return void do_test_finished();
26 dbg.memory.onGarbageCollection = data => {
27 print("onGarbageCollection: " + uneval(data));
30 equal(typeof lastGCCycleNumber, "number");
31 equal(data.gcCycleNumber - lastGCCycleNumber, 1);
35 lastGCCycleNumber = data.gcCycleNumber;
40 root.eval("gc(this)");