Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: eb08df79713cd4903328e7c76a52bc994d8d3be0
      
https://github.com/WebKit/WebKit/commit/eb08df79713cd4903328e7c76a52bc994d8d3be0
  Author: Yoav Weiss <[email protected]>
  Date:   2025-12-10 (Wed, 10 Dec 2025)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/speculation-rules/prefetch/prefetch-uses-cache.sub.https_cross-site-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/speculation-rules/prefetch/prefetch-uses-cache.sub.https_same-site-expected.txt
    M Source/WebCore/loader/DocumentLoader.cpp
    M Source/WebCore/loader/DocumentPrefetcher.cpp
    M Source/WebCore/loader/DocumentPrefetcher.h
    M Source/WebCore/loader/FrameLoader.cpp
    M Source/WebCore/loader/ResourceTiming.cpp
    M Source/WebCore/loader/ResourceTiming.h
    M Source/WebCore/platform/network/NetworkLoadMetrics.cpp
    M Source/WebCore/platform/network/NetworkLoadMetrics.h
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in

  Log Message:
  -----------
  SpeculationRules: ensure prefetches properly use the HTTP cache
https://bugs.webkit.org/show_bug.cgi?id=303752

Reviewed by Alex Christensen.

Currently the prefetch-uses-cache tests are expecting to fail.
This PR fixes that by:
* Adding a "cache" value to `deliveryType()`.
* Removing the non-current URLs from the prefetch cache when navigating.

This gets the test to pass, as it was relying on both these characteristics.

No new tests, but progressions on existing tests.

* 
LayoutTests/imported/w3c/web-platform-tests/speculation-rules/prefetch/prefetch-uses-cache.sub.https_cross-site-expected.txt:
 Expectation change.
* 
LayoutTests/imported/w3c/web-platform-tests/speculation-rules/prefetch/prefetch-uses-cache.sub.https_same-site-expected.txt:
 Progression.
* Source/WebCore/loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::notifyFinished): Function rename.
(WebCore::DocumentLoader::commitData): Set the cache state.
* Source/WebCore/loader/DocumentPrefetcher.cpp:
(WebCore::DocumentPrefetcher::takePrefetchedResourceMetrics): Remove resource 
from MemoryCache when navigated to.
(WebCore::DocumentPrefetcher::clearPrefetchedResourcesExcept): Remove 
non-current resources from MemoryCache.
(WebCore::DocumentPrefetcher::takePrefetchedNetworkLoadMetrics): Deleted.
* Source/WebCore/loader/DocumentPrefetcher.h:
* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::commitProvisionalLoad): Call 
clearPrefetchResourcesExcept.
* Source/WebCore/loader/ResourceTiming.cpp:
(WebCore::ResourceTiming::deliveryType const): Return a "cache" value if needed.
* Source/WebCore/loader/ResourceTiming.h:
(WebCore::ResourceTiming::deliveryType const):
* Source/WebCore/platform/network/NetworkLoadMetrics.cpp:
(WebCore::NetworkLoadMetrics::NetworkLoadMetrics): Handle fromCache.
(WebCore::NetworkLoadMetrics::updateFromFinalMetrics): Handle fromCache.
(WebCore::NetworkLoadMetrics::isolatedCopy const): Handle fromCache.
* Source/WebCore/platform/network/NetworkLoadMetrics.h:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in: Handle fromCache.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to