Firefox works

The child content processes must be told to GC too.
This commit is contained in:
Matthew Jee 2024-09-03 14:28:21 -07:00
parent 07d8bb10d9
commit 66dd543816
2 changed files with 9 additions and 10 deletions

View file

@ -257,11 +257,10 @@ class PageHandler {
}
async ['Heap.collectGarbage']() {
await new Promise((resolve) => {
Cu.schedulePreciseGC(() => {
resolve();
});
});
Services.obs.notifyObservers(null, "child-gc-request");
Cu.forceGC();
Services.obs.notifyObservers(null, "child-cc-request");
Cu.forceCC();
}
async ['Network.getResponseBody']({requestId}) {

View file

@ -16,12 +16,12 @@
import { test as it, expect } from './pageTest';
it('should work', async function({ page, browserName }) {
it.only('should work', async function({ page, browserName }) {
await page.evaluate(() => {
globalThis.thing = {};
globalThis.something = new WeakRef(globalThis.thing);
globalThis.objectToDestroy = {};
globalThis.weakRef = new WeakRef(globalThis.objectToDestroy);
});
await page.evaluate(() => globalThis.thing = null);
await page.evaluate(() => globalThis.objectToDestroy = null);
await page.forceGarbageCollection();
expect(await page.evaluate(() => globalThis.something.deref())).toBe(undefined);
expect(await page.evaluate(() => globalThis.weakRef.deref())).toBe(undefined);
});