summaryrefslogtreecommitdiffstats
path: root/toolkit
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/components/prompts/src/nsPrompter.js12
-rw-r--r--toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm12
2 files changed, 17 insertions, 7 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);
diff --git a/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm b/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm
index a5bc23ccd..a9201c3da 100644
--- a/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm
+++ b/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm
@@ -59,10 +59,14 @@ var ImageCropper = {
return aImageURL;
}
- if (Services.prefs.getBoolPref("lightweightThemes.animation.enabled")) {
- //Don't crop if animated
- return aImageURL;
- }
+ try {
+ if (Services.prefs.getBoolPref("lightweightThemes.animation.enabled")) {
+ //Don't crop if animated
+ return aImageURL;
+ }
+ } catch(e) {
+ // Continue of pref doesn't exist.
+ }
// Generate the cropped image's file name using its
// base name and the current screen size.