browser(firefox): fix closing browser contexts with beforeunload (#4314)
References #4021
This commit is contained in:
parent
3d3ce135f5
commit
e3b12b0a0d
|
|
@ -1,2 +1,2 @@
|
||||||
1199
|
1200
|
||||||
Changed: lushnikov@chromium.org Mon 02 Nov 2020 04:10:47 PM PST
|
Changed: lushnikov@chromium.org Mon 02 Nov 2020 05:18:01 PM PST
|
||||||
|
|
|
||||||
|
|
@ -417,8 +417,8 @@ class PageTarget {
|
||||||
await this.updateViewportSize();
|
await this.updateViewportSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
async close(runBeforeUnload = false) {
|
close(runBeforeUnload = false) {
|
||||||
await this._gBrowser.removeTab(this._tab, {
|
this._gBrowser.removeTab(this._tab, {
|
||||||
skipPermitUnload: !runBeforeUnload,
|
skipPermitUnload: !runBeforeUnload,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -562,7 +562,8 @@ class BrowserContext {
|
||||||
async destroy() {
|
async destroy() {
|
||||||
if (this.userContextId !== 0) {
|
if (this.userContextId !== 0) {
|
||||||
ContextualIdentityService.remove(this.userContextId);
|
ContextualIdentityService.remove(this.userContextId);
|
||||||
ContextualIdentityService.closeContainerTabs(this.userContextId);
|
for (const page of this.pages)
|
||||||
|
page.close();
|
||||||
if (this.pages.size) {
|
if (this.pages.size) {
|
||||||
await new Promise(f => {
|
await new Promise(f => {
|
||||||
const listener = helper.on(this._registry, TargetRegistry.Events.TargetDestroyed, () => {
|
const listener = helper.on(this._registry, TargetRegistry.Events.TargetDestroyed, () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue