Skip to content

Commit

Permalink
Bug 1655866: Part 5 - Use native PermitUnload implementation from fro…
Browse files Browse the repository at this point in the history
…nt-end code. r=nika,mconley

Differential Revision: https://phabricator.services.mozilla.com/D88318
  • Loading branch information
kmaglione committed Sep 21, 2020
1 parent b4c45a3 commit 814e506
Show file tree
Hide file tree
Showing 20 changed files with 147 additions and 793 deletions.
1 change: 0 additions & 1 deletion browser/base/content/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
PageThumbs: "resource://gre/modules/PageThumbs.jsm",
PanelMultiView: "resource:///modules/PanelMultiView.jsm",
PanelView: "resource:///modules/PanelMultiView.jsm",
PermitUnloader: "resource://gre/actors/BrowserElementParent.jsm",
PictureInPicture: "resource://gre/modules/PictureInPicture.jsm",
PlacesUtils: "resource://gre/modules/PlacesUtils.jsm",
PlacesUIUtils: "resource:///modules/PlacesUIUtils.jsm",
Expand Down
8 changes: 3 additions & 5 deletions browser/base/content/tabbrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2307,9 +2307,7 @@

_mayDiscardBrowser(aTab, aForceDiscard) {
let browser = aTab.linkedBrowser;
let permitUnloadFlags = aForceDiscard
? browser.dontPromptAndUnload
: browser.dontPromptAndDontUnload;
let action = aForceDiscard ? "unload" : "dontUnload";

if (
!aTab ||
Expand All @@ -2318,7 +2316,7 @@
this._windowIsClosing ||
!browser.isConnected ||
!browser.isRemoteBrowser ||
!browser.permitUnload(permitUnloadFlags).permitUnload
!browser.permitUnload(action).permitUnload
) {
return false;
}
Expand Down Expand Up @@ -3386,7 +3384,7 @@
_hasBeforeUnload(aTab) {
let browser = aTab.linkedBrowser;
if (browser.isRemoteBrowser && browser.frameLoader) {
return PermitUnloader.hasBeforeUnload(browser.frameLoader);
return browser.hasBeforeUnload;
}
return false;
},
Expand Down
2 changes: 2 additions & 0 deletions docshell/base/nsIContentViewer.idl
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ interface nsIContentViewer : nsISupports
* eDontPromptAndDontUnload: Don't prompt and return false (unload not permitted)
* if the document (or its children) asks us to prompt.
* eDontPromptAndUnload: Don't prompt and return true (unload permitted) no matter what.
*
* NOTE: Keep this in sync with PermitUnloadAction in WindowGlobalActors.webidl.
*/
cenum PermitUnloadAction : 8 {
ePrompt = 0,
Expand Down
5 changes: 0 additions & 5 deletions docshell/test/browser/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ support-files =
file_bug1328501.html
file_bug1328501_frame.html
file_bug1328501_framescript.js
file_bug1415918_beforeunload_2.html
file_bug1415918_beforeunload_3.html
file_bug1415918_beforeunload_iframe_2.html
file_bug1415918_beforeunload_iframe.html
file_bug1415918_beforeunload.html
file_bug1543077-1-child.html
file_bug1543077-1.html
file_bug1543077-2-child.html
Expand Down
Loading

0 comments on commit 814e506

Please sign in to comment.