feat(firefox): prepare to fission roll (#18302)

- Handle `Runtime.executionContextsCleared` event.
- Skip one auto-waiting test, because navigations now happen
asynchronously.
This commit is contained in:
Dmitry Gozman 2022-10-24 16:03:56 -07:00 committed by GitHub
parent ab78865a8d
commit 9a684d39ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -79,6 +79,7 @@ export class FFPage implements PageDelegate {
eventsHelper.addEventListener(this._session, 'Page.sameDocumentNavigation', this._onSameDocumentNavigation.bind(this)),
eventsHelper.addEventListener(this._session, 'Runtime.executionContextCreated', this._onExecutionContextCreated.bind(this)),
eventsHelper.addEventListener(this._session, 'Runtime.executionContextDestroyed', this._onExecutionContextDestroyed.bind(this)),
eventsHelper.addEventListener(this._session, 'Runtime.executionContextsCleared', this._onExecutionContextsCleared.bind(this)),
eventsHelper.addEventListener(this._session, 'Page.linkClicked', event => this._onLinkClicked(event.phase)),
eventsHelper.addEventListener(this._session, 'Page.uncaughtError', this._onUncaughtError.bind(this)),
eventsHelper.addEventListener(this._session, 'Runtime.console', this._onConsole.bind(this)),
@ -184,6 +185,11 @@ export class FFPage implements PageDelegate {
context.frame._contextDestroyed(context);
}
_onExecutionContextsCleared() {
for (const executionContextId of Array.from(this._contextIdToContext.keys()))
this._onExecutionContextDestroyed({ executionContextId });
}
private _removeContextsForFrame(frame: frames.Frame) {
for (const [contextId, context] of this._contextIdToContext) {
if (context.frame === frame)

View File

@ -164,7 +164,9 @@ it('should await navigation when assigning location twice', async ({ page, serve
expect(messages.join('|')).toBe('routeoverride|evaluate');
});
it('should await navigation when evaluating reload', async ({ page, server }) => {
it('should await navigation when evaluating reload', async ({ page, server, browserName }) => {
it.fixme(browserName === 'firefox', 'With fission enabled, navigations in Firefox start asynchronously');
await page.goto(server.EMPTY_PAGE);
const messages = initServer(server);
await Promise.all([