From c6d4ec0f5a5ef63c6263cfac3d1667070a96ca35 Mon Sep 17 00:00:00 2001 From: Liviu Tinta Date: Sun, 11 Dec 2022 21:38:06 +0000 Subject: [PATCH] Bug 1802730 [wpt PR 37174] - [No-Vary-Search] Add No-Vary-Search logic to prefetch cache, a=testonly Automatic update from web-platform-tests [No-Vary-Search] Add No-Vary-Search logic to prefetch cache Add logic to keep track of No-Vary-Search response data in prefetch cache and use it to make decisions to use existing prefetched response on new navigation. Bug: 1378075 Change-Id: Ie299308ead2b369b899c17d4a33a64588376a07d Fuchsia-Binary-Size: Size increase is unavoidable. Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4035669 Reviewed-by: Jeremy Roman Reviewed-by: Adam Rice Reviewed-by: Ian Kilpatrick Reviewed-by: Max Curran Commit-Queue: Liviu Tinta Cr-Commit-Position: refs/heads/main@{#1081197} -- wpt-commits: 5c4e374e6c3385befe533c12ab4db9c08cf9e5f4 wpt-pr: 37174 --- .../no-vary-search/prefetch-single.https.html | 282 ++++++++++++++++++ .../prefetch/resources/utils.sub.js | 6 + 2 files changed, 288 insertions(+) create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/no-vary-search/prefetch-single.https.html diff --git a/testing/web-platform/tests/speculation-rules/prefetch/no-vary-search/prefetch-single.https.html b/testing/web-platform/tests/speculation-rules/prefetch/no-vary-search/prefetch-single.https.html new file mode 100644 index 000000000000..543b46c535ae --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/no-vary-search/prefetch-single.https.html @@ -0,0 +1,282 @@ + +Prefetched response including No-Vary-Search headers is used during navigation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/resources/utils.sub.js b/testing/web-platform/tests/speculation-rules/prefetch/resources/utils.sub.js index a306b8cea981..ea70939aff08 100644 --- a/testing/web-platform/tests/speculation-rules/prefetch/resources/utils.sub.js +++ b/testing/web-platform/tests/speculation-rules/prefetch/resources/utils.sub.js @@ -94,6 +94,12 @@ class PrefetchAgent extends RemoteContext { document.head.append(meta); }, [referrerPolicy]); } + + async getDeliveryType(){ + return this.execute_script(() => { + return performance.getEntriesByType("navigation")[0].deliveryType; + }); + } } // Produces a URL with a UUID which will record when it's prefetched.