fix(chromium): handle backgroundPages() onClose (#6541)

This commit is contained in:
Max Schmitt 2021-05-12 22:15:04 +02:00 committed by GitHub
parent eb7b4dea0d
commit dc7f7f9a8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -209,6 +209,7 @@ export class Page extends ChannelOwner<channels.PageChannel, channels.PageInitia
_onClose() {
this._closed = true;
this._browserContext._pages.delete(this);
this._browserContext._backgroundPages.delete(this);
this.emit(Events.Page.Close, this);
}

View File

@ -52,7 +52,8 @@ it('should open devtools when "devtools: true" option is given', async ({browser
await browser.close();
});
it('should return background pages', async ({browserType, browserOptions, createUserDataDir, asset}) => {
it('should return background pages', async ({browserType, browserOptions, createUserDataDir, asset, browserChannel}) => {
it.fixme(browserChannel);
const userDataDir = await createUserDataDir();
const extensionPath = asset('simple-extension');
const extensionOptions = {...browserOptions,
@ -71,6 +72,8 @@ it('should return background pages', async ({browserType, browserOptions, create
expect(context.backgroundPages()).toContain(backgroundPage);
expect(context.pages()).not.toContain(backgroundPage);
await context.close();
expect(context.backgroundPages().length).toBe(0);
expect(context.pages().length).toBe(0);
});
it('should return background pages when recording video', async ({browserType, browserOptions, createUserDataDir, asset}, testInfo) => {