Closed Bug 1438642 Opened 6 years ago Closed 5 years ago

Source code view is outdated

Categories

(DevTools :: Debugger, defect)

58 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1528595

People

(Reporter: flack, Unassigned)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:58.0) Gecko/20100101 Firefox/58.0
Build ID: 20180128191252

Steps to reproduce:

- I have a server running on localhost and write PHP/JS code. I have the site open in Firefox
- let's say I add a JS function to my code (directly in the HTML of the page), and I have a typo
- I reload the page in Firefox. 
- The console in Dev Tools shows me an error (which is fine, because I have a typo)


Actual results:

- when I go to the DOM inspector to the script tag where I added my new function, it is not shown.
- when I press Cmd-U to view page source and go to the script tag, my new function is not shown

- when I reload the page a couple of times, it finally appears


Expected results:

Obviously, Firefox is using the latest version of my source code (because otherwise, I wouldn't see the JS error in the console that I just added), so this can't be a caching issue AFAICT. But for some reason the source code that is displayed in View Source and in the DOM inspector is out of date, almost as if it were cached for some reason.

I develop on this machine all the time, and haven't seen this ever, until a couple of days or so ago. I suppose it started the last time FF updated itself, but it's hard to say. In any case, it's really weird and irritating
Component: Untriaged → DOM
Product: Firefox → Core
Pretty sure this is by design.  We try to show the source used to load page, so we prefer http cache if the resource is present there.
(In reply to Ben Kelly [:bkelly] from comment #1)
> Pretty sure this is by design.  We try to show the source used to load page,
> so we prefer http cache if the resource is present there.

Well yes, the source view should correspond to what was used to render the page. My point is that it doesn't. Because like I said, I get a Javascript error in the console, but in the Source View the relevant JS code is not shown. So they seem to be out of sync for some reason
Hmm, ok.  Sorry for my confusion.
I've had this happen to me too quite a few times... but it's hard to reproduce (and yeah, super frustrating/confusing when it happens). :flack, you disabled the HTTP cache in the dev tools settings, I assume? I know that's not the problem (the cache is fine)... but seemed to help me a bit. 

Bouncing to DevTools folks.
Component: DOM → Developer Tools: Debugger
Product: Core → Firefox
Product: Firefox → DevTools

flack, can you still reproduce this?

Flags: needinfo?(flack)

No offense, but I have to say I find this way you let tickets lie for a year or more and then suddenly ask the reporter to reproduce it again a bit ... inefficient (I had this with another ticket recently after about three years of inactivity, so sorry if I sound irritated).

TBH I can't even remember what project I was working on back then. I do still remember that it was somehow atypical (i.e. not framework-based, but rather just a simple PHP file served by Apache or something). In the environments I work in normally, I don't see the issue, but I also haven't done that much frontend work recently (i.e. there wasn't much opportunity to see this again), so make of that what you will

Flags: needinfo?(flack)

I appreciate where you're coming from. Unfortunately, we let the backlog of issues grow to ~900 issues and I'm trying to get help grooming the backlog so that we're back in a manageable state. Over the past two weeks, I've followed up on ~500 bugs and we're now in a better state.

Hopefully, someone from the team can look into this more closely.

Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE

Just saw that this was marked as a duplicate. Are you sure that's true? Because this ticket is about source view (Ctrl-U), the other one seems to be about debugger.

Anywho, just wanted to add that currently, I can reproduce this again. I removed a script tag in my PHP code, pressed Ctrl-F5 to reload the browser tab, looked in the inspector, and it's gone. But when I press Ctrl-U to get the source code, it is still there (see attached screenshot). It doesn't happen all the time and I am not really sure how to reproduce it exactly, but I noticed the last couple of days that it seems to be back (but I'm on a different machine now, with Kubuntu 19.04).

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

Attachment

General

Creator:
Created:
Updated:
Size: