Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (226256 => 226257)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2017-12-22 05:36:13 UTC (rev 226257)
@@ -1,5 +1,14 @@
2017-12-21 Youenn Fablet <you...@apple.com>
+ ServiceWorkerThreadProxy should set the correct cookie and cache partitioning options
+ https://bugs.webkit.org/show_bug.cgi?id=181000
+
+ Reviewed by Chris Dumez.
+
+ * web-platform-tests/service-workers/service-worker/fetch-response-taint.https-expected.txt:
+
+2017-12-21 Youenn Fablet <you...@apple.com>
+
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-xhr.https.html is failing one test
https://bugs.webkit.org/show_bug.cgi?id=181072
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-response-taint.https-expected.txt (226256 => 226257)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-response-taint.https-expected.txt 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-response-taint.https-expected.txt 2017-12-22 05:36:13 UTC (rev 226257)
@@ -1,14 +1,14 @@
PASS initialize global state
PASS fetching url:"https://localhost:9443/service-workers/service-worker/resources/fetch-access-control.py?" mode:"same-origin" credentials:"omit" should succeed.
-FAIL fetching url:"https://localhost:9443/service-workers/service-worker/resources/fetch-access-control.py?" mode:"same-origin" credentials:"same-origin" should succeed. assert_equals: expected "username2s" but got "undefined"
-FAIL fetching url:"https://localhost:9443/service-workers/service-worker/resources/fetch-access-control.py?" mode:"same-origin" credentials:"include" should succeed. assert_equals: expected "username2s" but got "undefined"
+PASS fetching url:"https://localhost:9443/service-workers/service-worker/resources/fetch-access-control.py?" mode:"same-origin" credentials:"same-origin" should succeed.
+PASS fetching url:"https://localhost:9443/service-workers/service-worker/resources/fetch-access-control.py?" mode:"same-origin" credentials:"include" should succeed.
PASS fetching url:"https://localhost:9443/service-workers/service-worker/resources/fetch-access-control.py?" mode:"no-cors" credentials:"omit" should succeed.
-FAIL fetching url:"https://localhost:9443/service-workers/service-worker/resources/fetch-access-control.py?" mode:"no-cors" credentials:"same-origin" should succeed. assert_equals: expected "username2s" but got "undefined"
-FAIL fetching url:"https://localhost:9443/service-workers/service-worker/resources/fetch-access-control.py?" mode:"no-cors" credentials:"include" should succeed. assert_equals: expected "username2s" but got "undefined"
+PASS fetching url:"https://localhost:9443/service-workers/service-worker/resources/fetch-access-control.py?" mode:"no-cors" credentials:"same-origin" should succeed.
+PASS fetching url:"https://localhost:9443/service-workers/service-worker/resources/fetch-access-control.py?" mode:"no-cors" credentials:"include" should succeed.
PASS fetching url:"https://localhost:9443/service-workers/service-worker/resources/fetch-access-control.py?" mode:"cors" credentials:"omit" should succeed.
-FAIL fetching url:"https://localhost:9443/service-workers/service-worker/resources/fetch-access-control.py?" mode:"cors" credentials:"same-origin" should succeed. assert_equals: expected "username2s" but got "undefined"
-FAIL fetching url:"https://localhost:9443/service-workers/service-worker/resources/fetch-access-control.py?" mode:"cors" credentials:"include" should succeed. assert_equals: expected "username2s" but got "undefined"
+PASS fetching url:"https://localhost:9443/service-workers/service-worker/resources/fetch-access-control.py?" mode:"cors" credentials:"same-origin" should succeed.
+PASS fetching url:"https://localhost:9443/service-workers/service-worker/resources/fetch-access-control.py?" mode:"cors" credentials:"include" should succeed.
PASS url:"https://127.0.0.1:9443/service-workers/service-worker/resources/fetch-access-control.py?" mode:"same-origin" credentials:"omit" should fail.
PASS url:"https://127.0.0.1:9443/service-workers/service-worker/resources/fetch-access-control.py?" mode:"same-origin" credentials:"same-origin" should fail.
PASS url:"https://127.0.0.1:9443/service-workers/service-worker/resources/fetch-access-control.py?" mode:"same-origin" credentials:"include" should fail.
@@ -21,7 +21,7 @@
PASS fetching url:"https://127.0.0.1:9443/service-workers/service-worker/resources/fetch-access-control.py?ACAOrigin=*" mode:"cors" credentials:"omit" should succeed.
PASS fetching url:"https://127.0.0.1:9443/service-workers/service-worker/resources/fetch-access-control.py?ACAOrigin=*" mode:"cors" credentials:"same-origin" should succeed.
PASS url:"https://127.0.0.1:9443/service-workers/service-worker/resources/fetch-access-control.py?ACAOrigin=*" mode:"cors" credentials:"include" should fail.
-FAIL fetching url:"https://127.0.0.1:9443/service-workers/service-worker/resources/fetch-access-control.py?ACAOrigin=https://localhost:9443&ACACredentials=true" mode:"cors" credentials:"include" should succeed. assert_equals: expected "username1s" but got "undefined"
+PASS fetching url:"https://127.0.0.1:9443/service-workers/service-worker/resources/fetch-access-control.py?ACAOrigin=https://localhost:9443&ACACredentials=true" mode:"cors" credentials:"include" should succeed.
PASS fetching url:"https://localhost:9443/?url="" mode:"same-origin" credentials:"omit" should succeed.
PASS fetching url:"https://localhost:9443/?url="" mode:"same-origin" credentials:"same-origin" should succeed.
PASS fetching url:"https://localhost:9443/?url="" mode:"same-origin" credentials:"include" should succeed.
@@ -40,24 +40,24 @@
PASS fetching url:"https://127.0.0.1:9443/?url="" mode:"cors" credentials:"omit" should succeed.
PASS fetching url:"https://127.0.0.1:9443/?url="" mode:"cors" credentials:"same-origin" should succeed.
PASS fetching url:"https://127.0.0.1:9443/?url="" mode:"cors" credentials:"include" should succeed.
-FAIL fetching url:"https://localhost:9443/?url="" mode:"same-origin" credentials:"omit" should succeed. assert_equals: expected "username2s" but got "undefined"
-FAIL fetching url:"https://localhost:9443/?url="" mode:"same-origin" credentials:"same-origin" should succeed. assert_equals: expected "username2s" but got "undefined"
-FAIL fetching url:"https://localhost:9443/?url="" mode:"same-origin" credentials:"include" should succeed. assert_equals: expected "username2s" but got "undefined"
-FAIL fetching url:"https://localhost:9443/?url="" mode:"no-cors" credentials:"omit" should succeed. assert_equals: expected "username2s" but got "undefined"
-FAIL fetching url:"https://localhost:9443/?url="" mode:"no-cors" credentials:"same-origin" should succeed. assert_equals: expected "username2s" but got "undefined"
-FAIL fetching url:"https://localhost:9443/?url="" mode:"no-cors" credentials:"include" should succeed. assert_equals: expected "username2s" but got "undefined"
-FAIL fetching url:"https://localhost:9443/?url="" mode:"cors" credentials:"omit" should succeed. assert_equals: expected "username2s" but got "undefined"
-FAIL fetching url:"https://localhost:9443/?url="" mode:"cors" credentials:"same-origin" should succeed. assert_equals: expected "username2s" but got "undefined"
-FAIL fetching url:"https://localhost:9443/?url="" mode:"cors" credentials:"include" should succeed. assert_equals: expected "username2s" but got "undefined"
+PASS fetching url:"https://localhost:9443/?url="" mode:"same-origin" credentials:"omit" should succeed.
+PASS fetching url:"https://localhost:9443/?url="" mode:"same-origin" credentials:"same-origin" should succeed.
+PASS fetching url:"https://localhost:9443/?url="" mode:"same-origin" credentials:"include" should succeed.
+PASS fetching url:"https://localhost:9443/?url="" mode:"no-cors" credentials:"omit" should succeed.
+PASS fetching url:"https://localhost:9443/?url="" mode:"no-cors" credentials:"same-origin" should succeed.
+PASS fetching url:"https://localhost:9443/?url="" mode:"no-cors" credentials:"include" should succeed.
+PASS fetching url:"https://localhost:9443/?url="" mode:"cors" credentials:"omit" should succeed.
+PASS fetching url:"https://localhost:9443/?url="" mode:"cors" credentials:"same-origin" should succeed.
+PASS fetching url:"https://localhost:9443/?url="" mode:"cors" credentials:"include" should succeed.
PASS url:"https://127.0.0.1:9443/?url="" mode:"same-origin" credentials:"omit" should fail.
PASS url:"https://127.0.0.1:9443/?url="" mode:"same-origin" credentials:"same-origin" should fail.
PASS url:"https://127.0.0.1:9443/?url="" mode:"same-origin" credentials:"include" should fail.
-FAIL fetching url:"https://127.0.0.1:9443/?url="" mode:"no-cors" credentials:"omit" should succeed. assert_equals: expected "username2s" but got "undefined"
-FAIL fetching url:"https://127.0.0.1:9443/?url="" mode:"no-cors" credentials:"same-origin" should succeed. assert_equals: expected "username2s" but got "undefined"
-FAIL fetching url:"https://127.0.0.1:9443/?url="" mode:"no-cors" credentials:"include" should succeed. assert_equals: expected "username2s" but got "undefined"
-FAIL fetching url:"https://127.0.0.1:9443/?url="" mode:"cors" credentials:"omit" should succeed. assert_equals: expected "username2s" but got "undefined"
-FAIL fetching url:"https://127.0.0.1:9443/?url="" mode:"cors" credentials:"same-origin" should succeed. assert_equals: expected "username2s" but got "undefined"
-FAIL fetching url:"https://127.0.0.1:9443/?url="" mode:"cors" credentials:"include" should succeed. assert_equals: expected "username2s" but got "undefined"
+PASS fetching url:"https://127.0.0.1:9443/?url="" mode:"no-cors" credentials:"omit" should succeed.
+PASS fetching url:"https://127.0.0.1:9443/?url="" mode:"no-cors" credentials:"same-origin" should succeed.
+PASS fetching url:"https://127.0.0.1:9443/?url="" mode:"no-cors" credentials:"include" should succeed.
+PASS fetching url:"https://127.0.0.1:9443/?url="" mode:"cors" credentials:"omit" should succeed.
+PASS fetching url:"https://127.0.0.1:9443/?url="" mode:"cors" credentials:"same-origin" should succeed.
+PASS fetching url:"https://127.0.0.1:9443/?url="" mode:"cors" credentials:"include" should succeed.
PASS url:"https://localhost:9443/?url="" mode:"same-origin" credentials:"omit" should fail.
PASS url:"https://localhost:9443/?url="" mode:"same-origin" credentials:"same-origin" should fail.
PASS url:"https://localhost:9443/?url="" mode:"same-origin" credentials:"include" should fail.
@@ -112,23 +112,23 @@
PASS fetching url:"https://127.0.0.1:9443/?url="" mode:"cors" credentials:"omit" should succeed.
PASS fetching url:"https://127.0.0.1:9443/?url="" mode:"cors" credentials:"same-origin" should succeed.
PASS fetching url:"https://127.0.0.1:9443/?url="" mode:"cors" credentials:"include" should succeed.
-FAIL fetching url:"https://localhost:9443/?url="" mode:"same-origin" credentials:"omit" should succeed. assert_equals: expected "username1s" but got "undefined"
-FAIL fetching url:"https://localhost:9443/?url="" mode:"same-origin" credentials:"same-origin" should succeed. assert_equals: expected "username1s" but got "undefined"
-FAIL fetching url:"https://localhost:9443/?url="" mode:"same-origin" credentials:"include" should succeed. assert_equals: expected "username1s" but got "undefined"
-FAIL fetching url:"https://localhost:9443/?url="" mode:"no-cors" credentials:"omit" should succeed. assert_equals: expected "username1s" but got "undefined"
-FAIL fetching url:"https://localhost:9443/?url="" mode:"no-cors" credentials:"same-origin" should succeed. assert_equals: expected "username1s" but got "undefined"
-FAIL fetching url:"https://localhost:9443/?url="" mode:"no-cors" credentials:"include" should succeed. assert_equals: expected "username1s" but got "undefined"
-FAIL fetching url:"https://localhost:9443/?url="" mode:"cors" credentials:"omit" should succeed. assert_equals: expected "username1s" but got "undefined"
-FAIL fetching url:"https://localhost:9443/?url="" mode:"cors" credentials:"same-origin" should succeed. assert_equals: expected "username1s" but got "undefined"
-FAIL fetching url:"https://localhost:9443/?url="" mode:"cors" credentials:"include" should succeed. assert_equals: expected "username1s" but got "undefined"
+PASS fetching url:"https://localhost:9443/?url="" mode:"same-origin" credentials:"omit" should succeed.
+PASS fetching url:"https://localhost:9443/?url="" mode:"same-origin" credentials:"same-origin" should succeed.
+PASS fetching url:"https://localhost:9443/?url="" mode:"same-origin" credentials:"include" should succeed.
+PASS fetching url:"https://localhost:9443/?url="" mode:"no-cors" credentials:"omit" should succeed.
+PASS fetching url:"https://localhost:9443/?url="" mode:"no-cors" credentials:"same-origin" should succeed.
+PASS fetching url:"https://localhost:9443/?url="" mode:"no-cors" credentials:"include" should succeed.
+PASS fetching url:"https://localhost:9443/?url="" mode:"cors" credentials:"omit" should succeed.
+PASS fetching url:"https://localhost:9443/?url="" mode:"cors" credentials:"same-origin" should succeed.
+PASS fetching url:"https://localhost:9443/?url="" mode:"cors" credentials:"include" should succeed.
PASS url:"https://127.0.0.1:9443/?url="" mode:"same-origin" credentials:"omit" should fail.
PASS url:"https://127.0.0.1:9443/?url="" mode:"same-origin" credentials:"same-origin" should fail.
PASS url:"https://127.0.0.1:9443/?url="" mode:"same-origin" credentials:"include" should fail.
-FAIL fetching url:"https://127.0.0.1:9443/?url="" mode:"no-cors" credentials:"omit" should succeed. assert_equals: expected "username1s" but got "undefined"
-FAIL fetching url:"https://127.0.0.1:9443/?url="" mode:"no-cors" credentials:"same-origin" should succeed. assert_equals: expected "username1s" but got "undefined"
-FAIL fetching url:"https://127.0.0.1:9443/?url="" mode:"no-cors" credentials:"include" should succeed. assert_equals: expected "username1s" but got "undefined"
-FAIL fetching url:"https://127.0.0.1:9443/?url="" mode:"cors" credentials:"omit" should succeed. assert_equals: expected "username1s" but got "undefined"
-FAIL fetching url:"https://127.0.0.1:9443/?url="" mode:"cors" credentials:"same-origin" should succeed. assert_equals: expected "username1s" but got "undefined"
-FAIL fetching url:"https://127.0.0.1:9443/?url="" mode:"cors" credentials:"include" should succeed. assert_equals: expected "username1s" but got "undefined"
+PASS fetching url:"https://127.0.0.1:9443/?url="" mode:"no-cors" credentials:"omit" should succeed.
+PASS fetching url:"https://127.0.0.1:9443/?url="" mode:"no-cors" credentials:"same-origin" should succeed.
+PASS fetching url:"https://127.0.0.1:9443/?url="" mode:"no-cors" credentials:"include" should succeed.
+PASS fetching url:"https://127.0.0.1:9443/?url="" mode:"cors" credentials:"omit" should succeed.
+PASS fetching url:"https://127.0.0.1:9443/?url="" mode:"cors" credentials:"same-origin" should succeed.
+PASS fetching url:"https://127.0.0.1:9443/?url="" mode:"cors" credentials:"include" should succeed.
PASS restore global state
Modified: trunk/Source/WebCore/ChangeLog (226256 => 226257)
--- trunk/Source/WebCore/ChangeLog 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebCore/ChangeLog 2017-12-22 05:36:13 UTC (rev 226257)
@@ -1,3 +1,44 @@
+2017-12-21 Youenn Fablet <you...@apple.com>
+
+ ServiceWorkerThreadProxy should set the correct cookie and cache partitioning options
+ https://bugs.webkit.org/show_bug.cgi?id=181000
+
+ Reviewed by Chris Dumez.
+
+ Covered by rebased test.
+
+ Add a way to set the domain for cache partition explicitly on a ScriptExecutionContext.
+ This is used by ServiceWorkerThreadProxy document to mimick the fact that it may be
+ a service worker used by iframes that have a cross origin top document.
+ Updated code to use that new utility routine.
+
+ * Modules/websockets/WebSocketChannel.cpp:
+ (WebCore::WebSocketChannel::connect):
+ * dom/ScriptExecutionContext.cpp:
+ (WebCore::ScriptExecutionContext::domainForCachePartition const):
+ * dom/ScriptExecutionContext.h:
+ (WebCore::ScriptExecutionContext::setDomainForCachePartition):
+ * html/DOMURL.cpp:
+ (WebCore::DOMURL::revokeObjectURL):
+ * inspector/agents/InspectorPageAgent.cpp:
+ (WebCore::InspectorPageAgent::cachedResource):
+ * loader/EmptyFrameLoaderClient.h:
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::loadURL):
+ * loader/archive/cf/LegacyWebArchive.cpp:
+ (WebCore::LegacyWebArchive::create):
+ * loader/cache/CachedResourceRequest.cpp:
+ (WebCore::CachedResourceRequest::setDomainForCachePartition):
+ * testing/Internals.cpp:
+ (WebCore::Internals::isLoadingFromMemoryCache):
+ * workers/service/context/ServiceWorkerThreadProxy.cpp:
+ (WebCore::topOriginURL):
+ (WebCore::createPageForServiceWorker):
+ (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
+ * workers/service/context/ServiceWorkerThreadProxy.h:
+ * xml/XMLHttpRequest.cpp:
+ (WebCore::XMLHttpRequest::createRequest):
+
2017-12-21 Christopher Reid <chris.r...@sony.com>
[WinCairo] fix build after r226245
Modified: trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp (226256 => 226257)
--- trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp 2017-12-22 05:36:13 UTC (rev 226257)
@@ -121,7 +121,7 @@
ref();
Page* page = frame->page();
PAL::SessionID sessionID = page ? page->sessionID() : PAL::SessionID::defaultSessionID();
- String partition = m_document->topDocument().securityOrigin().domainForCachePartition();
+ String partition = m_document->domainForCachePartition();
m_handle = m_socketProvider->createSocketStreamHandle(m_handshake->url(), *this, sessionID, partition);
}
}
Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.cpp (226256 => 226257)
--- trunk/Source/WebCore/dom/ScriptExecutionContext.cpp 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.cpp 2017-12-22 05:36:13 UTC (rev 226257)
@@ -524,6 +524,11 @@
return execStateFromWorkerGlobalScope(workerGlobalScope);
}
+String ScriptExecutionContext::domainForCachePartition() const
+{
+ return m_domainForCachePartition.isNull() ? topOrigin().domainForCachePartition() : m_domainForCachePartition;
+}
+
#if ENABLE(SERVICE_WORKER)
bool ScriptExecutionContext::hasServiceWorkerScheme()
Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.h (226256 => 226257)
--- trunk/Source/WebCore/dom/ScriptExecutionContext.h 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.h 2017-12-22 05:36:13 UTC (rev 226257)
@@ -237,6 +237,9 @@
JSC::ExecState* execState();
+ WEBCORE_EXPORT String domainForCachePartition() const;
+ void setDomainForCachePartition(String&& domain) { m_domainForCachePartition = WTFMove(domain); }
+
#if ENABLE(SERVICE_WORKER)
bool hasServiceWorkerScheme();
ServiceWorker* activeServiceWorker() const;
@@ -323,6 +326,8 @@
RefPtr<ServiceWorker> m_activeServiceWorker;
HashMap<ServiceWorkerIdentifier, ServiceWorker*> m_serviceWorkers;
#endif
+
+ String m_domainForCachePartition;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/html/DOMURL.cpp (226256 => 226257)
--- trunk/Source/WebCore/html/DOMURL.cpp 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebCore/html/DOMURL.cpp 2017-12-22 05:36:13 UTC (rev 226257)
@@ -119,7 +119,7 @@
{
URL url(URL(), urlString);
ResourceRequest request(url);
- request.setDomainForCachePartition(scriptExecutionContext.topOrigin().domainForCachePartition());
+ request.setDomainForCachePartition(scriptExecutionContext.domainForCachePartition());
MemoryCache::removeRequestFromSessionCaches(scriptExecutionContext, request);
Modified: trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp (226256 => 226257)
--- trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp 2017-12-22 05:36:13 UTC (rev 226257)
@@ -176,7 +176,7 @@
CachedResource* cachedResource = frame->document()->cachedResourceLoader().cachedResource(MemoryCache::removeFragmentIdentifierIfNeeded(url));
if (!cachedResource) {
ResourceRequest request(url);
- request.setDomainForCachePartition(frame->document()->topOrigin().domainForCachePartition());
+ request.setDomainForCachePartition(frame->document()->domainForCachePartition());
cachedResource = MemoryCache::singleton().resourceForRequest(request, frame->page()->sessionID());
}
Modified: trunk/Source/WebCore/loader/EmptyFrameLoaderClient.h (226256 => 226257)
--- trunk/Source/WebCore/loader/EmptyFrameLoaderClient.h 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebCore/loader/EmptyFrameLoaderClient.h 2017-12-22 05:36:13 UTC (rev 226257)
@@ -52,7 +52,7 @@
void convertMainResourceLoadToDownload(DocumentLoader*, PAL::SessionID, const ResourceRequest&, const ResourceResponse&) final { }
void assignIdentifierToInitialRequest(unsigned long, DocumentLoader*, const ResourceRequest&) final { }
- bool shouldUseCredentialStorage(DocumentLoader*, unsigned long) final { return false; }
+ bool shouldUseCredentialStorage(DocumentLoader*, unsigned long) override { return false; }
void dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest&, const ResourceResponse&) final { }
void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge&) final { }
#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (226256 => 226257)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2017-12-22 05:36:13 UTC (rev 226257)
@@ -1277,7 +1277,7 @@
addHTTPOriginIfNeeded(request, referrerOrigin->toString());
}
if (&m_frame.tree().top() != &m_frame)
- request.setDomainForCachePartition(m_frame.tree().top().document()->securityOrigin().domainForCachePartition());
+ request.setDomainForCachePartition(m_frame.tree().top().document()->domainForCachePartition());
addExtraFieldsToRequest(request, newLoadType, true);
if (isReload(newLoadType))
Modified: trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp (226256 => 226257)
--- trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp 2017-12-22 05:36:13 UTC (rev 226257)
@@ -513,7 +513,7 @@
}
ResourceRequest request(subresourceURL);
- request.setDomainForCachePartition(frame.document()->topOrigin().domainForCachePartition());
+ request.setDomainForCachePartition(frame.document()->domainForCachePartition());
if (auto* cachedResource = MemoryCache::singleton().resourceForRequest(request, frame.page()->sessionID())) {
if (auto resource = ArchiveResource::create(cachedResource->resourceBuffer(), subresourceURL, cachedResource->response())) {
Modified: trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp (226256 => 226257)
--- trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp 2017-12-22 05:36:13 UTC (rev 226257)
@@ -133,7 +133,7 @@
void CachedResourceRequest::setDomainForCachePartition(Document& document)
{
- m_resourceRequest.setDomainForCachePartition(document.topOrigin().domainForCachePartition());
+ m_resourceRequest.setDomainForCachePartition(document.domainForCachePartition());
}
void CachedResourceRequest::setDomainForCachePartition(const String& domain)
Modified: trunk/Source/WebCore/testing/Internals.cpp (226256 => 226257)
--- trunk/Source/WebCore/testing/Internals.cpp 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebCore/testing/Internals.cpp 2017-12-22 05:36:13 UTC (rev 226257)
@@ -630,7 +630,7 @@
return false;
ResourceRequest request(contextDocument()->completeURL(url));
- request.setDomainForCachePartition(contextDocument()->topOrigin().domainForCachePartition());
+ request.setDomainForCachePartition(contextDocument()->domainForCachePartition());
CachedResource* resource = MemoryCache::singleton().resourceForRequest(request, contextDocument()->page()->sessionID());
return resource && resource->status() == CachedResource::Cached;
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp (226256 => 226257)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp 2017-12-22 05:36:13 UTC (rev 226257)
@@ -31,6 +31,7 @@
#include "CacheStorageProvider.h"
#include "FrameLoader.h"
#include "MainFrame.h"
+#include "Settings.h"
#include <pal/SessionID.h>
#include <wtf/MainThread.h>
#include <wtf/RunLoop.h>
@@ -37,13 +38,32 @@
namespace WebCore {
-static inline UniqueRef<Page> createPageForServiceWorker(PageConfiguration&& configuration, const URL& url)
+URL static inline topOriginURL(const SecurityOrigin& origin)
{
+ URL url;
+ url.setProtocol(origin.protocol());
+ url.setHost(origin.host());
+ if (origin.port())
+ url.setPort(*origin.port());
+ return url;
+}
+
+static inline UniqueRef<Page> createPageForServiceWorker(PageConfiguration&& configuration, const ServiceWorkerContextData& data, SecurityOrigin::StorageBlockingPolicy storageBlockingPolicy)
+{
auto page = makeUniqueRef<Page>(WTFMove(configuration));
auto& mainFrame = page->mainFrame();
mainFrame.loader().initForSynthesizedDocument({ });
- auto document = Document::createNonRenderedPlaceholder(&mainFrame, url);
+ auto document = Document::createNonRenderedPlaceholder(&mainFrame, data.scriptURL);
document->createDOMWindow();
+
+ document->mutableSettings().setStorageBlockingPolicy(storageBlockingPolicy);
+ document->storageBlockingStateDidChange();
+
+ auto origin = data.registration.key.topOrigin().securityOrigin();
+ origin->setStorageBlockingPolicy(storageBlockingPolicy);
+
+ document->setFirstPartyForCookies(topOriginURL(origin));
+ document->setDomainForCachePartition(origin->domainForCachePartition());
mainFrame.setDocument(WTFMove(document));
return page;
}
@@ -57,8 +77,8 @@
#endif
}
-ServiceWorkerThreadProxy::ServiceWorkerThreadProxy(PageConfiguration&& pageConfiguration, const ServiceWorkerContextData& data, PAL::SessionID sessionID, String&& userAgent, CacheStorageProvider& cacheStorageProvider)
- : m_page(createPageForServiceWorker(WTFMove(pageConfiguration), data.scriptURL))
+ServiceWorkerThreadProxy::ServiceWorkerThreadProxy(PageConfiguration&& pageConfiguration, const ServiceWorkerContextData& data, PAL::SessionID sessionID, String&& userAgent, CacheStorageProvider& cacheStorageProvider, SecurityOrigin::StorageBlockingPolicy storageBlockingPolicy)
+ : m_page(createPageForServiceWorker(WTFMove(pageConfiguration), data, storageBlockingPolicy))
, m_document(*m_page->mainFrame().document())
, m_serviceWorkerThread(ServiceWorkerThread::create(data, sessionID, WTFMove(userAgent), *this, *this, idbConnectionProxy(m_document), m_document->socketProvider()))
, m_cacheStorageProvider(cacheStorageProvider)
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h (226256 => 226257)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h 2017-12-22 05:36:13 UTC (rev 226257)
@@ -30,6 +30,7 @@
#include "CacheStorageConnection.h"
#include "Document.h"
#include "Page.h"
+#include "SecurityOrigin.h"
#include "ServiceWorkerDebuggable.h"
#include "ServiceWorkerIdentifier.h"
#include "ServiceWorkerInspectorProxy.h"
@@ -64,7 +65,7 @@
WEBCORE_EXPORT std::unique_ptr<FetchLoader> createBlobLoader(FetchLoaderClient&, const URL&);
private:
- WEBCORE_EXPORT ServiceWorkerThreadProxy(PageConfiguration&&, const ServiceWorkerContextData&, PAL::SessionID, String&& userAgent, CacheStorageProvider&);
+ WEBCORE_EXPORT ServiceWorkerThreadProxy(PageConfiguration&&, const ServiceWorkerContextData&, PAL::SessionID, String&& userAgent, CacheStorageProvider&, SecurityOrigin::StorageBlockingPolicy);
// WorkerLoaderProxy
bool postTaskForModeToWorkerGlobalScope(ScriptExecutionContext::Task&&, const String& mode) final;
Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (226256 => 226257)
--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp 2017-12-22 05:36:13 UTC (rev 226257)
@@ -643,7 +643,7 @@
if (m_loader)
setPendingActivity(this);
} else {
- request.setDomainForCachePartition(scriptExecutionContext()->topOrigin().domainForCachePartition());
+ request.setDomainForCachePartition(scriptExecutionContext()->domainForCachePartition());
InspectorInstrumentation::willLoadXHRSynchronously(scriptExecutionContext());
ThreadableLoader::loadResourceSynchronously(*scriptExecutionContext(), WTFMove(request), *this, options);
InspectorInstrumentation::didLoadXHRSynchronously(scriptExecutionContext());
Modified: trunk/Source/WebKit/ChangeLog (226256 => 226257)
--- trunk/Source/WebKit/ChangeLog 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebKit/ChangeLog 2017-12-22 05:36:13 UTC (rev 226257)
@@ -1,3 +1,34 @@
+2017-12-21 Youenn Fablet <you...@apple.com>
+
+ ServiceWorkerThreadProxy should set the correct cookie and cache partitioning options
+ https://bugs.webkit.org/show_bug.cgi?id=181000
+
+ Reviewed by Chris Dumez.
+
+ Update Service Worker WebPreferencesStore based on the first web page added.
+ This allows having the right storage blocking policy.
+
+ Storing that policy in the context manager to set it properly when
+ creating a new service worker thread proxy.
+
+ Set up correctly partitioning parameters in the dummy Document used by the service worker.
+
+ * UIProcess/ServiceWorkerProcessProxy.cpp:
+ (WebKit::ServiceWorkerProcessProxy::updatePreferencesStore):
+ * UIProcess/ServiceWorkerProcessProxy.h:
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebProcessPool.cpp:
+ (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
+ (WebKit::WebProcessPool::pageAddedToProcess):
+ * UIProcess/WebProcessPool.h:
+ * WebProcess/Plugins/PluginView.cpp:
+ (WebKit::PluginView::getAuthenticationInfo):
+ * WebProcess/Storage/WebSWContextManagerConnection.cpp:
+ (WebKit::WebSWContextManagerConnection::updatePreferencesStore):
+ (WebKit::WebSWContextManagerConnection::installServiceWorker):
+ * WebProcess/Storage/WebSWContextManagerConnection.h:
+ * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
+
2017-12-21 Dan Bernstein <m...@apple.com>
WKPreferences doesn’t expose editable link behavior
Modified: trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp (226256 => 226257)
--- trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp 2017-12-22 05:36:13 UTC (rev 226257)
@@ -70,6 +70,11 @@
send(Messages::WebSWContextManagerConnection::SetUserAgent { userAgent }, 0);
}
+void ServiceWorkerProcessProxy::updatePreferencesStore(const WebPreferencesStore& store)
+{
+ send(Messages::WebSWContextManagerConnection::UpdatePreferencesStore { store }, 0);
+}
+
void ServiceWorkerProcessProxy::didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, Ref<AuthenticationChallengeProxy>&& challenge)
{
UNUSED_PARAM(pageID);
Modified: trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.h (226256 => 226257)
--- trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.h 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.h 2017-12-22 05:36:13 UTC (rev 226257)
@@ -40,6 +40,7 @@
void start(const WebPreferencesStore&, std::optional<PAL::SessionID> initialSessionID);
void setUserAgent(const String&);
+ void updatePreferencesStore(const WebPreferencesStore&);
uint64_t pageID() const { return m_serviceWorkerPageID; }
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (226256 => 226257)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2017-12-22 05:36:13 UTC (rev 226257)
@@ -1263,6 +1263,8 @@
void getApplicationManifest(Function<void(const std::optional<WebCore::ApplicationManifest>&, CallbackBase::Error)>&&);
#endif
+ WebPreferencesStore preferencesStore() const;
+
private:
WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&);
void platformInitialize();
@@ -1655,8 +1657,6 @@
uint64_t generateNavigationID();
API::DiagnosticLoggingClient* effectiveDiagnosticLoggingClient(WebCore::ShouldSample);
- WebPreferencesStore preferencesStore() const;
-
void dispatchActivityStateChange();
void viewDidLeaveWindow();
void viewDidEnterWindow();
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (226256 => 226257)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2017-12-22 05:36:13 UTC (rev 226257)
@@ -618,7 +618,7 @@
m_processes.append(WTFMove(serviceWorkerProcessProxy));
- m_serviceWorkerProcess->start(m_defaultPageGroup->preferences().store(), sessionID);
+ m_serviceWorkerProcess->start(m_serviceWorkerPreferences ? m_serviceWorkerPreferences.value() : m_defaultPageGroup->preferences().store(), sessionID);
if (!m_serviceWorkerUserAgent.isNull())
m_serviceWorkerProcess->setUserAgent(m_serviceWorkerUserAgent);
}
@@ -1064,6 +1064,14 @@
ensureStorageProcessAndWebsiteDataStore(&page.websiteDataStore());
#endif
}
+
+#if ENABLE(SERVICE_WORKER)
+ if (!m_serviceWorkerPreferences) {
+ m_serviceWorkerPreferences = page.preferencesStore();
+ if (m_serviceWorkerProcess)
+ m_serviceWorkerProcess->updatePreferencesStore(m_serviceWorkerPreferences.value());
+ }
+#endif
}
void WebProcessPool::pageRemovedFromProcess(WebPageProxy& page)
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.h (226256 => 226257)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.h 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.h 2017-12-22 05:36:13 UTC (rev 226257)
@@ -505,6 +505,7 @@
bool m_waitingForWorkerContextProcessConnection { false };
bool m_allowsAnySSLCertificateForServiceWorker { false };
String m_serviceWorkerUserAgent;
+ std::optional<WebPreferencesStore> m_serviceWorkerPreferences;
#endif
Ref<WebPageGroup> m_defaultPageGroup;
Modified: trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp (226256 => 226257)
--- trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp 2017-12-22 05:36:13 UTC (rev 226257)
@@ -1598,7 +1598,7 @@
if (!contentDocument)
return false;
- String partitionName = contentDocument->topDocument().securityOrigin().domainForCachePartition();
+ String partitionName = contentDocument->topDocument().domainForCachePartition();
Credential credential = CredentialStorage::defaultCredentialStorage().get(partitionName, protectionSpace);
if (credential.isEmpty())
credential = CredentialStorage::defaultCredentialStorage().getFromPersistentStorage(protectionSpace);
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp (226256 => 226257)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp 2017-12-22 05:36:13 UTC (rev 226257)
@@ -83,6 +83,8 @@
void frameLoaderDestroyed() final { m_connection.removeFrameLoaderClient(*this); }
+ bool shouldUseCredentialStorage(DocumentLoader*, unsigned long) final { return true; }
+
PAL::SessionID sessionID() const final { return m_sessionID; }
std::optional<uint64_t> pageID() const final { return m_pageID; }
std::optional<uint64_t> frameID() const final { return m_frameID; }
@@ -100,16 +102,18 @@
, m_pageID(pageID)
, m_userAgent(standardUserAgentWithApplicationName({ }))
{
- updatePreferences(store);
+ updatePreferencesStore(store);
}
WebSWContextManagerConnection::~WebSWContextManagerConnection() = default;
-void WebSWContextManagerConnection::updatePreferences(const WebPreferencesStore& store)
+void WebSWContextManagerConnection::updatePreferencesStore(const WebPreferencesStore& store)
{
RuntimeEnabledFeatures::sharedFeatures().setServiceWorkerEnabled(true);
RuntimeEnabledFeatures::sharedFeatures().setCacheAPIEnabled(store.getBoolValueForKey(WebPreferencesKey::cacheAPIEnabledKey()));
RuntimeEnabledFeatures::sharedFeatures().setFetchAPIEnabled(store.getBoolValueForKey(WebPreferencesKey::fetchAPIEnabledKey()));
+
+ m_storageBlockingPolicy = static_cast<SecurityOrigin::StorageBlockingPolicy>(store.getUInt32ValueForKey(WebPreferencesKey::storageBlockingPolicyKey()));
}
void WebSWContextManagerConnection::installServiceWorker(const ServiceWorkerContextData& data, SessionID sessionID)
@@ -130,7 +134,7 @@
pageConfiguration.loaderClientForMainFrame = frameLoaderClient.get();
m_loaders.add(WTFMove(frameLoaderClient));
- auto serviceWorkerThreadProxy = ServiceWorkerThreadProxy::create(WTFMove(pageConfiguration), data, sessionID, String { m_userAgent }, WebProcess::singleton().cacheStorageProvider());
+ auto serviceWorkerThreadProxy = ServiceWorkerThreadProxy::create(WTFMove(pageConfiguration), data, sessionID, String { m_userAgent }, WebProcess::singleton().cacheStorageProvider(), m_storageBlockingPolicy);
SWContextManager::singleton().registerServiceWorkerThreadForInstall(WTFMove(serviceWorkerThreadProxy));
LOG(ServiceWorker, "Context process PID: %i created worker thread\n", getpid());
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h (226256 => 226257)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h 2017-12-22 05:36:13 UTC (rev 226257)
@@ -60,7 +60,7 @@
void removeFrameLoaderClient(ServiceWorkerFrameLoaderClient&);
private:
- void updatePreferences(const WebPreferencesStore&);
+ void updatePreferencesStore(const WebPreferencesStore&);
// WebCore::SWContextManager::Connection.
void postMessageToServiceWorkerClient(const WebCore::ServiceWorkerClientIdentifier& destinationIdentifier, Ref<WebCore::SerializedScriptValue>&& message, WebCore::ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin) final;
@@ -92,6 +92,8 @@
uint64_t m_pageID { 0 };
uint64_t m_previousServiceWorkerID { 0 };
+ WebCore::SecurityOrigin::StorageBlockingPolicy m_storageBlockingPolicy { WebCore::SecurityOrigin::StorageBlockingPolicy::AllowAllStorage };
+
HashSet<std::unique_ptr<ServiceWorkerFrameLoaderClient>> m_loaders;
HashMap<uint64_t, FindClientByIdentifierCallback> m_findClientByIdentifierRequests;
HashMap<uint64_t, WebCore::ServiceWorkerClientsMatchAllCallback> m_matchAllRequests;
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in (226256 => 226257)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in 2017-12-22 05:36:13 UTC (rev 226257)
@@ -35,6 +35,7 @@
ClaimCompleted(uint64_t claimRequestIdentifier)
DidFinishSkipWaiting(uint64_t callbackID)
SetUserAgent(String userAgent)
+ UpdatePreferencesStore(struct WebKit::WebPreferencesStore store)
}
#endif
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (226256 => 226257)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2017-12-22 05:36:13 UTC (rev 226257)
@@ -1,3 +1,13 @@
+2017-12-21 Youenn Fablet <you...@apple.com>
+
+ ServiceWorkerThreadProxy should set the correct cookie and cache partitioning options
+ https://bugs.webkit.org/show_bug.cgi?id=181000
+
+ Reviewed by Chris Dumez.
+
+ * Misc/WebCache.mm:
+ (+[WebCache addImageToCache:forURL:forFrame:]):
+
2017-12-21 Jeremy Jones <jere...@apple.com>
Update FULLSCREEN_API feature defines.
Modified: trunk/Source/WebKitLegacy/mac/Misc/WebCache.mm (226256 => 226257)
--- trunk/Source/WebKitLegacy/mac/Misc/WebCache.mm 2017-12-22 03:34:27 UTC (rev 226256)
+++ trunk/Source/WebKitLegacy/mac/Misc/WebCache.mm 2017-12-22 05:36:13 UTC (rev 226257)
@@ -162,10 +162,8 @@
{
if (!image || !url || ![[url absoluteString] length])
return false;
- WebCore::SecurityOrigin* topOrigin = nullptr;
- if (frame)
- topOrigin = &core(frame)->document()->topOrigin();
- return WebCore::MemoryCache::singleton().addImageToCache(RetainPtr<CGImageRef>(image), url, topOrigin ? topOrigin->domainForCachePartition() : emptyString());
+
+ return WebCore::MemoryCache::singleton().addImageToCache(RetainPtr<CGImageRef>(image), url, frame ? core(frame)->document()->domainForCachePartition() : emptyString());
}
+ (void)removeImageFromCacheForURL:(NSURL *)url
@@ -177,10 +175,8 @@
{
if (!url)
return;
- WebCore::SecurityOrigin* topOrigin = nullptr;
- if (frame)
- topOrigin = &core(frame)->document()->topOrigin();
- WebCore::MemoryCache::singleton().removeImageFromCache(url, topOrigin ? topOrigin->domainForCachePartition() : emptyString());
+
+ return WebCore::MemoryCache::singleton().removeImageFromCache(url, frame ? core(frame)->document()->domainForCachePartition() : emptyString());
}
+ (CGImageRef)imageForURL:(NSURL *)url