1 // Test multiple debuggers, GCs, and zones interacting with each other.
3 // Note: when observing both globals, but GC'ing in only one, we don't test that
4 // we *didn't* GC in the other zone because GCs are finicky and unreliable. That
5 // used to work when this was a jit-test, but in the process of migrating to
6 // xpcshell, we lost some amount of reliability and determinism.
8 const root1 = newGlobal();
9 const dbg1 = new Debugger();
10 dbg1.addDebuggee(root1)
12 const root2 = newGlobal();
13 const dbg2 = new Debugger();
14 dbg2.addDebuggee(root2)
18 dbg1.memory.onGarbageCollection = _ => fired1 = true;
19 dbg2.memory.onGarbageCollection = _ => fired2 = true;
21 Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);
22 registerCleanupFunction(() => {
23 Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
39 root1.eval(`gc(this)`);
45 root2.eval(`gc(this)`);
56 // Full GC with no debuggees
58 dbg1.removeAllDebuggees();
59 dbg2.removeAllDebuggees();
65 // One debugger with multiple debuggees in different zones.
67 dbg1.addDebuggee(root1);
68 dbg1.addDebuggee(root2);
72 root1.eval(`gc(this)`);
79 root2.eval(`gc(this)`);