//# sourceURL= pragma does not work in JS-inserted <script>s w/ "src" attr
Categories
(DevTools :: Debugger, defect, P3)
Tracking
(firefox61 wontfix, firefox62 wontfix, firefox63 wontfix, firefox77 verified)
People
(Reporter: jochen.kuehner, Assigned: loganfsmyth)
References
(Blocks 2 open bugs)
Details
Attachments
(3 files)
Comment 1•6 years ago
|
||
Comment 2•6 years ago
|
||
Comment 3•6 years ago
|
||
Could you look again Jochen? I can't reproduce in Firefox Nightly.
Reporter | ||
Comment 4•6 years ago
|
||
Reporter | ||
Comment 5•6 years ago
|
||
Yes is still an issue...
Reporter | ||
Comment 6•6 years ago
|
||
For example look at https://www.webcomponents.org/element/@polymer/iron-demo-helpers/demo/demo/index.html
Open Developer Tools, go to "Debugger", Expand "No Domain", klick on first file. It has a SOurceUrl comment but it is not used
Reporter | ||
Comment 7•6 years ago
|
||
Comment 8•6 years ago
|
||
Here is little test case that uses //# sourceURL
in evaluated script (using eval
)
http://janodvarko.cz/tests/bugzilla/1470768/
- Load the page
- Check that
https://www.webcomponents.org/src/lazy-resources.html-5.js
file is in the Sources panel - See also the (index) file that does the
eval
It works just fine.
But, the provided test case is using data: URI, might the issue?
Related MDN page:
https://developer.mozilla.org/en-US/docs/Tools/Debugger/How_to/Debug_eval_sources
Honza
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Assignee | ||
Comment 9•5 years ago
|
||
If you have a <script>
with a data:
URL, //# sourceURL=
can still be very useful for setting the location, but we current limit it's effects to things that we see as "eval-like". This means the pragma works for code evalled as a string, e.g. eval
, new Function
, setTimeout("console.log(42);", 0)
and such, including
const s = document.createElement("script");
s.text = "code; //# sourceURL=";
but it will not work if you take that same code, encode it as a data: URL, and then put it as the src
of a script, e.g.
const s = document.createElement("script");
s.src = "data:application/javascript;base64," + encodeBase64("code; //# sourceURL=");
I don't see a reason for us to have this logic be restricted to eval sources when we could instead make this logic essentially source.displayURL || source.url
. It appears that one of the only reasons we bother right now is to try to make displayURL
relative to a specific URL, but depending on how we deal with https://bugzilla.mozilla.org/show_bug.cgi?id=1192882, we may want to stop doing that anyway? I'll have to do some more research.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 10•5 years ago
|
||
Updated•5 years ago
|
Comment 11•5 years ago
|
||
Comment 12•5 years ago
|
||
Comment 13•5 years ago
|
||
Comment 14•5 years ago
|
||
bugherder |
Updated•5 years ago
|
Comment 15•5 years ago
|
||
Confirmed with 77.0b2 on Windows 10, macOS 10.15.3, Ubuntu 18.04 based on comment 8.
Description
•