Do not reuse resource for memory cache if selected service worker differs
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Dec 2017 18:30:06 +0000 (18:30 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Dec 2017 18:30:06 +0000 (18:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=181042

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Rebaseline WPT test now that it is consistently passing.

* web-platform-tests/service-workers/service-worker/unregister-controller.https-expected.txt:

Source/WebCore:

No new tests, rebaselined existing test.

* loader/cache/CachedResource.h:
(WebCore::CachedResource::options const):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::determineRevalidationPolicy const):

LayoutTests:

Drop test from flaky list now that it is consistently passing.

* TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226188 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-controller.https-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/loader/cache/CachedResource.h
Source/WebCore/loader/cache/CachedResourceLoader.cpp

index 0424eb7..de4bf96 100644 (file)
@@ -1,3 +1,14 @@
+2017-12-20  Chris Dumez  <cdumez@apple.com>
+
+        Do not reuse resource for memory cache if selected service worker differs
+        https://bugs.webkit.org/show_bug.cgi?id=181042
+
+        Reviewed by Youenn Fablet.
+
+        Drop test from flaky list now that it is consistently passing.
+
+        * TestExpectations:
+
 2017-12-20  Matt Lewis  <jlewis3@apple.com>
 
         Marked svg/animations/smil-leak-element-instances-noBaseValRef.svg as flaky on macOS WK1.
index 06c39f8..22c02ba 100644 (file)
@@ -180,7 +180,6 @@ imported/w3c/web-platform-tests/service-workers/service-worker/performance-timel
 imported/w3c/web-platform-tests/service-workers/service-worker/registration-service-worker-attributes.https.html [ Pass Failure ]
 imported/w3c/web-platform-tests/service-workers/service-worker/service-worker-csp-connect.https.html [ Pass Failure ]
 imported/w3c/web-platform-tests/service-workers/service-worker/uncontrolled-page.https.html [ Pass Failure ]
-imported/w3c/web-platform-tests/service-workers/service-worker/unregister-controller.https.html [ Pass Failure ]
 imported/w3c/web-platform-tests/service-workers/service-worker/websocket.https.html [ Pass Failure ]
 imported/w3c/web-platform-tests/service-workers/service-worker/windowclient-navigate.https.html [ Pass Failure ]
 imported/w3c/web-platform-tests/streams/readable-byte-streams/detached-buffers.serviceworker.https.html [ Pass Failure ]
index 28e2464..3e2aef8 100644 (file)
@@ -1,3 +1,14 @@
+2017-12-20  Chris Dumez  <cdumez@apple.com>
+
+        Do not reuse resource for memory cache if selected service worker differs
+        https://bugs.webkit.org/show_bug.cgi?id=181042
+
+        Reviewed by Youenn Fablet.
+
+        Rebaseline WPT test now that it is consistently passing.
+
+        * web-platform-tests/service-workers/service-worker/unregister-controller.https-expected.txt:
+
 2017-12-19  Chris Dumez  <cdumez@apple.com>
 
         [Fetch] Extracting a body of type Blob should not set Content-Type to the empty string
index 7dd8e00..225e3aa 100644 (file)
@@ -1,6 +1,6 @@
 
 
 PASS Unregister does not affect existing controller 
-FAIL Unregister prevents control of subsequent navigations assert_unreached: unexpected rejection: assert_equals: requests should not be intercepted expected "a simple text file\n" but got "intercepted by service worker" Reached unreachable code
+PASS Unregister prevents control of subsequent navigations 
 PASS Unregister prevents new controllee even if registration is still in use 
 
index 9416347..807c7b6 100644 (file)
@@ -1,3 +1,17 @@
+2017-12-20  Chris Dumez  <cdumez@apple.com>
+
+        Do not reuse resource for memory cache if selected service worker differs
+        https://bugs.webkit.org/show_bug.cgi?id=181042
+
+        Reviewed by Youenn Fablet.
+
+        No new tests, rebaselined existing test.
+
+        * loader/cache/CachedResource.h:
+        (WebCore::CachedResource::options const):
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::determineRevalidationPolicy const):
+
 2017-12-20  Youenn Fablet  <youenn@apple.com>
 
         Do not search for service worker registration in case of non HTTP navigation loads
index 35f78ce..7b5fea4 100644 (file)
@@ -234,7 +234,7 @@ public:
     DataBufferingPolicy dataBufferingPolicy() const { return m_options.dataBufferingPolicy; }
 
     bool allowsCaching() const { return m_options.cachingPolicy == CachingPolicy::AllowCaching; }
-    const FetchOptions& options() const { return m_options; }
+    const ResourceLoaderOptions& options() const { return m_options; }
 
     virtual void destroyDecodedData() { }
 
index ac1f89a..6cdfaa3 100644 (file)
@@ -1024,6 +1024,14 @@ CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalida
     if (request.cachePolicy() == RefreshAnyCacheData)
         return Reload;
 
+#if ENABLE(SERVICE_WORKER)
+    // FIXME: We should validate/specify this behavior.
+    if (cachedResourceRequest.options().serviceWorkerIdentifier != existingResource->options().serviceWorkerIdentifier) {
+        LOG(ResourceLoading, "CachedResourceLoader::determineRevalidationPolicy reloading because selected service worker differs");
+        return Reload;
+    }
+#endif
+
     // We already have a preload going for this URL.
     if (forPreload == ForPreload::Yes && existingResource->isPreloaded())
         return Use;