From 2bac333f88ee19ec30c22cbfa623928e792148c8 Mon Sep 17 00:00:00 2001 From: Jason Laster Date: Thu, 12 Dec 2019 18:35:57 +0000 Subject: [PATCH] Bug 1603283 - cache isOriginal source field. r=bhackett Differential Revision: https://phabricator.services.mozilla.com/D56815 --HG-- extra : moz-landing-system : lando --- .../__snapshots__/breakpoints.spec.js.snap | 2 + .../debugger/src/actions/source-actors.js | 5 +- .../src/actions/sources/newSources.js | 2 + .../src/actions/sources/prettyPrint.js | 1 + .../debugger/src/actions/sources/select.js | 2 +- .../__snapshots__/prettyPrint.spec.js.snap | 1 + devtools/client/debugger/src/actions/tabs.js | 6 +- .../src/components/Editor/EditorMenu.js | 3 +- .../src/components/Editor/menus/editor.js | 3 +- .../ConditionalPanel.spec.js.snap | 3 + .../__snapshots__/SourcesTree.spec.js.snap | 11 + .../SourcesTreeItem.spec.js.snap | 443 +++++++++++------- .../tests/__snapshots__/Frame.spec.js.snap | 8 + .../tests/__snapshots__/Frames.spec.js.snap | 4 + .../tests/__snapshots__/Group.spec.js.snap | 16 + .../client/debugger/src/reducers/sources.js | 1 + devtools/client/debugger/src/reducers/tabs.js | 2 +- .../selectors/test/getCallStackFrames.spec.js | 2 + devtools/client/debugger/src/types.js | 1 + .../client/debugger/src/utils/source-maps.js | 10 +- devtools/client/debugger/src/utils/source.js | 8 +- .../__snapshots__/updateTree.spec.js.snap | 18 +- .../client/debugger/src/utils/test-head.js | 1 + .../client/debugger/src/utils/test-mockup.js | 2 + 24 files changed, 349 insertions(+), 206 deletions(-) diff --git a/devtools/client/debugger/src/actions/breakpoints/tests/__snapshots__/breakpoints.spec.js.snap b/devtools/client/debugger/src/actions/breakpoints/tests/__snapshots__/breakpoints.spec.js.snap index c18ea38288c1..97b56babdb69 100644 --- a/devtools/client/debugger/src/actions/breakpoints/tests/__snapshots__/breakpoints.spec.js.snap +++ b/devtools/client/debugger/src/actions/breakpoints/tests/__snapshots__/breakpoints.spec.js.snap @@ -41,6 +41,7 @@ Array [ "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "/examples/a", @@ -123,6 +124,7 @@ Array [ "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "/examples/a", diff --git a/devtools/client/debugger/src/actions/source-actors.js b/devtools/client/debugger/src/actions/source-actors.js index 7d3b6a15440e..3c9f96c94f76 100644 --- a/devtools/client/debugger/src/actions/source-actors.js +++ b/devtools/client/debugger/src/actions/source-actors.js @@ -37,10 +37,7 @@ export function removeSourceActor(item: SourceActor) { } export function removeSourceActors(items: Array) { return function({ dispatch }: ThunkArgs) { - dispatch({ - type: "REMOVE_SOURCE_ACTORS", - items, - }); + dispatch({ type: "REMOVE_SOURCE_ACTORS", items }); }; } diff --git a/devtools/client/debugger/src/actions/sources/newSources.js b/devtools/client/debugger/src/actions/sources/newSources.js index 2540cbfd7fb1..1a88f542769d 100644 --- a/devtools/client/debugger/src/actions/sources/newSources.js +++ b/devtools/client/debugger/src/actions/sources/newSources.js @@ -283,6 +283,7 @@ export function newOriginalSources(sourceInfo: Array) { introductionType: undefined, isExtension: false, extensionName: null, + isOriginal: true, }); } @@ -331,6 +332,7 @@ export function newGeneratedSources(sourceInfo: Array) { isWasm: !!supportsWasm(getState()) && source.introductionType === "wasm", isExtension: (source.url && isUrlExtension(source.url)) || false, + isOriginal: false, }; } diff --git a/devtools/client/debugger/src/actions/sources/prettyPrint.js b/devtools/client/debugger/src/actions/sources/prettyPrint.js index 3880ab19d646..36c11327f9a3 100644 --- a/devtools/client/debugger/src/actions/sources/prettyPrint.js +++ b/devtools/client/debugger/src/actions/sources/prettyPrint.js @@ -83,6 +83,7 @@ export function createPrettySource(cx: Context, sourceId: string) { introductionType: undefined, isExtension: false, extensionName: null, + isOriginal: true, }; dispatch(({ type: "ADD_SOURCE", cx, source: prettySource }: Action)); diff --git a/devtools/client/debugger/src/actions/sources/select.js b/devtools/client/debugger/src/actions/sources/select.js index 1a8a3249f1b7..8a9a6ea1fd06 100644 --- a/devtools/client/debugger/src/actions/sources/select.js +++ b/devtools/client/debugger/src/actions/sources/select.js @@ -150,7 +150,7 @@ export function selectLocation( if ( keepContext && selectedSource && - isOriginalId(selectedSource.id) != isOriginalId(location.sourceId) + selectedSource.isOriginal != isOriginalId(location.sourceId) ) { location = await mapLocation(getState(), sourceMaps, location); source = getSourceFromId(getState(), location.sourceId); diff --git a/devtools/client/debugger/src/actions/sources/tests/__snapshots__/prettyPrint.spec.js.snap b/devtools/client/debugger/src/actions/sources/tests/__snapshots__/prettyPrint.spec.js.snap index 0ce21513a31c..f09b204e6473 100644 --- a/devtools/client/debugger/src/actions/sources/tests/__snapshots__/prettyPrint.spec.js.snap +++ b/devtools/client/debugger/src/actions/sources/tests/__snapshots__/prettyPrint.spec.js.snap @@ -8,6 +8,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": true, "isPrettyPrinted": true, "isWasm": false, "relativeUrl": "/examples/base.js:formatted", diff --git a/devtools/client/debugger/src/actions/tabs.js b/devtools/client/debugger/src/actions/tabs.js index 9334dfa266b8..7bc7bf9737be 100644 --- a/devtools/client/debugger/src/actions/tabs.js +++ b/devtools/client/debugger/src/actions/tabs.js @@ -9,8 +9,6 @@ * @module actions/tabs */ -import { isOriginalId } from "devtools-source-map"; - import { removeDocument } from "../utils/editor"; import { selectSource } from "./sources"; @@ -25,7 +23,7 @@ import type { Source, Context } from "../types"; export function updateTab(source: Source, framework: string): Action { const { url, id: sourceId } = source; - const isOriginal = isOriginalId(source.id); + const isOriginal = source.isOriginal; return { type: "UPDATE_TAB", @@ -38,7 +36,7 @@ export function updateTab(source: Source, framework: string): Action { export function addTab(source: Source): Action { const { url, id: sourceId } = source; - const isOriginal = isOriginalId(source.id); + const isOriginal = source.isOriginal; return { type: "ADD_TAB", diff --git a/devtools/client/debugger/src/components/Editor/EditorMenu.js b/devtools/client/debugger/src/components/Editor/EditorMenu.js index 40f5c8d86111..50419ee03c08 100644 --- a/devtools/client/debugger/src/components/Editor/EditorMenu.js +++ b/devtools/client/debugger/src/components/Editor/EditorMenu.js @@ -7,7 +7,6 @@ import { Component } from "react"; import { connect } from "../../utils/connect"; import { showMenu } from "devtools-contextmenu"; -import { isOriginalId } from "devtools-source-map"; import { getSourceLocationFromMouseEvent } from "../../utils/editor"; import { isPretty } from "../../utils/source"; @@ -92,7 +91,7 @@ const mapStateToProps = (state, props) => ({ cx: getThreadContext(state), isPaused: getIsPaused(state, getCurrentThread(state)), hasMappedLocation: - (isOriginalId(props.selectedSource.id) || + (props.selectedSource.isOriginal || isSourceWithMap(state, props.selectedSource.id) || isPretty(props.selectedSource)) && !getPrettySource(state, props.selectedSource.id), diff --git a/devtools/client/debugger/src/components/Editor/menus/editor.js b/devtools/client/debugger/src/components/Editor/menus/editor.js index 7568df84c5d3..03dad14ab12a 100644 --- a/devtools/client/debugger/src/components/Editor/menus/editor.js +++ b/devtools/client/debugger/src/components/Editor/menus/editor.js @@ -5,7 +5,6 @@ // @flow import { bindActionCreators } from "redux"; -import { isOriginalId } from "devtools-source-map"; import { copyToTheClipboard } from "../../../utils/clipboard"; import { @@ -90,7 +89,7 @@ const jumpToMappedLocationItem = ( id: "node-menu-jump", label: L10N.getFormatStr( "editor.jumpToMappedLocation1", - isOriginalId(selectedSource.id) + selectedSource.isOriginal ? L10N.getStr("generated") : L10N.getStr("original") ), diff --git a/devtools/client/debugger/src/components/Editor/tests/__snapshots__/ConditionalPanel.spec.js.snap b/devtools/client/debugger/src/components/Editor/tests/__snapshots__/ConditionalPanel.spec.js.snap index b45b97f11457..93332266b489 100644 --- a/devtools/client/debugger/src/components/Editor/tests/__snapshots__/ConditionalPanel.spec.js.snap +++ b/devtools/client/debugger/src/components/Editor/tests/__snapshots__/ConditionalPanel.spec.js.snap @@ -184,6 +184,7 @@ exports[`ConditionalPanel it should render at location of selected breakpoint 1` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -381,6 +382,7 @@ exports[`ConditionalPanel it should render with condition at selected breakpoint "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -578,6 +580,7 @@ exports[`ConditionalPanel it should render with logpoint at selected breakpoint "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", diff --git a/devtools/client/debugger/src/components/PrimaryPanes/tests/__snapshots__/SourcesTree.spec.js.snap b/devtools/client/debugger/src/components/PrimaryPanes/tests/__snapshots__/SourcesTree.spec.js.snap index 4f3bf23418bf..7f079f9bb8be 100644 --- a/devtools/client/debugger/src/components/PrimaryPanes/tests/__snapshots__/SourcesTree.spec.js.snap +++ b/devtools/client/debugger/src/components/PrimaryPanes/tests/__snapshots__/SourcesTree.spec.js.snap @@ -141,6 +141,7 @@ exports[`SourcesTree on receiving new props updates highlighted items updates hi "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/three.js", @@ -160,6 +161,7 @@ exports[`SourcesTree on receiving new props updates highlighted items updates hi "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/four.js", @@ -177,6 +179,7 @@ exports[`SourcesTree on receiving new props updates highlighted items updates hi "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": true, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/four.js [original]", @@ -194,6 +197,7 @@ exports[`SourcesTree on receiving new props updates highlighted items updates hi "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -211,6 +215,7 @@ exports[`SourcesTree on receiving new props updates highlighted items updates hi "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/three.js", @@ -228,6 +233,7 @@ exports[`SourcesTree on receiving new props updates highlighted items updates hi "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/two.js", @@ -254,6 +260,7 @@ exports[`SourcesTree on receiving new props updates highlighted items updates hi "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/four.js", @@ -271,6 +278,7 @@ exports[`SourcesTree on receiving new props updates highlighted items updates hi "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": true, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/four.js [original]", @@ -288,6 +296,7 @@ exports[`SourcesTree on receiving new props updates highlighted items updates hi "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -305,6 +314,7 @@ exports[`SourcesTree on receiving new props updates highlighted items updates hi "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/three.js", @@ -322,6 +332,7 @@ exports[`SourcesTree on receiving new props updates highlighted items updates hi "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/two.js", diff --git a/devtools/client/debugger/src/components/PrimaryPanes/tests/__snapshots__/SourcesTreeItem.spec.js.snap b/devtools/client/debugger/src/components/PrimaryPanes/tests/__snapshots__/SourcesTreeItem.spec.js.snap index 6f972979b09a..72867b0f3ef1 100644 --- a/devtools/client/debugger/src/components/PrimaryPanes/tests/__snapshots__/SourcesTreeItem.spec.js.snap +++ b/devtools/client/debugger/src/components/PrimaryPanes/tests/__snapshots__/SourcesTreeItem.spec.js.snap @@ -22,6 +22,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -56,6 +57,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -75,6 +77,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -108,6 +111,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -129,6 +133,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -166,6 +171,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -199,6 +205,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -218,6 +225,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -255,6 +263,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -295,6 +304,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -315,6 +325,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -349,6 +360,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -371,6 +383,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -408,6 +421,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -447,6 +461,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -467,6 +482,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -504,6 +520,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -539,6 +556,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -559,6 +577,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -593,6 +612,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -615,6 +635,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -652,6 +673,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -686,6 +708,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -706,6 +729,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -773,6 +797,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -818,6 +843,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -884,6 +910,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -952,6 +979,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -998,6 +1026,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -1065,6 +1094,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -1277,6 +1307,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -1321,6 +1352,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -1386,6 +1418,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -1401,6 +1434,190 @@ Object { } `; +exports[`SourceTreeItem renderItem should show icon for domain item when a thread is set to root 1`] = ` +Object { + "component":
+ + + + folder + + +
, + "defaultState": null, + "instance": SourceTreeItem { + "addCollapseExpandAllOptions": [Function], + "context": Object {}, + "handleDownloadFile": [Function], + "onClick": [Function], + "onContextMenu": [Function], + "props": Object { + "clearProjectDirectoryRoot": [MockFunction], + "debuggeeUrl": "http://mdn.com", + "depth": 0, + "expanded": false, + "focusItem": [MockFunction], + "item": Object { + "contents": Array [], + "name": "folder", + "path": "domain/subfolder", + "type": "directory", + }, + "projectRoot": "server1.conn13.child1/thread19", + "selectItem": [MockFunction], + "setExpanded": [MockFunction], + "setProjectDirectoryRoot": [MockFunction], + "source": Object { + "extensionName": null, + "id": "server1.conn13.child1/39", + "introductionType": undefined, + "introductionUrl": null, + "isBlackBoxed": false, + "isExtension": false, + "isOriginal": false, + "isPrettyPrinted": false, + "isWasm": false, + "relativeUrl": "http://mdn.com/one.js", + "url": "http://mdn.com/one.js", + }, + "threads": Array [ + Object { + "actor": "server1.conn13.child1/thread19", + "name": "Main Thread", + }, + ], + "toggleBlackBox": [MockFunction], + }, + "refs": Object {}, + "setState": [Function], + "state": null, + "updater": Updater { + "_callbacks": Array [], + "_renderer": ReactShallowRenderer { + "_context": Object {}, + "_element": , + "_forcedUpdate": false, + "_instance": [Circular], + "_newState": null, + "_rendered":
+ + + + folder + + +
, + "_rendering": false, + "_updater": [Circular], + }, + }, + Symbol(enzyme.__setState__): [Function], + }, + "props": Object { + "clearProjectDirectoryRoot": [MockFunction], + "debuggeeUrl": "http://mdn.com", + "depth": 0, + "expanded": false, + "focusItem": [MockFunction], + "item": Object { + "contents": Array [], + "name": "folder", + "path": "domain/subfolder", + "type": "directory", + }, + "projectRoot": "server1.conn13.child1/thread19", + "selectItem": [MockFunction], + "setExpanded": [MockFunction], + "setProjectDirectoryRoot": [MockFunction], + "source": Object { + "extensionName": null, + "id": "server1.conn13.child1/39", + "introductionType": undefined, + "introductionUrl": null, + "isBlackBoxed": false, + "isExtension": false, + "isOriginal": false, + "isPrettyPrinted": false, + "isWasm": false, + "relativeUrl": "http://mdn.com/one.js", + "url": "http://mdn.com/one.js", + }, + "threads": Array [ + Object { + "actor": "server1.conn13.child1/thread19", + "name": "Main Thread", + }, + ], + "toggleBlackBox": [MockFunction], + }, +} +`; + exports[`SourceTreeItem renderItem should show icon for folder with arrow 1`] = ` Object { "component":
- - - - folder - - -
, - "defaultState": null, - "instance": SourceTreeItem { - "addCollapseExpandAllOptions": [Function], - "context": Object {}, - "handleDownloadFile": [Function], - "onClick": [Function], - "onContextMenu": [Function], - "props": Object { - "clearProjectDirectoryRoot": [MockFunction], - "debuggeeUrl": "http://mdn.com", - "depth": 0, - "expanded": false, - "focusItem": [MockFunction], - "item": Object { - "contents": Array [], - "name": "folder", - "path": "domain/subfolder", - "type": "directory", - }, - "projectRoot": "server1.conn13.child1/thread19", - "selectItem": [MockFunction], - "setExpanded": [MockFunction], - "setProjectDirectoryRoot": [MockFunction], - "source": Object { - "extensionName": null, - "id": "server1.conn13.child1/39", - "introductionType": undefined, - "introductionUrl": null, - "isBlackBoxed": false, - "isExtension": false, - "isPrettyPrinted": false, - "isWasm": false, - "relativeUrl": "http://mdn.com/one.js", - "url": "http://mdn.com/one.js", - }, - "threads": Array [ - Object { - "actor": "server1.conn13.child1/thread19", - "name": "Main Thread", - }, - ], - "toggleBlackBox": [MockFunction], - }, - "refs": Object {}, - "setState": [Function], - "state": null, - "updater": Updater { - "_callbacks": Array [], - "_renderer": ReactShallowRenderer { - "_context": Object {}, - "_element": , - "_forcedUpdate": false, - "_instance": [Circular], - "_newState": null, - "_rendered":
- - - - folder - - -
, - "_rendering": false, - "_updater": [Circular], - }, - }, - Symbol(enzyme.__setState__): [Function], - }, - "props": Object { - "clearProjectDirectoryRoot": [MockFunction], - "debuggeeUrl": "http://mdn.com", - "depth": 0, - "expanded": false, - "focusItem": [MockFunction], - "item": Object { - "contents": Array [], - "name": "folder", - "path": "domain/subfolder", - "type": "directory", - }, - "projectRoot": "server1.conn13.child1/thread19", - "selectItem": [MockFunction], - "setExpanded": [MockFunction], - "setProjectDirectoryRoot": [MockFunction], - "source": Object { - "extensionName": null, - "id": "server1.conn13.child1/39", - "introductionType": undefined, - "introductionUrl": null, - "isBlackBoxed": false, - "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -2278,6 +2320,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -2322,6 +2365,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -2387,6 +2431,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -2444,6 +2489,7 @@ Object { "introductionUrl": null, "isBlackBoxed": true, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -2464,6 +2510,7 @@ Object { "introductionUrl": null, "isBlackBoxed": true, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -2497,6 +2544,7 @@ Object { "introductionUrl": null, "isBlackBoxed": true, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -2519,6 +2567,7 @@ Object { "introductionUrl": null, "isBlackBoxed": true, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -2575,6 +2624,7 @@ Object { "introductionUrl": null, "isBlackBoxed": true, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -2595,6 +2645,7 @@ Object { "introductionUrl": null, "isBlackBoxed": true, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -2653,6 +2704,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -2673,6 +2725,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -2707,6 +2760,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -2729,6 +2783,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -2786,6 +2841,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -2806,6 +2862,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -2843,6 +2900,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -2877,6 +2935,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -2897,6 +2956,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -2930,6 +2990,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -2952,6 +3013,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -2989,6 +3051,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -3022,6 +3085,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -3042,6 +3106,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -3079,6 +3144,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -3115,6 +3181,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -3134,6 +3201,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -3169,6 +3237,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -3190,6 +3259,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -3227,6 +3297,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -3262,6 +3333,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -3281,6 +3353,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -3318,6 +3391,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -3352,6 +3426,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -3372,6 +3447,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -3405,6 +3481,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -3427,6 +3504,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -3464,6 +3542,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", @@ -3497,6 +3576,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -3517,6 +3597,7 @@ Object { "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://mdn.com/one.js", diff --git a/devtools/client/debugger/src/components/SecondaryPanes/Frames/tests/__snapshots__/Frame.spec.js.snap b/devtools/client/debugger/src/components/SecondaryPanes/Frames/tests/__snapshots__/Frame.spec.js.snap index ea22c1c20b93..7987a9600a6d 100644 --- a/devtools/client/debugger/src/components/SecondaryPanes/Frames/tests/__snapshots__/Frame.spec.js.snap +++ b/devtools/client/debugger/src/components/SecondaryPanes/Frames/tests/__snapshots__/Frame.spec.js.snap @@ -45,6 +45,7 @@ exports[`Frame getFrameTitle 1`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com/assets/src/js/foo-view.js", @@ -99,6 +100,7 @@ exports[`Frame getFrameTitle 1`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com/assets/src/js/foo-view.js", @@ -160,6 +162,7 @@ exports[`Frame library frame 1`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "backbone.js", @@ -215,6 +218,7 @@ exports[`Frame library frame 1`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "backbone.js", @@ -275,6 +279,7 @@ exports[`Frame user frame (not selected) 1`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "foo-view.js", @@ -329,6 +334,7 @@ exports[`Frame user frame (not selected) 1`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "foo-view.js", @@ -389,6 +395,7 @@ exports[`Frame user frame 1`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "foo-view.js", @@ -443,6 +450,7 @@ exports[`Frame user frame 1`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "foo-view.js", diff --git a/devtools/client/debugger/src/components/SecondaryPanes/Frames/tests/__snapshots__/Frames.spec.js.snap b/devtools/client/debugger/src/components/SecondaryPanes/Frames/tests/__snapshots__/Frames.spec.js.snap index bb23c269c916..a71988d40c50 100644 --- a/devtools/client/debugger/src/components/SecondaryPanes/Frames/tests/__snapshots__/Frames.spec.js.snap +++ b/devtools/client/debugger/src/components/SecondaryPanes/Frames/tests/__snapshots__/Frames.spec.js.snap @@ -42,6 +42,7 @@ exports[`Frames Blackboxed Frames filters blackboxed frames 1`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -88,6 +89,7 @@ exports[`Frames Blackboxed Frames filters blackboxed frames 1`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -136,6 +138,7 @@ exports[`Frames Blackboxed Frames filters blackboxed frames 1`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -182,6 +185,7 @@ exports[`Frames Blackboxed Frames filters blackboxed frames 1`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", diff --git a/devtools/client/debugger/src/components/SecondaryPanes/Frames/tests/__snapshots__/Group.spec.js.snap b/devtools/client/debugger/src/components/SecondaryPanes/Frames/tests/__snapshots__/Group.spec.js.snap index cdc47cd92904..b430d2739f27 100644 --- a/devtools/client/debugger/src/components/SecondaryPanes/Frames/tests/__snapshots__/Group.spec.js.snap +++ b/devtools/client/debugger/src/components/SecondaryPanes/Frames/tests/__snapshots__/Group.spec.js.snap @@ -49,6 +49,7 @@ exports[`Group displays a group 1`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -123,6 +124,7 @@ exports[`Group passes the getFrameTitle prop to the Frame components 1`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://myfile.com/mahscripts.js", @@ -196,6 +198,7 @@ exports[`Group passes the getFrameTitle prop to the Frame components 1`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://myfile.com/mahscripts.js", @@ -244,6 +247,7 @@ exports[`Group passes the getFrameTitle prop to the Frame components 1`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -305,6 +309,7 @@ exports[`Group passes the getFrameTitle prop to the Frame components 1`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://myfile.com/back.js", @@ -353,6 +358,7 @@ exports[`Group passes the getFrameTitle prop to the Frame components 1`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -414,6 +420,7 @@ exports[`Group passes the getFrameTitle prop to the Frame components 1`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://myfile.com/back.js", @@ -462,6 +469,7 @@ exports[`Group passes the getFrameTitle prop to the Frame components 1`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -528,6 +536,7 @@ exports[`Group renders group with anonymous functions 1`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://myfile.com/mahscripts.js", @@ -602,6 +611,7 @@ exports[`Group renders group with anonymous functions 2`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://myfile.com/mahscripts.js", @@ -675,6 +685,7 @@ exports[`Group renders group with anonymous functions 2`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://myfile.com/mahscripts.js", @@ -722,6 +733,7 @@ exports[`Group renders group with anonymous functions 2`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -783,6 +795,7 @@ exports[`Group renders group with anonymous functions 2`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://myfile.com/back.js", @@ -830,6 +843,7 @@ exports[`Group renders group with anonymous functions 2`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", @@ -891,6 +905,7 @@ exports[`Group renders group with anonymous functions 2`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "http://myfile.com/back.js", @@ -938,6 +953,7 @@ exports[`Group renders group with anonymous functions 2`] = ` "introductionUrl": null, "isBlackBoxed": false, "isExtension": false, + "isOriginal": false, "isPrettyPrinted": false, "isWasm": false, "relativeUrl": "url", diff --git a/devtools/client/debugger/src/reducers/sources.js b/devtools/client/debugger/src/reducers/sources.js index c08bfea9f2e6..202f94911be7 100644 --- a/devtools/client/debugger/src/reducers/sources.js +++ b/devtools/client/debugger/src/reducers/sources.js @@ -99,6 +99,7 @@ export type SourceBase = {| +extensionName: ?string, +isExtension: boolean, +isWasm: boolean, + +isOriginal: boolean, |}; type SourceResource = Resource<{ diff --git a/devtools/client/debugger/src/reducers/tabs.js b/devtools/client/debugger/src/reducers/tabs.js index dcd7f8d69268..1fbe949d74c6 100644 --- a/devtools/client/debugger/src/reducers/tabs.js +++ b/devtools/client/debugger/src/reducers/tabs.js @@ -126,7 +126,7 @@ export function getNewSelectedSourceId(state: State, tabList: TabList): string { const selectedSource = getSpecificSourceByURL( state, selectedTab.url, - isOriginalId(selectedTab.id) + selectedTab.isOriginal ); if (selectedSource) { diff --git a/devtools/client/debugger/src/selectors/test/getCallStackFrames.spec.js b/devtools/client/debugger/src/selectors/test/getCallStackFrames.spec.js index 4c4281858e8c..ce2dd0133e5a 100644 --- a/devtools/client/debugger/src/selectors/test/getCallStackFrames.spec.js +++ b/devtools/client/debugger/src/selectors/test/getCallStackFrames.spec.js @@ -27,6 +27,7 @@ describe("getCallStackFrames selector", () => { ]), selectedSource: { id: "sourceId-originalSource", + isOriginal: true, }, }; @@ -146,6 +147,7 @@ describe("getCallStackFrames selector", () => { ]), selectedSource: { id: "sourceId-originalSource", + isOriginal: true, }, }; diff --git a/devtools/client/debugger/src/types.js b/devtools/client/debugger/src/types.js index f5011385208a..5d4c86350b92 100644 --- a/devtools/client/debugger/src/types.js +++ b/devtools/client/debugger/src/types.js @@ -432,6 +432,7 @@ export type Source = { +extensionName: ?string, +isExtension: boolean, +isWasm: boolean, + +isOriginal: boolean, }; /** diff --git a/devtools/client/debugger/src/utils/source-maps.js b/devtools/client/debugger/src/utils/source-maps.js index 02b30ed5029a..ef273539c1af 100644 --- a/devtools/client/debugger/src/utils/source-maps.js +++ b/devtools/client/debugger/src/utils/source-maps.js @@ -95,5 +95,13 @@ export async function mapLocation( } export function isOriginalSource(source: ?Source) { - return source && isOriginalId(source.id); + if (!source) { + return false; + } + + if (!source.hasOwnProperty("isOriginal")) { + throw new Error("source must have an isOriginal property"); + } + + return source.isOriginal; } diff --git a/devtools/client/debugger/src/utils/source.js b/devtools/client/debugger/src/utils/source.js index 0fcf92693477..13903deaba8b 100644 --- a/devtools/client/debugger/src/utils/source.js +++ b/devtools/client/debugger/src/utils/source.js @@ -9,9 +9,9 @@ * @module utils/source */ -import { isOriginalId, isGeneratedId } from "devtools-source-map"; import { getUnicodeUrl } from "devtools-modules"; +import { isOriginalSource } from "../utils/source-maps"; import { endTruncateStr } from "./utils"; import { truncateMiddleText } from "../utils/text"; import { parse as parseURL } from "../utils/url"; @@ -72,7 +72,7 @@ export function shouldBlackbox(source: ?Source) { return false; } - if (!features.originalBlackbox && isOriginalId(source.id)) { + if (!features.originalBlackbox && isOriginalSource(source)) { return false; } @@ -511,11 +511,11 @@ export function underRoot( export function isOriginal(source: Source) { // Pretty-printed sources are given original IDs, so no need // for any additional check - return isOriginalId(source.id); + return isOriginalSource(source); } export function isGenerated(source: Source) { - return isGeneratedId(source.id); + return !isOriginal(source); } export function getSourceQueryString(source: ?Source) { diff --git a/devtools/client/debugger/src/utils/sources-tree/tests/__snapshots__/updateTree.spec.js.snap b/devtools/client/debugger/src/utils/sources-tree/tests/__snapshots__/updateTree.spec.js.snap index 80a645cbc76b..f610d246089c 100644 --- a/devtools/client/debugger/src/utils/sources-tree/tests/__snapshots__/updateTree.spec.js.snap +++ b/devtools/client/debugger/src/utils/sources-tree/tests/__snapshots__/updateTree.spec.js.snap @@ -29,7 +29,8 @@ exports[`calls updateTree.js adds one source 1`] = ` \\"introductionUrl\\": null, \\"isWasm\\": false, \\"extensionName\\": null, - \\"isExtension\\": false + \\"isExtension\\": false, + \\"isOriginal\\": false } }, { @@ -45,7 +46,8 @@ exports[`calls updateTree.js adds one source 1`] = ` \\"introductionUrl\\": null, \\"isWasm\\": false, \\"extensionName\\": null, - \\"isExtension\\": false + \\"isExtension\\": false, + \\"isOriginal\\": false } } ] @@ -85,7 +87,8 @@ exports[`calls updateTree.js adds two sources 1`] = ` \\"introductionUrl\\": null, \\"isWasm\\": false, \\"extensionName\\": null, - \\"isExtension\\": false + \\"isExtension\\": false, + \\"isOriginal\\": false } }, { @@ -101,7 +104,8 @@ exports[`calls updateTree.js adds two sources 1`] = ` \\"introductionUrl\\": null, \\"isWasm\\": false, \\"extensionName\\": null, - \\"isExtension\\": false + \\"isExtension\\": false, + \\"isOriginal\\": false } }, { @@ -117,7 +121,8 @@ exports[`calls updateTree.js adds two sources 1`] = ` \\"introductionUrl\\": null, \\"isWasm\\": false, \\"extensionName\\": null, - \\"isExtension\\": false + \\"isExtension\\": false, + \\"isOriginal\\": false } } ] @@ -157,7 +162,8 @@ exports[`calls updateTree.js shows all the sources 1`] = ` \\"introductionUrl\\": null, \\"isWasm\\": false, \\"extensionName\\": null, - \\"isExtension\\": false + \\"isExtension\\": false, + \\"isOriginal\\": false } } ] diff --git a/devtools/client/debugger/src/utils/test-head.js b/devtools/client/debugger/src/utils/test-head.js index f43f6c27a5c3..e1d7e4bf748a 100644 --- a/devtools/client/debugger/src/utils/test-head.js +++ b/devtools/client/debugger/src/utils/test-head.js @@ -97,6 +97,7 @@ function createSourceObject( introductionUrl: props.introductionUrl || null, introductionType: props.introductionType || null, isExtension: false, + isOriginal: filename.includes("originalSource"), }: any); } diff --git a/devtools/client/debugger/src/utils/test-mockup.js b/devtools/client/debugger/src/utils/test-mockup.js index fa6ef4bb21f7..9eacb861dbbd 100644 --- a/devtools/client/debugger/src/utils/test-mockup.js +++ b/devtools/client/debugger/src/utils/test-mockup.js @@ -44,6 +44,7 @@ function makeMockSource( isWasm: false, extensionName: null, isExtension: false, + isOriginal: id.includes("originalSource"), }; } @@ -97,6 +98,7 @@ function makeMockWasmSource(): SourceBase { isWasm: true, extensionName: null, isExtension: false, + isOriginal: false, }; }