dynamically loaded js file incorrectly identified as part of jquery
Categories
(DevTools :: Debugger, defect, P2)
Tracking
(Not tracked)
People
(Reporter: r.ribas.jaume, Unassigned, NeedInfo)
References
(Depends on 1 open bug, Blocks 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
2.28 KB,
image/png
|
Details |
User Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0
Steps to reproduce:
Load js file dynamically using jquery ajax request. Write name of function defined in this file in console and double click to go to source.
Actual results:
Instead of opening the correct file, the jquery source file is opened.
I also noticed that when debugging one of this functions it is grouped under jquery in the call stack.
Expected results:
Open the dynamically loaded file containing the function definition.
Comment 1•4 years ago
|
||
Bugbug thinks this bug should belong to this component, but please revert this change in case of error.
Updated•4 years ago
|
Comment 2•4 years ago
|
||
r.ribas.jaume, do you have a test case or could create one to see how this source is loaded?
Reporter | ||
Comment 3•4 years ago
|
||
I've tried to isolate the error in a test case but apparently it's not as simple as I thought to get this error.
I still can't reproduce it outside of the project where I found it.
Unfortunately I can't give access to that particular project because it is not a public facing site.
I might try to isolate it again in the future.
Comment 4•4 years ago
|
||
The severity field is not set for this bug.
:jlast, could you have a look please?
For more information, please visit auto_nag documentation.
Comment 5•4 years ago
|
||
I was pretty sure I knew why this was happening, so just verified.
Here's repro steps without needing jQuery
- Make an HTML file containing:
<script>
(async () => {
const res = await fetch("random.js");
const text = await res.text();
var s = document.createElement("script");
s.text = text;
document.head.append(s);
})();
</script>
and a "random.js" file containing
function fn(){}
console.log(fn);
jQuery doesn't use eval
to actually run scripts, it inserts script tags either with text content or a "src".
Because an injected inline script has no useful URL it currently ends up with the URL of the file that did the injecting of the element. This all ties back to https://bugzilla.mozilla.org/show_bug.cgi?id=1641121 because this "Jump to Definition" logic is one of the cases where we don't currently send a source actor ID along with the location information, so all "Jump to Definition" has to work with is a URL that is wrong. We should really be sending the source actor ID along with the function URL data.
Comment 6•4 years ago
|
||
The severity field is not set for this bug.
:jlast, could you have a look please?
For more information, please visit auto_nag documentation.
Comment hidden (spam) |
Updated•4 years ago
|
Comment 8•4 years ago
|
||
I assume this will be fixed via Bug 1641121, let's keep both open for now.
Updated•2 years ago
|
Comment 9•2 years ago
|
||
Redirect a needinfo that is pending on an inactive user to the triage owner.
:bomsy, since the bug has high priority and recent activity, could you have a look please?
For more information, please visit auto_nag documentation.
Description
•