mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-07 04:26:32 +08:00
This CL removes a race that may happen if PersistenceImpl tries to move a breakpoint from one UISourceCode to another UISourceCode by explicitly awaiting the calls to remove/setBreakpoint in PersistenceImpl. The race happens in the following case (affecting snippets): * A snippet is created, and the user sets a breakpoint and reloads the page. * PersistenceImpl.ts will try to move the breakpoint via 1. removing the breakpoint from the old UISourceCode, and 2. re-setting the breakpoint on the new UISourceCode. * Simultaneously, the BreakpointManager tries to set a breakpoint on the new UISourceCode * For snippets, the url stays the same after reloading, and in some cases the `setBreakpointByURL` of the PersistenceImpl and the BreakpointManager will be sent to v8 one after another, such that v8 returns a ServerError, as it has already set the breakpoint previously This race causes the breakpoint to completely disappear, since DevTools front-end removes the breakpoint if it sees a ServerError. Drive-by: Added additional clean up step to tests. Bug: 1280621 Change-Id: I7c9cd94c02d80661100cc5c5141e7d0dbb027f6d Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3629862 Reviewed-by: Simon Zünd <szuend@chromium.org> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org> Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>