This repository has been archived by the owner on Apr 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
fix: allow snapshots in shorter transpiled files #513
Merged
DominicKramer
merged 11 commits into
googleapis:master
from
DominicKramer:fix/breakpoints-past-file-end
Aug 29, 2018
Merged
fix: allow snapshots in shorter transpiled files #513
DominicKramer
merged 11 commits into
googleapis:master
from
DominicKramer:fix/breakpoints-past-file-end
Aug 29, 2018
Conversation
This file contains 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
If a source file had `n` lines and was transpiled to a JavaScript file with `m` lines with `m < n`, and one tried to set a snapshot on a line between `m+1` and `n` in the original source file, setting the snapshot would incorrectly fail with an error stating that the requested line was beyond the size of the file. Fixes: googleapis#464
googlebot
added
the
cla: yes
This human has signed the Contributor License Agreement.
label
Aug 28, 2018
…mer/cloud-debug-nodejs into fix/breakpoints-past-file-end
soldair
reviewed
Aug 28, 2018
@@ -339,6 +324,20 @@ export class InspectorDebugApi implements debugapi.DebugApi { | |||
column += debugapi.MODULE_WRAP_PREFIX_LENGTH - 1; | |||
} | |||
|
|||
// TODO: Address the case where `breakpoint.location` is `null`. | |||
// TODO: Address the case where `fileStats[matchingScript]` is `null`. | |||
if (line >= (this.fileStats[matchingScript] as FileStats).lines) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/agent/v8/inspector-debugapi.ts
Outdated
return utils.setErrorStatusAndCallback( | ||
cb, breakpoint, StatusMessage.BREAKPOINT_SOURCE_LOCATION, | ||
utils.messages.INVALID_LINE_NUMBER + matchingScript + ':' + | ||
(breakpoint.location as stackdriver.SourceLocation).line + |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/agent/v8/legacy-debugapi.ts
Outdated
return utils.setErrorStatusAndCallback( | ||
cb, breakpoint, StatusMessage.BREAKPOINT_SOURCE_LOCATION, | ||
utils.messages.INVALID_LINE_NUMBER + matchingScript + ':' + | ||
(breakpoint.location as stackdriver.SourceLocation).line + |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
soldair
approved these changes
Aug 28, 2018
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.
approved with nits about the line number in the error message
…mer/cloud-debug-nodejs into fix/breakpoints-past-file-end
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
If a source file had
n
lines and was transpiled to a JavaScriptfile with
m
lines withm < n
, and one tried to set a snapshoton a line between
m+1
andn
in the original source file,setting the snapshot would incorrectly fail with an error stating
that the requested line was beyond the size of the file.
Fixes: #464