[webkit-changes] [WebKit/WebKit] 66a67b: Make sure `Clear-Site-Data: "cache"` properly clea...

Chris Dumez noreply at github.com
Thu Feb 2 13:45:12 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 66a67bafdb3335c5c4f2849a0fdaff0a9c69374f
      https://github.com/WebKit/WebKit/commit/66a67bafdb3335c5c4f2849a0fdaff0a9c69374f
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2023-02-02 (Thu, 02 Feb 2023)

  Changed paths:
    A LayoutTests/http/wpt/clear-site-data/clear-back-forward-cache-expected.txt
    A LayoutTests/http/wpt/clear-site-data/clear-back-forward-cache.html
    A LayoutTests/http/wpt/clear-site-data/resources/clear-back-forward-cache-popup.html
    A LayoutTests/http/wpt/clear-site-data/resources/logout.html
    A LayoutTests/http/wpt/clear-site-data/resources/logout.html.headers
    M Source/WebCore/history/BackForwardCache.cpp
    M Source/WebCore/loader/DocumentLoader.cpp
    M Source/WebCore/loader/DocumentLoader.h
    M Source/WebCore/platform/network/HTTPParsers.cpp
    M Source/WebCore/platform/network/HTTPParsers.h
    M Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp

  Log Message:
  -----------
  Make sure `Clear-Site-Data: "cache"` properly clears the last back/forward cache entry
https://bugs.webkit.org/show_bug.cgi?id=251470

Reviewed by Geoffrey Garen.

Make sure `Clear-Site-Data: "cache"` properly clears the last back/forward
cache entry.

In the case, where page "LoggedIn" is navigating to page "LoggedOut"
(same-origin) and the "LoggedOut" page serves the `Clear-Site-Data: "cache"`
HTTP header, we expect no back/forward cache entry for "LoggedIn" to be
present.

The `Clear-Site-Data` header gets handled in the NetworkProcess when the
network response is received. At this point, we do indeed ask to clear existing
back/forward cache entries for the origin. However, we only create the
back/forward cache entry for the current page when committing the load, which
occurs later on. This means we would clear the back/forward entries for the
origin but then still create one for "LoggedIn".

To address the issue, the back/forward cache logic in WebCore now also checks
the `Clear-Site-Data` HTTP header on the response and disables back/forward
caching if we're navigating to a same-origin resource that serves
`Clear-Site-Data: "cache"`.

Note that the navigation gesture snapshot still gets generated for such
navigation. I will address this in a follow-up.

* LayoutTests/http/wpt/clear-site-data/clear-back-forward-cache-expected.txt: Added.
* LayoutTests/http/wpt/clear-site-data/clear-back-forward-cache.html: Added.
* LayoutTests/http/wpt/clear-site-data/resources/clear-back-forward-cache-popup.html: Added.
* LayoutTests/http/wpt/clear-site-data/resources/logout.html: Added.
* LayoutTests/http/wpt/clear-site-data/resources/logout.html.headers: Added.
* Source/WebCore/history/BackForwardCache.cpp:
(WebCore::canCachePage):
* Source/WebCore/loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::responseReceived):
* Source/WebCore/loader/DocumentLoader.h:
(WebCore::DocumentLoader::responseClearSiteDataValues const):
* Source/WebCore/platform/network/HTTPParsers.cpp:
(WebCore::parseClearSiteDataHeader):
* Source/WebCore/platform/network/HTTPParsers.h:
* Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::processClearSiteDataHeader):

Canonical link: https://commits.webkit.org/259777@main




More information about the webkit-changes mailing list