Bug 1521765 - Use web technologies for "about:config" in the browser application. r=Mossop
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Thu, 24 Jan 2019 13:05:08 +0000
changeset 516874 cd4c2708c960b0db005a5e26a73417cb66dd16ee
parent 516873 370ea4403e557215110d57f9c53801f753a0c5a6
child 516875 91f5131e326ad99acb9a44567c9c08d3d1f8b06b
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMossop
bugs1521765
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 1521765 - Use web technologies for "about:config" in the browser application. r=Mossop Differential Revision: https://phabricator.services.mozilla.com/D17419
browser/base/content/test/general/browser_zbug569342.js
browser/base/content/test/static/browser_all_files_referenced.js
browser/components/about/AboutRedirector.cpp
browser/components/build/nsModule.cpp
browser/components/sessionstore/test/browser.ini
browser/components/sessionstore/test/browser_393716.js
docshell/base/nsAboutRedirector.cpp
docshell/build/nsDocShellModule.cpp
toolkit/content/tests/browser/browser_label_textlink.js
toolkit/modules/BrowserUtils.jsm
--- a/browser/base/content/test/general/browser_zbug569342.js
+++ b/browser/base/content/test/general/browser_zbug569342.js
@@ -8,17 +8,17 @@ add_task(async function findBarDisabledO
   let findbarOpenedPromise = BrowserTestUtils.waitForEvent(gBrowser.selectedTab, "TabFindInitialized");
   document.documentElement.focus();
   // Open the Find bar before we navigate to pages that shouldn't have it.
   EventUtils.synthesizeKey("f", { accelKey: true });
   await findbarOpenedPromise;
   ok(!gFindBar.hidden, "Find bar should be visible");
 
   let urls = [
-    "about:config",
+    "about:preferences",
     "about:addons",
   ];
 
   for (let url of urls) {
     await testFindDisabled(url);
   }
 
   // Make sure the find bar is re-enabled after disabled page is closed.
--- a/browser/base/content/test/static/browser_all_files_referenced.js
+++ b/browser/base/content/test/static/browser_all_files_referenced.js
@@ -37,18 +37,20 @@ var gExceptionPaths = [
 
   // Exclude all the metadata paths under the country metadata folder because these
   // paths will be concatenated in FormAutofillUtils.jsm based on different country/region.
   "resource://formautofill/addressmetadata/",
 
   // Exclude all search-plugins because they aren't referenced by filename
   "resource://search-plugins/",
 
-  // This is only in Nightly, and accessed using a direct chrome URL
-  "chrome://browser/content/aboutconfig/",
+  // Previous version of "about:config" kept for risk mitigation as a hidden
+  // page accessed using a direct chrome URL, will be removed in the future.
+  "chrome://global/content/config.js",
+  "chrome://global/content/config.xul",
 ];
 
 // These are not part of the omni.ja file, so we find them only when running
 // the test on a non-packaged build.
 if (AppConstants.platform == "macosx") {
   gExceptionPaths.push("resource://gre/res/cursors/");
   gExceptionPaths.push("resource://gre/res/touchbar/");
 }
--- a/browser/components/about/AboutRedirector.cpp
+++ b/browser/components/about/AboutRedirector.cpp
@@ -48,16 +48,17 @@ static const RedirEntry kRedirMap[] = {
     {"blocked", "chrome://browser/content/blockedSite.xhtml",
      nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
          nsIAboutModule::URI_CAN_LOAD_IN_CHILD | nsIAboutModule::ALLOW_SCRIPT |
          nsIAboutModule::HIDE_FROM_ABOUTABOUT},
     {"certerror", "chrome://browser/content/aboutNetError.xhtml",
      nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
          nsIAboutModule::URI_CAN_LOAD_IN_CHILD | nsIAboutModule::ALLOW_SCRIPT |
          nsIAboutModule::HIDE_FROM_ABOUTABOUT},
+    {"config", "chrome://browser/content/aboutconfig/aboutconfig.html", 0},
     {"tabcrashed", "chrome://browser/content/aboutTabCrashed.xhtml",
      nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
          nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::HIDE_FROM_ABOUTABOUT},
     {"policies", "chrome://browser/content/policies/aboutPolicies.xhtml",
      nsIAboutModule::ALLOW_SCRIPT},
     {"privatebrowsing", "chrome://browser/content/aboutPrivateBrowsing.xhtml",
      nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
          nsIAboutModule::URI_MUST_LOAD_IN_CHILD | nsIAboutModule::ALLOW_SCRIPT},
--- a/browser/components/build/nsModule.cpp
+++ b/browser/components/build/nsModule.cpp
@@ -88,16 +88,17 @@ static const mozilla::Module::ContractID
     // clang-format off
     { NS_BROWSERDIRECTORYPROVIDER_CONTRACTID, &kNS_BROWSERDIRECTORYPROVIDER_CID },
 #if defined(XP_WIN) || defined(MOZ_WIDGET_GTK) || defined(XP_MACOSX)
     { NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
     { NS_TOOLKITSHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
 #endif
     { NS_ABOUT_MODULE_CONTRACTID_PREFIX "blocked", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
     { NS_ABOUT_MODULE_CONTRACTID_PREFIX "certerror", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
+    { NS_ABOUT_MODULE_CONTRACTID_PREFIX "config", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
     { NS_ABOUT_MODULE_CONTRACTID_PREFIX "tabcrashed", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
     { NS_ABOUT_MODULE_CONTRACTID_PREFIX "privatebrowsing", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
     { NS_ABOUT_MODULE_CONTRACTID_PREFIX "rights", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
     { NS_ABOUT_MODULE_CONTRACTID_PREFIX "robots", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
     { NS_ABOUT_MODULE_CONTRACTID_PREFIX "searchreset", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
     { NS_ABOUT_MODULE_CONTRACTID_PREFIX "sessionrestore", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
     { NS_ABOUT_MODULE_CONTRACTID_PREFIX "welcomeback", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
     { NS_ABOUT_MODULE_CONTRACTID_PREFIX "home", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
--- a/browser/components/sessionstore/test/browser.ini
+++ b/browser/components/sessionstore/test/browser.ini
@@ -138,16 +138,17 @@ skip-if = (os == 'linux' && (asan || deb
 # Re-enabling and rewriting this test is tracked in bug 936919.
 skip-if = true
 [browser_339445.js]
 [browser_345898.js]
 [browser_350525.js]
 [browser_354894_perwindowpb.js]
 [browser_367052.js]
 [browser_393716.js]
+skip-if = debug # Bug 1507747
 [browser_394759_basic.js]
 # Disabled for intermittent failures, bug 944372.
 skip-if = true
 [browser_394759_behavior.js]
 [browser_394759_perwindowpb.js]
 [browser_394759_purge.js]
 [browser_423132.js]
 [browser_447951.js]
--- a/browser/components/sessionstore/test/browser_393716.js
+++ b/browser/components/sessionstore/test/browser_393716.js
@@ -1,15 +1,24 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const URL = "about:config";
 
+add_task(async function setup() {
+  // Make sure that the field of which we restore the state is visible on load.
+  await SpecialPowers.pushPrefEnv({
+    set: [
+      ["browser.aboutConfig.showWarning", false],
+    ],
+  });
+});
+
 /**
  * Bug 393716 - Basic tests for getTabState(), setTabState(), and duplicateTab().
  */
 add_task(async function test_set_tabstate() {
   let key = "Unique key: " + Date.now();
   let value = "Unique value: " + Math.random();
 
   // create a new tab
@@ -47,25 +56,25 @@ add_task(async function test_set_tabstat
   ss.setTabState(tab, JSON.stringify(state));
   await promiseBrowserLoaded(tab.linkedBrowser);
 
   // verify the correctness of the restored tab
   ok(ss.getCustomTabValue(tab, key2) == value2 && tab.linkedBrowser.currentURI.spec == URL,
      "the tab's state was correctly restored");
 
   // add text data
-  await setInputValue(tab.linkedBrowser, {id: "textbox", value: value3});
+  await setInputValue(tab.linkedBrowser, {id: "search", value: value3});
 
   // duplicate the tab
   let tab2 = ss.duplicateTab(window, tab);
   await promiseTabRestored(tab2);
 
   // verify the correctness of the duplicated tab
   ok(ss.getCustomTabValue(tab2, key2) == value2 &&
      tab2.linkedBrowser.currentURI.spec == URL,
      "correctly duplicated the tab's state");
-  let textbox = await getInputValue(tab2.linkedBrowser, {id: "textbox"});
+  let textbox = await getInputValue(tab2.linkedBrowser, {id: "search"});
   is(textbox, value3, "also duplicated text data");
 
   // clean up
   gBrowser.removeTab(tab2);
   gBrowser.removeTab(tab);
 });
--- a/docshell/base/nsAboutRedirector.cpp
+++ b/docshell/base/nsAboutRedirector.cpp
@@ -67,17 +67,19 @@ static const RedirEntry kRedirMap[] = {
     {"about", "chrome://global/content/aboutAbout.xhtml", 0},
     {"addons", "chrome://mozapps/content/extensions/extensions.xul",
      nsIAboutModule::ALLOW_SCRIPT},
     {"buildconfig", "chrome://global/content/buildconfig.html",
      nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT},
     {"checkerboard", "chrome://global/content/aboutCheckerboard.xhtml",
      nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
          nsIAboutModule::ALLOW_SCRIPT},
+#if !defined(NIGHTLY_BUILD) || !defined(MOZ_BUILD_APP_IS_BROWSER)
     {"config", "chrome://global/content/config.xul", 0},
+#endif
 #ifdef MOZ_CRASHREPORTER
     {"crashes", "chrome://global/content/crashes.xhtml", 0},
 #endif
     {"credits", "https://www.mozilla.org/credits/",
      nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT},
     {"license", "chrome://global/content/license.html",
      nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
          nsIAboutModule::MAKE_LINKABLE},
--- a/docshell/build/nsDocShellModule.cpp
+++ b/docshell/build/nsDocShellModule.cpp
@@ -143,17 +143,19 @@ const mozilla::Module::CIDEntry kDocShel
 const mozilla::Module::ContractIDEntry kDocShellContracts[] = {
     // clang-format off
   { NS_URIFIXUP_CONTRACTID, &kNS_DEFAULTURIFIXUP_CID },
   { NS_WEBNAVIGATION_INFO_CONTRACTID, &kNS_WEBNAVIGATION_INFO_CID },
   { NS_ABOUT_MODULE_CONTRACTID_PREFIX "about", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
   { NS_ABOUT_MODULE_CONTRACTID_PREFIX "addons", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
   { NS_ABOUT_MODULE_CONTRACTID_PREFIX "buildconfig", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
   { NS_ABOUT_MODULE_CONTRACTID_PREFIX "checkerboard", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
+#if !defined(NIGHTLY_BUILD) || !defined(MOZ_BUILD_APP_IS_BROWSER)
   { NS_ABOUT_MODULE_CONTRACTID_PREFIX "config", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
+#endif
 #ifdef MOZ_CRASHREPORTER
   { NS_ABOUT_MODULE_CONTRACTID_PREFIX "crashes", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
 #endif
   { NS_ABOUT_MODULE_CONTRACTID_PREFIX "crashparent", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
   { NS_ABOUT_MODULE_CONTRACTID_PREFIX "crashcontent", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
   { NS_ABOUT_MODULE_CONTRACTID_PREFIX "credits", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
   { NS_ABOUT_MODULE_CONTRACTID_PREFIX "license", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
   { NS_ABOUT_MODULE_CONTRACTID_PREFIX "logo", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
--- a/toolkit/content/tests/browser/browser_label_textlink.js
+++ b/toolkit/content/tests/browser/browser_label_textlink.js
@@ -1,19 +1,19 @@
 add_task(async function() {
   await BrowserTestUtils.withNewTab({gBrowser, url: "about:config"}, async function(browser) {
     let newTabURL = "http://www.example.com/";
     await ContentTask.spawn(browser, newTabURL, async function(newTabURL) {
       let doc = content.document;
-      let label = doc.createElement("label");
+      let label = doc.createXULElement("label");
       label.href = newTabURL;
       label.id = "textlink-test";
       label.className = "text-link";
       label.textContent = "click me";
-      doc.documentElement.append(label);
+      doc.body.prepend(label);
     });
 
     // Test that click will open tab in foreground.
     let awaitNewTab = BrowserTestUtils.waitForNewTab(gBrowser, newTabURL);
     await BrowserTestUtils.synthesizeMouseAtCenter("#textlink-test", {}, browser);
     let newTab = await awaitNewTab;
     is(newTab.linkedBrowser, gBrowser.selectedBrowser, "selected tab should be example page");
     BrowserTestUtils.removeTab(gBrowser.selectedTab);
--- a/toolkit/modules/BrowserUtils.jsm
+++ b/toolkit/modules/BrowserUtils.jsm
@@ -314,17 +314,16 @@ var BrowserUtils = {
    * Returns true if we can show a find bar, including FAYT, for the specified
    * document location. The location must not be in a blacklist of specific
    * "about:" pages for which find is disabled.
    *
    * This can be called from the parent process or from content processes.
    */
   canFindInPage(location) {
     return !location.startsWith("about:addons") &&
-           !location.startsWith("about:config") &&
            !location.startsWith("about:preferences");
   },
 
   _visibleToolbarsMap: new WeakMap(),
 
   /**
    * Return true if any or a specific toolbar that interacts with the content
    * document is visible.