Bug 332195 - part 6: make an exception for beforeunload events while tabview is open, r=mconley

--HG--
extra : commitid : DfE3UMe5yQX
extra : rebase_source : e743a0f45b5f31de18f07a00afebd798e5768f90
This commit is contained in:
Gijs Kruitbosch 2015-10-26 14:17:16 +01:00
Родитель ea934a6d68
Коммит 011936bed1
3 изменённых файлов: 20 добавлений и 9 удалений

Просмотреть файл

@ -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)