Bug 1510579 - Load scripts in global-scripts.inc the same way browser.xul does. r=Standard8
authorDão Gottwald <dao@mozilla.com>
Wed, 28 Nov 2018 16:13:16 +0000
changeset 507749 58482700e9cbb377d02295c36fb9afc442d9b538
parent 507748 937ed33f8229ec736cc467e2d323087edb9b7c6f
child 507750 81bf174016f60a3a2577239fc38c9d9d3cf6f519
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8
bugs1510579
milestone65.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 1510579 - Load scripts in global-scripts.inc the same way browser.xul does. r=Standard8 Differential Revision: https://phabricator.services.mozilla.com/D13237
browser/base/content/global-scripts.inc
tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js
--- a/browser/base/content/global-scripts.inc
+++ b/browser/base/content/global-scripts.inc
@@ -13,20 +13,17 @@
 
 <script type="text/javascript"
 #ifdef BROWSER_XHTML
 xmlns="http://www.w3.org/1999/xhtml"
 #endif
 >
 Components.utils.import("resource://gre/modules/Services.jsm");
 
-for (let script of [
-  "chrome://browser/content/browser.js",
-  "chrome://browser/content/browser-places.js",
-  "chrome://global/content/globalOverlay.js",
-  "chrome://browser/content/utilityOverlay.js",
+Services.scriptloader.loadSubScript("chrome://browser/content/browser.js", this);
+Services.scriptloader.loadSubScript("chrome://browser/content/browser-places.js", this);
+Services.scriptloader.loadSubScript("chrome://global/content/globalOverlay.js", this);
+Services.scriptloader.loadSubScript("chrome://browser/content/utilityOverlay.js", this);
 #ifdef XP_MACOSX
-  "chrome://global/content/macWindowMenu.js",
+Services.scriptloader.loadSubScript("chrome://global/content/macWindowMenu.js", this);
 #endif
-]) {
-  Services.scriptloader.loadSubScript(script, this);
-}
+
 </script>
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js
@@ -46,17 +46,17 @@ const extraDefinitions = [
 const MAPPINGS = {
   "printUtils.js": "toolkit/components/printing/content/printUtils.js",
   "panelUI.js": "browser/components/customizableui/content/panelUI.js",
   "viewSourceUtils.js":
     "toolkit/components/viewsource/content/viewSourceUtils.js",
 };
 
 const globalScriptsRegExp =
-  /^\s*(?:Services.scriptloader.loadSubScript\(\"(.*?)\", this\);|"(.*?\.js)",)$/;
+  /^\s*Services.scriptloader.loadSubScript\(\"(.*?)\", this\);$/;
 
 function getGlobalScriptIncludes(scriptPath) {
   let fileData;
   try {
     fileData = fs.readFileSync(scriptPath, {encoding: "utf8"});
   } catch (ex) {
     // The file isn't present, so this isn't an m-c repository.
     return null;
@@ -64,17 +64,17 @@ function getGlobalScriptIncludes(scriptP
 
   fileData = fileData.split("\n");
 
   let result = [];
 
   for (let line of fileData) {
     let match = line.match(globalScriptsRegExp);
     if (match) {
-      let sourceFile = (match[1] || match[2])
+      let sourceFile = match[1]
                 .replace("chrome://browser/content/search/", "browser/components/search/content/")
                 .replace("chrome://browser/content/", "browser/base/content/")
                 .replace("chrome://global/content/", "toolkit/content/");
 
       for (let mapping of Object.getOwnPropertyNames(MAPPINGS)) {
         if (sourceFile.includes(mapping)) {
           sourceFile = MAPPINGS[mapping];
         }