WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-200000-20200224134735.patch (text/plain), 10.44 KB, created by
Rob Buis
on 2020-02-24 04:47:37 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Rob Buis
Created:
2020-02-24 04:47:37 PST
Size:
10.44 KB
patch
obsolete
>Subversion Revision: 257203 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index a023241e677e37d5c0e15e1479ecaf8a2dfa2010..b57a7b0eff4d0a2660db02968654bb4b1c220fa0 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,20 @@ >+2020-02-24 Rob Buis <rbuis@igalia.com> >+ >+ Verify Prefetch and credential behavior >+ https://bugs.webkit.org/show_bug.cgi?id=200000 >+ >+ Reviewed by Youenn Fablet. >+ >+ Cancel cross-origin prefetches for Vary: Cookie. >+ >+ Test: http/wpt/prefetch/link-prefetch-cross-origin-vary-cookie.html >+ >+ * NetworkProcess/NetworkResourceLoader.cpp: >+ (WebKit::NetworkResourceLoader::retrieveCacheEntry): >+ (WebKit::NetworkResourceLoader::didReceiveResponse): >+ * NetworkProcess/cache/PrefetchCache.cpp: >+ (WebKit::PrefetchCache::take): >+ > 2020-02-23 Adrian Perez de Castro <aperez@igalia.com> > > Non-unified build fixes late February 2020 edition >diff --git a/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp b/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp >index f598d7966890e77dd114c12d7fae16356cd5c54e..40a3bda2fb358c744c8a4f551aa68442039ff567 100644 >--- a/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp >@@ -230,7 +230,6 @@ void NetworkResourceLoader::retrieveCacheEntry(const ResourceRequest& request) > if (auto* session = m_connection->networkProcess().networkSession(sessionID())) { > if (auto entry = session->prefetchCache().take(request.url())) { > RELEASE_LOG_IF_ALLOWED("retrieveCacheEntry: retrieved an entry from the prefetch cache (isRedirect=%d)", !entry->redirectRequest.isNull()); >- // FIXME: Deal with credentials (https://bugs.webkit.org/show_bug.cgi?id=200000) > if (!entry->redirectRequest.isNull()) { > auto cacheEntry = m_cache->makeRedirectEntry(request, entry->response, entry->redirectRequest); > retrieveCacheEntryInternal(WTFMove(cacheEntry), ResourceRequest { request }); >@@ -550,6 +549,11 @@ void NetworkResourceLoader::didReceiveResponse(ResourceResponse&& receivedRespon > > if (isCrossOriginPrefetch()) { > RELEASE_LOG_IF_ALLOWED("didReceiveResponse: Using response for cross-origin prefetch"); >+ if (response.httpHeaderField(HTTPHeaderName::Vary).contains("Cookie")) { >+ RELEASE_LOG_IF_ALLOWED("didReceiveResponse: Canceling cross-origin prefetch for Vary: Cookie"); >+ abort(); >+ return completionHandler(PolicyAction::Ignore); >+ } > return completionHandler(PolicyAction::Use); > } > >diff --git a/Source/WebKit/NetworkProcess/cache/PrefetchCache.cpp b/Source/WebKit/NetworkProcess/cache/PrefetchCache.cpp >index 7104d1f74cd701cbcecfab57d24ebff8daebedb2..5e2e02e2fba0b4a0c03b5d3e66b97f7bccc7958b 100644 >--- a/Source/WebKit/NetworkProcess/cache/PrefetchCache.cpp >+++ b/Source/WebKit/NetworkProcess/cache/PrefetchCache.cpp >@@ -65,7 +65,9 @@ std::unique_ptr<PrefetchCache::Entry> PrefetchCache::take(const URL& url) > m_sessionExpirationList.removeAllMatching([&url] (const auto& tuple) { > return std::get<0>(tuple) == url; > }); >- return resources->take(url); >+ auto entry = resources->take(url); >+ ASSERT(!entry || !entry->response.httpHeaderField(WebCore::HTTPHeaderName::Vary).contains("Cookie")); >+ return entry; > } > > static const Seconds expirationTimeout { 5_s }; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index c44ef74e09e3ec69ec0d33bd49c5cd1e4402bbf9..bd985f214004db8d5bfc80cc10e1c3398706580b 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,23 @@ >+2020-02-24 Rob Buis <rbuis@igalia.com> >+ >+ Verify Prefetch and credential behavior >+ https://bugs.webkit.org/show_bug.cgi?id=200000 >+ >+ Reviewed by Youenn Fablet. >+ >+ Add a test to verify that navigating to a prefetched main resource >+ that sets Vary: Cookie does send cookies. >+ >+ * http/wpt/prefetch/link-prefetch-cross-origin-vary-cookie-expected.txt: Added. >+ * http/wpt/prefetch/link-prefetch-cross-origin-vary-cookie.html: Added. >+ * http/wpt/prefetch/resources/main-resource-cross-origin-set-cookie.py: Added. >+ (main): >+ * http/wpt/prefetch/resources/main-resource-cross-origin-vary-cookie.py: Added. >+ (main): >+ * http/wpt/prefetch/resources/navigate-cross-origin-vary-cookie.html: Added. >+ * platform/mac-wk1/TestExpectations: >+ * platform/win/TestExpectations: >+ > 2020-02-24 Diego Pino Garcia <dpino@igalia.com> > > [GTK] Gardening, update TestExpectations and baselines >diff --git a/LayoutTests/http/wpt/prefetch/link-prefetch-cross-origin-vary-cookie-expected.txt b/LayoutTests/http/wpt/prefetch/link-prefetch-cross-origin-vary-cookie-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..89926724a0814660069214881f3211bec4f90b5e >--- /dev/null >+++ b/LayoutTests/http/wpt/prefetch/link-prefetch-cross-origin-vary-cookie-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Verify that navigating to a prefetched main resource that sets Vary: Cookie does send cookies. >+ >diff --git a/LayoutTests/http/wpt/prefetch/link-prefetch-cross-origin-vary-cookie.html b/LayoutTests/http/wpt/prefetch/link-prefetch-cross-origin-vary-cookie.html >new file mode 100644 >index 0000000000000000000000000000000000000000..4e5006f1f6b90531d95bb01fe14b6e39101abc52 >--- /dev/null >+++ b/LayoutTests/http/wpt/prefetch/link-prefetch-cross-origin-vary-cookie.html >@@ -0,0 +1,22 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script> >+ >+const wait_for_message = () => { >+ return new Promise((resolve, reject) => { >+ window.addEventListener('message', e => { >+ resolve(e); >+ }, { once: true }); >+ }); >+}; >+ >+promise_test(async function(t) { >+ let url_from = "resources/navigate-cross-origin-vary-cookie.html"; >+ var w = window.open(url_from); >+ let message = await wait_for_message(); >+ assert_equals(message.data, 'foo=bar'); >+ w.close(); >+}, 'Verify that navigating to a prefetched main resource that sets Vary: Cookie does send cookies.'); >+</script> >diff --git a/LayoutTests/http/wpt/prefetch/resources/main-resource-cross-origin-set-cookie.py b/LayoutTests/http/wpt/prefetch/resources/main-resource-cross-origin-set-cookie.py >new file mode 100644 >index 0000000000000000000000000000000000000000..7f52448e3ace8b0e894b0f8b692dddb97d546756 >--- /dev/null >+++ b/LayoutTests/http/wpt/prefetch/resources/main-resource-cross-origin-set-cookie.py >@@ -0,0 +1,7 @@ >+def main(request, response): >+ headers = [("Content-Type", "text/html"), ("Set-Cookie", "foo=bar")] >+ >+ response.headers.set("Access-Control-Allow-Origin", "http://localhost:8800") >+ response.headers.set("Access-Control-Allow-Credentials", "true") >+ >+ return headers, "" >diff --git a/LayoutTests/http/wpt/prefetch/resources/main-resource-cross-origin-vary-cookie.py b/LayoutTests/http/wpt/prefetch/resources/main-resource-cross-origin-vary-cookie.py >new file mode 100644 >index 0000000000000000000000000000000000000000..f523019e0ece9a7f8bb1725397d086e694316d31 >--- /dev/null >+++ b/LayoutTests/http/wpt/prefetch/resources/main-resource-cross-origin-vary-cookie.py >@@ -0,0 +1,15 @@ >+def main(request, response): >+ headers = [("Content-Type", "text/html"), ("Vary", "Cookie")] >+ >+ document = """ >+<!DOCTYPE html> >+<script> >+ function test() { >+ var result = '%(cookie)s'; >+ window.opener.postMessage(result, '*'); >+ } >+</script> >+<body onload="test()"> >+""" >+ >+ return headers, document % {'cookie': request.headers.get("Cookie", "") } >diff --git a/LayoutTests/http/wpt/prefetch/resources/navigate-cross-origin-vary-cookie.html b/LayoutTests/http/wpt/prefetch/resources/navigate-cross-origin-vary-cookie.html >new file mode 100644 >index 0000000000000000000000000000000000000000..1db7fdf2c3a08870acbabcf52ece32961a5a046d >--- /dev/null >+++ b/LayoutTests/http/wpt/prefetch/resources/navigate-cross-origin-vary-cookie.html >@@ -0,0 +1,20 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<script src="/common/get-host-info.sub.js"></script> >+<body onload="test()"> >+<script> >+ if (window.testRunner) >+ testRunner.setAlwaysAcceptCookies(true); >+ >+ async function test() { >+ var link = document.createElement("link"); >+ link.rel = "prefetch"; >+ link.href = get_host_info().HTTP_REMOTE_ORIGIN + "/WebKit/prefetch/resources/main-resource-cross-origin-vary-cookie.py"; >+ document.body.appendChild(link); >+ >+ await fetch(get_host_info().HTTP_REMOTE_ORIGIN + "/WebKit/prefetch/resources/main-resource-cross-origin-set-cookie.py", { "credentials": "include" }); >+ >+ window.location = get_host_info().HTTP_REMOTE_ORIGIN + "/WebKit/prefetch/resources/main-resource-cross-origin-vary-cookie.py"; >+ } >+</script> >+</body> >diff --git a/LayoutTests/platform/mac-wk1/TestExpectations b/LayoutTests/platform/mac-wk1/TestExpectations >index 06253c0aaabc8599bd8aaff87fa7134ac5484b80..00b258c9b71dcc0101a0625a46f1f8096c2847e8 100644 >--- a/LayoutTests/platform/mac-wk1/TestExpectations >+++ b/LayoutTests/platform/mac-wk1/TestExpectations >@@ -950,4 +950,7 @@ webkit.org/b/208059 [ Debug ] legacy-animation-engine/compositing/transitions/ad > > webkit.org/b/208065 [ Debug ] legacy-animation-engine/animations/animation-direction-normal.html [ Pass Failure ] > >-webkit.org/b/208019 [ Release ] legacy-animation-engine/fast/animation/animation-mixed-transform-crash.html [ Pass ImageOnlyFailure ] >\ No newline at end of file >+webkit.org/b/208019 [ Release ] legacy-animation-engine/fast/animation/animation-mixed-transform-crash.html [ Pass ImageOnlyFailure ] >+ >+# prefetch not supported in WK1 >+http/wpt/prefetch [ Skip ] >diff --git a/LayoutTests/platform/win/TestExpectations b/LayoutTests/platform/win/TestExpectations >index e71ca8cb5ed0529c06a1401d3b127eb84c02d997..ee94273466f8913059d53f9ff18e9b1ef9e01c46 100644 >--- a/LayoutTests/platform/win/TestExpectations >+++ b/LayoutTests/platform/win/TestExpectations >@@ -4556,3 +4556,6 @@ imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/ > imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/original-referrer-policy-applied.sub.html [ Skip ] > imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/picture-loading-lazy.html [ Skip ] > imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/remove-element-and-scroll.html [ Skip ] >+ >+# prefetch not supported in WK1 >+http/wpt/prefetch [ Skip ]
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 200000
:
374600
|
375411
|
375413
|
375419
|
375420
|
375426
|
375448
|
375523
|
376785
|
376865
|
376873
|
376899
|
376900
|
376902
|
380197
|
380614
|
380655
|
381200
|
391416
|
391526
|
391539