Bug 1430855 - Update Debugger Frontend v9.1. r=jdescottes
authorJason Laster <jason.laster.11@gmail.com>
Wed, 17 Jan 2018 17:58:26 +0100
changeset 399862 4f42c8b2e10caa1295c3bb5029e86e8261e0662d
parent 399861 294d12c7062b0ea08faf2ee12ff1a017a8f9c8f8
child 399863 265ec11162b8e606bcd47dd7861ecd3230bd565c
push id33279
push useraciure@mozilla.com
push dateThu, 18 Jan 2018 21:53:37 +0000
treeherdermozilla-central@cffb3cd9dbb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1430855
milestone59.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 1430855 - Update Debugger Frontend v9.1. r=jdescottes MozReview-Commit-ID: CnJ3iP3tjAw
devtools/client/debugger/new/README.mozilla
devtools/client/debugger/new/debugger.css
devtools/client/debugger/new/debugger.js
devtools/client/debugger/new/parser-worker.js
devtools/client/debugger/new/test/mochitest/browser_dbg-minified.js
devtools/client/debugger/new/test/mochitest/browser_dbg-sourcemaps3.js
devtools/client/preferences/debugger.js
--- a/devtools/client/debugger/new/README.mozilla
+++ b/devtools/client/debugger/new/README.mozilla
@@ -1,13 +1,13 @@
 This is the debugger.html project output.
 See https://github.com/devtools-html/debugger.html
 
-Version 9.0
-commit: https://github.com/devtools-html/debugger.html/commit/0de8d3f673ee0f0030d666f1827380e17bef8036
-comparison: https://github.com/devtools-html/debugger.html/compare/release-8...release-9
+Version 9.1
+commit: https://github.com/devtools-html/debugger.html/commit/3fbfed14525b26de4716db2a6447e2d612f4ff6a
+comparison: https://github.com/devtools-html/debugger.html/compare/release-9...release-9-1
 
 Packages:
 - babel-plugin-transform-es2015-modules-commonjs @6.26.0
 - babel-preset-react @6.24.1
 - react @15.6.2
 - react-dom @15.6.2
 - webpack @3.10.0
--- a/devtools/client/debugger/new/debugger.css
+++ b/devtools/client/debugger/new/debugger.css
@@ -1528,17 +1528,17 @@ html[dir="rtl"] .managed-tree .tree .nod
   background-color: var(--theme-highlight-blue);
   width: 13px;
   height: 13px;
   display: inline-block;
   margin-inline-end: 5px;
   margin-bottom: -2px;
 }
 
-.sources-list .managed-tree .tree .node.focused img.blackBox {
+.sources-list .managed-tree .tree .node.focused img {
   background-color: white;
 }
 
 .theme-dark .sources-list .managed-tree .tree .node:not(.focused) img.blackBox {
   background-color: var(--theme-content-color3);
 }
 
 .theme-dark .sources-list .managed-tree .tree .node img.blackBox {
--- a/devtools/client/debugger/new/debugger.js
+++ b/devtools/client/debugger/new/debugger.js
@@ -18735,17 +18735,17 @@ function isNotJavaScript(source) {
     return false;
   }
   const parsedExtension = parsedUrl.split(".").pop();
 
   return ["css", "svg", "png"].includes(parsedExtension);
 }
 
 function isInvalidUrl(url, source) {
-  return IGNORED_URLS.indexOf(url) != -1 || !source.get("url") || source.get("loadedState") === "loading" || !url.group || (0, _source.isPretty)(source) || isNotJavaScript(source);
+  return IGNORED_URLS.indexOf(url) != -1 || !source.get("url") || !url.group || (0, _source.isPretty)(source) || isNotJavaScript(source);
 }
 
 function partIsFile(index, parts, url) {
   const isLastPart = index === parts.length - 1;
   return !isDirectory(url) && isLastPart;
 }
 
 function createNode(name, path, contents) {
@@ -21542,18 +21542,18 @@ function setSymbols(sourceId) {
     const source = sourceRecord.toJS();
 
     if (!source.text || source.isWasm || (0, _selectors.hasSymbols)(getState(), source)) {
       return;
     }
 
     const symbols = await (0, _parser.getSymbols)(source);
     dispatch({ type: "SET_SYMBOLS", source, symbols });
-    dispatch(setEmptyLines(source.id));
-    dispatch(setSourceMetaData(source.id));
+    dispatch(setEmptyLines(sourceId));
+    dispatch(setSourceMetaData(sourceId));
   };
 }
 
 function setEmptyLines(sourceId) {
   return async ({ dispatch, getState }) => {
     const sourceRecord = (0, _selectors.getSource)(getState(), sourceId);
     if (!sourceRecord) {
       return;
@@ -21579,17 +21579,20 @@ function setOutOfScopeLocations() {
     const location = (0, _selectors.getSelectedLocation)(getState());
 
     if (!location) {
       return;
     }
 
     const source = (0, _selectors.getSource)(getState(), location.sourceId);
 
-    const locations = !location.line || !source ? null : await (0, _parser.findOutOfScopeLocations)(source.toJS(), location);
+    let locations = null;
+    if (location.line && source && (0, _selectors.isPaused)(getState())) {
+      locations = await (0, _parser.findOutOfScopeLocations)(source.toJS(), location);
+    }
 
     dispatch({
       type: "OUT_OF_SCOPE_LOCATIONS",
       locations
     });
 
     dispatch((0, _setInScopeLines.setInScopeLines)());
   };
@@ -24431,18 +24434,16 @@ Object.defineProperty(exports, "__esModu
 });
 exports.loadAllSources = loadAllSources;
 exports.loadSourceText = loadSourceText;
 
 var _devtoolsSourceMap = __webpack_require__(1360);
 
 var _promise = __webpack_require__(1653);
 
-var _ast = __webpack_require__(1399);
-
 var _selectors = __webpack_require__(1352);
 
 var _parser = __webpack_require__(1365);
 
 var parser = _interopRequireWildcard(_parser);
 
 var _source = __webpack_require__(1356);
 
@@ -24451,21 +24452,19 @@ var _defer = __webpack_require__(1800);
 var _defer2 = _interopRequireDefault(_defer);
 
 var _projectTextSearch = __webpack_require__(1433);
 
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 
 function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
 
-/* 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/>. */
-
-const requests = new Map();
+const requests = new Map(); /* 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/>. */
 
 async function loadSource(source, { sourceMaps, client }) {
   const id = source.get("id");
   if ((0, _devtoolsSourceMap.isOriginalId)(id)) {
     return await sourceMaps.getOriginalSourceText(source.toJS());
   }
 
   const response = await client.sourceContents(id);
@@ -24531,17 +24530,16 @@ function loadSourceText(source) {
 
     if ((0, _devtoolsSourceMap.isOriginalId)(newSource.id) && !newSource.isWasm) {
       const generatedSource = (0, _selectors.getGeneratedSource)(getState(), source.toJS());
       await dispatch(loadSourceText(generatedSource));
     }
 
     if (!newSource.isWasm) {
       await parser.setSource(newSource);
-      dispatch((0, _ast.setSymbols)(id));
     }
 
     // signal that the action is finished
     deferred.resolve();
     requests.delete(id);
   };
 }
 
@@ -49174,24 +49172,33 @@ function createOriginalSource(originalUr
     id: sourceMaps.generatedToOriginalId(generatedSource.id, originalUrl),
     isPrettyPrinted: false,
     isWasm: false,
     isBlackBoxed: false,
     loadedState: "unloaded"
   };
 }
 
+// TODO: It would be nice to make getOriginalURLs a safer api
+async function loadOriginalSourceUrls(sourceMaps, generatedSource) {
+  try {
+    return await sourceMaps.getOriginalURLs(generatedSource);
+  } catch (e) {
+    console.error(e);
+    return null;
+  }
+}
+
 /**
  * @memberof actions/sources
  * @static
  */
 function loadSourceMap(generatedSource) {
   return async function ({ dispatch, getState, sourceMaps }) {
-    const urls = await sourceMaps.getOriginalURLs(generatedSource);
-
+    const urls = await loadOriginalSourceUrls(sourceMaps, generatedSource);
     if (!urls) {
       // If this source doesn't have a sourcemap, do nothing.
       return;
     }
 
     const originalSources = urls.map(url => createOriginalSource(url, generatedSource, sourceMaps));
 
     // TODO: check if this line is really needed, it introduces
@@ -49443,21 +49450,27 @@ function selectLocation(location, tabInd
       type: "SELECT_SOURCE",
       source: source.toJS(),
       tabIndex,
       location
     });
 
     await dispatch((0, _loadSourceText.loadSourceText)(source));
     const selectedSource = (0, _selectors.getSelectedSource)(getState());
-    if (_prefs.prefs.autoPrettyPrint && !(0, _selectors.getPrettySource)(getState(), selectedSource.get("id")) && (0, _source.shouldPrettyPrint)(selectedSource) && (0, _source.isMinified)(selectedSource)) {
-      await dispatch((0, _prettyPrint.togglePrettyPrint)(source.get("id")));
+    if (!selectedSource) {
+      return;
+    }
+
+    const sourceId = selectedSource.get("id");
+    if (_prefs.prefs.autoPrettyPrint && !(0, _selectors.getPrettySource)(getState(), sourceId) && (0, _source.shouldPrettyPrint)(selectedSource) && (0, _source.isMinified)(selectedSource)) {
+      await dispatch((0, _prettyPrint.togglePrettyPrint)(sourceId));
       dispatch((0, _tabs.closeTab)(source.get("url")));
     }
 
+    dispatch((0, _ast.setSymbols)(sourceId));
     dispatch((0, _ast.setOutOfScopeLocations)());
   };
 }
 
 /**
  * @memberof actions/sources
  * @static
  */
--- a/devtools/client/debugger/new/parser-worker.js
+++ b/devtools/client/debugger/new/parser-worker.js
@@ -35470,21 +35470,16 @@ module.exports = {
 /***/ (function(module, exports, __webpack_require__) {
 
 "use strict";
 
 
 Object.defineProperty(exports, "__esModule", {
   value: true
 });
-
-var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /* 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/>. */
-
 exports.parseScript = parseScript;
 exports.getAst = getAst;
 exports.clearASTs = clearASTs;
 exports.traverseAst = traverseAst;
 
 var _parseScriptTags = __webpack_require__(1023);
 
 var _parseScriptTags2 = _interopRequireDefault(_parseScriptTags);
@@ -35500,24 +35495,33 @@ var _babelTraverse2 = _interopRequireDef
 var _isEmpty = __webpack_require__(963);
 
 var _isEmpty2 = _interopRequireDefault(_isEmpty);
 
 function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
 
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 
+/* 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/>. */
+
 let ASTs = new Map();
 
 function _parse(code, opts) {
-  return babylon.parse(code, _extends({}, opts, {
+  return babylon.parse(code, opts);
+}
+
+const sourceOptions = {
+  generated: {},
+  original: {
     sourceType: "module",
     plugins: ["jsx", "flow", "doExpressions", "objectRestSpread", "classProperties", "exportExtensions", "asyncGenerators", "functionBind", "functionSent", "dynamicImport", "templateInvalidEscapes"]
-  }));
-}
+  }
+};
 
 function parse(text, opts) {
   let ast;
   if (!text) {
     return;
   }
 
   try {
@@ -35527,19 +35531,17 @@ function parse(text, opts) {
   }
 
   return ast;
 }
 
 // Custom parser for parse-script-tags that adapts its input structure to
 // our parser's signature
 function htmlParser({ source, line }) {
-  return parse(source, {
-    startLine: line
-  });
+  return parse(source, { startLine: line });
 }
 
 function parseScript(text, opts) {
   return _parse(text, opts);
 }
 
 function getAst(source) {
   if (!source || !source.text) {
@@ -35550,17 +35552,19 @@ function getAst(source) {
     return ASTs.get(source.id);
   }
 
   let ast = {};
   const { contentType } = source;
   if (contentType == "text/html") {
     ast = (0, _parseScriptTags2.default)(source.text, htmlParser) || {};
   } else if (contentType && contentType.match(/(javascript|jsx)/)) {
-    ast = parse(source.text);
+    const type = source.id.includes("original") ? "original" : "generated";
+    const options = sourceOptions[type];
+    ast = parse(source.text, options);
   }
 
   ASTs.set(source.id, ast);
   return ast;
 }
 
 function clearASTs() {
   ASTs = new Map();
--- a/devtools/client/debugger/new/test/mochitest/browser_dbg-minified.js
+++ b/devtools/client/debugger/new/test/mochitest/browser_dbg-minified.js
@@ -11,16 +11,18 @@ function getScopeNodeLabel(dbg, index) {
   return findElement(dbg, "scopeNode", index).innerText;
 }
 
 function getScopeNodeValue(dbg, index) {
   return findElement(dbg, "scopeValue", index).innerText;
 }
 
 add_task(async function() {
+  await pushPref("devtools.debugger.features.map-scopes", true);
+
   const dbg = await initDebugger("doc-minified2.html");
 
   await waitForSources(dbg, "sum.js");
 
   await selectSource(dbg, "sum.js");
   await addBreakpoint(dbg, "sum.js", 2);
 
   invokeInTab("test");
--- a/devtools/client/debugger/new/test/mochitest/browser_dbg-sourcemaps3.js
+++ b/devtools/client/debugger/new/test/mochitest/browser_dbg-sourcemaps3.js
@@ -20,16 +20,17 @@ async function waitForScopeNode(dbg, ind
   const selector = getSelector("scopeNode", index);
   return waitForElement(dbg, selector);
 }
 
 // This source map does not have source contents, so it's fetched separately
 add_task(async function() {
   // NOTE: the CORS call makes the test run times inconsistent
   requestLongerTimeout(2);
+  await pushPref("devtools.debugger.features.map-scopes", true);
 
   const dbg = await initDebugger("doc-sourcemaps3.html");
   const { selectors: { getBreakpoint, getBreakpoints }, getState } = dbg;
 
   await waitForSources(dbg, "bundle.js", "sorted.js", "test.js");
 
   ok(true, "Original sources exist");
   const sortedSrc = findSource(dbg, "sorted.js");
--- a/devtools/client/preferences/debugger.js
+++ b/devtools/client/preferences/debugger.js
@@ -43,16 +43,16 @@ pref("devtools.debugger.file-search-rege
 pref("devtools.debugger.features.async-stepping", true);
 pref("devtools.debugger.project-directory-root", "");
 
 pref("devtools.debugger.features.wasm", true);
 pref("devtools.debugger.features.shortcuts", true);
 pref("devtools.debugger.features.root", false);
 pref("devtools.debugger.features.column-breakpoints", false);
 pref("devtools.debugger.features.chrome-scopes", false);
-pref("devtools.debugger.features.map-scopes", true);
+pref("devtools.debugger.features.map-scopes", false);
 pref("devtools.debugger.features.breakpoints-dropdown", true);
 pref("devtools.debugger.features.remove-command-bar-options", false);
 pref("devtools.debugger.features.workers", true);
 pref("devtools.debugger.features.code-coverage", false);
 pref("devtools.debugger.features.event-listeners", false);
 pref("devtools.debugger.features.code-folding", false);
 pref("devtools.debugger.features.outline", true);