Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

browser(firefox): fix closing browser contexts with beforeunload #4314

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions browser_patches/firefox/BUILD_NUMBER
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
1199
Changed: [email protected] Mon 02 Nov 2020 04:10:47 PM PST
1200
Changed: [email protected] Mon 02 Nov 2020 05:18:01 PM PST
7 changes: 4 additions & 3 deletions browser_patches/firefox/juggler/TargetRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,8 @@ class PageTarget {
await this.updateViewportSize();
}

async close(runBeforeUnload = false) {
await this._gBrowser.removeTab(this._tab, {
close(runBeforeUnload = false) {
this._gBrowser.removeTab(this._tab, {
skipPermitUnload: !runBeforeUnload,
});
}
Expand Down Expand Up @@ -562,7 +562,8 @@ class BrowserContext {
async destroy() {
if (this.userContextId !== 0) {
ContextualIdentityService.remove(this.userContextId);
ContextualIdentityService.closeContainerTabs(this.userContextId);
for (const page of this.pages)
page.close();
if (this.pages.size) {
await new Promise(f => {
const listener = helper.on(this._registry, TargetRegistry.Events.TargetDestroyed, () => {
Expand Down