Open Bug 1866938 Opened 1 year ago Updated 29 days ago

Debugger shows "Error: Incorrect contents fetched, please reload."

Categories

(DevTools :: Debugger, defect, P3)

Firefox 120
defect

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: diafygi, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0

Steps to reproduce:

When you load the dev tools debugger, some pages' javascript isn't loaded.

Reproduction steps:

  1. Login to https://bitbucket.org/
  2. Navigate to your profile settings page.
  3. Open the developer tools (right click on the page and select "Inspect Element").
  4. Click the "Debugger" tab in the dev tools.
  5. The source code will show the message: "Error: Incorrect contents fetched, please reload"

Filing a new issue based on this comment from Bug #307089:
https://bugzilla.mozilla.org/show_bug.cgi?id=307089#c86

In reference to my comments on Bug #307089:
https://bugzilla.mozilla.org/show_bug.cgi?id=307089#c55
https://bugzilla.mozilla.org/show_bug.cgi?id=307089#c84

Actual results:

The page's javascript source code didn't show, and an error showed instead.

Expected results:

The page's javascript source code should show.

The Bugbug bot thinks this bug should belong to the 'DevTools::Debugger' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Debugger
Product: Firefox → DevTools

Thanks for reporting. This has been a long existing issue.

Severity: -- → S3
Flags: needinfo?(poirot.alex)
Priority: -- → P3

This issue is specific to HTML pages containing inline scripts (<script> ... some js code ... </script>).
The current implementation relies on receiving the HTML content directly from the HTML parser via some live events:
https://searchfox.org/mozilla-central/rev/996f5bf0b9a32aa0620a841abb9531625fe916aa/devtools/server/actors/utils/sources-manager.js#352
So that if DevTools aren't opened before the HTML page is loaded, you will miss its content and we show this message.

Unfortunately it is complex to be able to retrieve HTML content reliably without causing performance regression on Firefox when DevTools isn't involved.

Flags: needinfo?(poirot.alex)

Hello,

I would like to update that reloading the page with DevTools opened, doesn't seem to work anymore (with newer firefox versions).
This work-around works with version 114.0.2, but not with 120 nor with 127...at least in my cases, where are indeed HTML pages with <scripts> inside.
I can't say if the 114.0.2 is the last version that this work-around works. It might work on newer versions after 114, but I haven't tested them.

I've also noticed that with these new versions (120, 127), whenever I reload the page, inside the Debugger->Sources, a new "Main Thread" tree appears. So if you reload the page 3 times, you get 3 "Main Thread", none of which is working of course. Meaning that although the filenames/paths are visible, the content is not, giving this error "Error: Incorrect contents fetched, please reload.".
Let me stress once more that this problem occurs only in mixed HTML with <script>.

Perhaps this info will give you a clue to fix it.
If you need any details, please do let me know.

I can verify that this stopped working at 115 (at least with 115.12.0esr-1 that I installed from kubuntu's snap).
So the last working version seems to be 114.0.2.

This also breaks in a valid XHTML5 document with a script of the form:
<script>
//<![CDATA[
console.log("hello world");
//]]>
</script>
... that said, I'm not sure why it is breaking. It only seems to happen when the document is behind authentication (caching disabled, auth session cookie). Perhaps devtools is trying to refetch it without the cookie for some reason? Perhaps related to the issue with Basic auth and devtools?

I'm on 131.0.2 and this is standing in the way of me going live with a page. I need to be able to troubleshoot my pages but Firefox can't see the source. Reloading with the dev tools open does not help.

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

Attachment

General

Creator:
Created:
Updated:
Size: