Closed Bug 1582266 Opened 5 years ago Closed 5 years ago

Never show incorrect source contents

Categories

(DevTools :: Debugger, enhancement, P2)

enhancement

Tracking

(firefox73 fixed)

RESOLVED FIXED
Firefox 73
Tracking Status
firefox73 --- fixed

People

(Reporter: bhackett1024, Assigned: bhackett1024)

References

(Blocks 3 open bugs)

Details

Attachments

(1 file)

Several times this year I've had to fix bugs related to the debugger showing incorrect contents for sources on a page. Bug 1577407 is a fresh instance of this, and there are other issues outstanding, like attaching the debugger to a page and fetching the wrong HTML.

Whenever this happens it is very confusing for users, and we should make sure that it can never happen. The server has the text which was compiled and ran, and we can cross check that against the text we send up to the client and make sure we are never giving the client bogus source text. A potential complexity is that the client will collate sources for inline scripts in an HTML file, and if we are able to determine that an inline source does not appear in the HTML then the client needs to show it separately.

Blocks: dbg-sources
Priority: -- → P3
Blocks: 1569969

P2 as similar inconsistencies have been coming a lot lately.

Priority: P3 → P2

Implementing this is tricky. The difficulty is that when we have multiple source actors with the same URL, we group them into the same source without knowing whether their contents match. They are probably part of the same stream of text, but might not be if either (a) they loaded different content at different times for the same URL, or (b) they are all part of the same HTML file, but we weren't able to determine the contents of that HTML (we had to fetch the contents and got back the wrong result). So, we need to account for the possibility that we discover at some later time that source actors we've grouped together do not actually have the same text. There are a few ways I can think of for dealing with this:

  • We could avoid grouping source actors together in the first place. This wouldn't require any special handling to deal with the case where the actors have different contents, but would require some pretty significant reorganization of how we deal with breakpoints and other per-source state.

  • If we determine that a source has actors with inconsistent text, we could split the actors off into new sources. This would need similar handling to the above option for dealing with breakpoints and so forth.

  • If we determine that a source has actors with inconsistent text, we could stick with one source and just replace its contents as necessary, e.g. when we want to show the source for a specific actor (e.g. the user selected a stack frame in a paused thread) we make sure the contents we show are correct for that source actor.

I'm inclined to go with the last option, because even though it's a little weird it's the simplest approach and I don't think this problem calls for a large scale reorganization of the reducers.

This is a little simpler than the approaches discussed above, and just deal with the case where the server fetches contents for a URL which do not match up with the actual contents of the sources. If the server detects a mismatch, it fabricates new contents for the URL which combine the contents of all the source actors associated with that URL. For an HTML file this will be a block of text with only the inline scripts and no HTML tags.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 73
Regressions: 1603311
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: