-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Fix relative paths in wasm backend source maps. Fixes #9837 #9882
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
Changes from 2 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
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -263,7 +263,7 @@ def build_sourcemap(entries, code_section_offset, prefixes, collect_sources): | |
if column == 0: | ||
column = 1 | ||
address = entry['address'] + code_section_offset | ||
file_name = entry['file'] | ||
file_name = os.path.relpath(entry['file']) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure this is correct: it uses a path relative to the current directory, but browsers / spec expect For example, consider case like following: $ emcc ./temp.c -g4 -o dist/temp.wasm Currently this produces a source map {"version":3,"sources":["./temp.c"],... But this is incorrect, because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case wouldn't the user need to set up There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So But once browser found that source map, it now needs to find source files. There are three potential ways for it to do that:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, maybe you're right, and in this case There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, wait, scratch that, because relative URL still has to be relative to the source map itself. So the comment before still stands :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What browser is basically doing:
So we need each item in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! I think I see a little better. I'm still confused about how that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In both places it's used as "URL of the .wasm.map". First, to find the map, and later to resolve other files it references, but semantic meaning is the same. It's similar to how most module systems work, too: if A imports B, and B imports C, then first B is found from A, and then reference to C is resolve relatively to B. |
||
source_name = prefixes.sources.resolve(file_name) | ||
if source_name not in sources_map: | ||
source_id = len(sources) | ||
|
Uh oh!
There was an error while loading. Please reload this page.