summaryrefslogtreecommitdiffstats
path: root/toolkit/components/prompts
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-07-03 04:16:11 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-07-03 04:16:11 +0200
commit4b76d6427a6650a499f8840fb8b054be70dd1c35 (patch)
treec44aa4acc87c8916f3d31054ba093ad30b6a4368 /toolkit/components/prompts
parent30cc819b77891ec4c097156670ecb5ce10b5d9c7 (diff)
downloadUXP-4b76d6427a6650a499f8840fb8b054be70dd1c35.tar
UXP-4b76d6427a6650a499f8840fb8b054be70dd1c35.tar.gz
UXP-4b76d6427a6650a499f8840fb8b054be70dd1c35.tar.lz
UXP-4b76d6427a6650a499f8840fb8b054be70dd1c35.tar.xz
UXP-4b76d6427a6650a499f8840fb8b054be70dd1c35.zip
Re-implement prompts.tab_modal.focusSwitch control in toolkit.
Diffstat (limited to 'toolkit/components/prompts')
-rw-r--r--toolkit/components/prompts/src/nsPrompter.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/toolkit/components/prompts/src/nsPrompter.js b/toolkit/components/prompts/src/nsPrompter.js
index 26efe28cc..0503b5925 100644
--- a/toolkit/components/prompts/src/nsPrompter.js
+++ b/toolkit/components/prompts/src/nsPrompter.js
@@ -369,7 +369,13 @@ function openTabPrompt(domWin, tabPrompt, args) {
.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 allowFocusSwitch = true;
+ try {
+ allowFocusSwitch = Services.prefs.getBoolPref("prompts.tab_modal.focusSwitch");
+ } catch(e) {}
+
+ if (allowFocusSwitch)
+ PromptUtils.fireDialogEvent(domWin, "DOMWillOpenModalDialog", null, eventDetail);
let winUtils = domWin.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
@@ -395,8 +401,8 @@ function openTabPrompt(domWin, tabPrompt, args) {
frameMM.removeEventListener("pagehide", pagehide, true);
winUtils.leaveModalState();
-
- PromptUtils.fireDialogEvent(domWin, "DOMModalDialogClosed");
+ if (allowFocusSwitch)
+ PromptUtils.fireDialogEvent(domWin, "DOMModalDialogClosed");
}
frameMM.addEventListener("pagehide", pagehide, true);