diff --git a/devtools/client/debugger/new/README.mozilla b/devtools/client/debugger/new/README.mozilla index a4d1e08265a2..a091017bdd7e 100644 --- a/devtools/client/debugger/new/README.mozilla +++ b/devtools/client/debugger/new/README.mozilla @@ -1,9 +1,9 @@ This is the debugger.html project output. See https://github.com/devtools-html/debugger.html -Version 64 +Version 66 -Comparison: https://github.com/devtools-html/debugger.html/compare/release-63...release-64 +Comparison: https://github.com/devtools-html/debugger.html/compare/release-65...release-66 Packages: - babel-plugin-transform-es2015-modules-commonjs @6.26.2 diff --git a/devtools/client/debugger/new/dist/parser-worker.js b/devtools/client/debugger/new/dist/parser-worker.js index 285f0bd154ae..3181ccdb55bc 100644 --- a/devtools/client/debugger/new/dist/parser-worker.js +++ b/devtools/client/debugger/new/dist/parser-worker.js @@ -1673,7 +1673,8 @@ function extractSymbols(sourceId) { imports: [], literals: [], hasJsx: false, - hasTypes: false + hasTypes: false, + loading: false }; const ast = (0, _ast.traverseAst)(sourceId, { diff --git a/devtools/client/debugger/new/dist/vendors.js b/devtools/client/debugger/new/dist/vendors.js index 3556a8ce53d9..5a22a80bc41c 100644 --- a/devtools/client/debugger/new/dist/vendors.js +++ b/devtools/client/debugger/new/dist/vendors.js @@ -7890,15 +7890,6 @@ class Tree extends Component { return; } - const traversal = this._dfsFromRoots(); - const length = traversal.length; - let parentIndex = 0; - for (; parentIndex < length; parentIndex++) { - if (traversal[parentIndex].item === parent) { - break; - } - } - this._focus(parent, { alignTo: "top" }); } @@ -7979,12 +7970,12 @@ class Tree extends Component { return; } - const { relatedTarget } = nativeEvent; + const { explicitOriginalTarget } = nativeEvent; // Only set default focus to the first tree node if the focus came // from outside the tree (e.g. by tabbing to the tree from other // external elements). - if (relatedTarget !== this.treeRef && !this.treeRef.contains(relatedTarget)) { + if (explicitOriginalTarget !== this.treeRef && !this.treeRef.contains(explicitOriginalTarget)) { this._focus(traversal[0].item); } }, diff --git a/devtools/client/debugger/new/src/actions/breakpoints.js b/devtools/client/debugger/new/src/actions/breakpoints.js index d341384b536d..6382f1944946 100644 --- a/devtools/client/debugger/new/src/actions/breakpoints.js +++ b/devtools/client/debugger/new/src/actions/breakpoints.js @@ -407,12 +407,13 @@ function toggleBreakpoint(line, column) { client, sourceMaps }) => { - if (!line) { + const state = getState(); + const selectedSource = (0, _selectors.getSelectedSource)(state); + + if (!line || !selectedSource) { return; } - const state = getState(); - const selectedSource = (0, _selectors.getSelectedSource)(state); const bp = (0, _selectors.getBreakpointAtLocation)(state, { line, column @@ -449,11 +450,12 @@ function addOrToggleDisabledBreakpoint(line, column) { client, sourceMaps }) => { - if (!line) { + const selectedSource = (0, _selectors.getSelectedSource)(getState()); + + if (!line || !selectedSource) { return; } - const selectedSource = (0, _selectors.getSelectedSource)(getState()); const bp = (0, _selectors.getBreakpointAtLocation)(getState(), { line, column @@ -469,8 +471,8 @@ function addOrToggleDisabledBreakpoint(line, column) { } return dispatch(addBreakpoint({ - sourceId: selectedSource.get("id"), - sourceUrl: selectedSource.get("url"), + sourceId: selectedSource.id, + sourceUrl: selectedSource.url, line: line, column: column })); diff --git a/devtools/client/debugger/new/src/actions/pause/continueToHere.js b/devtools/client/debugger/new/src/actions/pause/continueToHere.js index 5e34bca0e97b..30aa0c46d974 100644 --- a/devtools/client/debugger/new/src/actions/pause/continueToHere.js +++ b/devtools/client/debugger/new/src/actions/pause/continueToHere.js @@ -20,12 +20,12 @@ function continueToHere(line) { getState }) { const selectedSource = (0, _selectors.getSelectedSource)(getState()); + const selectedFrame = (0, _selectors.getSelectedFrame)(getState()); - if (!(0, _selectors.isPaused)(getState()) || !selectedSource) { + if (!selectedFrame || !selectedSource) { return; } - const selectedFrame = (0, _selectors.getSelectedFrame)(getState()); const debugLine = selectedFrame.location.line; if (debugLine == line) { diff --git a/devtools/client/debugger/new/src/actions/pause/extra.js b/devtools/client/debugger/new/src/actions/pause/extra.js index 80f1cf72ee4c..844f41fd1c10 100644 --- a/devtools/client/debugger/new/src/actions/pause/extra.js +++ b/devtools/client/debugger/new/src/actions/pause/extra.js @@ -73,6 +73,11 @@ function fetchExtra() { getState }) { const frame = (0, _selectors.getSelectedFrame)(getState()); + + if (!frame) { + return; + } + const extra = await dispatch(getExtra("this;", frame.this)); dispatch({ type: "ADD_EXTRA", diff --git a/devtools/client/debugger/new/src/actions/pause/paused.js b/devtools/client/debugger/new/src/actions/pause/paused.js index 4e561e341033..4cfa6d48320c 100644 --- a/devtools/client/debugger/new/src/actions/pause/paused.js +++ b/devtools/client/debugger/new/src/actions/pause/paused.js @@ -88,7 +88,7 @@ function paused(pauseInfo) { if (selectedFrame) { const visibleFrame = (0, _selectors.getVisibleSelectedFrame)(getState()); - const location = (0, _devtoolsSourceMap.isGeneratedId)(visibleFrame.location.sourceId) ? selectedFrame.generatedLocation : selectedFrame.location; + const location = visibleFrame && (0, _devtoolsSourceMap.isGeneratedId)(visibleFrame.location.sourceId) ? selectedFrame.generatedLocation : selectedFrame.location; await dispatch((0, _sources.selectLocation)(location)); } diff --git a/devtools/client/debugger/new/src/actions/preview.js b/devtools/client/debugger/new/src/actions/preview.js index 91ba7c28c989..7fc2e3909678 100644 --- a/devtools/client/debugger/new/src/actions/preview.js +++ b/devtools/client/debugger/new/src/actions/preview.js @@ -83,6 +83,11 @@ function setPreview(expression, location, tokenPos, cursorPos) { type: "SET_PREVIEW", [_promise.PROMISE]: async function () { const source = (0, _selectors.getSelectedSource)(getState()); + + if (!source) { + return; + } + const sourceId = source.id; const selectedFrame = (0, _selectors.getSelectedFrame)(getState()); diff --git a/devtools/client/debugger/new/src/actions/sources/select.js b/devtools/client/debugger/new/src/actions/sources/select.js index 853680d5c242..81be4c7ce16b 100644 --- a/devtools/client/debugger/new/src/actions/sources/select.js +++ b/devtools/client/debugger/new/src/actions/sources/select.js @@ -248,6 +248,11 @@ function jumpToMappedSelectedLocation() { getState }) { const location = (0, _selectors.getSelectedLocation)(getState()); + + if (!location) { + return; + } + await dispatch(jumpToMappedLocation(location)); }; } \ No newline at end of file diff --git a/devtools/client/debugger/new/src/components/Editor/Preview/Popup.js b/devtools/client/debugger/new/src/components/Editor/Preview/Popup.js index 0eb7a4026f63..570fd57439ec 100644 --- a/devtools/client/debugger/new/src/components/Editor/Preview/Popup.js +++ b/devtools/client/debugger/new/src/components/Editor/Preview/Popup.js @@ -336,4 +336,4 @@ const mapDispatchToProps = { setPopupObjectProperties, openLink }; -exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(Popup); \ No newline at end of file +exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(Popup); diff --git a/devtools/client/debugger/new/src/components/QuickOpenModal.js b/devtools/client/debugger/new/src/components/QuickOpenModal.js index 88d7c2ca0905..2ae4d5e9fc33 100644 --- a/devtools/client/debugger/new/src/components/QuickOpenModal.js +++ b/devtools/client/debugger/new/src/components/QuickOpenModal.js @@ -324,23 +324,6 @@ class QuickOpenModal extends _react.Component { this.isSourceSearch = () => this.isSourcesQuery() || this.isGotoSourceQuery(); - this.renderHighlight = (candidateString, query, name) => { - const options = { - wrap: { - tagOpen: '', - tagClose: "" - } - }; - - const html = _fuzzaldrinPlus2.default.wrap(candidateString, query, options); - - return _react2.default.createElement("div", { - dangerouslySetInnerHTML: { - __html: html - } - }); - }; - this.highlightMatching = (query, results) => { let newQuery = query; @@ -350,9 +333,13 @@ class QuickOpenModal extends _react.Component { newQuery = query.replace(/[@:#?]/gi, " "); return results.map(result => { - return _objectSpread({}, result, { - title: this.renderHighlight(result.title, (0, _path.basename)(newQuery), "title") - }); + if (typeof result.title == "string") { + return _objectSpread({}, result, { + title: this.renderHighlight(result.title, (0, _path.basename)(newQuery), "title") + }); + } + + return result; }); }; @@ -388,6 +375,24 @@ class QuickOpenModal extends _react.Component { } } + /* eslint-disable react/no-danger */ + renderHighlight(candidateString, query, name) { + const options = { + wrap: { + tagOpen: '', + tagClose: "" + } + }; + + const html = _fuzzaldrinPlus2.default.wrap(candidateString, query, options); + + return _react2.default.createElement("div", { + dangerouslySetInnerHTML: { + __html: html + } + }); + } + shouldShowErrorEmoji() { const { query diff --git a/devtools/client/debugger/new/src/components/SecondaryPanes/Breakpoints/index.js b/devtools/client/debugger/new/src/components/SecondaryPanes/Breakpoints/index.js index d04951a707dd..f29b92c7864b 100644 --- a/devtools/client/debugger/new/src/components/SecondaryPanes/Breakpoints/index.js +++ b/devtools/client/debugger/new/src/components/SecondaryPanes/Breakpoints/index.js @@ -77,7 +77,7 @@ class Breakpoints extends _react.Component { breakpoints }) => [_react2.default.createElement("div", { className: "breakpoint-heading", - title: source.url, + title: (0, _source.getRawSourceURL)(source.url), key: source.url, onClick: () => this.props.selectSource(source.id) }, _react2.default.createElement(_SourceIcon2.default, { diff --git a/devtools/client/debugger/new/src/components/SecondaryPanes/Frames/Frame.js b/devtools/client/debugger/new/src/components/SecondaryPanes/Frames/Frame.js index bc2e3258d70a..0552f1e64c8c 100644 --- a/devtools/client/debugger/new/src/components/SecondaryPanes/Frames/Frame.js +++ b/devtools/client/debugger/new/src/components/SecondaryPanes/Frames/Frame.js @@ -80,7 +80,7 @@ class FrameComponent extends _react.Component { } onMouseDown(e, frame, selectedFrame) { - if (e.nativeEvent.which == 3) { + if (e.which == 3) { return; } diff --git a/devtools/client/debugger/new/src/components/shared/Popover.js b/devtools/client/debugger/new/src/components/shared/Popover.js index a5bb7ad61c93..9f8382f655d4 100644 --- a/devtools/client/debugger/new/src/components/shared/Popover.js +++ b/devtools/client/debugger/new/src/components/shared/Popover.js @@ -171,11 +171,12 @@ class Popover extends _react.Component { const editorRect = editor.getBoundingClientRect(); const targetRect = this.props.targetPosition; const left = this.calculateLeft(targetRect, editorRect, tooltipRect); - const top = targetRect.top - tooltipRect.height; + const enoughRoomForTooltipAbove = targetRect.top - editorRect.top > tooltipRect.height; + const top = enoughRoomForTooltipAbove ? targetRect.top - tooltipRect.height : targetRect.bottom; return { left, top, - orientation: "up", + orientation: enoughRoomForTooltipAbove ? "up" : "down", targetMid: { x: 0, y: 0 diff --git a/devtools/client/debugger/new/src/components/shared/PreviewFunction.js b/devtools/client/debugger/new/src/components/shared/PreviewFunction.js index b9e1bc184b2b..adb5444ac7a4 100644 --- a/devtools/client/debugger/new/src/components/shared/PreviewFunction.js +++ b/devtools/client/debugger/new/src/components/shared/PreviewFunction.js @@ -41,7 +41,8 @@ class PreviewFunction extends _react.Component { const commas = (0, _lodash.times)(params.length - 1).map((_, i) => _react2.default.createElement("span", { className: "delimiter", key: i - }, ", ")); + }, ", ")); // $FlowIgnore + return (0, _lodash.flatten)((0, _lodash.zip)(params, commas)); } diff --git a/devtools/client/debugger/new/src/components/shared/SearchInput.js b/devtools/client/debugger/new/src/components/shared/SearchInput.js index 2f142001f3b4..e3b50d09988b 100644 --- a/devtools/client/debugger/new/src/components/shared/SearchInput.js +++ b/devtools/client/debugger/new/src/components/shared/SearchInput.js @@ -108,7 +108,7 @@ class SearchInput extends _react.Component { handleNext, handlePrev } = this.props; - return [arrowBtn(handleNext, "arrow-down", (0, _classnames2.default)("nav-btn", "next"), L10N.getFormatStr("editor.searchResults.nextResult")), arrowBtn(handlePrev, "arrow-up", (0, _classnames2.default)("nav-btn", "prev"), L10N.getFormatStr("editor.searchResults.prevResult"))]; + return [arrowBtn(handlePrev, "arrow-up", (0, _classnames2.default)("nav-btn", "prev"), L10N.getFormatStr("editor.searchResults.prevResult")), arrowBtn(handleNext, "arrow-down", (0, _classnames2.default)("nav-btn", "next"), L10N.getFormatStr("editor.searchResults.nextResult"))]; } renderSummaryMsg() { diff --git a/devtools/client/debugger/new/src/reducers/ast.js b/devtools/client/debugger/new/src/reducers/ast.js index f3b502b8a22d..6e81c1381a65 100644 --- a/devtools/client/debugger/new/src/reducers/ast.js +++ b/devtools/client/debugger/new/src/reducers/ast.js @@ -154,7 +154,7 @@ function hasSymbols(state, source) { return false; } - return !symbols.hasOwnProperty("loading"); + return !symbols.loading; } function isSymbolsLoading(state, source) { @@ -164,7 +164,7 @@ function isSymbolsLoading(state, source) { return false; } - return symbols.hasOwnProperty("loading"); + return symbols.loading; } function isEmptyLineInSource(state, line, selectedSourceId) { diff --git a/devtools/client/debugger/new/src/reducers/debuggee.js b/devtools/client/debugger/new/src/reducers/debuggee.js index 14334e459893..094afeaf0e3f 100644 --- a/devtools/client/debugger/new/src/reducers/debuggee.js +++ b/devtools/client/debugger/new/src/reducers/debuggee.js @@ -7,8 +7,6 @@ exports.getWorkers = exports.createDebuggeeState = undefined; exports.default = debuggee; exports.getWorker = getWorker; -var _reselect = require("devtools/client/debugger/new/dist/vendors").vendored["reselect"]; - var _immutable = require("devtools/client/shared/vendor/immutable"); var _makeRecord = require("../utils/makeRecord"); @@ -39,9 +37,7 @@ function debuggee(state = createDebuggeeState(), action) { } } -const getDebuggeeWrapper = state => state.debuggee; - -const getWorkers = exports.getWorkers = (0, _reselect.createSelector)(getDebuggeeWrapper, debuggeeState => debuggeeState.get("workers")); +const getWorkers = exports.getWorkers = state => state.debuggee.workers; function getWorker(state, url) { return getWorkers(state).find(value => url); diff --git a/devtools/client/debugger/new/src/reducers/replay.js b/devtools/client/debugger/new/src/reducers/replay.js index d32c22c5d39d..1ce3ae4ff057 100644 --- a/devtools/client/debugger/new/src/reducers/replay.js +++ b/devtools/client/debugger/new/src/reducers/replay.js @@ -74,8 +74,7 @@ function update(state = initialState(), action) { function addScopes(state, action) { const { frame, - status, - value + status } = action; const selectedFrameId = frame.id; const instance = state.history[state.position]; @@ -85,12 +84,16 @@ function addScopes(state, action) { } const pausedInst = instance.paused; + const scopeValue = status === "done" ? { + pending: false, + scope: action.value + } : { + pending: true, + scope: null + }; const generated = _objectSpread({}, pausedInst.frameScopes.generated, { - [selectedFrameId]: { - pending: status !== "done", - scope: value - } + [selectedFrameId]: scopeValue }); const newPaused = _objectSpread({}, pausedInst, { diff --git a/devtools/client/debugger/new/src/reducers/sources.js b/devtools/client/debugger/new/src/reducers/sources.js index 546cf302476d..c5283a517625 100644 --- a/devtools/client/debugger/new/src/reducers/sources.js +++ b/devtools/client/debugger/new/src/reducers/sources.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.getSelectedSourceText = exports.getSelectedSource = exports.getSelectedLocation = exports.getSourcesForTabs = exports.getSourceTabs = exports.getTabs = exports.getSources = exports.RelativeSourceRecordClass = exports.SourceRecordClass = undefined; +exports.getSelectedSource = exports.getSelectedLocation = exports.getSourcesForTabs = exports.getSourceTabs = exports.getTabs = exports.getSources = exports.RelativeSourceRecordClass = exports.SourceRecordClass = undefined; exports.initialSourcesState = initialSourcesState; exports.createSourceRecord = createSourceRecord; exports.removeSourceFromTabList = removeSourceFromTabList; @@ -122,16 +122,12 @@ function update(state = initialSourcesState(), action) { case "ADD_TAB": return state.merge({ - tabs: updateTabList({ - sources: state - }, action.url) + tabs: updateTabList(state.tabs, action.url) }); case "MOVE_TAB": return state.merge({ - tabs: updateTabList({ - sources: state - }, action.url, action.tabIndex) + tabs: updateTabList(state.tabs, action.url, action.tabIndex) }); case "CLOSE_TAB": @@ -162,9 +158,7 @@ function update(state = initialSourcesState(), action) { break; case "NAVIGATE": - const source = getSelectedSource({ - sources: state - }); + const source = state.selectedLocation && state.sources.get(state.selectedLocation.sourceId); const url = source && source.url; if (!url) { @@ -181,7 +175,6 @@ function update(state = initialSourcesState(), action) { function getTextPropsFromAction(action) { const { - value, sourceId } = action; @@ -199,9 +192,9 @@ function getTextPropsFromAction(action) { } return { - text: value.text, + text: action.value.text, id: sourceId, - contentType: value.contentType, + contentType: action.value.contentType, loadedState: "loaded" }; } // TODO: Action is coerced to `any` unfortunately because how we type @@ -240,11 +233,6 @@ function removeSourcesFromTabList(tabs, urls) { function restoreTabs() { const prefsTabs = _prefs.prefs.tabs || []; - - if (prefsTabs.length == 0) { - return; - } - return prefsTabs; } /** @@ -254,8 +242,7 @@ function restoreTabs() { */ -function updateTabList(state, url, tabIndex) { - let tabs = state.sources.tabs; +function updateTabList(tabs, url, tabIndex) { const urlIndex = tabs.indexOf(url); const includesUrl = !!tabs.find(tab => tab == url); @@ -396,7 +383,8 @@ function getSourceInSources(sources, id) { return sources.get(id); } -const getSources = exports.getSources = (0, _reselect.createSelector)(getSourcesState, sources => sources.sources); +const getSources = exports.getSources = sources => sources.sources.sources; + const getTabs = exports.getTabs = (0, _reselect.createSelector)(getSourcesState, sources => sources.tabs); const getSourceTabs = exports.getSourceTabs = (0, _reselect.createSelector)(getTabs, getSources, (tabs, sources) => tabs.filter(tab => getSourceByUrlInSources(sources, tab))); const getSourcesForTabs = exports.getSourcesForTabs = (0, _reselect.createSelector)(getSourceTabs, getSources, (tabs, sources) => { @@ -410,8 +398,4 @@ const getSelectedSource = exports.getSelectedSource = (0, _reselect.createSelect return sources.get(selectedLocation.sourceId); }); -const getSelectedSourceText = exports.getSelectedSourceText = (0, _reselect.createSelector)(getSelectedSource, getSourcesState, (selectedSource, sources) => { - const id = selectedSource.id; - return id ? sources.sourcesText.get(id) : null; -}); exports.default = update; \ No newline at end of file diff --git a/devtools/client/debugger/new/src/selectors/breakpointSources.js b/devtools/client/debugger/new/src/selectors/breakpointSources.js index 272c0d01191b..8a648aa7b0b6 100644 --- a/devtools/client/debugger/new/src/selectors/breakpointSources.js +++ b/devtools/client/debugger/new/src/selectors/breakpointSources.js @@ -17,7 +17,8 @@ var _source = require("../utils/source"); * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ function getBreakpointsForSource(source, breakpoints) { - return breakpoints.valueSeq().filter(bp => bp.location.sourceId == source.id && !bp.hidden && (bp.text || bp.condition)).sortBy(bp => bp.location.line).toJS(); + const bpList = breakpoints.valueSeq(); + return bpList.filter(bp => bp.location.sourceId == source.id && !bp.hidden && (bp.text || bp.condition)).sortBy(bp => bp.location.line).toJS(); } function findBreakpointSources(sources, breakpoints) { diff --git a/devtools/client/debugger/new/src/selectors/inComponent.js b/devtools/client/debugger/new/src/selectors/inComponent.js index 7512c6b1f636..c7a3bc31ec0f 100644 --- a/devtools/client/debugger/new/src/selectors/inComponent.js +++ b/devtools/client/debugger/new/src/selectors/inComponent.js @@ -16,6 +16,11 @@ var _ast2 = require("../reducers/ast"); * file, You can obtain one at . */ function inComponent(state) { const selectedFrame = (0, _.getSelectedFrame)(state); + + if (!selectedFrame) { + return; + } + const source = (0, _.getSource)(state, selectedFrame.location.sourceId); const symbols = (0, _.getSymbols)(state, source); diff --git a/devtools/client/debugger/new/src/utils/pause/frames/annotateFrames.js b/devtools/client/debugger/new/src/utils/pause/frames/annotateFrames.js index 48ecd137bc63..5c8dff7b36b8 100644 --- a/devtools/client/debugger/new/src/utils/pause/frames/annotateFrames.js +++ b/devtools/client/debugger/new/src/utils/pause/frames/annotateFrames.js @@ -69,6 +69,7 @@ function getBabelFrameIndexes(frames) { } // Receives an array of start and end index tuples and returns // an array of async call stack index ranges. // e.g. [[1,3], [5,7]] => [[1,2,3], [5,6,7]] + // $FlowIgnore return (0, _lodash.flatMap)((0, _lodash.zip)(startIndexes, endIndexes), ([startIndex, endIndex]) => (0, _lodash.range)(startIndex, endIndex + 1)); diff --git a/devtools/client/debugger/new/src/utils/pause/frames/getLibraryFromUrl.js b/devtools/client/debugger/new/src/utils/pause/frames/getLibraryFromUrl.js index 7a086ec1750a..56c05b0a5070 100644 --- a/devtools/client/debugger/new/src/utils/pause/frames/getLibraryFromUrl.js +++ b/devtools/client/debugger/new/src/utils/pause/frames/getLibraryFromUrl.js @@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.getLibraryFromUrl = getLibraryFromUrl; -var _lodash = require("devtools/client/shared/vendor/lodash"); - var _getFrameUrl = require("./getFrameUrl"); /* This Source Code Form is subject to the terms of the Mozilla Public @@ -90,6 +88,11 @@ function getLibraryFromUrl(frame) { // @TODO each of these fns calls getFrameUrl, just call it once // (assuming there's not more complex logic to identify a lib) const frameUrl = (0, _getFrameUrl.getFrameUrl)(frame); - const match = (0, _lodash.find)(libraryMap, o => frameUrl.match(o.pattern)); - return match && match.label; + const matches = libraryMap.filter(o => frameUrl.match(o.pattern)); + + if (matches.length == 0) { + return null; + } + + return matches[0].label; } \ No newline at end of file diff --git a/devtools/client/debugger/new/src/workers/parser/getSymbols.js b/devtools/client/debugger/new/src/workers/parser/getSymbols.js index 17f82e4ede82..381431604bec 100644 --- a/devtools/client/debugger/new/src/workers/parser/getSymbols.js +++ b/devtools/client/debugger/new/src/workers/parser/getSymbols.js @@ -282,7 +282,8 @@ function extractSymbols(sourceId) { imports: [], literals: [], hasJsx: false, - hasTypes: false + hasTypes: false, + loading: false }; const ast = (0, _ast.traverseAst)(sourceId, { enter(node, ancestors) { diff --git a/devtools/client/debugger/new/src/workers/parser/utils/formatSymbols.js b/devtools/client/debugger/new/src/workers/parser/utils/formatSymbols.js index b0e7a18a8cbe..915a8c7875b3 100644 --- a/devtools/client/debugger/new/src/workers/parser/utils/formatSymbols.js +++ b/devtools/client/debugger/new/src/workers/parser/utils/formatSymbols.js @@ -41,13 +41,15 @@ function summarize(symbol) { return `${loc} ${expression} ${name}${params} ${klass} ${names} ${values}`.trim(); // eslint-disable-line max-len } -function formatKey(name, symbols) { - if (name == "hasJsx") { - return `hasJsx: ${symbols.hasJsx ? "true" : "false"}`; - } +const bools = ["hasJsx", "hasTypes", "loading"]; - if (name == "hasTypes") { - return `hasTypes: ${symbols.hasTypes ? "true" : "false"}`; +function formatBool(name, symbols) { + return `${name}: ${symbols[name] ? "true" : "false"}`; +} + +function formatKey(name, symbols) { + if (bools.includes(name)) { + return formatBool(name, symbols); } return `${name}:\n${symbols[name].map(summarize).join("\n")}`; diff --git a/devtools/client/debugger/new/test/mochitest/browser.ini b/devtools/client/debugger/new/test/mochitest/browser.ini index 240e1d96f94d..79d223a4f176 100644 --- a/devtools/client/debugger/new/test/mochitest/browser.ini +++ b/devtools/client/debugger/new/test/mochitest/browser.ini @@ -89,10 +89,9 @@ support-files = examples/sourcemaps-reload/v3.bundle.js.map examples/sourcemaps-reload/doc-sourcemaps-reload.html examples/sourcemaps-reload/sjs_code_reload.sjs - examples/wasm-sourcemaps/average.js - examples/wasm-sourcemaps/average.wasm - examples/wasm-sourcemaps/average.wasm.map - examples/wasm-sourcemaps/average.c + examples/wasm-sourcemaps/fib.c + examples/wasm-sourcemaps/fib.wasm + examples/wasm-sourcemaps/fib.wasm.map examples/wasm-sourcemaps/utils.js examples/sum/sum.js examples/sum/sum.min.js diff --git a/devtools/client/debugger/new/test/mochitest/browser_dbg-wasm-sourcemaps.js b/devtools/client/debugger/new/test/mochitest/browser_dbg-wasm-sourcemaps.js index acdb21d01900..2af1ecc4c07e 100644 --- a/devtools/client/debugger/new/test/mochitest/browser_dbg-wasm-sourcemaps.js +++ b/devtools/client/debugger/new/test/mochitest/browser_dbg-wasm-sourcemaps.js @@ -1,5 +1,6 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ + requestLongerTimeout(2); /** * Test WebAssembly source maps @@ -18,22 +19,25 @@ add_task(async function() { await waitForLoadedSource(dbg, "doc-wasm-sourcemaps"); assertPausedLocation(dbg); - await waitForSource(dbg, "wasm-sourcemaps/average.c"); - await addBreakpoint(dbg, "wasm-sourcemaps/average.c", 12); + await waitForSource(dbg, "fib.c"); - clickElement(dbg, "resume"); + ok(true, "Original sources exist"); + const mainSrc = findSource(dbg, "fib.c"); - await waitForPaused(dbg); - await waitForSelectedSource(dbg, "average.c"); - assertPausedLocation(dbg); + await selectSource(dbg, mainSrc); + await addBreakpoint(dbg, "fib.c", 10); + + resume(dbg); + + await waitForPaused(dbg, "fib.c"); const frames = findAllElements(dbg, "frames"); const firstFrameTitle = frames[0].querySelector(".title").textContent; is(firstFrameTitle, "(wasmcall)", "It shall be a wasm call"); const firstFrameLocation = frames[0].querySelector(".location").textContent; is( - firstFrameLocation.includes("average.c"), + firstFrameLocation.includes("fib.c"), true, - "It shall be to avarage.c source" + "It shall be to fib.c source" ); }); diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-wasm-sourcemaps.html b/devtools/client/debugger/new/test/mochitest/examples/doc-wasm-sourcemaps.html index 696233a95a8a..04fc33726c92 100644 --- a/devtools/client/debugger/new/test/mochitest/examples/doc-wasm-sourcemaps.html +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-wasm-sourcemaps.html @@ -10,44 +10,22 @@