Issue #2029 - Part 1: Add preference for opening the protocol handling dialog as window modal

This adds the preference, `prompts.content_handling_dialog_modal.enabled`, to control whether the dialog is window modal or not.
This commit is contained in:
FranklinDM 2022-03-14 21:23:32 +08:00 • committed by roytam1
commit 36ddeff63c
2 changed files with 11 additions and 8 deletions

View file

@ -5227,6 +5227,9 @@ pref("dom.storageManager.enabled", false);
// See application preferences for appropriate defaults. // See application preferences for appropriate defaults.
pref("prompts.authentication_dialog_abuse_limit", 0); pref("prompts.authentication_dialog_abuse_limit", 0);
// Whether content handling dialog is window modal
pref("prompts.content_handling_dialog_modal.enabled", false);
// Whether module scripts (<script type="module">) are enabled for content. // Whether module scripts (<script type="module">) are enabled for content.
pref("dom.moduleScripts.enabled", true); pref("dom.moduleScripts.enabled", true);

View file

@ -6,9 +6,8 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
// Constants // Constants
const Cc = Components.classes; const {utils: Cu, interfaces: Ci, classes: Cc, results: Cr} = Components;
const Ci = Components.interfaces; Cu.import("resource://gre/modules/Services.jsm");
const Cr = Components.results;
const CONTENT_HANDLING_URL = "chrome://mozapps/content/handling/dialog.xul"; const CONTENT_HANDLING_URL = "chrome://mozapps/content/handling/dialog.xul";
const STRINGBUNDLE_URL = "chrome://mozapps/locale/handling/handling.properties"; const STRINGBUNDLE_URL = "chrome://mozapps/locale/handling/handling.properties";
@ -64,13 +63,14 @@ nsContentDispatchChooser.prototype =
params.appendElement(aURI, false); params.appendElement(aURI, false);
params.appendElement(aWindowContext, false); params.appendElement(aWindowContext, false);
var features = "chrome,dialog=yes,resizable,centerscreen";
if (Services.prefs.getBoolPref("prompts.content_handling_dialog_modal.enabled")) {
features += ",modal";
}
var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"]. var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
getService(Ci.nsIWindowWatcher); getService(Ci.nsIWindowWatcher);
ww.openWindow(window, ww.openWindow(window, CONTENT_HANDLING_URL, null, features, params);
CONTENT_HANDLING_URL,
null,
"chrome,dialog=yes,resizable,centerscreen",
params);
}, },
// nsISupports // nsISupports