RESOLVED FIXED 208381
Add quirk to disable to back/forward cache on docs.google.com
https://bugs.webkit.org/show_bug.cgi?id=208381
Summary Add quirk to disable to back/forward cache on docs.google.com
Chris Dumez
Reported 2020-02-28 10:37:06 PST
Add quirk to disable to back/forward cache on docs.google.com. docs.google.com used to bypass the back/forward cache by serving "Cache-Control: no-store" over HTTPS. We started caching such content in r250437 but the docs.google.com content unfortunately is not currently compatible because it puts an overlay over the page and starts an animation when navigating away and fails to remove those when coming back from the back/forward cache (e.g. in 'pageshow' event handler).
Attachments
Patch (2.40 KB, patch)
2020-02-28 10:38 PST, Chris Dumez
no flags
Patch (2.81 KB, patch)
2020-02-28 17:01 PST, Chris Dumez
no flags
Chris Dumez
Comment 1 2020-02-28 10:37:22 PST
Chris Dumez
Comment 2 2020-02-28 10:38:36 PST
Ryosuke Niwa
Comment 3 2020-02-28 13:42:48 PST
Comment on attachment 391990 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=391990&action=review > Source/WebCore/page/Quirks.cpp:634 > + if (topURL.protocolIs("https") && equalLettersIgnoringASCIICase(host, "docs.google.com")) { Hm... this wouldn't work with Google's hosted apps, would it?
Chris Dumez
Comment 4 2020-02-28 13:44:19 PST
(In reply to Ryosuke Niwa from comment #3) > Comment on attachment 391990 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=391990&action=review > > > Source/WebCore/page/Quirks.cpp:634 > > + if (topURL.protocolIs("https") && equalLettersIgnoringASCIICase(host, "docs.google.com")) { > > Hm... this wouldn't work with Google's hosted apps, would it? Good point. Ideally, we'd find another way to detect google docs which does not rely on the host. Will need to think about it.
Ryosuke Niwa
Comment 5 2020-02-28 13:53:47 PST
(In reply to Chris Dumez from comment #4) > (In reply to Ryosuke Niwa from comment #3) > > Comment on attachment 391990 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=391990&action=review > > > > > Source/WebCore/page/Quirks.cpp:634 > > > + if (topURL.protocolIs("https") && equalLettersIgnoringASCIICase(host, "docs.google.com")) { > > > > Hm... this wouldn't work with Google's hosted apps, would it? > > Good point. Ideally, we'd find another way to detect google docs which does > not rely on the host. Will need to think about it. Do they add some kind of event listener, meta tag, etc... that makes it easy to target?
Chris Dumez
Comment 6 2020-02-28 17:01:28 PST
Chris Dumez
Comment 7 2020-02-28 17:02:43 PST
(In reply to Ryosuke Niwa from comment #5) > (In reply to Chris Dumez from comment #4) > > (In reply to Ryosuke Niwa from comment #3) > > > Comment on attachment 391990 [details] > > > Patch > > > > > > View in context: > > > https://bugs.webkit.org/attachment.cgi?id=391990&action=review > > > > > > > Source/WebCore/page/Quirks.cpp:634 > > > > + if (topURL.protocolIs("https") && equalLettersIgnoringASCIICase(host, "docs.google.com")) { > > > > > > Hm... this wouldn't work with Google's hosted apps, would it? > > > > Good point. Ideally, we'd find another way to detect google docs which does > > not rely on the host. Will need to think about it. > > Do they add some kind of event listener, meta tag, etc... that makes it easy > to target? Here is an alternative fix that works by detecting the overlay that they put on top of the page when navigating away.
Ryosuke Niwa
Comment 8 2020-02-28 21:46:40 PST
Comment on attachment 392034 [details] Patch Looks good to me.
Chris Dumez
Comment 9 2020-03-02 08:25:28 PST
Comment on attachment 392034 [details] Patch Clearing flags on attachment: 392034 Committed r257714: <https://trac.webkit.org/changeset/257714>
Chris Dumez
Comment 10 2020-03-02 08:25:30 PST
All reviewed patches have been landed. Closing bug.
Konstantin Tokarev
Comment 11 2020-03-02 08:30:36 PST
Is it really correct to have such a quirk specifically for Google Docs? Any other web application can be potentially broken, as they may rely on Cache-Control headers to work properly in any navigation.
Chris Dumez
Comment 12 2020-03-02 08:36:25 PST
(In reply to Konstantin Tokarev from comment #11) > Is it really correct to have such a quirk specifically for Google Docs? Any > other web application can be potentially broken, as they may rely on > Cache-Control headers to work properly in any navigation. Cache-Control is about the HTTP disk cache, and works. There is no documented impact of the Cache-Control header on the back/forward cache.
Konstantin Tokarev
Comment 13 2020-03-02 08:44:16 PST
It seems to me that RFC 7234 doesn't make a difference between disk and memory caches. And CachedResourceLoader (rightfully) takes them into account, though it's not a disk cache.
Konstantin Tokarev
Comment 14 2020-03-02 08:56:42 PST
If there is a consensus that back/forward cache should be exempt from caching rules[*], IMHO it needs to be codified somewhere in Web Platform standards so that authors could design their pages accordingly. [*]given that Google product doesn't assume this it seems to me there isn't)
Ryosuke Niwa
Comment 15 2020-03-02 23:18:46 PST
(In reply to Konstantin Tokarev from comment #14) > If there is a consensus that back/forward cache should be exempt from > caching rules[*], IMHO it needs to be codified somewhere in Web Platform > standards so that authors could design their pages accordingly. > > [*]given that Google product doesn't assume this it seems to me there isn't) Back/Forward cache isn't like a "cache". When a page is put into back/forward cache, all page's states are still here. It's as if the page never navigated away. So it's not really a cache in the sense of the browser saving sub-resources & re-loading a web page using those cached resources. For web pages, it behaves as if the user hadn't navigated away / never been closed.
Note You need to log in before you can comment on or make changes to this bug.