mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 332195 - part 6: make an exception for beforeunload events while tabview is open, r=mconley
This commit is contained in:
parent
3a1a587f5e
commit
00fbf43cf3
@ -4346,7 +4346,11 @@
|
||||
if (tabForEvent.selected)
|
||||
return;
|
||||
|
||||
// If this is a tabprompt, and we're not in tabview/panorama with
|
||||
// the prompt being a beforeunload one, we won't switch tabs
|
||||
// (unless this behaviour has been disabled entirely using the pref).
|
||||
if (event.detail && event.detail.tabPrompt &&
|
||||
!(event.detail.inPermitUnload && ("TabView" in window) && TabView.isVisible()) &&
|
||||
Services.prefs.getBoolPref("browser.tabs.dontfocusfordialogs")) {
|
||||
let docPrincipal = targetIsWindow ? event.target.document.nodePrincipal : null;
|
||||
// At least one of these should/will be non-null:
|
||||
|
@ -63,7 +63,11 @@ var RemotePrompt = {
|
||||
});
|
||||
|
||||
try {
|
||||
let eventDetail = {tabPrompt: true, promptPrincipal: args.promptPrincipal};
|
||||
let eventDetail = {
|
||||
tabPrompt: true,
|
||||
promptPrincipal: args.promptPrincipal,
|
||||
inPermitUnload: args.inPermitUnload,
|
||||
};
|
||||
PromptUtils.fireDialogEvent(window, "DOMWillOpenModalDialog", browser, eventDetail);
|
||||
|
||||
args.promptActive = true;
|
||||
|
@ -371,7 +371,10 @@ function openModalWindow(domWin, uri, args) {
|
||||
}
|
||||
|
||||
function openTabPrompt(domWin, tabPrompt, args) {
|
||||
let eventDetail = Cu.cloneInto({tabPrompt: true}, domWin);
|
||||
let docShell = domWin.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDocShell);
|
||||
let inPermitUnload = docShell.contentViewer && docShell.contentViewer.inPermitUnload;
|
||||
let eventDetail = Cu.cloneInto({tabPrompt: true, inPermitUnload}, domWin);
|
||||
PromptUtils.fireDialogEvent(domWin, "DOMWillOpenModalDialog", null, eventDetail);
|
||||
|
||||
let winUtils = domWin.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
@ -434,14 +437,14 @@ function openTabPrompt(domWin, tabPrompt, args) {
|
||||
}
|
||||
|
||||
function openRemotePrompt(domWin, args, tabPrompt) {
|
||||
let messageManager = domWin.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShell)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsITabChild)
|
||||
.messageManager;
|
||||
let docShell = domWin.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDocShell);
|
||||
let messageManager = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsITabChild)
|
||||
.messageManager;
|
||||
|
||||
let eventDetail = Cu.cloneInto({tabPrompt}, domWin);
|
||||
let inPermitUnload = docShell.contentViewer && docShell.contentViewer.inPermitUnload;
|
||||
let eventDetail = Cu.cloneInto({tabPrompt, inPermitUnload}, domWin);
|
||||
PromptUtils.fireDialogEvent(domWin, "DOMWillOpenModalDialog", null, eventDetail);
|
||||
|
||||
let winUtils = domWin.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
|
Loading…
Reference in New Issue
Block a user