Firefox support that doesn't work

Results don't seem to be observable from the test
This commit is contained in:
Matthew Jee 2024-08-29 10:48:14 -07:00
parent 58bcfc2a6b
commit 07d8bb10d9
4 changed files with 21 additions and 4 deletions

View file

@ -256,6 +256,14 @@ class PageHandler {
return await this._contentPage.send('disposeObject', options); return await this._contentPage.send('disposeObject', options);
} }
async ['Heap.collectGarbage']() {
await new Promise((resolve) => {
Cu.schedulePreciseGC(() => {
resolve();
});
});
}
async ['Network.getResponseBody']({requestId}) { async ['Network.getResponseBody']({requestId}) {
return this._pageNetwork.getResponseBody(requestId); return this._pageNetwork.getResponseBody(requestId);
} }

View file

@ -487,6 +487,17 @@ const Browser = {
}, },
}; };
const Heap = {
targets: ['page'],
types: {},
events: {},
methods: {
'collectGarbage': {
params: {},
},
},
};
const Network = { const Network = {
targets: ['page'], targets: ['page'],
types: networkTypes, types: networkTypes,
@ -1002,7 +1013,7 @@ const Accessibility = {
} }
this.protocol = { this.protocol = {
domains: {Browser, Page, Runtime, Network, Accessibility}, domains: {Browser, Heap, Page, Runtime, Network, Accessibility},
}; };
this.checkScheme = checkScheme; this.checkScheme = checkScheme;
this.EXPORTED_SYMBOLS = ['protocol', 'checkScheme']; this.EXPORTED_SYMBOLS = ['protocol', 'checkScheme'];

View file

@ -401,7 +401,7 @@ export class FFPage implements PageDelegate {
} }
async forceGarbageCollection(): Promise<void> { async forceGarbageCollection(): Promise<void> {
// Not supported in Firefox. await this._session.send('Heap.collectGarbage');
} }
async addInitScript(initScript: InitScript, worldName?: string): Promise<void> { async addInitScript(initScript: InitScript, worldName?: string): Promise<void> {

View file

@ -17,8 +17,6 @@
import { test as it, expect } from './pageTest'; import { test as it, expect } from './pageTest';
it('should work', async function({ page, browserName }) { it('should work', async function({ page, browserName }) {
it.skip(browserName === 'firefox', 'forceGarbageCollection is supported only in Chromium and WebKit');
await page.evaluate(() => { await page.evaluate(() => {
globalThis.thing = {}; globalThis.thing = {};
globalThis.something = new WeakRef(globalThis.thing); globalThis.something = new WeakRef(globalThis.thing);