Skip to content

Instantly share code, notes, and snippets.

@jasonLaster
Created August 13, 2019 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonLaster/ad589e9ace05bfe18440e19e2ef32115 to your computer and use it in GitHub Desktop.
Save jasonLaster/ad589e9ace05bfe18440e19e2ef32115 to your computer and use it in GitHub Desktop.
diff --git a/devtools/client/debugger/panel.js b/devtools/client/debugger/panel.js
index 4723ee44ace5..fa4d30582d4b 100644
--- a/devtools/client/debugger/panel.js
+++ b/devtools/client/debugger/panel.js
@@ -160,27 +160,14 @@ DebuggerPanel.prototype = {
return this._actions.selectSourceURL(cx, url, { line, column });
},
- async selectSource(sourceId, line, column, options) {
+ async selectSource(sourceId, line, column) {
const cx = this._selectors.getContext(this._getState());
+ const location = { sourceId, line, column };
- if (options.showLogPoint) {
- const logPoint = this._selectors.getBreakpoint(this._getState(), {
- sourceId,
- line,
- column,
- });
- // If a breakpoint or a conditional breakpoint is added to the old logpoint location,
- // editor panel won't open
- if (logPoint && logPoint.options.logValue) {
- await this._actions.selectSource(cx, sourceId);
- return this._actions.openConditionalPanel(
- { line, column, sourceId },
- true
- );
- }
+ await this._actions.selectSource(cx, sourceId, location);
+ if (this._selectors.hasLogpoint(this._getState(), location)) {
+ this._actions.openConditionalPanel(location, true);
}
-
- return this._actions.selectSource(cx, sourceId, { line, column });
},
canLoadSource(sourceId) {
diff --git a/devtools/client/debugger/src/reducers/breakpoints.js b/devtools/client/debugger/src/reducers/breakpoints.js
index 635ee074bd73..36e5e6cb7137 100644
--- a/devtools/client/debugger/src/reducers/breakpoints.js
+++ b/devtools/client/debugger/src/reducers/breakpoints.js
@@ -178,9 +178,9 @@ export function getBreakpointCount(state: OuterState): number {
export function getBreakpoint(
state: OuterState,
- location: SourceLocation | null
+ location: ?SourceLocation
): ?Breakpoint {
- if (!location || !location.sourceId) {
+ if (!location) {
return undefined;
}
@@ -212,9 +212,9 @@ export function getBreakpointsForSource(
export function getBreakpointForLocation(
state: OuterState,
- location: SourceLocation | null
+ location: ?SourceLocation
): ?Breakpoint {
- if (!location || !location.sourceId) {
+ if (!location) {
return undefined;
}
@@ -230,4 +230,9 @@ export function getHiddenBreakpoint(state: OuterState): ?Breakpoint {
return breakpoints.find(bp => bp.options.hidden);
}
+export function hasLogpoint(state, location) {
+ const breakpoint = getBreakpoint(state, location);
+ return breakpoint && breakpoint.options.logValue;
+}
+
export default update;
diff --git a/devtools/client/shared/components/Frame.js b/devtools/client/shared/components/Frame.js
index 42e3bf78b3a9..1282e1518351 100644
--- a/devtools/client/shared/components/Frame.js
+++ b/devtools/client/shared/components/Frame.js
@@ -114,14 +114,13 @@ class Frame extends Component {
* @returns {{url: *, line: *, column: *, functionDisplayName: *, options: *}}
*/
getSourceForClick(frame) {
- const { source, line, column, sourceId, options } = frame;
+ const { source, line, column, sourceId } = frame;
return {
url: source,
line,
column,
functionDisplayName: this.props.frame.functionDisplayName,
sourceId,
- options,
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment