RESOLVED FIXED 202434
XMLHttpRequest sometimes prevents pages from entering the back/forward cache
https://bugs.webkit.org/show_bug.cgi?id=202434
Summary XMLHttpRequest sometimes prevents pages from entering the back/forward cache
Chris Dumez
Reported 2019-10-01 14:37:12 PDT
XMLHttpRequest sometimes prevents pages from entering the back/forward cache.
Attachments
Patch (5.97 KB, patch)
2019-10-01 15:44 PDT, Chris Dumez
no flags
Radar WebKit Bug Importer
Comment 1 2019-10-01 14:37:38 PDT
Chris Dumez
Comment 2 2019-10-01 15:44:32 PDT
Geoffrey Garen
Comment 3 2019-10-03 13:44:29 PDT
Comment on attachment 379958 [details] Patch r=me Isn't it also the case that the document refuses to cache if it has not fired the load event yet? It seems like tight coupling for an XHR object to maintain invariants on behalf of the document.
Chris Dumez
Comment 4 2019-10-03 13:46:02 PDT
(In reply to Geoffrey Garen from comment #3) > Comment on attachment 379958 [details] > Patch > > r=me > > Isn't it also the case that the document refuses to cache if it has not > fired the load event yet? It seems like tight coupling for an XHR object to > maintain invariants on behalf of the document. It is true for the main frame but not necessarily true for subframes (that were added later on, after the load event had fired in the main frame).
Geoffrey Garen
Comment 5 2019-10-03 13:48:49 PDT
> > Isn't it also the case that the document refuses to cache if it has not > > fired the load event yet? It seems like tight coupling for an XHR object to > > maintain invariants on behalf of the document. > > It is true for the main frame but not necessarily true for subframes (that > were added later on, after the load event had fired in the main frame). If a subframe has not loaded yet, and we cancel its loads in order to enter the page cache, doesn't that present the same concern -- that the subframe document will fire its load event while in the page cache?
Chris Dumez
Comment 6 2019-10-03 13:51:37 PDT
(In reply to Geoffrey Garen from comment #5) > > > Isn't it also the case that the document refuses to cache if it has not > > > fired the load event yet? It seems like tight coupling for an XHR object to > > > maintain invariants on behalf of the document. > > > > It is true for the main frame but not necessarily true for subframes (that > > were added later on, after the load event had fired in the main frame). > > If a subframe has not loaded yet, and we cancel its loads in order to enter > the page cache, doesn't that present the same concern -- that the subframe > document will fire its load event while in the page cache? No, the load event would fire before entering PageCache, which is when we stop the loads. The issue here is that XMLHttpRequest stops its load in the "suspend" function (where script is not allowed to run). This can be refactored further so that XMLHttpRequest no longer stops its loads in suspend though. I can look into it in a follow-up.
Geoffrey Garen
Comment 7 2019-10-03 13:57:58 PDT
Sounds good.
WebKit Commit Bot
Comment 8 2019-10-03 14:29:50 PDT
Comment on attachment 379958 [details] Patch Clearing flags on attachment: 379958 Committed r250678: <https://trac.webkit.org/changeset/250678>
WebKit Commit Bot
Comment 9 2019-10-03 14:29:51 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.