Bug 1291049 - 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 440566 bafc1d3814c22b6a4ae1247c73ce8bab4b5d37c1
parent 440565 81b9ae2f052e7208049482b941f307bb041ef205
child 537411 468dba79974517b13c73ef26c1efbeea6a8dc924
push id36266
push userjdescottes@mozilla.com
push dateThu, 17 Nov 2016 20:42:33 +0000
bugs1291049
milestone52.0a1
Bug 1291049 - 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",