summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/preload/prefetch-document.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/preload/prefetch-document.html')
-rw-r--r--testing/web-platform/tests/preload/prefetch-document.html51
1 files changed, 5 insertions, 46 deletions
diff --git a/testing/web-platform/tests/preload/prefetch-document.html b/testing/web-platform/tests/preload/prefetch-document.html
index bdb12bd58a..9f9810be46 100644
--- a/testing/web-platform/tests/preload/prefetch-document.html
+++ b/testing/web-platform/tests/preload/prefetch-document.html
@@ -10,49 +10,6 @@
<script>
const {ORIGIN, REMOTE_ORIGIN, HTTP_NOTSAMESITE_ORIGIN} = get_host_info();
-const loaders = {
- image: {
- file: 'square.png',
- type: 'image/png',
- load: href => {
- const image = document.createElement('img');
- image.src = href;
- document.body.appendChild(image);
- return new Promise(resolve => image.addEventListener('load', resolve));
- }
- },
- script: {
- file: 'dummy.js',
- type: 'application/javascript',
- load: href => {
- const script = document.createElement('script');
- script.src = href;
- document.body.appendChild(script);
- return new Promise(resolve => script.addEventListener('load', resolve));
- }
- },
- style: {
- file: 'dummy.css',
- type: 'text/css',
- load: href => {
- const link = document.createElement('link');
- link.href = href;
- link.rel = "stylesheet";
- document.body.appendChild(link);
- return new Promise(resolve => link.addEventListener('load', resolve));
- }
- },
- document: {
- file: 'empty.html',
- type: 'text/html',
- load: href => {
- const iframe = document.createElement("iframe");
- iframe.src = href;
- document.body.appendChild(iframe);
- return new Promise(resolve => iframe.addEventListener("load", resolve));
- }
- }
-};
async function prefetch_document_and_count_fetches(options, t) {
const {href, uid} = await prefetch({
@@ -74,8 +31,10 @@ promise_test(async t => {
}, "same origin document prefetch without 'as' should be consumed");
promise_test(async t => {
- assert_equals(await prefetch_document_and_count_fetches({origin: REMOTE_ORIGIN}, t), 1);
-}, "same-site different-origin document prefetch without 'as' should be consumed");
+ // This (pre-)fetch will be blocked by ORB, which will prevent it from
+ // being cached. Thus this prefetch is not consumed.
+ assert_equals(await prefetch_document_and_count_fetches({origin: REMOTE_ORIGIN}, t), 2);
+}, "same-site different-origin document prefetch without 'as' should not be consumed");
promise_test(async t => {
assert_equals(await prefetch_document_and_count_fetches({origin: HTTP_NOTSAMESITE_ORIGIN}, t), 2);
@@ -100,4 +59,4 @@ promise_test(async t => {
assert_equals(results[0].headers.accept, results[1].headers.accept);
}, "Document prefetch should send the exact Accept header as navigation")
</script>
-</body> \ No newline at end of file
+</body>