Bug 1844536 - [devtools] Remove isGenerated util and access .isOriginal property directly r=devtools-reviewers,ochameau

Differential Revision: https://phabricator.services.mozilla.com/D186899
This commit is contained in:
Hubert Boma Manilla 2023-09-07 09:54:13 +00:00
parent dfde72b50b
commit 55e306c62c
6 changed files with 8 additions and 24 deletions

View file

@ -19,7 +19,6 @@ import { validateSelectedFrame } from "../../utils/context";
import { PROMISE } from "../utils/middleware/promise";
import { log } from "../../utils/log";
import { isGenerated } from "../../utils/source";
import { buildMappedScopes } from "../../utils/pause/mapScopes";
import { isFulfilled } from "../../utils/async-value";
@ -153,7 +152,7 @@ export function getMappedScopes(scopes, locations) {
!generatedSource ||
generatedSource.isWasm ||
source.isPrettyPrinted ||
isGenerated(source)
!source.isOriginal
) {
return null;
}

View file

@ -12,11 +12,7 @@ import { recordEvent } from "../../utils/telemetry";
import { updateBreakpointsForNewPrettyPrintedSource } from "../breakpoints";
import { createLocation } from "../../utils/location";
import {
getPrettySourceURL,
isGenerated,
isJavaScript,
} from "../../utils/source";
import { getPrettySourceURL, isJavaScript } from "../../utils/source";
import { isFulfilled } from "../../utils/async-value";
import { getOriginalLocation } from "../../utils/source-maps";
import { prefs } from "../../utils/prefs";
@ -292,7 +288,7 @@ export function togglePrettyPrint(sourceId) {
}
assert(
isGenerated(source),
!source.isOriginal,
"Pretty-printing only allowed on generated sources"
);

View file

@ -4,18 +4,17 @@
import { getSelectedSource, getBreakpointPositionsForLine } from "./sources";
import { getBreakpointsList } from "./breakpoints";
import { isGenerated } from "../utils/source";
function getColumn(column, selectedSource) {
if (column) {
return column;
}
return isGenerated(selectedSource) ? undefined : 0;
return !selectedSource.isOriginal ? undefined : 0;
}
function getLocation(bp, selectedSource) {
return isGenerated(selectedSource)
return !selectedSource.isOriginal
? bp.generatedLocation || bp.location
: bp.location;
}

View file

@ -4,12 +4,7 @@
import { createSelector } from "reselect";
import {
getPrettySourceURL,
isGenerated,
isPretty,
isJavaScript,
} from "../utils/source";
import { getPrettySourceURL, isPretty, isJavaScript } from "../utils/source";
import { findPosition } from "../utils/breakpoint/breakpointPositions";
import { isFulfilled } from "../utils/async-value";
@ -77,7 +72,7 @@ export function getGeneratedSource(state, source) {
return null;
}
if (isGenerated(source)) {
if (!source.isOriginal) {
return source;
}

View file

@ -3,7 +3,6 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import { getSourceActorsForSource } from "../../selectors";
import { isGenerated } from "../source";
import { sortSelectedLocations } from "../location";
export * from "./breakpointPositions";
@ -62,7 +61,7 @@ export function createXHRBreakpoint(path, method, overrides = {}) {
}
export function getSelectedText(breakpoint, selectedSource) {
return !!selectedSource && isGenerated(selectedSource)
return !!selectedSource && !selectedSource.isOriginal
? breakpoint.text
: breakpoint.originalText;
}

View file

@ -489,10 +489,6 @@ export function isDescendantOfRoot(source, rootUrlWithoutThreadActor) {
return !!source.url && source.url.includes(rootUrlWithoutThreadActor);
}
export function isGenerated(source) {
return !source.isOriginal;
}
export function getSourceQueryString(source) {
if (!source) {
return "";