Source content is wrong when hitting a breakpoint on an updated script
Categories
(DevTools :: Debugger, defect, P3)
Tracking
(Not tracked)
People
(Reporter: ochameau, Unassigned)
References
(Depends on 1 open bug, Blocks 1 open bug)
Details
Attachments
(1 file)
When we are loading multiple source from the same URL,
we end up with one Redux source object, but multiple source-actor objects (and related source actors, and related Debugger.Source objects).
But the frontend only fetch the first source actor text content.
Because of that, when we are hitting a breakpoint on all but the very first loaded script, the source text content will be wrong.
STR:
- open a page with
<script src=script.js>
and script.js=console.log("foo"); debugger
- change script.js to
console.log("bar"); debugger
- re-add the same
<script src=script.js>
Actual result:
console.log("foo"); debugger
is shown in the editor
Expected result:
console.log("bar"); debugger
should be shown instead.
Reporter | ||
Comment 1•3 years ago
|
||
This helps update the source content to the precise content of the source we just hit a breakpoint.
This is useful when we get many sources loaded from the same URL.
They will be displayed as a unique entry in the Source Tree,
but they may have distinct content.
For now, we were arbritarily displaying the content of the first available source actor.
Now, we update the content with the source actor from which we hit a breakpoint.
From the Source Tree, you would still not be able to manually see the distinct source contents
for the same URL. But at least, the content is correct when you are hitting a breakpoint!
Reporter | ||
Comment 2•3 years ago
|
||
Some related bugs: bug 1517625, bug 1131756, bug 973879.
But I couldn't see any bug opened and not resolved about any reload script?
Unless these script generate distinct URL, they are meant to fail because of this.
Honza, I think you mentioned using yourself one of these script and having issues with Firefox.
Would you have some time to give it another try and see if the attached patch fixes everything?
Comment 3•3 years ago
•
|
||
I was testing this and I can't reproduce the original problem (using Firefox Nightly)
I couldn't repro using the STRs in comment #0 and I also tried my own test case. The test case utilizes http://janodvarko.cz/tests/bugzilla/1751063/script.php
that returns different script source every time it's called (it generates console.log call with the current time).
Here is my test case http://janodvarko.cz/tests/bugzilla/1751063/
(see instructions on the page)
Honza
Comment 4•3 years ago
•
|
||
I updated the test page, it now shows that the script is not properly updated (no BP involved though)
I am yet working on a test that is based on React hot reload.
Updated•3 years ago
|
Updated•3 years ago
|
Reporter | ||
Comment 5•2 years ago
|
||
Bug 1787198 started fixing a few things around this. The source content starts being correct if you close the related tab/source editor.
Description
•