Bug 1532685 - avoid opening help pages more than once by adding listeners to the actual dialogs instead of using utilityOverlay.js, r=jaws
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 06 Mar 2019 16:10:37 +0000
changeset 520513 980042eb94d3a705b7d62eff885805125bcd5303
parent 520512 39c2628de53e5a87b23737ae0364705197cef9b1
child 520514 8f243b54b8035e15d44b1eb8c266234e05fa541e
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1532685
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1532685 - avoid opening help pages more than once by adding listeners to the actual dialogs instead of using utilityOverlay.js, r=jaws Differential Revision: https://phabricator.services.mozilla.com/D22300
browser/base/content/utilityOverlay.js
browser/components/preferences/browserLanguages.js
browser/components/preferences/colors.js
browser/components/preferences/connection.js
browser/components/preferences/fonts.js
browser/components/preferences/languages.js
browser/components/preferences/sanitize.js
--- a/browser/base/content/utilityOverlay.js
+++ b/browser/base/content/utilityOverlay.js
@@ -1030,18 +1030,16 @@ function openHelpLink(aHelpTopic, aCalle
   var url = getHelpLinkURL(aHelpTopic);
   var where = aWhere;
   if (!aWhere)
     where = aCalledFromModal ? "window" : "tab";
 
   openTrustedLinkIn(url, where);
 }
 
-window.addEventListener("dialoghelp", openPrefsHelp);
-
 function openPrefsHelp() {
   // non-instant apply prefwindows are usually modal, so we can't open in the topmost window,
   // since its probably behind the window.
   var instantApply = Services.prefs.getBoolPref("browser.preferences.instantApply");
 
   var helpTopic = document.documentElement.getAttribute("helpTopic");
   openHelpLink(helpTopic, !instantApply);
 }
--- a/browser/components/preferences/browserLanguages.js
+++ b/browser/components/preferences/browserLanguages.js
@@ -13,16 +13,18 @@ ChromeUtils.defineModuleGetter(this, "Ad
                                "resource://gre/modules/AddonManager.jsm");
 ChromeUtils.defineModuleGetter(this, "AddonRepository",
                                "resource://gre/modules/addons/AddonRepository.jsm");
 ChromeUtils.defineModuleGetter(this, "RemoteSettings",
                                "resource://services-settings/remote-settings.js");
 ChromeUtils.defineModuleGetter(this, "SelectionChangedMenulist",
                                "resource:///modules/SelectionChangedMenulist.jsm");
 
+document.documentElement.addEventListener("dialoghelp", window.top.openPrefsHelp);
+
 /* This dialog provides an interface for managing what language the browser is
  * displayed in.
  *
  * There is a list of "requested" locales and a list of "available" locales. The
  * requested locales must be installed and enabled. Available locales could be
  * installed and enabled, or fetched from the AMO language tools API.
  *
  * If a langpack is disabled, there is no way to determine what locale it is for and
--- a/browser/components/preferences/colors.js
+++ b/browser/components/preferences/colors.js
@@ -1,14 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* import-globals-from ../../../toolkit/content/preferencesBindings.js */
 
+document.documentElement.addEventListener("dialoghelp", window.top.openPrefsHelp);
+
 Preferences.addAll([
   { id: "browser.display.document_color_use", type: "int" },
   { id: "browser.anchor_color", type: "string" },
   { id: "browser.visited_color", type: "string" },
   { id: "browser.underline_anchors", type: "bool" },
   { id: "browser.display.foreground_color", type: "string" },
   { id: "browser.display.background_color", type: "string" },
   { id: "browser.display.use_system_colors", type: "bool" },
--- a/browser/components/preferences/connection.js
+++ b/browser/components/preferences/connection.js
@@ -2,16 +2,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* import-globals-from ../../base/content/utilityOverlay.js */
 /* import-globals-from ../../../toolkit/content/preferencesBindings.js */
 /* import-globals-from in-content/extensionControlled.js */
 
+document.documentElement.addEventListener("dialoghelp", window.top.openPrefsHelp);
+
 Preferences.addAll([
   // Add network.proxy.autoconfig_url before network.proxy.type so they're
   // both initialized when network.proxy.type initialization triggers a call to
   // gConnectionsDialog.updateReloadButton().
   { id: "network.proxy.autoconfig_url", type: "string" },
   { id: "network.proxy.type", type: "int" },
   { id: "network.proxy.http", type: "string" },
   { id: "network.proxy.http_port", type: "int" },
--- a/browser/components/preferences/fonts.js
+++ b/browser/components/preferences/fonts.js
@@ -13,16 +13,18 @@ const kFontNameFmtSansSerif     = "font.
 const kFontNameFmtMonospace     = "font.name.monospace.%LANG%";
 const kFontNameListFmtSerif     = "font.name-list.serif.%LANG%";
 const kFontNameListFmtSansSerif = "font.name-list.sans-serif.%LANG%";
 const kFontNameListFmtMonospace = "font.name-list.monospace.%LANG%";
 const kFontSizeFmtVariable      = "font.size.variable.%LANG%";
 const kFontSizeFmtFixed         = "font.size.fixed.%LANG%";
 const kFontMinSizeFmt           = "font.minimum-size.%LANG%";
 
+document.documentElement.addEventListener("dialoghelp", window.top.openPrefsHelp);
+
 Preferences.addAll([
   { id: "font.language.group", type: "wstring" },
   { id: "browser.display.use_document_fonts", type: "int" },
   { id: "intl.charset.fallback.override", type: "string" },
 ]);
 
 var gFontsDialog = {
   _selectLanguageGroupPromise: Promise.resolve(),
--- a/browser/components/preferences/languages.js
+++ b/browser/components/preferences/languages.js
@@ -2,16 +2,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* import-globals-from ../../../toolkit/content/preferencesBindings.js */
 
 var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
+document.documentElement.addEventListener("dialoghelp", window.top.openPrefsHelp);
+
 Preferences.addAll([
   { id: "intl.accept_languages", type: "wstring" },
   { id: "pref.browser.language.disable_button.up", type: "bool" },
   { id: "pref.browser.language.disable_button.down", type: "bool" },
   { id: "pref.browser.language.disable_button.remove", type: "bool" },
   { id: "privacy.spoof_english", type: "int" },
 ]);
 
--- a/browser/components/preferences/sanitize.js
+++ b/browser/components/preferences/sanitize.js
@@ -1,15 +1,17 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* import-globals-from ../../../toolkit/content/preferencesBindings.js */
 
+document.documentElement.addEventListener("dialoghelp", window.top.openPrefsHelp);
+
 Preferences.addAll([
   { id: "privacy.clearOnShutdown.history", type: "bool" },
   { id: "privacy.clearOnShutdown.formdata", type: "bool" },
   { id: "privacy.clearOnShutdown.downloads", type: "bool" },
   { id: "privacy.clearOnShutdown.cookies", type: "bool" },
   { id: "privacy.clearOnShutdown.cache", type: "bool" },
   { id: "privacy.clearOnShutdown.offlineApps", type: "bool" },
   { id: "privacy.clearOnShutdown.sessions", type: "bool" },