Bug 1403489 - remove special loader rule for devtools/shared/platform;r=tromey
authorJulian Descottes <jdescottes@mozilla.com>
Wed, 27 Sep 2017 12:38:23 +0200
changeset 434009 e10a7083e7a7fab40f1aa1dd446decde7e340281
parent 434008 aab1bc673fd7caa494d8f21809d68a370faef1e4
child 434010 d4ccab1528bf4fe48bcbde2ea7b57cb9313e794a
push id8114
push userjlorenzo@mozilla.com
push dateThu, 02 Nov 2017 16:33:21 +0000
treeherdermozilla-beta@73e0d89a540f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstromey
bugs1403489
milestone58.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 1403489 - remove special loader rule for devtools/shared/platform;r=tromey MozReview-Commit-ID: HwhAXHm8ipq
.eslintignore
devtools/client/inspector/webpack.config.js
devtools/client/netmonitor/webpack.config.js
devtools/client/shared/moz.build
devtools/client/shared/webpack/moz.build
devtools/client/shared/webpack/shims/.eslintrc.js
devtools/client/shared/webpack/shims/moz.build
devtools/client/shared/webpack/shims/platform-clipboard-stub.js
devtools/client/shared/webpack/shims/platform-stack-stub.js
devtools/client/shared/webpack/shims/test/.eslintrc.js
devtools/client/shared/webpack/shims/test/mochitest.ini
devtools/client/shared/webpack/shims/test/test_clipboard.html
devtools/client/shared/webpack/shims/test/test_stack.js
devtools/client/shared/webpack/shims/test/xpcshell.ini
devtools/client/webconsole/webpack.config.js
devtools/shared/Loader.jsm
devtools/shared/platform/README.md
devtools/shared/platform/chrome/clipboard.js
devtools/shared/platform/chrome/moz.build
devtools/shared/platform/chrome/stack.js
devtools/shared/platform/clipboard.js
devtools/shared/platform/content/.eslintrc.js
devtools/shared/platform/content/clipboard.js
devtools/shared/platform/content/moz.build
devtools/shared/platform/content/stack.js
devtools/shared/platform/content/test/.eslintrc.js
devtools/shared/platform/content/test/mochitest.ini
devtools/shared/platform/content/test/test_clipboard.html
devtools/shared/platform/content/test/test_stack.js
devtools/shared/platform/content/test/xpcshell.ini
devtools/shared/platform/moz.build
devtools/shared/platform/stack.js
devtools/shared/worker/loader.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -126,17 +126,17 @@ devtools/client/webconsole/hudservice.js
 devtools/client/webconsole/webconsole-connection-proxy.js
 devtools/client/webconsole/webconsole.js
 devtools/client/webide/**
 !devtools/client/webide/components/webideCli.js
 devtools/server/tests/browser/storage-*.html
 !devtools/server/tests/browser/storage-unsecured-iframe.html
 devtools/server/tests/browser/stylesheets-nested-iframes.html
 devtools/server/tests/unit/xpcshell_debugging_script.js
-devtools/shared/platform/content/test/test_clipboard.html
+devtools/client/shared/webpack/shims/test/test_clipboard.html
 devtools/shared/qrcode/tests/mochitest/test_decode.html
 devtools/shared/tests/mochitest/*.html
 devtools/shared/webconsole/test/test_*.html
 
 # Ignore devtools preferences files
 devtools/client/preferences/**
 devtools/shim/devtools-startup-prefs.js
 
--- a/devtools/client/inspector/webpack.config.js
+++ b/devtools/client/inspector/webpack.config.js
@@ -94,17 +94,20 @@ module.exports = envConfig => {
         "devtools/client/jsonview/main":
           path.join(__dirname, "./webpack/jsonview-sham.js"),
         "devtools/client/sourceeditor/editor":
           path.join(__dirname, "./webpack/editor-sham.js"),
         "devtools/client/locales": path.join(__dirname, "../locales/en-US"),
         "devtools/shared/DevToolsUtils":
           path.join(__dirname, "./webpack/devtools-utils-sham.js"),
         "devtools/shared/locales": path.join(__dirname, "../../shared/locales/en-US"),
-        "devtools/shared/platform": path.join(__dirname, "../../shared/platform/content"),
+        "devtools/shared/platform/clipboard": path.join(__dirname,
+          "../../client/shared/webpack/shims/platform-clipboard-stub"),
+        "devtools/shared/platform/stack": path.join(__dirname,
+          "../../client/shared/webpack/shims/platform-clipboard-stub"),
         "devtools": path.join(__dirname, "../../"),
         "gcli": path.join(__dirname, "../../shared/gcli/source/lib/gcli"),
         "method": path.join(__dirname, "../../../addon-sdk/source/lib/method"),
         "modules/libpref/init/all":
           path.join(__dirname, "../../../modules/libpref/init/all.js"),
         "devtools/shared/generate-uuid":
           path.join(__dirname, "./webpack/uuid-sham.js"),
         "sdk": path.join(__dirname, "../../../addon-sdk/source/lib/sdk"),
--- a/devtools/client/netmonitor/webpack.config.js
+++ b/devtools/client/netmonitor/webpack.config.js
@@ -82,17 +82,17 @@ let webpackConfig = {
       "devtools/client/shared/vendor/redux": "redux",
       "devtools/client/shared/vendor/reselect": "reselect",
       "devtools/client/shared/vendor/jszip": "jszip",
 
       "devtools/client/sourceeditor/editor": "devtools-source-editor/src/source-editor",
 
       "devtools/shared/old-event-emitter": "devtools-modules/src/utils/event-emitter",
       "devtools/shared/fronts/timeline": path.join(__dirname, "../../client/shared/webpack/shims/fronts-timeline-shim"),
-      "devtools/shared/platform/clipboard": path.join(__dirname, "../../shared/platform/content/clipboard"),
+      "devtools/shared/platform/clipboard": path.join(__dirname, "../../client/shared/webpack/shims/platform-clipboard-stub"),
 
       // Locales need to be explicitly mapped to the en-US subfolder
       "devtools/client/locales": path.join(__dirname, "../../client/locales/en-US"),
       "devtools/shared/locales": path.join(__dirname, "../../shared/locales/en-US"),
       "devtools/shim/locales": path.join(__dirname, "../../shared/locales/en-US"),
       "toolkit/locales": path.join(__dirname, "../../../toolkit/locales/en-US"),
 
       // Unless a path explicitly needs to be rewritten or shimmed, all devtools paths can
--- a/devtools/client/shared/moz.build
+++ b/devtools/client/shared/moz.build
@@ -7,16 +7,17 @@
 BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
 XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini']
 
 DIRS += [
     'components',
     'redux',
     'source-map',
     'vendor',
+    'webpack',
     'widgets',
 ]
 
 DevToolsModules(
     'AppCacheUtils.jsm',
     'autocomplete-popup.js',
     'browser-loader.js',
     'css-angle.js',
new file mode 100644
--- /dev/null
+++ b/devtools/client/shared/webpack/moz.build
@@ -0,0 +1,9 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+DIRS += [
+    'shims',
+]
rename from devtools/shared/platform/content/.eslintrc.js
rename to devtools/client/shared/webpack/shims/.eslintrc.js
--- a/devtools/shared/platform/content/.eslintrc.js
+++ b/devtools/client/shared/webpack/shims/.eslintrc.js
@@ -1,12 +1,12 @@
 "use strict";
 
 module.exports = {
   // Extend from the devtools eslintrc.
-  "extends": "../../../.eslintrc.js",
+  "extends": "../../../../.eslintrc.js",
 
   "rules": {
     /* eslint-disable max-len */
     // All code in this directory must be content-clean.
     "mozilla/reject-some-requires": ["error", "^(chrome|chrome:.*|resource:.*|devtools/server/.*|.*\\.jsm|devtools/shared/platform/(chome|content)/.*)$"],
   },
 };
rename from devtools/shared/platform/content/moz.build
rename to devtools/client/shared/webpack/shims/moz.build
--- a/devtools/shared/platform/content/moz.build
+++ b/devtools/client/shared/webpack/shims/moz.build
@@ -1,16 +1,16 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
 DevToolsModules(
-    'clipboard.js',
-    'stack.js',
+    'platform-clipboard-stub.js',
+    'platform-stack-stub.js',
 )
 
 XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell.ini']
 
 MOCHITEST_MANIFESTS += [
     'test/mochitest.ini',
 ]
rename from devtools/shared/platform/content/clipboard.js
rename to devtools/client/shared/webpack/shims/platform-clipboard-stub.js
rename from devtools/shared/platform/content/stack.js
rename to devtools/client/shared/webpack/shims/platform-stack-stub.js
rename from devtools/shared/platform/content/test/.eslintrc.js
rename to devtools/client/shared/webpack/shims/test/.eslintrc.js
--- a/devtools/shared/platform/content/test/.eslintrc.js
+++ b/devtools/client/shared/webpack/shims/test/.eslintrc.js
@@ -1,6 +1,6 @@
 "use strict";
 
 module.exports = {
   // Extend from the common devtools xpcshell eslintrc config.
-  "extends": "../../../../.eslintrc.xpcshell.js"
+  "extends": "../../../../../.eslintrc.xpcshell.js"
 };
rename from devtools/shared/platform/content/test/mochitest.ini
rename to devtools/client/shared/webpack/shims/test/mochitest.ini
rename from devtools/shared/platform/content/test/test_clipboard.html
rename to devtools/client/shared/webpack/shims/test/test_clipboard.html
--- a/devtools/shared/platform/content/test/test_clipboard.html
+++ b/devtools/client/shared/webpack/shims/test/test_clipboard.html
@@ -34,17 +34,17 @@ async function pre_do_tests() {
       ["security.all_resource_uri_content_accessible", true]
     ]
   });
 
   // Load script.
   await (() => new Promise((resolve) => {
     var script = document.createElement("script");
     script.onload = resolve;
-    script.src = "resource://devtools/shared/platform/content/clipboard.js";
+    script.src = "resource://devtools/client/shared/webpack/shims/platform-clipboard-stub.js";
     document.head.appendChild(script);
   }))();
 
   do_tests();
 }
 
 function do_tests() {
   let elt = document.querySelector("#key");
rename from devtools/shared/platform/content/test/test_stack.js
rename to devtools/client/shared/webpack/shims/test/test_stack.js
--- a/devtools/shared/platform/content/test/test_stack.js
+++ b/devtools/client/shared/webpack/shims/test/test_stack.js
@@ -4,24 +4,21 @@
 // There isn't really very much about the content stack.js that we can
 // test, but we'll do what we can.
 
 "use strict";
 
 var Cu = Components.utils;
 const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
 
-// Make sure to explicitly require the content version of this module.
-// We have to use the ".." trick due to the way the loader remaps
-// devtools/shared/platform.
 const {
   callFunctionWithAsyncStack,
   getStack,
   describeNthCaller
-} = require("devtools/shared/platform/../content/stack");
+} = require("devtools/client/shared/webpack/shims/platform-stack-stub");
 
 function f3() {
   return describeNthCaller(2);
 }
 
 function f2() {
   return f3();
 }
