fix(chromium): handle backgroundPages() onClose (#6541)
This commit is contained in:
parent
eb7b4dea0d
commit
dc7f7f9a8c
|
|
@ -209,6 +209,7 @@ export class Page extends ChannelOwner<channels.PageChannel, channels.PageInitia
|
||||||
_onClose() {
|
_onClose() {
|
||||||
this._closed = true;
|
this._closed = true;
|
||||||
this._browserContext._pages.delete(this);
|
this._browserContext._pages.delete(this);
|
||||||
|
this._browserContext._backgroundPages.delete(this);
|
||||||
this.emit(Events.Page.Close, this);
|
this.emit(Events.Page.Close, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,8 @@ it('should open devtools when "devtools: true" option is given', async ({browser
|
||||||
await browser.close();
|
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 userDataDir = await createUserDataDir();
|
||||||
const extensionPath = asset('simple-extension');
|
const extensionPath = asset('simple-extension');
|
||||||
const extensionOptions = {...browserOptions,
|
const extensionOptions = {...browserOptions,
|
||||||
|
|
@ -71,6 +72,8 @@ it('should return background pages', async ({browserType, browserOptions, create
|
||||||
expect(context.backgroundPages()).toContain(backgroundPage);
|
expect(context.backgroundPages()).toContain(backgroundPage);
|
||||||
expect(context.pages()).not.toContain(backgroundPage);
|
expect(context.pages()).not.toContain(backgroundPage);
|
||||||
await context.close();
|
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) => {
|
it('should return background pages when recording video', async ({browserType, browserOptions, createUserDataDir, asset}, testInfo) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue