Bug 1466870 - Update Debugger Frontend v63 r=jdescottes
authorDavid Walsh <dwalsh@mozilla.com>
Wed, 06 Jun 2018 09:09:14 -0500
changeset 476037 cb38aa5ce628b86603c8466abfeed0aacec4ca08
parent 476036 dad7dd00c1927c43822df69bbd0546c195ad40bd
child 476038 9e717c6aaa70daa363832215d3a78ffa605f92bb
push id9374
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:43:20 +0000
treeherdermozilla-beta@160e085dfb0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1466870
milestone62.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 1466870 - Update Debugger Frontend v63 r=jdescottes
devtools/client/debugger/new/dist/debugger.css
devtools/client/debugger/new/src/components/PrimaryPanes/SourcesTree.js
devtools/client/debugger/new/src/components/QuickOpenModal.js
devtools/client/debugger/new/src/components/SecondaryPanes/Breakpoints/Breakpoint.js
devtools/client/debugger/new/src/selectors/getRelativeSources.js
devtools/client/debugger/new/src/utils/editor/source-editor.js
devtools/client/debugger/new/src/utils/quick-open.js
devtools/client/debugger/new/src/utils/source.js
devtools/client/debugger/new/src/utils/sources-tree/addToTree.js
devtools/client/debugger/new/src/utils/sources-tree/utils.js
--- a/devtools/client/debugger/new/dist/debugger.css
+++ b/devtools/client/debugger/new/dist/debugger.css
@@ -3061,17 +3061,16 @@ html .breakpoints-list .breakpoint.pause
   font-family: var(--monospace-font-family);
 }
 
 .breakpoints-list .breakpoint .breakpoint-line {
   font-size: 11px;
   color: var(--theme-comment);
   min-width: 16px;
   text-align: right;
-  margin-top: -1px;
 }
 
 html[dir="rtl"] .breakpoints-list .breakpoint .breakpoint-line {
   text-align: left;
 }
 
 .breakpoints-list .breakpoint:hover .breakpoint-line {
   display: none;
@@ -3084,17 +3083,17 @@ html[dir="rtl"] .breakpoints-list .break
 .breakpoints-list .breakpoint-label {
   max-width: calc(100% - var(--breakpoint-expression-right-clear-space));
   display: inline-block;
   padding-inline-end: 8px;
   cursor: pointer;
   flex-grow: 1;
   text-overflow: ellipsis;
   overflow: hidden;
-  padding-top: 3px;
+  padding-top: 2px;
   font-size: 11px;
 }
 
 .breakpoints-list .breakpoint-label,
 .breakpoint-line-close {
   line-height: 1.4em;
 }
 
--- a/devtools/client/debugger/new/src/components/PrimaryPanes/SourcesTree.js
+++ b/devtools/client/debugger/new/src/components/PrimaryPanes/SourcesTree.js
@@ -155,31 +155,22 @@ class SourcesTree extends _react.Compone
       className: "no-sources-message"
     }, message);
   }
 
   renderProjectRootHeader() {
     const {
       projectRoot
     } = this.props;
-    const {
-      sourceTree
-    } = this.state;
 
     if (!projectRoot) {
       return null;
     }
 
-    const sourceContents = sourceTree.contents[0];
-    let rootLabel = projectRoot.split("/").pop();
-
-    if (sourceContents && sourceContents.name !== rootLabel) {
-      rootLabel = sourceContents.contents[0].name;
-    }
-
+    const rootLabel = projectRoot.split("/").pop();
     return _react2.default.createElement("div", {
       key: "root",
       className: "sources-clear-root-container"
     }, _react2.default.createElement("button", {
       className: "sources-clear-root",
       onClick: () => this.props.clearProjectDirectoryRoot(),
       title: L10N.getStr("removeDirectoryRoot.label")
     }, _react2.default.createElement(_Svg2.default, {
@@ -447,17 +438,17 @@ var _initialiseProps = function () {
 
 const mapStateToProps = state => {
   return {
     shownSource: (0, _selectors.getShownSource)(state),
     selectedSource: (0, _selectors.getSelectedSource)(state),
     debuggeeUrl: (0, _selectors.getDebuggeeUrl)(state),
     expanded: (0, _selectors.getExpandedState)(state),
     projectRoot: (0, _selectors.getProjectDirectoryRoot)(state),
-    sources: (0, _selectors.getSources)(state)
+    sources: (0, _selectors.getRelativeSources)(state)
   };
 };
 
 const actionCreators = {
   setExpandedState: _sourceTree.setExpandedState,
   selectSource: _sources.selectSource,
   setProjectDirectoryRoot: _ui.setProjectDirectoryRoot,
   clearProjectDirectoryRoot: _ui.clearProjectDirectoryRoot
--- a/devtools/client/debugger/new/src/components/QuickOpenModal.js
+++ b/devtools/client/debugger/new/src/components/QuickOpenModal.js
@@ -463,17 +463,17 @@ class QuickOpenModal extends _react.Comp
 
 exports.QuickOpenModal = QuickOpenModal;
 /* istanbul ignore next: ignoring testing of redux connection stuff */
 
 function mapStateToProps(state) {
   const selectedSource = (0, _selectors.getSelectedSource)(state);
   return {
     enabled: (0, _selectors.getQuickOpenEnabled)(state),
-    sources: (0, _quickOpen.formatSources)((0, _selectors.getRelativeSources)(state).toArray(), (0, _selectors.getTabs)(state).toArray()),
+    sources: (0, _quickOpen.formatSources)((0, _selectors.getRelativeSources)(state), (0, _selectors.getTabs)(state).toArray()),
     selectedSource,
     symbols: (0, _quickOpen.formatSymbols)((0, _selectors.getSymbols)(state, selectedSource)),
     symbolsLoading: (0, _selectors.isSymbolsLoading)(state, selectedSource),
     query: (0, _selectors.getQuickOpenQuery)(state),
     searchType: (0, _selectors.getQuickOpenType)(state),
     tabs: (0, _selectors.getTabs)(state).toArray()
   };
 }
--- a/devtools/client/debugger/new/src/components/SecondaryPanes/Breakpoints/Breakpoint.js
+++ b/devtools/client/debugger/new/src/components/SecondaryPanes/Breakpoints/Breakpoint.js
@@ -132,17 +132,17 @@ class Breakpoint extends _react.PureComp
     if (selectedSource && (0, _devtoolsSourceMap.isGeneratedId)(selectedSource.id)) {
       return breakpoint.text;
     }
 
     return breakpoint.originalText;
   }
 
   highlightText() {
-    const text = this.getBreakpointText();
+    const text = this.getBreakpointText() || "";
     const editor = (0, _editor.getEditor)();
 
     if (!editor.CodeMirror) {
       return {
         __html: text
       };
     }
 
--- a/devtools/client/debugger/new/src/selectors/getRelativeSources.js
+++ b/devtools/client/debugger/new/src/selectors/getRelativeSources.js
@@ -29,10 +29,10 @@ function formatSource(source, root) {
   return new _sources.RelativeSourceRecordClass(source).set("relativeUrl", getRelativeUrl(source.url, root));
 }
 /*
  * Gets the sources that are below a project root
  */
 
 
 const getRelativeSources = exports.getRelativeSources = (0, _reselect.createSelector)(_selectors.getSources, _selectors.getProjectDirectoryRoot, (sources, root) => {
-  return sources.valueSeq().filter(source => source.url && source.url.includes(root)).map(source => formatSource(source, root));
+  return sources.filter(source => source.url && source.url.includes(root)).map(source => formatSource(source, root));
 });
\ No newline at end of file
--- a/devtools/client/debugger/new/src/utils/editor/source-editor.js
+++ b/devtools/client/debugger/new/src/utils/editor/source-editor.js
@@ -23,16 +23,18 @@ require("codemirror/mode/htmlmixed/htmlm
 require("codemirror/mode/coffeescript/coffeescript/index");
 
 require("codemirror/mode/jsx/jsx/index");
 
 require("codemirror/mode/elm/elm/index");
 
 require("codemirror/mode/clojure/clojure/index");
 
+require("codemirror/mode/haxe/haxe/index");
+
 require("codemirror/addon/search/searchcursor/index");
 
 require("codemirror/addon/fold/foldcode/index");
 
 require("codemirror/addon/fold/brace-fold/index");
 
 require("codemirror/addon/fold/indent-fold/index");
 
--- a/devtools/client/debugger/new/src/utils/quick-open.js
+++ b/devtools/client/debugger/new/src/utils/quick-open.js
@@ -118,12 +118,12 @@ function formatShortcutResults() {
   }, {
     value: L10N.getStr("gotoLineModal.title"),
     title: `: ${L10N.getStr("gotoLineModal.placeholder")}`,
     id: ":"
   }];
 }
 
 function formatSources(sources, tabs) {
-  return sources.filter(source => !(0, _source.isPretty)(source)).filter(({
+  return sources.valueSeq().toArray().filter(source => !(0, _source.isPretty)(source)).filter(({
     relativeUrl
   }) => !!relativeUrl).map(source => formatSourcesForList(source, tabs));
 }
\ No newline at end of file
--- a/devtools/client/debugger/new/src/utils/source.js
+++ b/devtools/client/debugger/new/src/utils/source.js
@@ -350,16 +350,19 @@ function getMode(source, symbols) {
     ext: ".cpp",
     mode: "text/x-c++src"
   }, {
     ext: ".m",
     mode: "text/x-objectivec"
   }, {
     ext: ".rs",
     mode: "text/x-rustsrc"
+  }, {
+    ext: ".hx",
+    mode: "text/x-haxe"
   }]; // check for C and other non JS languages
 
   if (url) {
     const result = languageMimeMap.find(({
       ext
     }) => url.endsWith(ext));
 
     if (result !== undefined) {
--- a/devtools/client/debugger/new/src/utils/sources-tree/addToTree.js
+++ b/devtools/client/debugger/new/src/utils/sources-tree/addToTree.js
@@ -9,29 +9,16 @@ var _utils = require("./utils");
 
 var _treeOrder = require("./treeOrder");
 
 var _getURL = require("./getURL");
 
 /* 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/>. */
-function isUnderRoot(url, projectRoot) {
-  if (!projectRoot) {
-    return true;
-  }
-
-  return `${url.group}${url.path}`.startsWith(projectRoot);
-}
-
-function removeProjectRoot(parts, projectRoot) {
-  const rootParts = projectRoot.replace("://", "").split("/");
-  return parts.splice(0, rootParts.length - 2);
-}
-
 function createNodeInTree(part, path, tree, index) {
   const node = (0, _utils.createNode)(part, path, []); // we are modifying the tree
 
   const contents = tree.contents.slice(0);
   contents.splice(index, 0, node);
   tree.contents = contents;
   return node;
 }
@@ -67,25 +54,20 @@ function findOrCreateNode(parts, subTree
   return child;
 }
 /*
  * walk the source tree to the final node for a given url,
  * adding new nodes along the way
  */
 
 
-function traverseTree(url, tree, debuggeeHost, projectRoot) {
+function traverseTree(url, tree, debuggeeHost) {
   url.path = decodeURIComponent(url.path);
   const parts = url.path.split("/").filter(p => p !== "");
   parts.unshift(url.group);
-
-  if (projectRoot) {
-    removeProjectRoot(parts, projectRoot);
-  }
-
   let path = "";
   return parts.reduce((subTree, part, index) => {
     path = path ? `${path}/${part}` : part;
     const debuggeeHostIfRoot = index === 0 ? debuggeeHost : null;
     return findOrCreateNode(parts, subTree, path, part, index, url, debuggeeHostIfRoot);
   }, tree);
 }
 /*
@@ -124,18 +106,18 @@ function addSourceToNode(node, url, sour
 }
 /**
  * @memberof utils/sources-tree
  * @static
  */
 
 
 function addToTree(tree, source, debuggeeUrl, projectRoot) {
-  const url = (0, _getURL.getURL)(source.get ? source.get("url") : source.url, debuggeeUrl);
+  const url = (0, _getURL.getURL)(source.url, debuggeeUrl);
   const debuggeeHost = (0, _treeOrder.getDomain)(debuggeeUrl);
 
-  if ((0, _utils.isInvalidUrl)(url, source) || !isUnderRoot(url, projectRoot)) {
+  if ((0, _utils.isInvalidUrl)(url, source)) {
     return;
   }
 
-  const finalNode = traverseTree(url, tree, debuggeeHost, projectRoot);
+  const finalNode = traverseTree(url, tree, debuggeeHost);
   finalNode.contents = addSourceToNode(finalNode, url, source);
 }
\ No newline at end of file
--- a/devtools/client/debugger/new/src/utils/sources-tree/utils.js
+++ b/devtools/client/debugger/new/src/utils/sources-tree/utils.js
@@ -57,17 +57,17 @@ function getFileExtension(url = "") {
   return parsedUrl.split(".").pop();
 }
 
 function isNotJavaScript(source) {
   return ["css", "svg", "png"].includes(getFileExtension(source.url));
 }
 
 function isInvalidUrl(url, source) {
-  return IGNORED_URLS.indexOf(url) != -1 || !(source.get ? source.get("url") : source.url) || !url.group || (0, _source.isPretty)(source) || isNotJavaScript(source);
+  return IGNORED_URLS.indexOf(url) != -1 || !source.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) {