Title: [291485] trunk/Source/WebCore
Revision
291485
Author
[email protected]
Date
2022-03-18 08:08:43 -0700 (Fri, 18 Mar 2022)

Log Message

REGRESSION(r290356-r290351?): [ iOS EWS ] 3 imported/w3c/web-platform-tests/service-workers/service-worker/* tests are constant text failures.
https://bugs.webkit.org/show_bug.cgi?id=237160
<rdar://problem/89440067>

Reviewed by Chris Dumez.

When we try reusing a resource in the MemoryCache that was provided by a service worker, we might need to revalidate it.
In that case, we might add revalidation headers that will show up in service workers fetch event request.
To prevent this, we reload instead of revalidating at document level.
The service worker will then be able to revalidate itself the resource since it is probably in its memory cache.

Covered by test that is no longer flaky.

* loader/cache/CachedResourceLoader.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (291484 => 291485)


--- trunk/Source/WebCore/ChangeLog	2022-03-18 14:31:16 UTC (rev 291484)
+++ trunk/Source/WebCore/ChangeLog	2022-03-18 15:08:43 UTC (rev 291485)
@@ -1,3 +1,20 @@
+2022-03-18  Youenn Fablet  <[email protected]>
+
+        REGRESSION(r290356-r290351?): [ iOS EWS ] 3 imported/w3c/web-platform-tests/service-workers/service-worker/* tests are constant text failures.
+        https://bugs.webkit.org/show_bug.cgi?id=237160
+        <rdar://problem/89440067>
+
+        Reviewed by Chris Dumez.
+
+        When we try reusing a resource in the MemoryCache that was provided by a service worker, we might need to revalidate it.
+        In that case, we might add revalidation headers that will show up in service workers fetch event request.
+        To prevent this, we reload instead of revalidating at document level.
+        The service worker will then be able to revalidate itself the resource since it is probably in its memory cache.
+
+        Covered by test that is no longer flaky.
+
+        * loader/cache/CachedResourceLoader.cpp:
+
 2022-03-18  Philippe Normand  <[email protected]>
 
         [GStreamer] Migrate gst-full support to 1.20

Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (291484 => 291485)


--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2022-03-18 14:31:16 UTC (rev 291484)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2022-03-18 15:08:43 UTC (rev 291485)
@@ -1336,8 +1336,14 @@
     // Check if the cache headers requires us to revalidate (cache expiration for example).
     if (revalidationDecision != CachedResource::RevalidationDecision::No) {
         // See if the resource has usable ETag or Last-modified headers.
-        if (existingResource->canUseCacheValidator())
+        if (existingResource->canUseCacheValidator()) {
+#if ENABLE(SERVICE_WORKER)
+            // Revalidating will mean exposing headers to the service worker, let's reload given the service worker already handled it.
+            if (cachedResourceRequest.options().serviceWorkerRegistrationIdentifier)
+                return Reload;
+#endif
             return Revalidate;
+        }
         
         // No, must reload.
         LOG(ResourceLoading, "CachedResourceLoader::determineRevalidationPolicy reloading due to missing cache validators.");
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to