WebKit Bugzilla
Attachment 369388 Details for
Bug 197371
: Store prefetch redirects in the prefetch cache
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197371-20190508180122.patch (text/plain), 5.86 KB, created by
Rob Buis
on 2019-05-08 09:01:23 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Rob Buis
Created:
2019-05-08 09:01:23 PDT
Size:
5.86 KB
patch
obsolete
>Subversion Revision: 245053 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index b6d3be8e20552f04bae83c5a51335794b30bcfea..c9dbef2b4f37bee8d2465678d926d5d527e35d6d 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,15 @@ >+2019-05-08 Rob Buis <rbuis@igalia.com> >+ >+ Add tests for prefetch redirects >+ https://bugs.webkit.org/show_bug.cgi?id=197371 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Store prefetch navigations in the prefetch cache. >+ >+ * NetworkProcess/NetworkResourceLoader.cpp: >+ (WebKit::NetworkResourceLoader::didFinishWithRedirectResponse): >+ > 2019-05-08 Rob Buis <rbuis@igalia.com> > > Link prefetch not useful for top-level navigation >diff --git a/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp b/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp >index 4510e9268a22c205c8c6b035a7b0fcfe478e06e2..74ce7c7eca76f6d304a8ccae38f05c94b10a8895 100644 >--- a/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp >@@ -690,6 +690,10 @@ void NetworkResourceLoader::didFinishWithRedirectResponse(ResourceResponse&& red > networkLoadMetrics.responseBodyDecodedSize = 0; > send(Messages::WebResourceLoader::DidFinishResourceLoad { networkLoadMetrics }); > >+ if (isCrossOriginPrefetch()) { >+ if (auto session = m_connection->networkProcess().networkSession(sessionID())) >+ session->prefetchCache().store(m_networkLoad->currentRequest().url(), WTFMove(m_response), WTFMove(m_bufferedDataForCache)); >+ } > cleanup(LoadResult::Success); > } > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 2f702f48d4ba65115347508448a8bff03bc7bda7..0d5207bcbee980c4c519200598253e640b42c9c1 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,19 @@ >+2019-05-08 Rob Buis <rbuis@igalia.com> >+ >+ Add tests for prefetch redirects >+ https://bugs.webkit.org/show_bug.cgi?id=197371 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a test to verify prefetch redirections are cached in the prefetch >+ cache and reused when navigating. >+ >+ * http/tests/cache/link-prefetch-main-resource-redirect-expected.txt: Added. >+ * http/tests/cache/link-prefetch-main-resource-redirect.html: Added. >+ * http/tests/cache/resources/prefetched-main-resource-redirect.php: Added. >+ * platform/mac-wk1/TestExpectations: >+ * platform/win/TestExpectations: >+ > 2019-05-08 Rob Buis <rbuis@igalia.com> > > Link prefetch not useful for top-level navigation >diff --git a/LayoutTests/http/tests/cache/link-prefetch-main-resource-redirect-expected.txt b/LayoutTests/http/tests/cache/link-prefetch-main-resource-redirect-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..7ef22e9a431ad0272713b71fdc8794016c8ef12f >--- /dev/null >+++ b/LayoutTests/http/tests/cache/link-prefetch-main-resource-redirect-expected.txt >@@ -0,0 +1 @@ >+PASS >diff --git a/LayoutTests/http/tests/cache/link-prefetch-main-resource-redirect.html b/LayoutTests/http/tests/cache/link-prefetch-main-resource-redirect.html >new file mode 100644 >index 0000000000000000000000000000000000000000..6182a728f2d80daa1a949e6f002e0c3b97582743 >--- /dev/null >+++ b/LayoutTests/http/tests/cache/link-prefetch-main-resource-redirect.html >@@ -0,0 +1,16 @@ >+<html> >+<script> >+if (window.testRunner) { >+ testRunner.waitUntilDone(); >+ testRunner.dumpAsText(); >+} >+ >+function loadAfterPrefetch() >+{ >+ window.location.assign('http://localhost:8000/cache/resources/prefetched-main-resource-redirect.php'); >+} >+</script> >+<body> >+<link rel="prefetch" href="http://localhost:8000/cache/resources/prefetched-main-resource-redirect.php" onload="loadAfterPrefetch()"> >+</body> >+</html> >diff --git a/LayoutTests/http/tests/cache/resources/prefetched-main-resource-redirect.php b/LayoutTests/http/tests/cache/resources/prefetched-main-resource-redirect.php >new file mode 100644 >index 0000000000000000000000000000000000000000..873ac8f1a3f39544cfdd4772627e1137a5168708 >--- /dev/null >+++ b/LayoutTests/http/tests/cache/resources/prefetched-main-resource-redirect.php >@@ -0,0 +1,27 @@ >+<?php >+if ($_SERVER["HTTP_PURPOSE"] == "prefetch") { >+ header('HTTP/1.1 ' . 200); >+} else { >+ header('HTTP/1.1 ' . 302); >+ header('Location: ' . 'prefetched-main-resource.php'); >+} >+header('Cache-Control: max-age=3600'); >+?> >+<!DOCTYPE html> >+<html> >+<body> >+<script> >+ >+if (window.testRunner) >+ testRunner.notifyDone(); >+ >+</script> >+<?php >+if ($_SERVER["HTTP_PURPOSE"] == "prefetch") { >+ print('PASS'); >+} else { >+ print('FAIL'); >+} >+?> >+</body> >+</html> >diff --git a/LayoutTests/platform/mac-wk1/TestExpectations b/LayoutTests/platform/mac-wk1/TestExpectations >index 53658806710303b211507e8dae926eaa6843d844..89a8cca7024911f662f4113db0eafd535f33e237 100644 >--- a/LayoutTests/platform/mac-wk1/TestExpectations >+++ b/LayoutTests/platform/mac-wk1/TestExpectations >@@ -705,3 +705,5 @@ webkit.org/b/196915 [ Debug ] inspector/timeline/timeline-recording.html [ Pass > > webkit.org/b/195623 http/tests/cache/link-prefetch-main-resource.html [ Skip ] > webkit.org/b/195623 http/tests/cache/link-prefetch-main-resource-iframe.html [ Skip ] >+ >+webkit.org/b/197371 http/tests/cache/link-prefetch-main-resource-redirect.html [ Skip ] >diff --git a/LayoutTests/platform/win/TestExpectations b/LayoutTests/platform/win/TestExpectations >index 9d9773f7002703bb6fc88b029354539e84417162..49955a6b36aae6f7f1e465a54e3671e661d26bcc 100644 >--- a/LayoutTests/platform/win/TestExpectations >+++ b/LayoutTests/platform/win/TestExpectations >@@ -4398,3 +4398,5 @@ webkit.org/b/197310 fast/harness/render-tree-as-text-options.html [ Failure ] > > webkit.org/b/195623 http/tests/cache/link-prefetch-main-resource.html [ Skip ] > webkit.org/b/195623 http/tests/cache/link-prefetch-main-resource-iframe.html [ Skip ] >+ >+webkit.org/b/197371 http/tests/cache/link-prefetch-main-resource-redirect.html [ 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 197371
:
368556
|
368559
|
368560
|
368565
|
368566
|
368568
|
369382
|
369384
|
369386
|
369387
|
369388
|
369418
|
369504
|
369733
|
371728
|
371854
|
372194