This repository was archived by the owner on Jan 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 746
Refactor Pending Breakpoints to fix reloading #2877
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5cab08f
Refactor Pending Breakpoints to fix reloading
jasonLaster 5cf7147
update newSources
jasonLaster 2728a92
address comments in reducers/breakpoints.js
codehag b0f11bf
add helpers to breakpoints
codehag 1fb5dd6
add async to newsource actions in actions/sources tests
codehag f007e95
refactor actions/tests/pending-breakpoints for readability
codehag 1f86764
prefer Promise.resolve to new Promise
codehag 63305a4
make flow type checking happier
codehag 649843b
bump ci node
jasonLaster ddfdbe1
run jest serially
jasonLaster a1609f3
fix mochitests
jasonLaster File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| import { makeLocationId } from "../../../reducers/breakpoints"; | ||
|
|
||
| export const theMockedPendingBreakpoint = { | ||
| location: { | ||
| sourceUrl: "http://localhost:8000/examples/bar.js", | ||
| line: 5, | ||
| column: undefined | ||
| }, | ||
| condition: "3", | ||
| disabled: false | ||
| }; | ||
|
|
||
| export function generateCorrectedBreakpoint(breakpoint, correctedLocation) { | ||
| return Object.assign({}, breakpoint, { location: correctedLocation }); | ||
| } | ||
|
|
||
| function generateCorrectingThreadClient(offset = 0) { | ||
| return { | ||
| setBreakpoint: (location, condition) => { | ||
| const actualLocation = Object.assign({}, location, { | ||
| line: location.line + offset | ||
| }); | ||
|
|
||
| return Promise.resolve({ | ||
| id: makeLocationId(location), | ||
| actualLocation, | ||
| condition | ||
| }); | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| /* in some cases, a breakpoint may be added, but the source will respond | ||
| * with a different breakpoint location. This is due to the breakpoint being | ||
| * added between functions, or somewhere that doesnt make sense. This function | ||
| * simulates that behavior. | ||
| * */ | ||
| export function simulateCorrectThreadClient(offset, location) { | ||
| const correctedThreadClient = generateCorrectingThreadClient(offset); | ||
| const offsetLine = { line: location.line + offset }; | ||
| const correctedLocation = Object.assign({}, location, offsetLine); | ||
| return { correctedThreadClient, correctedLocation }; | ||
| } | ||
|
|
||
| export function generateBreakpoint(filename) { | ||
| return { | ||
| location: { | ||
| sourceUrl: `http://localhost:8000/examples/${filename}`, | ||
| sourceId: filename, | ||
| line: 5 | ||
| }, | ||
| condition: null, | ||
| disabled: false | ||
| }; | ||
| } | ||
|
|
||
| export function generatePendingBreakpoint(breakpoint) { | ||
| const { | ||
| location: { sourceUrl, line, column }, | ||
| condition, | ||
| disabled | ||
| } = breakpoint; | ||
|
|
||
| return { | ||
| location: { sourceUrl, line, column }, | ||
| condition, | ||
| disabled | ||
| }; | ||
| } | ||
|
|
||
| export const simpleMockThreadClient = { | ||
| setBreakpoint: (location, _condition) => | ||
| Promise.resolve({ id: "hi", actualLocation: location }), | ||
|
|
||
| removeBreakpoint: _id => Promise.resolve({ status: "done" }), | ||
|
|
||
| setBreakpointCondition: (_id, _location, _condition, _noSliding) => | ||
| Promise.resolve({ sourceId: "a", line: 5 }) | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned earlier, this block probably needs to be refactored. The if statements do not make sense, as in all cases we will call
await dispatch(addBreakpoint(location, { condition }));. Instead we probably want to use an early return if!isEnabled("columnBreakpoints").