Bug 1440609 - Uncouple DEBUG_JS_MODULES and DEBUG in devtools code r?jryans draft
authorMichael Ratcliffe <mratcliffe@mozilla.com>
Tue, 13 Mar 2018 12:49:39 +0000
changeset 767727 6585fc248e14f0b6d37d5b542edc96f4930628ab
parent 767726 0d81c80876dd09536f78d1158e1e6ff78f9ad226
push id102668
push userbmo:mratcliffe@mozilla.com
push dateWed, 14 Mar 2018 22:49:54 +0000
reviewersjryans
bugs1440609
milestone61.0a1
Bug 1440609 - Uncouple DEBUG_JS_MODULES and DEBUG in devtools code r?jryans MozReview-Commit-ID: 6qiu3D5eYyn
devtools/client/jsonview/converter-child.js
devtools/client/jsonview/viewer-config.js
devtools/client/shared/browser-loader.js
devtools/client/shared/vendor/moz.build
devtools/shared/DevToolsUtils.js
--- a/devtools/client/jsonview/converter-child.js
+++ b/devtools/client/jsonview/converter-child.js
@@ -7,19 +7,19 @@
 "use strict";
 
 const {Cc, Ci, Cu, CC} = require("chrome");
 const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
 const Services = require("Services");
 
 loader.lazyRequireGetter(this, "NetworkHelper",
                                "devtools/shared/webconsole/network-helper");
-loader.lazyGetter(this, "debug", function() {
+loader.lazyGetter(this, "debugJsModules", function() {
   let {AppConstants} = require("resource://gre/modules/AppConstants.jsm");
-  return !!(AppConstants.DEBUG || AppConstants.DEBUG_JS_MODULES);
+  return !!(AppConstants.DEBUG_JS_MODULES);
 });
 
 const childProcessMessageManager =
   Cc["@mozilla.org/childprocessmessagemanager;1"]
     .getService(Ci.nsISyncMessageSender);
 const BinaryInput = CC("@mozilla.org/binaryinputstream;1",
                        "nsIBinaryInputStream", "setInputStream");
 const BufferStream = CC("@mozilla.org/io/arraybuffer-input-stream;1",
@@ -163,17 +163,17 @@ function fixSave(request) {
 }
 
 // Exports variables that will be accessed by the non-privileged scripts.
 function exportData(win, request) {
   let data = Cu.createObjectIn(win, {
     defineAs: "JSONView"
   });
 
-  data.debug = debug;
+  data.debugJsModules = debugJsModules;
 
   data.json = new win.Text();
 
   data.readyState = "uninitialized";
 
   let Locale = {
     $STR: key => {
       try {
--- a/devtools/client/jsonview/viewer-config.js
+++ b/devtools/client/jsonview/viewer-config.js
@@ -25,28 +25,28 @@ window.dispatchEvent(new CustomEvent("Ap
  * of the code base, so it's consistent and modules can be easily reused.
  */
 require.config({
   baseUrl: "resource://devtools-client-jsonview/",
   paths: {
     "devtools/client/shared": "resource://devtools-client-shared",
     "devtools/shared": "resource://devtools/shared",
     "devtools/client/shared/vendor/react":
-      JSONView.debug
+      JSONView.debugJsModules
       ? "resource://devtools-client-shared/vendor/react-dev"
       : "resource://devtools-client-shared/vendor/react",
     "devtools/client/shared/vendor/react-dom":
-      JSONView.debug
+      JSONView.debugJsModules
       ? "resource://devtools-client-shared/vendor/react-dom-dev"
       : "resource://devtools-client-shared/vendor/react-dom",
     "devtools/client/shared/vendor/react-prop-types":
-      JSONView.debug
+      JSONView.debugJsModules
       ? "resource://devtools-client-shared/vendor/react-prop-types-dev"
       : "resource://devtools-client-shared/vendor/react-prop-types",
     "devtools/client/shared/vendor/react-dom-test-utils":
-      JSONView.debug
+      JSONView.debugJsModules
       ? "resource://devtools-client-shared/vendor/react-dom-test-utils-dev"
       : "resource://devtools-client-shared/vendor/react-dom-test-utils",
   }
 });
 
 // Load the main panel module
 requirejs(["json-viewer"]);
--- a/devtools/client/shared/browser-loader.js
+++ b/devtools/client/shared/browser-loader.js
@@ -95,17 +95,17 @@ function BrowserLoader(options) {
  */
 function BrowserLoaderBuilder({ baseURI, window, useOnlyShared, commonLibRequire }) {
   assert(!!baseURI !== !!useOnlyShared,
     "Cannot use both `baseURI` and `useOnlyShared`.");
 
   const loaderOptions = devtools.require("@loader/options");
   const dynamicPaths = {};
 
-  if (AppConstants.DEBUG || AppConstants.DEBUG_JS_MODULES) {
+  if (AppConstants.DEBUG_JS_MODULES) {
     dynamicPaths["devtools/client/shared/vendor/react"] =
       "resource://devtools/client/shared/vendor/react-dev";
     dynamicPaths["devtools/client/shared/vendor/react-dom"] =
       "resource://devtools/client/shared/vendor/react-dom-dev";
     dynamicPaths["devtools/client/shared/vendor/react-dom-server"] =
       "resource://devtools/client/shared/vendor/react-dom-server-dev";
     dynamicPaths["devtools/client/shared/vendor/react-prop-types"] =
       "resource://devtools/client/shared/vendor/react-prop-types-dev";
--- a/devtools/client/shared/vendor/moz.build
+++ b/devtools/client/shared/vendor/moz.build
@@ -23,19 +23,17 @@ DevToolsModules(
     'react.js',
     'redux.js',
     'reselect.js',
     'seamless-immutable.js',
     'WasmDis.js',
     'WasmParser.js',
 )
 
-# react dev versions are used if either debug mode is enabled,
-# or enable-debug-js-modules is set in .mozconfig so include it for
-# both
-if CONFIG['DEBUG_JS_MODULES'] or CONFIG['MOZ_DEBUG']:
+# react dev versions are used if enable-debug-js-modules is set in .mozconfig.
+if CONFIG['DEBUG_JS_MODULES']:
     DevToolsModules(
         'react-dev.js',
         'react-dom-dev.js',
         'react-dom-server-dev.js',
         'react-dom-test-utils-dev.js',
         'react-prop-types-dev.js',
     )
--- a/devtools/shared/DevToolsUtils.js
+++ b/devtools/shared/DevToolsUtils.js
@@ -427,26 +427,25 @@ function reallyAssert(condition, message
 /**
  * DevToolsUtils.assert(condition, message)
  *
  * @param Boolean condition
  * @param String message
  *
  * Assertions are enabled when any of the following are true:
  *   - This is a DEBUG_JS_MODULES build
- *   - This is a DEBUG build
  *   - flags.testing is set to true
  *
  * If assertions are enabled, then `condition` is checked and if false-y, the
  * assertion failure is logged and then an error is thrown.
  *
  * If assertions are not enabled, then this function is a no-op.
  */
 Object.defineProperty(exports, "assert", {
-  get: () => (AppConstants.DEBUG || AppConstants.DEBUG_JS_MODULES || flags.testing)
+  get: () => (AppConstants.DEBUG_JS_MODULES || flags.testing)
     ? reallyAssert
     : exports.noop,
 });
 
 /**
  * Defines a getter on a specified object for a module.  The module will not
  * be imported until first use.
  *