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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix relative paths in wasm backend source maps. Fixes #9837 #9882
Fix relative paths in wasm backend source maps. Fixes #9837 #9882
Changes from 12 commits
a213913
c813941
6367083
4c2cf4a
842caaf
acef71d
a9467bd
18ac680
c9a3bd0
bb04bd9
917b74c
3b15d9e
6bdc495
8412ca7
2174057
f2b9909
450097c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I'm not sure if we should do anything special here... since we're talking about edge cases anyway, consider one where a static server that is hosting
/
directory under, say,http://somedomain/static/
.Then, let's say Wasm is under
/dist/temp.wasm
on the disk (corresponding to URL:http://somedomain/static/dist/temp.wasm
on server), and source is under/src/temp.c
(URL:http://somedomain/static/src/temp.c
).If you use relative paths, then source would be encoded as
../src/temp.c
and resolve correctly in URL context, but if you keep it as-is, then it would be encoded as/src/temp.c
and resolve tohttp://somedomain/src/temp.c
in browser, which is invalid.TL;DR - let's just do the simple thing and use relative paths unconditionally, which would happen to also cover edge cases more correctly.
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.
That would break the current
other.test_wasm_sourcemap
test, it gets this as the source file location:Is that ok?
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.
(if that's not ok, what would the proper output there be, do you think?)
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.
I see, interesting. Where is
wasm-src://
added? We probably should skip resolving relative paths altogether when that option is enabled.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.
It's added in the test, using the
--prefix
flag to the source map tool (which I don't understand well).Maybe we can remove that option? If you and @yurydelendik agree that should be fine as I don't see other users in the codebase.
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.
@yurydelendik Doesn't
-fdebug-prefix-map
in Clang change DWARF paths in-place to the remapped locations? If it does, then what is the role of custom--prefix
handling?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.
To do it after the fact of creating a wasm binary. (
-fdebug-prefix-map
did not work in rustc at the moment of writing wasm-sourcemap.py)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.
Sure, but now that both compilers support native remapping, it seems that we can just skip it here?
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.
the
--base_path
logic is a really narrow case of the--prefix
. The former assumes that sources folders will have the same directory structure when published and calculates replacement part automatically, the latter provides more flexibility. FWIW they can exist together (by addingelse:
forprefixes.sources.resolve
line). Sorry, I cannot provide more definite "yes, let's remove it", since I accustomed to the--prefix
way. :)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.
Thanks @RReverser , you are right, I had that mixed up! Should be correct now - use the prefixes if provided, otherwise use a proper relative path.