Open Bug 1037721 Opened 11 years ago Updated 2 months ago

Figure out whether we can get rid of the forceGet argument to location.reload

Categories

(Core :: DOM: Core & HTML, defect, P5)

x86
macOS
defect

Tracking

()

People

(Reporter: bzbarsky, Unassigned)

References

(Blocks 2 open bugs)

Details

(Keywords: dev-doc-needed, webcompat:platform-bug)

User Story

user-impact-score:20
It's not there in the spec.
So both W3Schools and MDN claim the arg exists. However location.reload.length == 0 in every single non-Gecko-based browser I can find. And at least source inspection suggests webkit/blink don't have that arg. In our tree, we have a dozen or two uses of reload(true) at first glance, mostly in tests. I don't know about non-literals being passed in, or extensions. :(
Interested to know Ilya Grigorik's take on this. I've seen him use location.reload(true) in examples.
The bug on the specification for adding this turned out to be INVALID. I didn't know it was only Gecko that supported this. Do please reopen that bug if the circumstances here change: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27764
"forceGet" always worked in Chrome because we make conditional requests on `location.reload()`, so we were able to cache-bust resources with a future max-age even without `location.reload(true)`. Appears that Firefox also makes conditional requests on `location.reload()`, so the boolean can be dropped and work as Chrome does now. Maybe Firefox used to fetch resources with future max-age from the cache on `location.reload()`? That might explain why the boolean used to be useful.
No, having the boolean false still forced cache revalidation via conditional request. The boolean being true does a lot more than do conditional requests. It completely bypasses the cache, it forces creation of a new HTTP connection instead of reuse of an existing one, it disables pipelining on that connection, and if we're doing an HTTP 1.1 request sends a "Cache-Control: no-cache" on the outgoing request (and a "Pragma: no-cache" if doing HTTP 1.0), to bypass proxy caches. The boolean being false will do "Cache-Control: max-age=0" on the request if HTTP 1.1, else also "Pragma: no-cache". And of course it'll force the use of a conditional request no matter what max-age our cache has. But it won't do those other bits.
Sorry, I wasn't clear. I was referring to the posts Ilya posted. I mean their techniques still work without boolean-true, because of the conditional requests, which is why they work in Chrome too.
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
Severity: normal → S3
Blocks: 1997120
User Story: (updated)
You need to log in before you can comment on or make changes to this bug.