Bug 1310417 - use shams for devtools.js dependencies unable to run in content draft
authorJulian Descottes <jdescottes@mozilla.com>
Wed, 09 Nov 2016 17:21:53 +0100
changeset 436745 b797bec9dc59dbc2fce2a02f03dbcf6971db0475
parent 436744 92e83c84a54e271af5481c77fce687ed11daee05
child 536416 bb22e047a141990e27a1434265b60a4be8ef89dc
push id35167
push userjdescottes@mozilla.com
push dateWed, 09 Nov 2016 16:29:17 +0000
bugs1310417
milestone52.0a1
Bug 1310417 - use shams for devtools.js dependencies unable to run in content MozReview-Commit-ID: LKtzQoJBJLr
devtools/client/shared/shim/about-devtools-sham.js
devtools/client/shared/shim/jsonview-sham.js
devtools/client/shared/shim/system-unload-sham.js
devtools/client/webpack.config.js
new file mode 100644
--- /dev/null
+++ b/devtools/client/shared/shim/about-devtools-sham.js
@@ -0,0 +1,12 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* 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/. */
+
+"use strict";
+
+module.exports = {
+  register: () => {},
+  unregister: () => {},
+};
new file mode 100644
--- /dev/null
+++ b/devtools/client/shared/shim/jsonview-sham.js
@@ -0,0 +1,14 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* 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/. */
+
+"use strict";
+
+module.exports = {
+  JsonView: {
+    initialize: () => {},
+    destroy: () => {},
+  }
+};
new file mode 100644
--- /dev/null
+++ b/devtools/client/shared/shim/system-unload-sham.js
@@ -0,0 +1,11 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* 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/. */
+
+"use strict";
+
+module.exports = {
+  when: () => {},
+};
--- a/devtools/client/webpack.config.js
+++ b/devtools/client/webpack.config.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/. */
 
 "use strict";
 
+/* globals __dirname */
+
 const path = require("path");
 const webpack = require("webpack");
 
 module.exports = [{
   bail: true,
   entry: [
     "./sourceeditor/codemirror/addon/dialog/dialog.js",
     "./sourceeditor/codemirror/addon/search/searchcursor.js",
@@ -77,36 +79,46 @@ module.exports = [{
       path.resolve("./node_modules"),
       path.resolve("./webpack"),
     ]
   },
   resolve: {
     alias: {
       "devtools/shared/locales": path.join(__dirname, "../shared/locales/en-US"),
       "devtools/client/locales": path.join(__dirname, "./locales/en-US"),
-      "toolkit/locales": path.join(__dirname, "../../toolkit/locales/en-US/chrome/global"),
+      "toolkit/locales":
+        path.join(__dirname, "../../toolkit/locales/en-US/chrome/global"),
       "devtools/shared/platform": path.join(__dirname, "../shared/platform/content"),
+      Services: path.join(__dirname, "./shared/shim/Services.js"),
+      "devtools/client/jsonview/main":
+        path.join(__dirname, "./shared/shim/jsonview-sham.js"),
+      "sdk/system/unload": path.join(__dirname, "./shared/shim/system-unload-sham.js"),
+      "devtools/client/framework/about-devtools-toolbox":
+        path.join(__dirname, "./shared/shim/about-devtools-sham.js"),
       devtools: path.join(__dirname, "../"),
-      Services: path.join(__dirname, "./shared/shim/Services.js"),
       gcli: path.join(__dirname, "../shared/gcli/source/lib/gcli"),
       acorn: path.join(__dirname, "../shared/acorn"),
       "acorn/util/walk": path.join(__dirname, "../shared/acorn/walk"),
       sdk: path.join(__dirname, "../../addon-sdk/source/lib/sdk"),
       method: path.join(__dirname, "../../addon-sdk/source/lib/method"),
       "modules/libpref/init/all": path.join(__dirname,
                                             "../../modules/libpref/init/all.js"),
     },
   },
 
   plugins: [
     new webpack.DefinePlugin({
       "isWorker": JSON.stringify(false),
       "reportError": "console.error",
       "AppConstants": "{ DEBUG: true, DEBUG_JS_MODULES: true }",
-      "loader": "{ lazyRequireGetter: () => {}, lazyGetter: () => {}, chromeRequire: () => {} }",
+      "loader": `{
+                    lazyRequireGetter: () => {},
+                    lazyGetter: () => {},
+                    chromeRequire: () => {}
+                  }`,
       "dump": "console.log",
     }),
   ],
 
   externals: [
     /codemirror\//,
     {
       "promise": "var Promise",