зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 1416218ae397 (bug 1580334) for Devtools failure on Debugger. CLOSED TREE
--HG-- extra : amend_source : 5480f365a0c5ea13f3be30ced032db85ade8418d
This commit is contained in:
Родитель
5913925d4e
Коммит
a740ed290d
|
@ -168,14 +168,6 @@ DebuggerPanel.prototype = {
|
||||||
return this._actions.selectSourceURL(cx, url, { line, column });
|
return this._actions.selectSourceURL(cx, url, { line, column });
|
||||||
},
|
},
|
||||||
|
|
||||||
previewPausedLocation(location) {
|
|
||||||
return this._actions.previewPausedLocation(location);
|
|
||||||
},
|
|
||||||
|
|
||||||
clearPreviewPausedLocation() {
|
|
||||||
return this._actions.clearPreviewPausedLocation();
|
|
||||||
},
|
|
||||||
|
|
||||||
async selectSource(sourceId, line, column) {
|
async selectSource(sourceId, line, column) {
|
||||||
const cx = this._selectors.getContext(this._getState());
|
const cx = this._selectors.getContext(this._getState());
|
||||||
const location = { sourceId, line, column };
|
const location = { sourceId, line, column };
|
||||||
|
|
|
@ -30,7 +30,3 @@ export { toggleSkipPausing, setSkipPausing } from "./skipPausing";
|
||||||
export { toggleMapScopes } from "./mapScopes";
|
export { toggleMapScopes } from "./mapScopes";
|
||||||
export { setExpandedScope } from "./expandScopes";
|
export { setExpandedScope } from "./expandScopes";
|
||||||
export { generateInlinePreview } from "./inlinePreview";
|
export { generateInlinePreview } from "./inlinePreview";
|
||||||
export {
|
|
||||||
previewPausedLocation,
|
|
||||||
clearPreviewPausedLocation,
|
|
||||||
} from "./previewPausedLocation";
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ CompiledModules(
|
||||||
'mapScopes.js',
|
'mapScopes.js',
|
||||||
'paused.js',
|
'paused.js',
|
||||||
'pauseOnExceptions.js',
|
'pauseOnExceptions.js',
|
||||||
'previewPausedLocation.js',
|
|
||||||
'resumed.js',
|
'resumed.js',
|
||||||
'selectFrame.js',
|
'selectFrame.js',
|
||||||
'skipPausing.js',
|
'skipPausing.js',
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
/* 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/>. */
|
|
||||||
|
|
||||||
// @flow
|
|
||||||
|
|
||||||
import { selectLocation } from "../sources";
|
|
||||||
import { getContext, getSourceByURL } from "../../selectors";
|
|
||||||
import type { ThunkArgs } from "../types";
|
|
||||||
|
|
||||||
type Location = {
|
|
||||||
sourceUrl: string,
|
|
||||||
column: number,
|
|
||||||
line: number,
|
|
||||||
};
|
|
||||||
|
|
||||||
export function previewPausedLocation(location: Location) {
|
|
||||||
return ({ dispatch, getState }: ThunkArgs) => {
|
|
||||||
const cx = getContext(getState());
|
|
||||||
const source = getSourceByURL(getState(), location.sourceUrl);
|
|
||||||
if (!source) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const sourceLocation = { ...location, sourceId: source.id };
|
|
||||||
dispatch(selectLocation(cx, sourceLocation));
|
|
||||||
|
|
||||||
dispatch({
|
|
||||||
type: "PREVIEW_PAUSED_LOCATION",
|
|
||||||
location: sourceLocation,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function clearPreviewPausedLocation() {
|
|
||||||
return {
|
|
||||||
type: "CLEAR_PREVIEW_PAUSED_LOCATION",
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -5,13 +5,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import typeof SourceMaps from "devtools-source-map";
|
import typeof SourceMaps from "devtools-source-map";
|
||||||
import type {
|
import type { ThreadList, Thread, Context, ThreadId } from "../../types";
|
||||||
ThreadList,
|
|
||||||
Thread,
|
|
||||||
Context,
|
|
||||||
ThreadId,
|
|
||||||
SourceLocation,
|
|
||||||
} from "../../types";
|
|
||||||
import type { State } from "../../reducers/types";
|
import type { State } from "../../reducers/types";
|
||||||
import type { MatchedLocations } from "../../reducers/file-search";
|
import type { MatchedLocations } from "../../reducers/file-search";
|
||||||
import type { TreeNode } from "../../utils/sources-tree/types";
|
import type { TreeNode } from "../../utils/sources-tree/types";
|
||||||
|
@ -155,13 +149,6 @@ export type DebuggeeAction =
|
||||||
+type: "SELECT_THREAD",
|
+type: "SELECT_THREAD",
|
||||||
+cx: Context,
|
+cx: Context,
|
||||||
+thread: ThreadId,
|
+thread: ThreadId,
|
||||||
|}
|
|
||||||
| {|
|
|
||||||
+type: "PREVIEW_PAUSED_LOCATION",
|
|
||||||
+location: SourceLocation,
|
|
||||||
|}
|
|
||||||
| {|
|
|
||||||
+type: "CLEAR_PREVIEW_PAUSED_LOCATION",
|
|
||||||
|};
|
|};
|
||||||
|
|
||||||
export type {
|
export type {
|
||||||
|
|
|
@ -20,13 +20,12 @@ import {
|
||||||
getPauseReason,
|
getPauseReason,
|
||||||
getSourceWithContent,
|
getSourceWithContent,
|
||||||
getCurrentThread,
|
getCurrentThread,
|
||||||
getPausePreviewLocation,
|
|
||||||
} from "../../selectors";
|
} from "../../selectors";
|
||||||
|
|
||||||
import type { SourceLocation, Why, SourceWithContent } from "../../types";
|
import type { Frame, Why, SourceWithContent } from "../../types";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
location: SourceLocation,
|
frame: Frame,
|
||||||
why: Why,
|
why: Why,
|
||||||
source: ?SourceWithContent,
|
source: ?SourceWithContent,
|
||||||
};
|
};
|
||||||
|
@ -36,40 +35,42 @@ type TextClasses = {
|
||||||
lineClass: string,
|
lineClass: string,
|
||||||
};
|
};
|
||||||
|
|
||||||
function isDocumentReady(source: ?SourceWithContent, location) {
|
function isDocumentReady(source: ?SourceWithContent, frame) {
|
||||||
return location && source && source.content && hasDocument(location.sourceId);
|
return (
|
||||||
|
frame && source && source.content && hasDocument(frame.location.sourceId)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DebugLine extends PureComponent<Props> {
|
export class DebugLine extends PureComponent<Props> {
|
||||||
debugExpression: null;
|
debugExpression: null;
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { why, location, source } = this.props;
|
const { why, frame, source } = this.props;
|
||||||
this.setDebugLine(why, location, source);
|
this.setDebugLine(why, frame, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
const { why, location, source } = this.props;
|
const { why, frame, source } = this.props;
|
||||||
this.clearDebugLine(why, location, source);
|
this.clearDebugLine(why, frame, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps: Props) {
|
componentDidUpdate(prevProps: Props) {
|
||||||
const { why, location, source } = this.props;
|
const { why, frame, source } = this.props;
|
||||||
|
|
||||||
startOperation();
|
startOperation();
|
||||||
this.clearDebugLine(prevProps.why, prevProps.location, prevProps.source);
|
this.clearDebugLine(prevProps.why, prevProps.frame, prevProps.source);
|
||||||
this.setDebugLine(why, location, source);
|
this.setDebugLine(why, frame, source);
|
||||||
endOperation();
|
endOperation();
|
||||||
}
|
}
|
||||||
|
|
||||||
setDebugLine(why: Why, location: SourceLocation, source: ?SourceWithContent) {
|
setDebugLine(why: Why, frame: Frame, source: ?SourceWithContent) {
|
||||||
if (!isDocumentReady(source, location)) {
|
if (!isDocumentReady(source, frame)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const sourceId = location.sourceId;
|
const sourceId = frame.location.sourceId;
|
||||||
const doc = getDocument(sourceId);
|
const doc = getDocument(sourceId);
|
||||||
|
|
||||||
let { line, column } = toEditorPosition(location);
|
let { line, column } = toEditorPosition(frame.location);
|
||||||
let { markTextClass, lineClass } = this.getTextClasses(why);
|
let { markTextClass, lineClass } = this.getTextClasses(why);
|
||||||
doc.addLineClass(line, "line", lineClass);
|
doc.addLineClass(line, "line", lineClass);
|
||||||
|
|
||||||
|
@ -91,12 +92,8 @@ export class DebugLine extends PureComponent<Props> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
clearDebugLine(
|
clearDebugLine(why: Why, frame: Frame, source: ?SourceWithContent) {
|
||||||
why: Why,
|
if (!isDocumentReady(source, frame)) {
|
||||||
location: SourceLocation,
|
|
||||||
source: ?SourceWithContent
|
|
||||||
) {
|
|
||||||
if (!isDocumentReady(source, location)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,15 +101,15 @@ export class DebugLine extends PureComponent<Props> {
|
||||||
this.debugExpression.clear();
|
this.debugExpression.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
const sourceId = location.sourceId;
|
const sourceId = frame.location.sourceId;
|
||||||
const { line } = toEditorPosition(location);
|
const { line } = toEditorPosition(frame.location);
|
||||||
const doc = getDocument(sourceId);
|
const doc = getDocument(sourceId);
|
||||||
const { lineClass } = this.getTextClasses(why);
|
const { lineClass } = this.getTextClasses(why);
|
||||||
doc.removeLineClass(line, "line", lineClass);
|
doc.removeLineClass(line, "line", lineClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
getTextClasses(why: Why): TextClasses {
|
getTextClasses(why: Why): TextClasses {
|
||||||
if (why && isException(why)) {
|
if (isException(why)) {
|
||||||
return {
|
return {
|
||||||
markTextClass: "debug-expression-error",
|
markTextClass: "debug-expression-error",
|
||||||
lineClass: "new-debug-line-error",
|
lineClass: "new-debug-line-error",
|
||||||
|
@ -129,11 +126,9 @@ export class DebugLine extends PureComponent<Props> {
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
const frame = getVisibleSelectedFrame(state);
|
const frame = getVisibleSelectedFrame(state);
|
||||||
const previewLocation = getPausePreviewLocation(state);
|
|
||||||
const location = previewLocation || (frame && frame.location);
|
|
||||||
return {
|
return {
|
||||||
location,
|
frame,
|
||||||
source: location && getSourceWithContent(state, location.sourceId),
|
source: frame && getSourceWithContent(state, frame.location.sourceId),
|
||||||
why: getPauseReason(state, getCurrentThread(state)),
|
why: getPauseReason(state, getCurrentThread(state)),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,11 +41,13 @@ function generateDefaults(editor, overrides) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function createLocation(line) {
|
function createFrame(line) {
|
||||||
return {
|
return {
|
||||||
sourceId: "foo",
|
location: {
|
||||||
line,
|
sourceId: "foo",
|
||||||
column: 2,
|
line,
|
||||||
|
column: 2,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,9 +80,9 @@ describe("DebugLine Component", () => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const line = 2;
|
const line = 2;
|
||||||
const location = createLocation(line);
|
const frame = createFrame(line);
|
||||||
|
|
||||||
component.setProps({ ...props, location });
|
component.setProps({ ...props, frame });
|
||||||
|
|
||||||
expect(doc.removeLineClass.mock.calls).toEqual([]);
|
expect(doc.removeLineClass.mock.calls).toEqual([]);
|
||||||
expect(doc.addLineClass.mock.calls).toEqual([
|
expect(doc.addLineClass.mock.calls).toEqual([
|
||||||
|
@ -105,10 +107,10 @@ describe("DebugLine Component", () => {
|
||||||
const firstLine = 2;
|
const firstLine = 2;
|
||||||
const secondLine = 2;
|
const secondLine = 2;
|
||||||
|
|
||||||
component.setProps({ ...props, location: createLocation(firstLine) });
|
component.setProps({ ...props, frame: createFrame(firstLine) });
|
||||||
component.setProps({
|
component.setProps({
|
||||||
...props,
|
...props,
|
||||||
frame: createLocation(secondLine),
|
frame: createFrame(secondLine),
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(doc.removeLineClass.mock.calls).toEqual([
|
expect(doc.removeLineClass.mock.calls).toEqual([
|
||||||
|
@ -141,9 +143,9 @@ describe("DebugLine Component", () => {
|
||||||
it("should not set the debug line", () => {
|
it("should not set the debug line", () => {
|
||||||
const { component, props, doc } = render({ frame: null });
|
const { component, props, doc } = render({ frame: null });
|
||||||
const line = 2;
|
const line = 2;
|
||||||
const location = createLocation(line);
|
const frame = createFrame(line);
|
||||||
|
|
||||||
component.setProps({ ...props, location });
|
component.setProps({ ...props, frame });
|
||||||
expect(doc.removeLineClass).not.toHaveBeenCalled();
|
expect(doc.removeLineClass).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
|
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
|
||||||
|
|
||||||
// @flow
|
// @flow
|
||||||
/* eslint complexity: ["error", 35]*/
|
/* eslint complexity: ["error", 30]*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pause reducer
|
* Pause reducer
|
||||||
|
@ -29,7 +29,6 @@ import type {
|
||||||
Context,
|
Context,
|
||||||
ThreadContext,
|
ThreadContext,
|
||||||
Previews,
|
Previews,
|
||||||
SourceLocation,
|
|
||||||
} from "../types";
|
} from "../types";
|
||||||
|
|
||||||
export type Command =
|
export type Command =
|
||||||
|
@ -97,7 +96,6 @@ export type PauseState = {
|
||||||
mapScopes: boolean,
|
mapScopes: boolean,
|
||||||
shouldPauseOnExceptions: boolean,
|
shouldPauseOnExceptions: boolean,
|
||||||
shouldPauseOnCaughtExceptions: boolean,
|
shouldPauseOnCaughtExceptions: boolean,
|
||||||
previewLocation: ?SourceLocation,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function createPauseState(thread: ThreadId = "UnknownThread") {
|
function createPauseState(thread: ThreadId = "UnknownThread") {
|
||||||
|
@ -111,7 +109,6 @@ function createPauseState(thread: ThreadId = "UnknownThread") {
|
||||||
isPaused: false,
|
isPaused: false,
|
||||||
pauseCounter: 0,
|
pauseCounter: 0,
|
||||||
},
|
},
|
||||||
previewLocation: null,
|
|
||||||
threads: {},
|
threads: {},
|
||||||
canRewind: false,
|
canRewind: false,
|
||||||
skipPausing: prefs.skipPausing,
|
skipPausing: prefs.skipPausing,
|
||||||
|
@ -194,7 +191,6 @@ function update(
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
...state,
|
...state,
|
||||||
previewLocation: null,
|
|
||||||
threadcx: {
|
threadcx: {
|
||||||
...state.threadcx,
|
...state.threadcx,
|
||||||
pauseCounter: state.threadcx.pauseCounter + 1,
|
pauseCounter: state.threadcx.pauseCounter + 1,
|
||||||
|
@ -211,14 +207,6 @@ function update(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
case "PREVIEW_PAUSED_LOCATION": {
|
|
||||||
return { ...state, previewLocation: action.location };
|
|
||||||
}
|
|
||||||
|
|
||||||
case "CLEAR_PREVIEW_PAUSED_LOCATION": {
|
|
||||||
return { ...state, previewLocation: null };
|
|
||||||
}
|
|
||||||
|
|
||||||
case "MAP_FRAMES": {
|
case "MAP_FRAMES": {
|
||||||
const { selectedFrameId, frames } = action;
|
const { selectedFrameId, frames } = action;
|
||||||
return updateThreadState({ frames, selectedFrameId });
|
return updateThreadState({ frames, selectedFrameId });
|
||||||
|
@ -689,8 +677,4 @@ export function getLastExpandedScopes(state: State, thread: ThreadId) {
|
||||||
return getThreadPauseState(state.pause, thread).lastExpandedScopes;
|
return getThreadPauseState(state.pause, thread).lastExpandedScopes;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getPausePreviewLocation(state: State) {
|
|
||||||
return state.pause.previewLocation;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default update;
|
export default update;
|
||||||
|
|
|
@ -101,13 +101,6 @@ function sameLocation(m1, m2) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMessageLocation(message) {
|
|
||||||
const {
|
|
||||||
frame: { source, line, column },
|
|
||||||
} = message;
|
|
||||||
return { sourceUrl: source, line, column };
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* The player has 4 valid states
|
* The player has 4 valid states
|
||||||
|
@ -348,6 +341,11 @@ class WebReplayPlayer extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async clearPreviewLocation() {
|
||||||
|
const dbg = await this.toolbox.loadTool("jsdebugger");
|
||||||
|
dbg.clearPreviewPausedLocation();
|
||||||
|
}
|
||||||
|
|
||||||
unhighlightConsoleMessage() {
|
unhighlightConsoleMessage() {
|
||||||
if (this.hoveredMessage) {
|
if (this.hoveredMessage) {
|
||||||
this.hoveredMessage.classList.remove("highlight");
|
this.hoveredMessage.classList.remove("highlight");
|
||||||
|
@ -376,20 +374,9 @@ class WebReplayPlayer extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onMessageMouseEnter(message) {
|
onMessageMouseEnter(message) {
|
||||||
this.previewLocation(message);
|
|
||||||
this.showMessage(message);
|
this.showMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
async previewLocation(closestMessage) {
|
|
||||||
const dbg = await this.toolbox.loadTool("jsdebugger");
|
|
||||||
dbg.previewPausedLocation(getMessageLocation(closestMessage));
|
|
||||||
}
|
|
||||||
|
|
||||||
async clearPreviewLocation() {
|
|
||||||
const dbg = await this.toolbox.loadTool("jsdebugger");
|
|
||||||
dbg.clearPreviewPausedLocation();
|
|
||||||
}
|
|
||||||
|
|
||||||
onProgressBarClick(e) {
|
onProgressBarClick(e) {
|
||||||
if (!e.altKey) {
|
if (!e.altKey) {
|
||||||
return;
|
return;
|
||||||
|
@ -416,7 +403,6 @@ class WebReplayPlayer extends Component {
|
||||||
|
|
||||||
onPlayerMouseLeave() {
|
onPlayerMouseLeave() {
|
||||||
this.unhighlightConsoleMessage();
|
this.unhighlightConsoleMessage();
|
||||||
this.clearPreviewLocation();
|
|
||||||
return this.threadFront.paintCurrentPoint();
|
return this.threadFront.paintCurrentPoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -628,7 +614,7 @@ class WebReplayPlayer extends Component {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
this.seek(message.executionPoint);
|
this.seek(message.executionPoint);
|
||||||
},
|
},
|
||||||
onMouseEnter: () => this.onMessageMouseEnter(message),
|
onMouseEnter: () => this.onMessageMouseEnter(message.executionPoint),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче