debugger icon indicating copy to clipboard operation
debugger copied to clipboard

[Breakpoints] we should resume if we pause at an old breakpoint

Open jasonLaster opened this issue 9 years ago • 28 comments

With AST BPs and original BPs, it's possible that we've paused at a breakpoint before we've had a chance to move it to a new location. See GIF. In that case, we should check to see if the breakpoint is missing... or in an old location...

Missing

diff --git a/src/actions/pause.js b/src/actions/pause.js
index 4fa84b5..4462642 100644
--- a/src/actions/pause.js
+++ b/src/actions/pause.js
@@ -104,6 +104,11 @@ export function paused(pauseInfo: Pause) {
       dispatch(evaluateExpressions(frame.id));
     }

+    const bp = getBreakpoint(getState(), frame.location);
+    if (why.type == "breakpoint" && !bp) {
+      dispatch(resume());
+    }
+
     dispatch(
       selectSource(frame.location.sourceId, { line: frame.location.line })

has moved

+    const { location, astLocation } = pendingBreakpoint;
+    const previousLocation = { ...location, sourceId };
+
+    const scopedLocation = await makeScopedLocation(
+      astLocation,
+      previousLocation,
+      source
+    );
+
+    const scopedGeneratedLocation = await getGeneratedLocation(
+      getState(),
+      source,
+      scopedLocation,
+      sourceMaps
+    );
+
+    const hasMoved = locationMoved(generatedLocation, scopedGeneratedLocation);
+
+    const bp = getBreakpoint(getState(), frame.location);
+    if ((why.type == "breakpoint" && !bp) || hasMoved) {
+      dispatch(resume());
+    }
+

jasonLaster avatar Sep 20 '17 14:09 jasonLaster

/claim

jacobjzhang avatar Oct 24 '18 02:10 jacobjzhang

Thanks for claiming the issue! :wave:

Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.

:fox_face: Debugger team!

claim avatar Oct 24 '18 02:10 claim

Is this still a relevant issue? I can't seem to reproduce it. In the GIF from a year ago, was that a handspun page or one of the existing examples?

jacobjzhang avatar Oct 24 '18 02:10 jacobjzhang

Disregard, was able to replicate it. I did some digging, haven't done much except copy @jasonLaster's example from a year ago and tweak it in this PR

It seems to just work? I'm not sure of all the scenarios we're trying to cover, but I'm sure there's more. Perhaps one of the mozilla folks can enlighten?

jacobjzhang avatar Oct 24 '18 04:10 jacobjzhang

@loganfsmyth, @jasonLaster told me to check with you on this and the above PR to see if we could get this in. Thoughts on what kind of coverage we need in addition to what's in the PR?

jacobjzhang avatar Oct 24 '18 20:10 jacobjzhang

/claim

WenInCode avatar Jan 15 '19 20:01 WenInCode

Thanks for claiming the issue! :wave:

Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.

:fox_face: Debugger team!

claim avatar Jan 15 '19 20:01 claim

It seems like this may have been resolved by something else? I am unable to reproduce it any more. Altering the source and refreshing, the breakpoint moves to the proper location and pauses. I'm going to close this and we can re-open if someone manages to reproduce it.

WenInCode avatar Mar 07 '19 15:03 WenInCode