зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1513397 - [release 107] Resolve pause-point flow errors due to new mapped points. (#7375). r=davidwalsh
This commit is contained in:
Родитель
efc00313f9
Коммит
e089fdf3d3
|
@ -2,14 +2,16 @@
|
|||
* 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/>. */
|
||||
|
||||
// @flow
|
||||
|
||||
import { getSourceFromId } from "../../selectors";
|
||||
import * as parser from "../../workers/parser";
|
||||
import { isGenerated } from "../../utils/source";
|
||||
import { mapPausePoints } from "../../utils/pause/pausePoints";
|
||||
import { features } from "../../utils/prefs";
|
||||
|
||||
import type { SourceId } from "../types";
|
||||
import type { ThunkArgs, Action } from "./types";
|
||||
import type { SourceId } from "../../types";
|
||||
import type { ThunkArgs, Action } from "../types";
|
||||
|
||||
function compressPausePoints(pausePoints) {
|
||||
const compressed = {};
|
||||
|
|
|
@ -126,15 +126,11 @@ export class QuickOpenModal extends Component<Props, State> {
|
|||
|
||||
searchSymbols = (query: string) => {
|
||||
const {
|
||||
symbols: { functions, identifiers }
|
||||
symbols: { functions }
|
||||
} = this.props;
|
||||
|
||||
let results = functions;
|
||||
if (this.isVariableQuery()) {
|
||||
results = identifiers;
|
||||
} else {
|
||||
results = results.filter(result => result.title !== "anonymous");
|
||||
}
|
||||
results = results.filter(result => result.title !== "anonymous");
|
||||
|
||||
if (query === "@" || query === "#") {
|
||||
return this.setState({ results });
|
||||
|
@ -219,24 +215,11 @@ export class QuickOpenModal extends Component<Props, State> {
|
|||
};
|
||||
|
||||
onSelectResultItem = (item: QuickOpenResult) => {
|
||||
const {
|
||||
selectSpecificLocation,
|
||||
selectedSource,
|
||||
highlightLineRange
|
||||
} = this.props;
|
||||
const { selectedSource, highlightLineRange } = this.props;
|
||||
if (!this.isSymbolSearch() || selectedSource == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.isVariableQuery()) {
|
||||
const line =
|
||||
item.location && item.location.start ? item.location.start.line : 0;
|
||||
return selectSpecificLocation({
|
||||
sourceId: selectedSource.id,
|
||||
line
|
||||
});
|
||||
}
|
||||
|
||||
if (this.isFunctionQuery()) {
|
||||
return highlightLineRange({
|
||||
...(item.location != null
|
||||
|
@ -322,8 +305,7 @@ export class QuickOpenModal extends Component<Props, State> {
|
|||
|
||||
// Query helpers
|
||||
isFunctionQuery = () => this.props.searchType === "functions";
|
||||
isVariableQuery = () => this.props.searchType === "variables";
|
||||
isSymbolSearch = () => this.isFunctionQuery() || this.isVariableQuery();
|
||||
isSymbolSearch = () => this.isFunctionQuery();
|
||||
isGotoQuery = () => this.props.searchType === "goto";
|
||||
isGotoSourceQuery = () => this.props.searchType === "gotoSource";
|
||||
isShortcutQuery = () => this.props.searchType === "shortcuts";
|
||||
|
@ -379,10 +361,7 @@ export class QuickOpenModal extends Component<Props, State> {
|
|||
let summaryMsg = "";
|
||||
if (this.isGotoQuery()) {
|
||||
summaryMsg = L10N.getStr("shortcuts.gotoLine");
|
||||
} else if (
|
||||
(this.isFunctionQuery() || this.isVariableQuery()) &&
|
||||
this.props.symbolsLoading
|
||||
) {
|
||||
} else if (this.isFunctionQuery() && this.props.symbolsLoading) {
|
||||
summaryMsg = L10N.getStr("loadingText");
|
||||
}
|
||||
return summaryMsg;
|
||||
|
|
|
@ -79,7 +79,7 @@ export default class Group extends Component<Props, State> {
|
|||
);
|
||||
}
|
||||
|
||||
toggleFrames = (event) => {
|
||||
toggleFrames = event => {
|
||||
event.stopPropagation();
|
||||
this.setState(prevState => ({ expanded: !prevState.expanded }));
|
||||
};
|
||||
|
|
|
@ -12,12 +12,7 @@ import { parseQuickOpenQuery } from "../utils/quick-open";
|
|||
import type { Action } from "../actions/types";
|
||||
import type { Record } from "../utils/makeRecord";
|
||||
|
||||
export type QuickOpenType =
|
||||
| "sources"
|
||||
| "functions"
|
||||
| "variables"
|
||||
| "goto"
|
||||
| "gotoSource";
|
||||
export type QuickOpenType = "sources" | "functions" | "goto" | "gotoSource";
|
||||
|
||||
type QuickOpenState = {
|
||||
enabled: boolean,
|
||||
|
|
|
@ -42,15 +42,20 @@ export function formatPausePoints(text: string, pausePoints: PausePoints) {
|
|||
return lines.join("\n");
|
||||
}
|
||||
|
||||
export async function mapPausePoints(pausePoints, iteratee) {
|
||||
export async function mapPausePoints<T>(
|
||||
pausePoints: PausePoints,
|
||||
iteratee: PausePoint => T
|
||||
) {
|
||||
const results = await Promise.all(convertToList(pausePoints).map(iteratee));
|
||||
|
||||
const newPausePoints = {};
|
||||
for (const line in pausePoints) {
|
||||
const linePoints = pausePoints[line];
|
||||
const newLinePoints = (newPausePoints[line] = {});
|
||||
for (const column in linePoints) {
|
||||
linePoints[column] = results.shift();
|
||||
newLinePoints[column] = results.shift();
|
||||
}
|
||||
}
|
||||
|
||||
return pausePoints;
|
||||
return newPausePoints;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ export const features = new PrefsHelper("devtools.debugger.features", {
|
|||
mapAwaitExpression: ["Bool", "map-await-expression"],
|
||||
componentPane: ["Bool", "component-pane"],
|
||||
xhrBreakpoints: ["Bool", "xhr-breakpoints"],
|
||||
originalBlackbox: ["Bool", "origial-blackbox"],
|
||||
originalBlackbox: ["Bool", "origial-blackbox"]
|
||||
});
|
||||
|
||||
export const asyncStore = asyncStoreHelper("debugger", {
|
||||
|
|
|
@ -17,7 +17,10 @@ import type { Symbols } from "../reducers/ast";
|
|||
import type { QuickOpenType } from "../reducers/quick-open";
|
||||
import type { TabList } from "../reducers/tabs";
|
||||
import type { Source } from "../types";
|
||||
import type { SymbolDeclaration } from "../workers/parser";
|
||||
import type {
|
||||
SymbolDeclaration,
|
||||
IdentifierDeclaration
|
||||
} from "../workers/parser";
|
||||
|
||||
export const MODIFIERS = {
|
||||
"@": "functions",
|
||||
|
@ -86,11 +89,12 @@ export type QuickOpenResult = {|
|
|||
|};
|
||||
|
||||
export type FormattedSymbolDeclarations = {|
|
||||
variables: Array<QuickOpenResult>,
|
||||
functions: Array<QuickOpenResult>
|
||||
|};
|
||||
|
||||
export function formatSymbol(symbol: SymbolDeclaration): QuickOpenResult {
|
||||
export function formatSymbol(
|
||||
symbol: SymbolDeclaration | IdentifierDeclaration
|
||||
): QuickOpenResult {
|
||||
return {
|
||||
id: `${symbol.name}:${symbol.location.start.line}`,
|
||||
title: symbol.name,
|
||||
|
|
|
@ -103,5 +103,6 @@ export type {
|
|||
ClassDeclaration,
|
||||
SymbolDeclaration,
|
||||
SymbolDeclarations,
|
||||
IdentifierDeclaration,
|
||||
FunctionDeclaration
|
||||
} from "./getSymbols";
|
||||
|
|
|
@ -67,4 +67,4 @@ pref("devtools.debugger.features.skip-pausing", true);
|
|||
pref("devtools.debugger.features.autocomplete-expressions", false);
|
||||
pref("devtools.debugger.features.map-expression-bindings", true);
|
||||
pref("devtools.debugger.features.xhr-breakpoints", true);
|
||||
pref("devtools.debugger.features.origial-blackbox", false);
|
||||
pref("devtools.debugger.features.origial-blackbox", false);
|
||||
|
|
Загрузка…
Ссылка в новой задаче