Open Bug 1751063 Opened 2 years ago Updated 1 year ago

Source content is wrong when hitting a breakpoint on an updated script


(DevTools :: Debugger, defect, P3)



(Not tracked)


(Reporter: ochameau, Unassigned)


(Depends on 1 open bug, Blocks 1 open bug)



(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.


  • 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.

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!

Depends on: 1751067

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?

Flags: needinfo?(odvarko)

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 that returns different script source every time it's called (it generates console.log call with the current time).

Here is my test case
(see instructions on the page)


Flags: needinfo?(odvarko)

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.

Severity: -- → S3
Priority: -- → P3

Bug 1787198 started fixing a few things around this. The source content starts being correct if you close the related tab/source editor.

Depends on: 1787198
You need to log in before you can comment on or make changes to this bug.