rename from devtools/shared/platform/content/test/xpcshell.ini
rename to devtools/client/shared/webpack/shims/test/xpcshell.ini
--- a/devtools/client/webconsole/webpack.config.js
+++ b/devtools/client/webconsole/webpack.config.js
@@ -85,18 +85,18 @@ webpackConfig.resolve = {
     "devtools/client/framework/menu": "devtools-modules/src/menu",
     "devtools/client/sourceeditor/editor": "devtools-source-editor/src/source-editor",
 
     "devtools/client/shared/zoom-keys": "devtools-modules/src/zoom-keys",
 
     "devtools/shared/fronts/timeline": path.join(__dirname, "../../client/shared/webpack/shims/fronts-timeline-shim"),
     "devtools/shared/old-event-emitter": "devtools-modules/src/utils/event-emitter",
     "devtools/shared/client/main": path.join(__dirname, "new-console-output/test/fixtures/ObjectClient"),
-    "devtools/shared/platform/clipboard": path.join(__dirname, "../../shared/platform/content/clipboard"),
-    "devtools/shared/platform/stack": path.join(__dirname, "../../shared/platform/content/stack"),
+    "devtools/shared/platform/clipboard": path.join(__dirname, "../../client/shared/webpack/shims/platform-clipboard-stub"),
+    "devtools/shared/platform/stack": path.join(__dirname, "../../client/shared/webpack/shims/platform-stack-stub"),
 
     // Locales need to be explicitly mapped to the en-US subfolder
     "toolkit/locales": path.join(__dirname, "../../../toolkit/locales/en-US"),
     "devtools/client/locales": path.join(__dirname, "../../client/locales/en-US"),
     "devtools/shared/locales": path.join(__dirname, "../../shared/locales/en-US"),
     "devtools/shim/locales": path.join(__dirname, "../../shared/locales/en-US"),
 
     // Unless a path explicitly needs to be rewritten or shimmed, all devtools paths can
--- a/devtools/shared/Loader.jsm
+++ b/devtools/shared/Loader.jsm
@@ -25,23 +25,16 @@ this.EXPORTED_SYMBOLS = ["DevToolsLoader
  * Used when the tools should be loaded from the Firefox package itself.
  * This is the default case.
  */
 function BuiltinProvider() {}
 BuiltinProvider.prototype = {
   load: function () {
     const paths = {
       // ⚠ DISCUSSION ON DEV-DEVELOPER-TOOLS REQUIRED BEFORE MODIFYING ⚠
-      // Modules here are intended to have one implementation for
-      // chrome, and a separate implementation for content.  Here we
-      // map the directory to the chrome subdirectory, but the content
-      // loader will map to the content subdirectory.  See the
-      // README.md in devtools/shared/platform.
-      "devtools/shared/platform": "resource://devtools/shared/platform/chrome",
-      // ⚠ DISCUSSION ON DEV-DEVELOPER-TOOLS REQUIRED BEFORE MODIFYING ⚠
       "devtools": "resource://devtools",
       // ⚠ DISCUSSION ON DEV-DEVELOPER-TOOLS REQUIRED BEFORE MODIFYING ⚠
       "gcli": "resource://devtools/shared/gcli/source/lib/gcli",
       // ⚠ DISCUSSION ON DEV-DEVELOPER-TOOLS REQUIRED BEFORE MODIFYING ⚠
       "acorn": "resource://devtools/shared/acorn",
       // ⚠ DISCUSSION ON DEV-DEVELOPER-TOOLS REQUIRED BEFORE MODIFYING ⚠
       "acorn/util/walk": "resource://devtools/shared/acorn/walk.js",
       // ⚠ DISCUSSION ON DEV-DEVELOPER-TOOLS REQUIRED BEFORE MODIFYING ⚠
deleted file mode 100644
--- a/devtools/shared/platform/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-This directory is treated specially by the loaders.
-
-In particular, when running in chrome, a resource like
-"devtools/shared/platform/mumble" will be found in the chrome
-subdirectory; and when running in content, it will be found in the
-content subdirectory.
-
-Outside of tests, it's not ok to require a specific version of a file;
-and there is an eslint test to check for that.  That is,
-require("devtools/shared/platform/client/mumble") is an error.
-
-When adding a new file, you must add two copies, one to chrome and one
-to content.  Otherwise, one case or the other will fail to work.
deleted file mode 100644
--- a/devtools/shared/platform/chrome/moz.build
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# 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/.
-
-DevToolsModules(
-    'clipboard.js',
-    'stack.js',
-)
rename from devtools/shared/platform/chrome/clipboard.js
rename to devtools/shared/platform/clipboard.js
--- a/devtools/shared/platform/moz.build
+++ b/devtools/shared/platform/moz.build
@@ -1,10 +1,10 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
-DIRS += [
-    'chrome',
-    'content',
-]
+DevToolsModules(
+    'clipboard.js',
+    'stack.js',
+)
rename from devtools/shared/platform/chrome/stack.js
rename to devtools/shared/platform/stack.js
--- a/devtools/shared/worker/loader.js
+++ b/devtools/shared/worker/loader.js
@@ -573,23 +573,16 @@ this.worker = new WorkerDebuggerLoader({
   modules: {
     "Debugger": Debugger,
     "Services": Object.create(null),
     "chrome": chrome,
     "xpcInspector": xpcInspector
   },
   paths: {
     // ⚠ DISCUSSION ON DEV-DEVELOPER-TOOLS REQUIRED BEFORE MODIFYING ⚠
-    // Modules here are intended to have one implementation for
-    // chrome, and a separate implementation for content.  Here we
-    // map the directory to the chrome subdirectory, but the content
-    // loader will map to the content subdirectory.  See the
-    // README.md in devtools/shared/platform.
-    "devtools/shared/platform": "resource://devtools/shared/platform/chrome",
-    // ⚠ DISCUSSION ON DEV-DEVELOPER-TOOLS REQUIRED BEFORE MODIFYING ⚠
     "devtools": "resource://devtools",
     // ⚠ DISCUSSION ON DEV-DEVELOPER-TOOLS REQUIRED BEFORE MODIFYING ⚠
     "promise": "resource://gre/modules/Promise-backend.js",
     // ⚠ DISCUSSION ON DEV-DEVELOPER-TOOLS REQUIRED BEFORE MODIFYING ⚠
     "source-map": "resource://devtools/shared/sourcemap/source-map.js",
     // ⚠ DISCUSSION ON DEV-DEVELOPER-TOOLS REQUIRED BEFORE MODIFYING ⚠
     "xpcshell-test": "resource://test"
     // ⚠ DISCUSSION ON DEV-DEVELOPER-TOOLS REQUIRED BEFORE MODIFYING ⚠