| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Review requested:
|
Sorry, something went wrong.
V8 already parses the source map magic comments. Currently, only scripts and functions expose the parsed source map URLs. It is unnecessary to parse the source map magic comments again when the parsed information is available.
| if (result | ||
| ->Set(parsing_context, | ||
| env->source_map_url_string(), | ||
| fn->GetScriptOrigin().SourceMapUrl()) |
There was a problem hiding this comment.
Does this work with the debug build? I think this being empty could trigger a DCHECK.
Sorry, something went wrong.
There was a problem hiding this comment.
I added a test on no magic comment presents. Verified with debug build that no DCHECK are violated.
Sorry, something went wrong.
Sorry, something went wrong.
| // This is needed so that we don't match sourceMappingURL in string literals. | ||
| while ((match = RegExpPrototypeExec(kSourceMappingURLMagicComment, content))) { | ||
| lastMatch = match; | ||
| if (sourceMapURL === undefined) { |
There was a problem hiding this comment.
Is it by design that we still do the regex parse when V8 told us that there is no source map? If so, should we add a test case, e.g.:
checkSourceMapUrl(`
function myFunc() {}
`
//# sourceMappingURL=sourcemap.json
`;
`, 'sourcemap.json');
Sorry, something went wrong.
There was a problem hiding this comment.
I think this fallback is kept here to handle the ES modules?
Sorry, something went wrong.
There was a problem hiding this comment.
@jkrems @joyeecheung thanks for the suggestion. We don't need to apply the regex again when the parse result of the script indicates that no source mapping URL is available. I've updated the code to eliminate the duplicated scans.
It is true that the fallback is left here to handle the ES modules.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
| // This is needed so that we don't match sourceMappingURL in string literals. | ||
| while ((match = RegExpPrototypeExec(kSourceMappingURLMagicComment, content))) { | ||
| lastMatch = match; | ||
| if (sourceMapURL === undefined) { |
There was a problem hiding this comment.
I think this fallback is kept here to handle the ES modules?
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
|
@jkrems @joyeecheung would you mind taking a look again at this with the updates on #44798 (comment)? thank you! |
Sorry, something went wrong.
|
Landed in 6bdc101. Thank you for the reviews! |
Sorry, something went wrong.
V8 already parses the source map magic comments. Currently, only scripts and functions expose the parsed source map URLs. It is unnecessary to parse the source map magic comments again when the parsed information is available. PR-URL: #44798 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Jan Krems <jan.krems@gmail.com>
V8 already parses the source map magic comments. Currently, only scripts and functions expose the parsed source map URLs. It is unnecessary to parse the source map magic comments again when the parsed information is available. PR-URL: #44798 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Jan Krems <jan.krems@gmail.com>
V8 already parses the source map magic comments. Currently, only scripts and functions expose the parsed source map URLs. It is unnecessary to parse the source map magic comments again when the parsed information is available. PR-URL: #44798 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Jan Krems <jan.krems@gmail.com>
V8 already parses the source map magic comments. Currently, only scripts and functions expose the parsed source map URLs. It is unnecessary to parse the source map magic comments again when the parsed information is available. PR-URL: #44798 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Jan Krems <jan.krems@gmail.com>
V8 already parses the source map magic comments. Currently, only scripts and functions expose the parsed source map URLs. It is unnecessary to parse the source map magic comments again when the parsed information is available. PR-URL: #44798 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Jan Krems <jan.krems@gmail.com>
| Back | FazBrowse Home | New Git URL |
V8 already parses the source map magic comments. Currently, only scripts
and functions expose the parsed source map URLs. It is unnecessary to
parse the source map magic comments again when the parsed information is
available.
Retrieving source map URL of a Module needs a V8 patch, working on
https://chromium-review.googlesource.com/c/v8/v8/+/3917379.