Skip to content

Instantly share code, notes, and snippets.

@jasonLaster
Created August 13, 2019 19:18
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/a63574c6f7a278582ff93373854c7c2e to your computer and use it in GitHub Desktop.
Save jasonLaster/a63574c6f7a278582ff93373854c7c2e to your computer and use it in GitHub Desktop.
diff --git a/devtools/server/actors/common.js b/devtools/server/actors/common.js
index 865a2379f2c9..43ed75769340 100644
--- a/devtools/server/actors/common.js
+++ b/devtools/server/actors/common.js
@@ -145,6 +145,10 @@ SourceLocation.prototype = {
return this._lastColumn;
},
+ get sourceUrl() {
+ return this.sourceActor.url;
+ },
+
equals: function(other) {
return (
this.sourceActor.url == other.sourceActor.url &&
@@ -161,6 +165,7 @@ SourceLocation.prototype = {
line: this.line,
column: this.column,
lastColumn: this.lastColumn,
+ sourceUrl: this.sourceUrl,
};
},
};
diff --git a/devtools/server/actors/thread.js b/devtools/server/actors/thread.js
index d42e64d63f20..4dc6d5ffe55a 100644
--- a/devtools/server/actors/thread.js
+++ b/devtools/server/actors/thread.js
@@ -1760,16 +1760,17 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
*/
onDebuggerStatement: function(frame) {
const location = this.sources.getFrameLocation(frame);
- const url = location.sourceActor.url;
// Don't pause if
- // 1. the debugger is in the same position
+ // 1. we have not moved since the last pause
// 2. breakpoints are disabled
// 3. the source is blackboxed
+ // 4. there is a breakpoint at the same location
if (
!this.hasMoved(frame, "debuggerStatement") ||
this.skipBreakpoints ||
- this.sources.isBlackBoxed(url)
+ this.sources.isBlackBoxed(location.sourceUrl) ||
+ this.breakpointActorMap.get(location)
) {
return undefined;
}
diff --git a/devtools/server/actors/utils/breakpoint-actor-map.js b/devtools/server/actors/utils/breakpoint-actor-map.js
index a0ad07517680..2773ec723b02 100644
--- a/devtools/server/actors/utils/breakpoint-actor-map.js
+++ b/devtools/server/actors/utils/breakpoint-actor-map.js
@@ -21,6 +21,8 @@ BreakpointActorMap.prototype = {
// See also duplicate code in commands.js :(
_locationKey(location) {
const { sourceUrl, sourceId, line, column } = location;
+
+ console.log(`>> _locationKey`, { sourceUrl, sourceId, line, column });
return `${sourceUrl}:${sourceId}:${line}:${column}`;
},
@@ -53,6 +55,11 @@ BreakpointActorMap.prototype = {
return this._actors[key];
},
+ get(location) {
+ const key = this._locationKey(location);
+ return this._actors[key];
+ },
+
/**
* Delete the BreakpointActor from the given location in this
* BreakpointActorMap.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment