summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/mozilla/tests/fetch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/mozilla/tests/fetch
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/mozilla/tests/fetch')
-rw-r--r--testing/web-platform/mozilla/tests/fetch/api/redirect/redirect-referrer-mixed-content.js51
-rw-r--r--testing/web-platform/mozilla/tests/fetch/api/redirect/redirect-referrer.https.html18
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/fetchpriority-disabled.h2.html18
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/fetchpriority.h2.html18
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/fetchpriority.js107
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/fetch-tests-data.js40
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/fetch-tests/fetch-init.h2.html66
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/font-face-tests-data.js21
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/font-face-tests/font-face-worker.js5
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/font-face-tests/load-font-face-from-head.h2.html24
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/font-face-tests/load-font-face-from-script.h2.html18
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/font-face-tests/load-font-face-from-worker.h2.html19
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests-data.js96
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests/image-dynamic-load.h2.html41
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests/image-initial-load.h2.html18
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests/image-svg-dynamic-load.h2.html50
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests/image-svg-initial-load.h2.html30
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests/shape-outside-image.h2.html29
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests-data.js471
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-load-stylesheet.h2.html74
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-modulepreload.h2.html36
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-prefetch.h2.html36
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-preload-fetch.h2.html37
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-preload-font.h2.html37
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-preload-image.h2.html37
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-preload-script.h2.html37
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-preload-style.h2.html37
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-header.h2.html14
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-load-stylesheet.h2.html26
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-modulepreload.h2.html18
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-prefetch.h2.html18
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-preload-fetch.h2.html18
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-preload-font.h2.html18
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-preload-image.h2.html18
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-preload-script.h2.html18
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-preload-style.h2.html18
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/dummy.css1
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/dummy.font0
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/dummy.image0
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/dummy.js0
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/dummy.txt0
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/square_25px_x_25px.pngbin0 -> 570 bytes
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests-data.js216
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/async-module-script-initial-load.h2.html18
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/async-script-initial-load.h2.html18
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/deferred-script-initial-load.h2.html18
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/module-script-dynamic-insertion.h2.html37
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/module-script-initial-load.h2.html18
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/script-dynamic-insertion.h2.html35
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/script-initial-load-body.h2.html27
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/script-initial-load-head.h2.html18
-rw-r--r--testing/web-platform/mozilla/tests/fetch/orb/tentative/content-range.sub.window.js19
-rw-r--r--testing/web-platform/mozilla/tests/fetch/orb/tentative/img-mime-types-coverage.tentative.sub.html43
-rw-r--r--testing/web-platform/mozilla/tests/fetch/orb/tentative/known-mime-type.sub.window.js48
-rw-r--r--testing/web-platform/mozilla/tests/fetch/orb/tentative/nosniff.sub.window.js43
-rw-r--r--testing/web-platform/mozilla/tests/fetch/orb/tentative/resources/utils.js28
-rw-r--r--testing/web-platform/mozilla/tests/fetch/orb/tentative/status.sub.window.js30
57 files changed, 2254 insertions, 0 deletions
diff --git a/testing/web-platform/mozilla/tests/fetch/api/redirect/redirect-referrer-mixed-content.js b/testing/web-platform/mozilla/tests/fetch/api/redirect/redirect-referrer-mixed-content.js
new file mode 100644
index 0000000000..ad59904fd9
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/api/redirect/redirect-referrer-mixed-content.js
@@ -0,0 +1,51 @@
+if (this.document === undefined) {
+ importScripts("/common/utils.js");
+ importScripts("/resources/testharness.js");
+ importScripts("/fetch/api/resources/utils.js");
+ importScripts("/common/get-host-info.sub.js");
+}
+
+function testReferrerAfterRedirection(desc, redirectUrl, redirectLocation, referrerPolicy, redirectReferrerPolicy, expectedReferrer) {
+ var url = redirectUrl;
+ var urlParameters = "?location=" + encodeURIComponent(redirectLocation);
+
+ if (redirectReferrerPolicy)
+ urlParameters += "&redirect_referrerpolicy=" + redirectReferrerPolicy;
+
+ var requestInit = {"redirect": "follow", "referrerPolicy": referrerPolicy};
+
+ promise_test(function(test) {
+ return fetch(url + urlParameters, requestInit).then(function(response) {
+ assert_equals(response.status, 200, "Inspect header response's status is 200");
+ assert_equals(response.headers.get("x-request-referer"), expectedReferrer ? expectedReferrer : null, "Check referrer header");
+ });
+ }, desc);
+}
+
+var referrerOrigin = get_host_info().HTTPS_ORIGIN + "/";
+var referrerUrl = location.href;
+
+var RESOURCES_DIR = "/fetch/api/resources/";
+var redirectUrl = RESOURCES_DIR + "redirect.py";
+var locationUrl = get_host_info().HTTPS_ORIGIN + RESOURCES_DIR + "inspect-headers.py?headers=referer";
+var httpLocationUrl = get_host_info().HTTP_REMOTE_ORIGIN + RESOURCES_DIR + "inspect-headers.py?cors&headers=referer";
+
+testReferrerAfterRedirection("Downgrade, empty init, unsafe-url redirect header ", redirectUrl, httpLocationUrl, "", "unsafe-url", referrerUrl);
+testReferrerAfterRedirection("Downgrade, empty init, no-referrer-when-downgrade redirect header ", redirectUrl, httpLocationUrl, "", "no-referrer-when-downgrade", null);
+testReferrerAfterRedirection("Downgrade, empty init, same-origin redirect header ", redirectUrl, httpLocationUrl, "", "same-origin", null);
+testReferrerAfterRedirection("Downgrade, empty init, origin redirect header ", redirectUrl, httpLocationUrl, "", "origin", referrerOrigin);
+testReferrerAfterRedirection("Downgrade, empty init, origin-when-cross-origin redirect header ", redirectUrl, httpLocationUrl, "", "origin-when-cross-origin", referrerOrigin);
+testReferrerAfterRedirection("Downgrade, empty init, no-referrer redirect header ", redirectUrl, httpLocationUrl, "", "no-referrer", null);
+testReferrerAfterRedirection("Downgrade, empty init, strict-origin redirect header ", redirectUrl, httpLocationUrl, "", "strict-origin", null);
+testReferrerAfterRedirection("Downgrade, empty init, strict-origin-when-cross-origin redirect header ", redirectUrl, httpLocationUrl, "", "strict-origin-when-cross-origin", null);
+
+testReferrerAfterRedirection("Downgrade, empty redirect header, unsafe-url init ", redirectUrl, httpLocationUrl, "unsafe-url", "", referrerUrl);
+testReferrerAfterRedirection("Downgrade, empty redirect header, no-referrer-when-downgrade init ", redirectUrl, httpLocationUrl, "no-referrer-when-downgrade", "", null);
+testReferrerAfterRedirection("Downgrade, empty redirect header, same-origin init ", redirectUrl, httpLocationUrl, "same-origin", "", null);
+testReferrerAfterRedirection("Downgrade, empty redirect header, origin init ", redirectUrl, httpLocationUrl, "origin", "", referrerOrigin);
+testReferrerAfterRedirection("Downgrade, empty redirect header, origin-when-cross-origin init ", redirectUrl, httpLocationUrl, "origin-when-cross-origin", "", referrerOrigin);
+testReferrerAfterRedirection("Downgrade, empty redirect header, no-referrer init ", redirectUrl, httpLocationUrl, "no-referrer", "", null);
+testReferrerAfterRedirection("Downgrade, empty redirect header, strict-origin init ", redirectUrl, httpLocationUrl, "strict-origin", "", null);
+testReferrerAfterRedirection("Downgrade, empty redirect header, strict-origin-when-cross-origin init ", redirectUrl, httpLocationUrl, "strict-origin-when-cross-origin", "", null);
+
+
diff --git a/testing/web-platform/mozilla/tests/fetch/api/redirect/redirect-referrer.https.html b/testing/web-platform/mozilla/tests/fetch/api/redirect/redirect-referrer.https.html
new file mode 100644
index 0000000000..bcd24892e2
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/api/redirect/redirect-referrer.https.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Fetch: redirect referrer handling, mixed content</title>
+ <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#http-redirect-fetch">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script src="/common/utils.js"></script>
+ <script src="/fetch/api/resources/utils.js"></script>
+ <script src="/common/get-host-info.sub.js"></script>
+ <script src="redirect-referrer-mixed-content.js"></script>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/fetchpriority-disabled.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/fetchpriority-disabled.h2.html
new file mode 100644
index 0000000000..8f4a2a15aa
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/fetchpriority-disabled.h2.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <meta name="timeout" content="long">
+ <title>fetchpriority: internal priorities of corresponding http-on-opening-requests</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+ <script type="module">
+ import { runTests } from "./fetchpriority.js";
+ runTests({
+ testDataKey: 'kTestDataDisabled',
+ });
+ </script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/fetchpriority.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/fetchpriority.h2.html
new file mode 100644
index 0000000000..43f0b10be2
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/fetchpriority.h2.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <meta name="timeout" content="long">
+ <title>fetchpriority: internal priorities of corresponding http-on-opening-requests</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+ <script type="module">
+ import { runTests } from "./fetchpriority.js";
+ runTests({
+ testDataKey: 'kTestData',
+ });
+ </script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/fetchpriority.js b/testing/web-platform/mozilla/tests/fetch/fetchpriority/fetchpriority.js
new file mode 100644
index 0000000000..dfdfd4a161
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/fetchpriority.js
@@ -0,0 +1,107 @@
+import * as scriptTestsData from "./support/script-tests-data.js";
+import * as linkTestsData from "./support/link-tests-data.js";
+import * as fontfaceTestsData from "./support/font-face-tests-data.js";
+import * as imageTestsData from "./support/image-tests-data.js";
+import * as fetchTestsData from "./support/fetch-tests-data.js";
+
+const kTopicHttpOnOpeningRequest = "http-on-opening-request";
+
+function getFileNameAndSuffixOf(aStr) {
+ return aStr.substr(aStr.lastIndexOf("/") + 1);
+}
+
+let httpOnOpeningRequests = [];
+
+const observeHttpOnOpeningRequest = { observe(aSubject, aTopic) {
+ assert_equals(aTopic, kTopicHttpOnOpeningRequest, "Observed '" +
+ kTopicHttpOnOpeningRequest + "'");
+
+ const fileNameAndSuffix = getFileNameAndSuffixOf(
+ aSubject.QueryInterface(SpecialPowers.Ci.nsIChannel).URI.spec);
+ const internalPriority =
+ aSubject.QueryInterface(SpecialPowers.Ci.nsISupportsPriority).priority;
+
+ httpOnOpeningRequests.push(
+ { fileNameAndSuffix: fileNameAndSuffix,
+ internalPriority: internalPriority});
+}};
+
+SpecialPowers.addObserver(observeHttpOnOpeningRequest,
+ kTopicHttpOnOpeningRequest);
+
+function containsOnlyUniqueFileNames(aRequests) {
+ const fileNames = aRequests.map((r) => r.fileNameAndSuffix);
+ return (new Set(fileNames)).size == fileNames.length;
+}
+
+const kTestGroups = [
+ scriptTestsData, linkTestsData, fontfaceTestsData, imageTestsData, fetchTestsData
+];
+
+const kSupportFolderName = "support";
+
+function runSingleTest(aTestData, aTestFolderName) {
+ promise_test((t) => {
+ return new Promise(resolve => {
+ const testPath = kSupportFolderName + "/" + aTestFolderName + "/" +
+ aTestData.testFileName;
+ var childWindow = window.open(testPath);
+
+ t.add_cleanup(() => {
+ httpOnOpeningRequests = [];
+ childWindow.close();
+ });
+
+ window.addEventListener("message", resolve);
+ }).then(e => {
+ assert_true(typeof e.data === "string", "String message received");
+ assert_equals(e.data, "ChildLoaded", "Child loaded");
+
+ assert_greater_than(aTestData.expectedRequests.length, 0,
+ "Test data should be non-empty");
+
+ assert_true(containsOnlyUniqueFileNames(aTestData.expectedRequests),
+ "Test data contains only unique filenames")
+
+ assert_greater_than(httpOnOpeningRequests.length, 0,
+ "Observed HTTP requests should be non-empty");
+
+ assert_true(containsOnlyUniqueFileNames(httpOnOpeningRequests),
+ "Observed only one HTTP request per filename");
+
+ // The actual order of the "http-on-opening-request"s is not checked,
+ // since the corresponding notification is sent when the resource is
+ // started to be loaded. However, since the resources might be too
+ // quick to load, depending on the machine and network, it can't be
+ // ensured that the server can reflect the priorities correctly.
+ // Hence, here only the internal priority sent to the server is
+ // checked.
+ aTestData.expectedRequests.forEach(
+ (expectedRequest) => {
+ const actualRequest =
+ httpOnOpeningRequests.find(
+ (actualRequest) => actualRequest.fileNameAndSuffix ==
+ expectedRequest.fileNameAndSuffix);
+ assert_not_equals(actualRequest, undefined,
+ "Found request for \"" + expectedRequest.fileNameAndSuffix +
+ "\"");
+ assert_equals(actualRequest.internalPriority,
+ expectedRequest.internalPriority,
+ "Check internal priority for '" +
+ expectedRequest.fileNameAndSuffix + "'");
+ });
+ });
+ }, aTestData.testFileName + ": test different 'fetchpriority' values");
+}
+
+export function runTests(aRunConfig) {
+ for (const testGroup of kTestGroups) {
+ const testDataKey = aRunConfig.testDataKey;
+ if (!testGroup[testDataKey]) {
+ continue;
+ }
+ for (const singleTestData of testGroup[testDataKey]) {
+ runSingleTest(singleTestData, testGroup.kTestFolderName);
+ }
+ }
+}
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/fetch-tests-data.js b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/fetch-tests-data.js
new file mode 100644
index 0000000000..4edb3ae171
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/fetch-tests-data.js
@@ -0,0 +1,40 @@
+export const kTestFolderName = "fetch-tests";
+
+const kExpectedRequestsOfFetchAPI = [
+ { fileNameAndSuffix: "dummy.css?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "dummy.css?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "dummy.css?3",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "dummy.css?4",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "dummy.css?5",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "dummy.css?6",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "dummy.css?7",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "dummy.css?8",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "dummy.css?9",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "dummy.css?10",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ }
+];
+
+export const kTestData = [
+ { testFileName: "fetch-init.h2.html",
+ expectedRequests: kExpectedRequestsOfFetchAPI
+ }
+];
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/fetch-tests/fetch-init.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/fetch-tests/fetch-init.h2.html
new file mode 100644
index 0000000000..0e267b0a3a
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/fetch-tests/fetch-init.h2.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+</head>
+<body>
+<script>
+ const resource_url = new URL('../resources/dummy.css', location);
+ onload = function() {
+ const kData = [
+ {
+ description: 'fetch() with URL and request_init whose priority is "high" must be fetched with high load priority',
+ request_info: `${resource_url}?1`,
+ request_init: {priority: 'high'}
+ },
+ {
+ description: 'fetch() with URL and request_init whose priority is "auto" must have no effect on resource load priority',
+ request_info: `${resource_url}?2`,
+ request_init: {priority: 'auto'}
+ },
+ {
+ description: 'fetch() with URL and request_init whose priority is missing must have no effect on resource load priority',
+ request_info: `${resource_url}?3`,
+ request_init: {}
+ },
+ {
+ description: 'fetch() with URL and request_init whose priority is "low" must be fetched with low resource load priority',
+ request_info: `${resource_url}?4`,
+ request_init: {priority: 'low'}
+ },
+ {
+ description: 'fetch() with Request whose priority is "low" and request_init whose priority is "high" must have no effect on resource load priority',
+ request_info: new Request(`${resource_url}?5`, {priority: 'low'}),
+ request_init: {priority: 'high'}
+ },
+ {
+ description: 'fetch() with Request whose priority is "high" and request_init whose priority is "low" must be fetched with low resource load priority',
+ request_info: new Request(`${resource_url}?6`, {priority: 'high'}),
+ request_init: {priority: 'low'}
+ },
+ {
+ description: 'fetch() with Request whose priority is "high" and no request_init must be fetched with high resource load priority',
+ request_info: new Request(`${resource_url}?7`, {priority: 'high'})
+ },
+ {
+ description: 'fetch() with Request whose priority is "auto" and no request_init must have no effect on resource load priority',
+ request_info: new Request(`${resource_url}?8`, {priority: 'auto'})
+ },
+ {
+ description: 'fetch() with Request whose priority is missing and no request_init must have no effect on resource load priority',
+ request_info: new Request(`${resource_url}?9`)
+ },
+ {
+ description: 'fetch() with Request whose priority is "low" and no request_init must be fetched with low resource load priority',
+ request_info: new Request(`${resource_url}?10`, {priority: 'low'})
+ }
+ ];
+ for (const data of kData) {
+ const response = fetch(data.request_info, data.request_init);
+ opener.postMessage("ChildLoaded", "*");
+ }
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/font-face-tests-data.js b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/font-face-tests-data.js
new file mode 100644
index 0000000000..513bfe7a03
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/font-face-tests-data.js
@@ -0,0 +1,21 @@
+const kExpectedRequests = [
+ { fileNameAndSuffix: "dummy.font",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+];
+
+export const kTestFolderName = "font-face-tests";
+
+export const kTestData = [
+ { testFileName: "load-font-face-from-head.h2.html",
+ expectedRequests: kExpectedRequests
+ },
+ { testFileName: "load-font-face-from-worker.h2.html",
+ expectedRequests: kExpectedRequests
+ },
+ { testFileName: "load-font-face-from-script.h2.html",
+ expectedRequests: kExpectedRequests
+ },
+];
+
+export const kTestDataDisabled = kTestData;
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/font-face-tests/font-face-worker.js b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/font-face-tests/font-face-worker.js
new file mode 100644
index 0000000000..5afd6641b5
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/font-face-tests/font-face-worker.js
@@ -0,0 +1,5 @@
+const fontFace = new FontFace("dummy-font", "url(../resources/dummy.font)");
+fonts.add(fontFace);
+fontFace.load();
+
+fonts.ready.then(() => { postMessage("Font loaded"); })
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/font-face-tests/load-font-face-from-head.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/font-face-tests/load-font-face-from-head.h2.html
new file mode 100644
index 0000000000..db3ebc148c
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/font-face-tests/load-font-face-from-head.h2.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+ <style>
+ @font-face {
+ font-family: "dummy-font";
+ src: url("../resources/dummy.font");
+ }
+ body {
+ font-family: "dummy-font";
+ }
+ </style>
+</head>
+<body>
+asdf
+<script>
+ onload = function() {
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/font-face-tests/load-font-face-from-script.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/font-face-tests/load-font-face-from-script.h2.html
new file mode 100644
index 0000000000..90af7200d2
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/font-face-tests/load-font-face-from-script.h2.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+</head>
+<body>
+asdf
+<script>
+ onload = function() {
+ const fontFace = new FontFace("dummy-font", "url(../resources/dummy.font)");
+ document.fonts.add(fontFace);
+ fontFace.load();
+ document.fonts.ready.then(() => opener.postMessage("ChildLoaded", "*"));
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/font-face-tests/load-font-face-from-worker.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/font-face-tests/load-font-face-from-worker.h2.html
new file mode 100644
index 0000000000..795e517594
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/font-face-tests/load-font-face-from-worker.h2.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+</head>
+<body>
+<script>
+ onload = function() {
+ const worker = new Worker("font-face-worker.js");
+ worker.addEventListener("message", (m) => {
+ if (m.data == "Font loaded") {
+ opener.postMessage("ChildLoaded", "*");
+ }
+ });
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests-data.js b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests-data.js
new file mode 100644
index 0000000000..ee070c338b
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests-data.js
@@ -0,0 +1,96 @@
+export const kTestFolderName = "image-tests";
+
+// The internal priorities are specified as implementation-defined,
+// (https://fetch.spec.whatwg.org/#concept-fetch, step 15). For web-
+// compatibility, Chromium's mapping is chosen
+// (https://web.dev/articles/fetch-priority#browser_priority_and_fetchpriority).
+const kExpectedRequestsOfInitialLoad = [
+ { fileNameAndSuffix: "square_25px_x_25px.png?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "square_25px_x_25px.png?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "square_25px_x_25px.png?3",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "square_25px_x_25px.png?4",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+];
+
+const kExpectedRequestsOfInitialLoadDisabled = [
+ { fileNameAndSuffix: "square_25px_x_25px.png?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "square_25px_x_25px.png?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "square_25px_x_25px.png?3",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "square_25px_x_25px.png?4",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+];
+
+const kExpectedRequestsOfDynamicLoad = kExpectedRequestsOfInitialLoad;
+
+const kExpectedRequestsOfDynamicLoadDisabled = kExpectedRequestsOfInitialLoadDisabled;
+
+const kExpectedRequestsOfInitialLoadForSVGImageTagDisabled = kExpectedRequestsOfInitialLoadDisabled;
+
+// TODO(bug 1865837): Should SVG's `<image>` element support the `fetchpriority` attribute?
+const kExpectedRequestsOfInitialLoadForSVGImageTag = kExpectedRequestsOfInitialLoadForSVGImageTagDisabled;
+
+const kExpectedRequestsOfDynamicLoadForSVGImageTagDisabled = kExpectedRequestsOfDynamicLoadDisabled;
+
+// TODO(bug 1865837): Should SVG's `<image>` element support the `fetchpriority` attribute?
+const kExpectedRequestsOfDynamicLoadForSVGImageTag = kExpectedRequestsOfDynamicLoadForSVGImageTagDisabled;
+
+const kExpectedRequestsShapeOutsideImage = [
+ { fileNameAndSuffix: "square_25px_x_25px.png?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "square_25px_x_25px.png?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+];
+
+const kExpectedRequestsShapeOutsideImageDisabled = kExpectedRequestsShapeOutsideImage;
+
+export const kTestData = [
+ { testFileName: "image-initial-load.h2.html",
+ expectedRequests: kExpectedRequestsOfInitialLoad
+ },
+ { testFileName: "image-dynamic-load.h2.html",
+ expectedRequests: kExpectedRequestsOfDynamicLoad
+ },
+ { testFileName: "image-svg-initial-load.h2.html",
+ expectedRequests: kExpectedRequestsOfInitialLoadForSVGImageTag,
+ },
+ { testFileName: "image-svg-dynamic-load.h2.html",
+ expectedRequests: kExpectedRequestsOfDynamicLoadForSVGImageTag,
+ },
+ { testFileName: "shape-outside-image.h2.html",
+ expectedRequests: kExpectedRequestsShapeOutsideImage
+ },
+];
+
+export const kTestDataDisabled = [
+ { testFileName: "image-initial-load.h2.html",
+ expectedRequests: kExpectedRequestsOfInitialLoadDisabled
+ },
+ { testFileName: "image-dynamic-load.h2.html",
+ expectedRequests: kExpectedRequestsOfDynamicLoadDisabled
+ },
+ { testFileName: "image-svg-initial-load.h2.html",
+ expectedRequests: kExpectedRequestsOfInitialLoadForSVGImageTagDisabled,
+ },
+ { testFileName: "image-svg-dynamic-load.h2.html",
+ expectedRequests: kExpectedRequestsOfDynamicLoadForSVGImageTagDisabled,
+ },
+ { testFileName: "shape-outside-image.h2.html",
+ expectedRequests: kExpectedRequestsShapeOutsideImageDisabled
+ },
+];
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests/image-dynamic-load.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests/image-dynamic-load.h2.html
new file mode 100644
index 0000000000..20de6ed042
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests/image-dynamic-load.h2.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+</head>
+<body>
+<script>
+ onload = function() {
+ const kData = [
+ { src: "../resources/square_25px_x_25px.png?1", fetchPriority: "low" },
+ { src: "../resources/square_25px_x_25px.png?2", fetchPriority: "high" },
+ { src: "../resources/square_25px_x_25px.png?3", fetchPriority: "auto" },
+ { src: "../resources/square_25px_x_25px.png?4"},
+ ];
+
+ let numberOfLoads = 0;
+ for (const data of kData) {
+ const imgElement = document.createElement("img");
+
+ if ("fetchPriority" in data) {
+ imgElement.fetchPriority = data.fetchPriority;
+ }
+
+ imgElement.addEventListener("load", () => {
+ ++numberOfLoads;
+ if (numberOfLoads == kData.length) {
+ opener.postMessage("ChildLoaded");
+ }
+ }, { once: "true"});
+
+ imgElement.alt = "a";
+ imgElement.src = data.src;
+
+ // Don't append `imgElement` to the document to prevent re-
+ // priotiziation.
+ }
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests/image-initial-load.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests/image-initial-load.h2.html
new file mode 100644
index 0000000000..c3ee532d9e
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests/image-initial-load.h2.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+ </head>
+ <body>
+ <img fetchpriority="low" src="../resources/square_25px_x_25px.png?2" alt="img">
+ <img fetchpriority="high" src="../resources/square_25px_x_25px.png?1" alt="img">
+ <img fetchpriority="auto" src="../resources/square_25px_x_25px.png?3" alt="img">
+ <img src="../resources/square_25px_x_25px.png?4" alt="img">
+ <script>
+ onload = function() {
+ opener.postMessage("ChildLoaded", "*");
+ }
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests/image-svg-dynamic-load.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests/image-svg-dynamic-load.h2.html
new file mode 100644
index 0000000000..81df28cd8a
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests/image-svg-dynamic-load.h2.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>internal priority of SVG's &lt;image&gt; element (dynamic insertion)</title>
+</head>
+<body>
+<script>
+ onload = function() {
+ const kData = [
+ { src: "../resources/square_25px_x_25px.png?1", fetchPriority: "low" },
+ { src: "../resources/square_25px_x_25px.png?2", fetchPriority: "high" },
+ { src: "../resources/square_25px_x_25px.png?3", fetchPriority: "auto" },
+ { src: "../resources/square_25px_x_25px.png?4"},
+ ];
+ let numberOfLoads = 0;
+ for (const data of kData) {
+ const namespaceURI = "http://www.w3.org/2000/svg";
+ const imgElement = document.createElementNS(namespaceURI, "image");
+
+ if ("fetchPriority" in data) {
+ imgElement.fetchPriority = data.fetchPriority;
+ }
+
+ imgElement.addEventListener("load", () => {
+ ++numberOfLoads;
+ if (numberOfLoads == kData.length) {
+ opener.postMessage("ChildLoaded");
+ }
+ }, { once: "true"});
+
+ // Use setAttribute as corresponding SVGImageElement/SVGURIReference
+ // attributes are read-only.
+ imgElement.setAttribute("width", "25");
+ imgElement.setAttribute("height", "25");
+ imgElement.setAttribute("href", data.src);
+
+ // Per https://svgwg.org/svg2-draft/linking.html#processingURL
+ // the URL is only processed "at the time the element is connected to a
+ // document, or at the time when the attribute is set, whichever is
+ // later" so it's necessary to insert imgElement into the document in
+ // order to trigger ressource fetching.
+ let svg = document.createElementNS(namespaceURI, "svg");
+ svg.appendChild(imgElement);
+ document.body.appendChild(svg);
+ }
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests/image-svg-initial-load.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests/image-svg-initial-load.h2.html
new file mode 100644
index 0000000000..d8d46e37c8
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests/image-svg-initial-load.h2.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>internal priority of SVG's &lt;image&gt; element</title>
+ </head>
+ <body>
+ <svg width="25" height="25">
+ <image href="../resources/square_25px_x_25px.png?1"
+ width="25" height="25" fetchpriority="low"/>
+ </svg>
+ <svg width="25" height="25">
+ <image href="../resources/square_25px_x_25px.png?2"
+ width="25" height="25" fetchpriority="high"/>
+ </svg>
+ <svg width="25" height="25">
+ <image href="../resources/square_25px_x_25px.png?3"
+ width="25" height="25" fetchpriority="auto"/>
+ </svg>
+ <svg width="25" height="25">
+ <image href="../resources/square_25px_x_25px.png?4"
+ width="25" height="25"/>
+ </svg>
+ <script>
+ onload = function() {
+ opener.postMessage("ChildLoaded", "*");
+ }
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests/shape-outside-image.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests/shape-outside-image.h2.html
new file mode 100644
index 0000000000..7668a3292c
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests/shape-outside-image.h2.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>internal priority of shape-outside image</title>
+ <style>
+ .floated-box {
+ border: solid;
+ width: 150px;
+ height: 150px;
+ float: right;
+ shape-outside: url("../resources/square_25px_x_25px.png?1");
+ }
+ </style>
+</head>
+<body>
+<!-- The url for the src and `shape-outside` may differ per spec
+ (https://drafts.csswg.org/css-shapes/#shape-outside-property) . !-->
+<img class=floated-box src="../resources/square_25px_x_25px.png?2" alt="img with shape-outside image"></img>
+
+<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+
+<script>
+ onload = function() {
+ opener.postMessage("ChildLoaded")
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests-data.js b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests-data.js
new file mode 100644
index 0000000000..16e59f2fd9
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests-data.js
@@ -0,0 +1,471 @@
+export const kTestFolderName = "link-tests";
+
+const kExpectedRequestsOfLoadStylesheet = [
+ { fileNameAndSuffix: "dummy.css?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "dummy.css?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST
+ },
+ { fileNameAndSuffix: "dummy.css?3",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST
+ },
+ { fileNameAndSuffix: "dummy.css?4",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST
+ },
+ { fileNameAndSuffix: "dummy.css?5",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "dummy.css?6",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "dummy.css?7",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "dummy.css?8",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ // `media=print` doesn't match the environment
+ // (https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#matches-the-environment)
+ // hence all internal priorities should be low.
+ { fileNameAndSuffix: "dummy.css?9",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "dummy.css?10",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "dummy.css?11",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "dummy.css?12",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+];
+
+const kExpectedRequestsOfLoadStylesheetDisabled = [
+ { fileNameAndSuffix: "dummy.css?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.css?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.css?3",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.css?4",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.css?5",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.css?6",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.css?7",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.css?8",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.css?9",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.css?10",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.css?11",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.css?12",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+];
+
+const kExpectedRequestsOfLinkPreloadFont = [
+ { fileNameAndSuffix: "dummy.font?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "dummy.font?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "dummy.font?3",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "dummy.font?4",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+];
+
+const kExpectedRequestsOfLinkPreloadFontDisabled = [
+ { fileNameAndSuffix: "dummy.font?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "dummy.font?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "dummy.font?3",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "dummy.font?4",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+];
+
+const kExpectedRequestsOfLinkPreloadImage = [
+ { fileNameAndSuffix: "dummy.image?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "dummy.image?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "dummy.image?3",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "dummy.image?4",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+];
+
+const kExpectedRequestsOfLinkPreloadImageDisabled = [
+ { fileNameAndSuffix: "dummy.image?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW + 1
+ },
+ { fileNameAndSuffix: "dummy.image?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW + 1
+ },
+ { fileNameAndSuffix: "dummy.image?3",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW + 1
+ },
+ { fileNameAndSuffix: "dummy.image?4",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW + 1
+ },
+];
+
+const kExpectedRequestsOfLinkPreloadFetch = [
+ { fileNameAndSuffix: "dummy.txt?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "dummy.txt?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "dummy.txt?3",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.txt?4",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+];
+
+const kExpectedRequestsOfLinkPreloadFetchDisabled = [
+ { fileNameAndSuffix: "dummy.txt?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.txt?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.txt?3",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.txt?4",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+];
+
+const kExpectedRequestsOfPreloadScript = [
+ { fileNameAndSuffix: "dummy.js?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "dummy.js?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "dummy.js?3",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "dummy.js?4",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+];
+
+const kExpectedRequestsOfPreloadScriptDisabled = [
+ { fileNameAndSuffix: "dummy.js?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST
+ },
+ { fileNameAndSuffix: "dummy.js?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST
+ },
+ { fileNameAndSuffix: "dummy.js?3",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST
+ },
+ { fileNameAndSuffix: "dummy.js?4",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST
+ },
+];
+
+const kExpectedRequestsOfLinkPreloadStyle = [
+ { fileNameAndSuffix: "dummy.css?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "dummy.css?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST
+ },
+ { fileNameAndSuffix: "dummy.css?3",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST
+ },
+ { fileNameAndSuffix: "dummy.css?4",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST
+ },
+];
+
+const kExpectedRequestsOfLinkPreloadStyleDisabled = [
+ { fileNameAndSuffix: "dummy.css?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST
+ },
+ { fileNameAndSuffix: "dummy.css?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST
+ },
+ { fileNameAndSuffix: "dummy.css?3",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST
+ },
+ { fileNameAndSuffix: "dummy.css?4",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST
+ },
+];
+
+const kExpectedRequestsOfModulepreload = kExpectedRequestsOfPreloadScript;
+
+const kExpectedRequestsOfModulepreloadDisabled = kExpectedRequestsOfPreloadScriptDisabled;
+
+const kExpectedRequestsOfPrefetch = [
+ { fileNameAndSuffix: "dummy.txt?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOWEST
+ },
+ { fileNameAndSuffix: "dummy.txt?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOWEST
+ },
+ { fileNameAndSuffix: "dummy.txt?3",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOWEST
+ },
+ { fileNameAndSuffix: "dummy.txt?4",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOWEST
+ }
+];
+
+const kExpectedRequestsOfPrefetchDisabled = kExpectedRequestsOfPrefetch;
+
+const kPipeHeaderLinksToStylesheets =
+ "=header(Link,<dummy.css?1>; rel=stylesheet; fetchpriority=low,True)" +
+ "|header(Link,<dummy.css?2>; rel=stylesheet; fetchpriority=high,True)" +
+ "|header(Link,<dummy.css?3>; rel=stylesheet; fetchpriority=auto,True)" +
+ "|header(Link,<dummy.css?4>; rel=stylesheet,True)" +
+ "|header(Link,<dummy.css?5>; rel=\"alternate stylesheet\"; title=5; fetchpriority=low,True)" +
+ "|header(Link,<dummy.css?6>; rel=\"alternate stylesheet\"; title=6; fetchpriority=high,True)" +
+ "|header(Link,<dummy.css?7>; rel=\"alternate stylesheet\"; title=7; fetchpriority=auto,True)" +
+ "|header(Link,<dummy.css?8>; rel=\"alternate stylesheet\"; title=8,True)" +
+ "|header(Link,<dummy.css?9>; rel=stylesheet; fetchpriority=low; media=print,True)" +
+ "|header(Link,<dummy.css?10>; rel=stylesheet; fetchpriority=high; media=print,True)" +
+ "|header(Link,<dummy.css?11>; rel=stylesheet; fetchpriority=auto; media=print,True)" +
+ "|header(Link,<dummy.css?12>; rel=stylesheet; media=print,True)";
+
+const kPipeHeaderPreloadFontLinks =
+ "=header(Link,<dummy.font?1>; rel=preload; as=font; fetchpriority=low,True)" +
+ "|header(Link,<dummy.font?2>; rel=preload; as=font; fetchpriority=high,True)" +
+ "|header(Link,<dummy.font?3>; rel=preload; as=font; fetchpriority=auto,True)" +
+ "|header(Link,<dummy.font?4>; rel=preload; as=font,True)";
+
+const kPipeHeaderPreloadImageLinks =
+ "=|header(Link,<dummy.image?1>; rel=preload; as=image; fetchpriority=low,True)" +
+ "|header(Link,<dummy.image?2>; rel=preload; as=image; fetchpriority=high,True)" +
+ "|header(Link,<dummy.image?3>; rel=preload; as=image; fetchpriority=auto,True)" +
+ "|header(Link,<dummy.image?4>; rel=preload; as=image,True)";
+
+const kPipeHeaderPreloadFetchLinks =
+ "=header(Link,<dummy.txt?1>; rel=preload; as=fetch; fetchpriority=low,True)" +
+ "|header(Link,<dummy.txt?2>; rel=preload; as=fetch; fetchpriority=high,True)" +
+ "|header(Link,<dummy.txt?3>; rel=preload; as=fetch; fetchpriority=auto,True)" +
+ "|header(Link,<dummy.txt?4>; rel=preload; as=fetch,True)";
+
+const kPipeHeaderPreloadScriptLinks =
+ "=header(Link,<dummy.js?1>; rel=preload; as=script; fetchpriority=low,True)" +
+ "|header(Link,<dummy.js?2>; rel=preload; as=script; fetchpriority=high,True)" +
+ "|header(Link,<dummy.js?3>; rel=preload; as=script; fetchpriority=auto,True)" +
+ "|header(Link,<dummy.js?4>; rel=preload; as=script,True)";
+
+ const kPipeHeaderPreloadStyleLinks =
+ "=header(Link,<dummy.css?1>; rel=preload; as=style; fetchpriority=low,True)" +
+ "|header(Link,<dummy.css?2>; rel=preload; as=style; fetchpriority=high,True)" +
+ "|header(Link,<dummy.css?3>; rel=preload; as=style; fetchpriority=auto,True)" +
+ "|header(Link,<dummy.css?4>; rel=preload; as=style,True)";
+
+const kPipeHeaderModulepreloadLinks =
+ "=header(Link,<dummy.js?1>; rel=modulepreload; fetchpriority=low,True)" +
+ "|header(Link,<dummy.js?2>; rel=modulepreload; fetchpriority=high,True)" +
+ "|header(Link,<dummy.js?3>; rel=modulepreload; fetchpriority=auto,True)" +
+ "|header(Link,<dummy.js?4>; rel=modulepreload,True)";
+
+const kPipeHeaderPrefetchLinks =
+ "=header(Link,<dummy.txt?1>; rel=prefetch; fetchpriority=low,True)" +
+ "|header(Link,<dummy.txt?2>; rel=prefetch; fetchpriority=high,True)" +
+ "|header(Link,<dummy.txt?3>; rel=prefetch; fetchpriority=auto,True)" +
+ "|header(Link,<dummy.txt?4>; rel=prefetch,True)";
+
+// The expected internal priorites of the test data are specified as
+// implementation-defined. See step 11. of
+// <https://html.spec.whatwg.org/#create-a-link-request> and step 15. of
+// <https://fetch.spec.whatwg.org/#concept-fetch>.
+//
+// The internal priorities already differ for browsers. The ones for Chromium,
+// including fetchpriority's effect on them, are reported at
+// <https://web.dev/fetch-priority/#browser-priority-and-fetchpriority>.
+// When Gecko's internal priorities match those, the fetchpriority attribute in
+// Gecko is expected to have the same effect as in Chromium. When not, applying
+// "fetchpriority=low" ("high") is expected to adjust the internal priority to
+// the next lower (higher) priority.
+export const kTestData = [
+ { testFileName: "link-initial-load-stylesheet.h2.html",
+ expectedRequests: kExpectedRequestsOfLoadStylesheet
+ },
+ { testFileName: "link-dynamic-load-stylesheet.h2.html",
+ expectedRequests: kExpectedRequestsOfLoadStylesheet
+ },
+ { testFileName: "link-header.h2.html?pipe" + kPipeHeaderLinksToStylesheets,
+ expectedRequests: kExpectedRequestsOfLoadStylesheet
+ },
+ { testFileName: "link-initial-preload-image.h2.html",
+ expectedRequests: kExpectedRequestsOfLinkPreloadImage
+ },
+ { testFileName: "link-initial-preload-font.h2.html",
+ expectedRequests: kExpectedRequestsOfLinkPreloadFont
+ },
+ { testFileName: "link-initial-preload-fetch.h2.html",
+ expectedRequests: kExpectedRequestsOfLinkPreloadFetch
+ },
+ { testFileName: "link-initial-preload-script.h2.html",
+ expectedRequests: kExpectedRequestsOfPreloadScript
+ },
+ { testFileName: "link-initial-preload-style.h2.html",
+ expectedRequests: kExpectedRequestsOfLinkPreloadStyle
+ },
+ { testFileName: "link-dynamic-preload-image.h2.html",
+ expectedRequests: kExpectedRequestsOfLinkPreloadImage
+ },
+ { testFileName: "link-dynamic-preload-font.h2.html",
+ expectedRequests: kExpectedRequestsOfLinkPreloadFont
+ },
+ { testFileName: "link-dynamic-preload-fetch.h2.html",
+ expectedRequests: kExpectedRequestsOfLinkPreloadFetch
+ },
+ { testFileName: "link-dynamic-preload-script.h2.html",
+ expectedRequests: kExpectedRequestsOfPreloadScript
+ },
+ { testFileName: "link-dynamic-preload-style.h2.html",
+ expectedRequests: kExpectedRequestsOfLinkPreloadStyle
+ },
+ { testFileName: "link-header.h2.html?pipe" + kPipeHeaderPreloadImageLinks,
+ expectedRequests: kExpectedRequestsOfLinkPreloadImage
+ },
+ { testFileName: "link-header.h2.html?pipe" + kPipeHeaderPreloadFontLinks,
+ expectedRequests: kExpectedRequestsOfLinkPreloadFont
+ },
+ { testFileName: "link-header.h2.html?pipe" + kPipeHeaderPreloadFetchLinks,
+ expectedRequests: kExpectedRequestsOfLinkPreloadFetch
+ },
+ { testFileName: "link-header.h2.html?pipe" + kPipeHeaderPreloadScriptLinks,
+ expectedRequests: kExpectedRequestsOfPreloadScript
+ },
+ { testFileName: "link-header.h2.html?pipe" + kPipeHeaderPreloadStyleLinks,
+ expectedRequests: kExpectedRequestsOfLinkPreloadStyle
+ },
+ { testFileName: "link-initial-modulepreload.h2.html",
+ expectedRequests: kExpectedRequestsOfModulepreload
+ },
+ { testFileName: "link-dynamic-modulepreload.h2.html",
+ expectedRequests: kExpectedRequestsOfModulepreload
+ },
+ { testFileName: "link-header.h2.html?pipe" + kPipeHeaderModulepreloadLinks,
+ expectedRequests: kExpectedRequestsOfModulepreload
+ },
+ { testFileName: "link-initial-prefetch.h2.html",
+ expectedRequests: kExpectedRequestsOfPrefetch
+ },
+ { testFileName: "link-dynamic-prefetch.h2.html",
+ expectedRequests: kExpectedRequestsOfPrefetch
+ },
+ { testFileName: "link-header.h2.html?pipe" + kPipeHeaderPrefetchLinks,
+ expectedRequests: kExpectedRequestsOfPrefetch
+ }
+];
+
+export const kTestDataDisabled = [
+ { testFileName: "link-initial-load-stylesheet.h2.html",
+ expectedRequests: kExpectedRequestsOfLoadStylesheetDisabled
+ },
+ { testFileName: "link-initial-preload-font.h2.html",
+ expectedRequests: kExpectedRequestsOfLinkPreloadFontDisabled
+ },
+ { testFileName: "link-initial-preload-fetch.h2.html",
+ expectedRequests: kExpectedRequestsOfLinkPreloadFetchDisabled
+ },
+ { testFileName: "link-initial-preload-script.h2.html",
+ expectedRequests: kExpectedRequestsOfPreloadScriptDisabled
+ },
+ { testFileName: "link-initial-preload-style.h2.html",
+ expectedRequests: kExpectedRequestsOfLinkPreloadStyleDisabled
+ },
+ { testFileName: "link-initial-modulepreload.h2.html",
+ expectedRequests: kExpectedRequestsOfModulepreloadDisabled
+ },
+ { testFileName: "link-initial-prefetch.h2.html",
+ expectedRequests: kExpectedRequestsOfPrefetchDisabled
+ },
+ { testFileName: "link-initial-preload-image.h2.html",
+ expectedRequests: kExpectedRequestsOfLinkPreloadImageDisabled
+ },
+ { testFileName: "link-dynamic-load-stylesheet.h2.html",
+ expectedRequests: kExpectedRequestsOfLoadStylesheetDisabled
+ },
+ { testFileName: "link-dynamic-prefetch.h2.html",
+ expectedRequests: kExpectedRequestsOfPrefetchDisabled
+ },
+ { testFileName: "link-dynamic-preload-font.h2.html",
+ expectedRequests: kExpectedRequestsOfLinkPreloadFontDisabled
+ },
+ { testFileName: "link-dynamic-preload-fetch.h2.html",
+ expectedRequests: kExpectedRequestsOfLinkPreloadFetchDisabled
+ },
+ { testFileName: "link-dynamic-preload-script.h2.html",
+ expectedRequests: kExpectedRequestsOfPreloadScriptDisabled
+ },
+ { testFileName: "link-dynamic-preload-style.h2.html",
+ expectedRequests: kExpectedRequestsOfLinkPreloadStyleDisabled
+ },
+ { testFileName: "link-dynamic-modulepreload.h2.html",
+ expectedRequests: kExpectedRequestsOfModulepreloadDisabled
+ },
+ { testFileName: "link-dynamic-preload-image.h2.html",
+ expectedRequests: kExpectedRequestsOfLinkPreloadImageDisabled
+ },
+ { testFileName: "link-header.h2.html?pipe" + kPipeHeaderLinksToStylesheets,
+ expectedRequests: kExpectedRequestsOfLoadStylesheetDisabled
+ },
+ { testFileName: "link-header.h2.html?pipe" + kPipeHeaderPrefetchLinks,
+ expectedRequests: kExpectedRequestsOfPrefetchDisabled
+ },
+ { testFileName: "link-header.h2.html?pipe" + kPipeHeaderPreloadStyleLinks,
+ expectedRequests: kExpectedRequestsOfLinkPreloadStyleDisabled
+ },
+ { testFileName: "link-header.h2.html?pipe" + kPipeHeaderPreloadFontLinks,
+ expectedRequests: kExpectedRequestsOfLinkPreloadFontDisabled
+ },
+ { testFileName: "link-header.h2.html?pipe" + kPipeHeaderPreloadFetchLinks,
+ expectedRequests: kExpectedRequestsOfLinkPreloadFetchDisabled
+ },
+ { testFileName: "link-header.h2.html?pipe" + kPipeHeaderPreloadImageLinks,
+ expectedRequests: kExpectedRequestsOfLinkPreloadImageDisabled
+ },
+ { testFileName: "link-header.h2.html?pipe" + kPipeHeaderPreloadScriptLinks,
+ expectedRequests: kExpectedRequestsOfPreloadScriptDisabled
+ },
+ { testFileName: "link-header.h2.html?pipe" + kPipeHeaderModulepreloadLinks,
+ expectedRequests: kExpectedRequestsOfModulepreloadDisabled
+ },
+];
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-load-stylesheet.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-load-stylesheet.h2.html
new file mode 100644
index 0000000000..13a6b6f0f3
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-load-stylesheet.h2.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+</head>
+<body>
+<script>
+ onload = function() {
+ const kData = [
+ { href: "../resources/dummy.css?1", fetchPriority: "low", isAlternate: false,
+ isMediaPrint: false },
+ { href: "../resources/dummy.css?2", fetchPriority: "high", isAlternate: false,
+ isMediaPrint: false },
+ { href: "../resources/dummy.css?3", fetchPriority: "auto", isAlternate: false,
+ isMediaPrint: false } ,
+ { href: "../resources/dummy.css?4", isAlternate: false,
+ isMediaPrint: false } ,
+ { href: "../resources/dummy.css?5", fetchPriority: "low", isAlternate: true,
+ isMediaPrint: false, title: "5" },
+ { href: "../resources/dummy.css?6", fetchPriority: "high", isAlternate: true,
+ isMediaPrint: false, title: "6" },
+ { href: "../resources/dummy.css?7", fetchPriority: "auto", isAlternate: true,
+ isMediaPrint: false, title: "7" },
+ { href: "../resources/dummy.css?8", isAlternate: true,
+ isMediaPrint: false, title: "8" },
+ { href: "../resources/dummy.css?9", fetchPriority: "low", isAlternate: false,
+ isMediaPrint: true },
+ { href: "../resources/dummy.css?10", fetchPriority: "high", isAlternate: false,
+ isMediaPrint: true },
+ { href: "../resources/dummy.css?11", fetchPriority: "auto", isAlternate: false,
+ isMediaPrint: true },
+ { href: "../resources/dummy.css?12", isAlternate: false,
+ isMediaPrint: true },
+ ];
+
+ let loadCounter = 0;
+ let allLinkElements = [];
+ for (data of kData) {
+ let linkElement = document.createElement("link");
+
+ linkElement.rel = data.isAlternate ? "alternate stylesheet" :
+ "stylesheet";
+
+ if (data.isAlternate) {
+ linkElement.title = data.title;
+ }
+
+ linkElement.href = data.href;
+
+ // Wait until all elements have been loaded.
+ linkElement.onload = () => {
+ ++loadCounter;
+ if (loadCounter == allLinkElements.length) {
+ opener.postMessage("ChildLoaded", "*");
+ }
+ }
+
+ if ("fetchPriority" in data) {
+ linkElement.fetchPriority = data.fetchPriority;
+ }
+
+ if (data.isMediaPrint) {
+ linkElement.media = "print";
+ }
+
+ allLinkElements.push(linkElement);
+ }
+
+ document.head.append(...allLinkElements)
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-modulepreload.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-modulepreload.h2.html
new file mode 100644
index 0000000000..43a1e50813
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-modulepreload.h2.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+</head>
+<body>
+<script>
+ onload = function() {
+ const kData = [
+ { href: "../resources/dummy.js?1", fetchPriority: "low" },
+ { href: "../resources/dummy.js?2", fetchPriority: "high" },
+ { href: "../resources/dummy.js?3", fetchPriority: "auto" },
+ { href: "../resources/dummy.js?4" }
+ ];
+
+ let allLinkElements = [];
+ for (data of kData) {
+ let linkElement = document.createElement("link");
+ linkElement.rel = "modulepreload";
+ linkElement.href = data.href;
+
+ if ("fetchPriority" in data) {
+ linkElement.fetchPriority = data.fetchPriority;
+ }
+
+ allLinkElements.push(linkElement);
+ }
+
+ document.head.append(...allLinkElements)
+
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-prefetch.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-prefetch.h2.html
new file mode 100644
index 0000000000..2640596ee8
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-prefetch.h2.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+</head>
+<body>
+<script>
+ onload = function() {
+ const kData = [
+ { href: "../resources/dummy.txt?1", fetchPriority: "low" },
+ { href: "../resources/dummy.txt?2", fetchPriority: "high" },
+ { href: "../resources/dummy.txt?3", fetchPriority: "auto" },
+ { href: "../resources/dummy.txt?4" }
+ ];
+
+ let allLinkElements = [];
+ for (data of kData) {
+ let linkElement = document.createElement("link");
+ linkElement.rel = "prefetch";
+ linkElement.href = data.href;
+
+ if ("fetchPriority" in data) {
+ linkElement.fetchPriority = data.fetchPriority;
+ }
+
+ allLinkElements.push(linkElement);
+ }
+
+ document.head.append(...allLinkElements)
+
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-preload-fetch.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-preload-fetch.h2.html
new file mode 100644
index 0000000000..b055a0e22c
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-preload-fetch.h2.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+</head>
+<body>
+<script>
+ onload = function() {
+ const kData = [
+ { as: "fetch", href: "../resources/dummy.txt?1", fetchPriority: "low" },
+ { as: "fetch", href: "../resources/dummy.txt?2", fetchPriority: "high" },
+ { as: "fetch", href: "../resources/dummy.txt?3", fetchPriority: "auto" },
+ { as: "fetch", href: "../resources/dummy.txt?4" },
+ ];
+
+ let allLinkElements = [];
+ for (data of kData) {
+ let linkElement = document.createElement("link");
+ linkElement.rel = "preload";
+ linkElement.as = data.as;
+ linkElement.href = data.href;
+
+ if ("fetchPriority" in data) {
+ linkElement.fetchPriority = data.fetchPriority;
+ }
+
+ allLinkElements.push(linkElement);
+ }
+
+ document.head.append(...allLinkElements)
+
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-preload-font.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-preload-font.h2.html
new file mode 100644
index 0000000000..96e61c04b6
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-preload-font.h2.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+</head>
+<body>
+<script>
+ onload = function() {
+ const kData = [
+ { as: "font", href: "../resources/dummy.font?1", fetchPriority: "low" },
+ { as: "font", href: "../resources/dummy.font?2", fetchPriority: "high" },
+ { as: "font", href: "../resources/dummy.font?3", fetchPriority: "auto" },
+ { as: "font", href: "../resources/dummy.font?4" },
+ ];
+
+ let allLinkElements = [];
+ for (data of kData) {
+ let linkElement = document.createElement("link");
+ linkElement.rel = "preload";
+ linkElement.as = data.as;
+ linkElement.href = data.href;
+
+ if ("fetchPriority" in data) {
+ linkElement.fetchPriority = data.fetchPriority;
+ }
+
+ allLinkElements.push(linkElement);
+ }
+
+ document.head.append(...allLinkElements)
+
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-preload-image.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-preload-image.h2.html
new file mode 100644
index 0000000000..767a425ffc
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-preload-image.h2.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+</head>
+<body>
+<script>
+ onload = function() {
+ const kData = [
+ { as: "image", href: "../resources/dummy.image?1", fetchPriority: "low" },
+ { as: "image", href: "../resources/dummy.image?2", fetchPriority: "high" },
+ { as: "image", href: "../resources/dummy.image?3", fetchPriority: "auto" },
+ { as: "image", href: "../resources/dummy.image?4" },
+ ];
+
+ let allLinkElements = [];
+ for (data of kData) {
+ let linkElement = document.createElement("link");
+ linkElement.rel = "preload";
+ linkElement.as = data.as;
+ linkElement.href = data.href;
+
+ if ("fetchPriority" in data) {
+ linkElement.fetchPriority = data.fetchPriority;
+ }
+
+ allLinkElements.push(linkElement);
+ }
+
+ document.head.append(...allLinkElements)
+
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-preload-script.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-preload-script.h2.html
new file mode 100644
index 0000000000..5c46c9004a
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-preload-script.h2.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+</head>
+<body>
+<script>
+ onload = function() {
+ const kData = [
+ { as: "script", href: "../resources/dummy.js?1", fetchPriority: "low" },
+ { as: "script", href: "../resources/dummy.js?2", fetchPriority: "high" },
+ { as: "script", href: "../resources/dummy.js?3", fetchPriority: "auto" },
+ { as: "script", href: "../resources/dummy.js?4" },
+ ];
+
+ let allLinkElements = [];
+ for (data of kData) {
+ let linkElement = document.createElement("link");
+ linkElement.rel = "preload";
+ linkElement.as = data.as;
+ linkElement.href = data.href;
+
+ if ("fetchPriority" in data) {
+ linkElement.fetchPriority = data.fetchPriority;
+ }
+
+ allLinkElements.push(linkElement);
+ }
+
+ document.head.append(...allLinkElements)
+
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-preload-style.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-preload-style.h2.html
new file mode 100644
index 0000000000..e69364c50b
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-preload-style.h2.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+</head>
+<body>
+<script>
+ onload = function() {
+ const kData = [
+ { as: "style", href: "../resources/dummy.css?1", fetchPriority: "low" },
+ { as: "style", href: "../resources/dummy.css?2", fetchPriority: "high" },
+ { as: "style", href: "../resources/dummy.css?3", fetchPriority: "auto" },
+ { as: "style", href: "../resources/dummy.css?4" }
+ ];
+
+ let allLinkElements = [];
+ for (data of kData) {
+ let linkElement = document.createElement("link");
+ linkElement.rel = "preload";
+ linkElement.as = data.as;
+ linkElement.href = data.href;
+
+ if ("fetchPriority" in data) {
+ linkElement.fetchPriority = data.fetchPriority;
+ }
+
+ allLinkElements.push(linkElement);
+ }
+
+ document.head.append(...allLinkElements)
+
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-header.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-header.h2.html
new file mode 100644
index 0000000000..6b50fe3543
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-header.h2.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+</head>
+<body>
+<script>
+ onload = function() {
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-load-stylesheet.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-load-stylesheet.h2.html
new file mode 100644
index 0000000000..e235ad0d49
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-load-stylesheet.h2.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+ <link rel="stylesheet" href="../resources/dummy.css?1" fetchpriority="low">
+ <link rel="stylesheet" href="../resources/dummy.css?2" fetchpriority="high">
+ <link rel="stylesheet" href="../resources/dummy.css?3" fetchpriority="auto">
+ <link rel="stylesheet" href="../resources/dummy.css?4">
+ <link rel="alternate stylesheet" title="5" href="../resources/dummy.css?5" fetchpriority="low">
+ <link rel="alternate stylesheet" title="6" href="../resources/dummy.css?6" fetchpriority="high">
+ <link rel="alternate stylesheet" title="7" href="../resources/dummy.css?7" fetchpriority="auto">
+ <link rel="alternate stylesheet" title="8" href="../resources/dummy.css?8">
+ <link rel="stylesheet" href="../resources/dummy.css?9" fetchpriority="low" media="print">
+ <link rel="stylesheet" href="../resources/dummy.css?10" fetchpriority="high" media="print">
+ <link rel="stylesheet" href="../resources/dummy.css?11" fetchpriority="auto" media="print">
+ <link rel="stylesheet" href="../resources/dummy.css?12" media="print">
+</head>
+<body>
+<script>
+ onload = function() {
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-modulepreload.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-modulepreload.h2.html
new file mode 100644
index 0000000000..365695ff1e
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-modulepreload.h2.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+ <link rel="modulepreload" href="../resources/dummy.js?1" fetchpriority="low">
+ <link rel="modulepreload" href="../resources/dummy.js?2" fetchpriority="high">
+ <link rel="modulepreload" href="../resources/dummy.js?3" fetchpriority="auto">
+ <link rel="modulepreload" href="../resources/dummy.js?4">
+</head>
+<body>
+<script>
+ onload = function() {
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-prefetch.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-prefetch.h2.html
new file mode 100644
index 0000000000..746997aca2
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-prefetch.h2.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+ <link rel="prefetch" href="../resources/dummy.txt?1" fetchpriority="low">
+ <link rel="prefetch" href="../resources/dummy.txt?2" fetchpriority="high">
+ <link rel="prefetch" href="../resources/dummy.txt?3" fetchpriority="auto">
+ <link rel="prefetch" href="../resources/dummy.txt?4">
+</head>
+<body>
+<script>
+ onload = function() {
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-preload-fetch.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-preload-fetch.h2.html
new file mode 100644
index 0000000000..891425d1ce
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-preload-fetch.h2.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+ <link rel="preload" as="fetch" href="../resources/dummy.txt?1" fetchpriority="low">
+ <link rel="preload" as="fetch" href="../resources/dummy.txt?2" fetchpriority="high">
+ <link rel="preload" as="fetch" href="../resources/dummy.txt?3" fetchpriority="auto">
+ <link rel="preload" as="fetch" href="../resources/dummy.txt?4">
+</head>
+<body>
+<script>
+ onload = function() {
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-preload-font.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-preload-font.h2.html
new file mode 100644
index 0000000000..32228a99dc
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-preload-font.h2.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+ <link rel="preload" as="font" href="../resources/dummy.font?1" fetchpriority="low">
+ <link rel="preload" as="font" href="../resources/dummy.font?2" fetchpriority="high">
+ <link rel="preload" as="font" href="../resources/dummy.font?3" fetchpriority="auto">
+ <link rel="preload" as="font" href="../resources/dummy.font?4">
+</head>
+<body>
+<script>
+ onload = function() {
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-preload-image.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-preload-image.h2.html
new file mode 100644
index 0000000000..0dc1b482b4
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-preload-image.h2.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+ <link rel="preload" as="image" href="../resources/dummy.image?1" fetchpriority="low">
+ <link rel="preload" as="image" href="../resources/dummy.image?2" fetchpriority="high">
+ <link rel="preload" as="image" href="../resources/dummy.image?3" fetchpriority="auto">
+ <link rel="preload" as="image" href="../resources/dummy.image?4">
+</head>
+<body>
+<script>
+ onload = function() {
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-preload-script.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-preload-script.h2.html
new file mode 100644
index 0000000000..bcc23751bc
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-preload-script.h2.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+ <link rel="preload" as="script" href="../resources/dummy.js?1" fetchpriority="low">
+ <link rel="preload" as="script" href="../resources/dummy.js?2" fetchpriority="high">
+ <link rel="preload" as="script" href="../resources/dummy.js?3" fetchpriority="auto">
+ <link rel="preload" as="script" href="../resources/dummy.js?4">
+</head>
+<body>
+<script>
+ onload = function() {
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-preload-style.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-preload-style.h2.html
new file mode 100644
index 0000000000..77aba48907
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-initial-preload-style.h2.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+ <link rel="preload" as="style" href="../resources/dummy.css?1" fetchpriority="low">
+ <link rel="preload" as="style" href="../resources/dummy.css?2" fetchpriority="high">
+ <link rel="preload" as="style" href="../resources/dummy.css?3" fetchpriority="auto">
+ <link rel="preload" as="style" href="../resources/dummy.css?4">
+</head>
+<body>
+<script>
+ onload = function() {
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/dummy.css b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/dummy.css
new file mode 100644
index 0000000000..d9a4c4e1b6
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/dummy.css
@@ -0,0 +1 @@
+p { color: green; }
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/dummy.font b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/dummy.font
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/dummy.font
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/dummy.image b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/dummy.image
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/dummy.image
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/dummy.js b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/dummy.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/dummy.js
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/dummy.txt b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/dummy.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/dummy.txt
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/square_25px_x_25px.png b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/square_25px_x_25px.png
new file mode 100644
index 0000000000..33015ff4a4
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/resources/square_25px_x_25px.png
Binary files differ
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests-data.js b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests-data.js
new file mode 100644
index 0000000000..8f3b2033ad
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests-data.js
@@ -0,0 +1,216 @@
+const kFetchPriorityLowRequestFileNameAndSuffix = "dummy.js?1";
+const kFetchPriorityHighRequestFileNameAndSuffix = "dummy.js?2";
+const kFetchPriorityAutoRequestFileNameAndSuffix = "dummy.js?3";
+const kNoFetchPriorityRequestFileNameAndSuffix = "dummy.js?4";
+
+// Mapping fetchpriority's values to internal priorities is specified as
+// implementation-defined (https://fetch.spec.whatwg.org/#concept-fetch, step
+// 15). For web-compatibility, Chromium's desired mapping is chosen, see
+// <https://web.dev/articles/fetch-priority#browser_priority_and_fetchpriority>.
+// Exceptions are commented below.
+
+const kExpectedRequestsForScriptsInHead = [
+ { fileNameAndSuffix: kFetchPriorityLowRequestFileNameAndSuffix,
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: kFetchPriorityHighRequestFileNameAndSuffix,
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: kFetchPriorityAutoRequestFileNameAndSuffix,
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: kNoFetchPriorityRequestFileNameAndSuffix,
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ }
+];
+
+const kExpectedRequestsForScriptsInHeadDisabled = [
+ { fileNameAndSuffix: kFetchPriorityLowRequestFileNameAndSuffix,
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: kFetchPriorityHighRequestFileNameAndSuffix,
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: kFetchPriorityAutoRequestFileNameAndSuffix,
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: kNoFetchPriorityRequestFileNameAndSuffix,
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ }
+];
+
+const kExpectedRequestsForScriptsInBody = [
+ { fileNameAndSuffix: "dummy.js?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "dummy.js?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ // Bug 1872654: Chromium's behavior here differs.
+ { fileNameAndSuffix: "dummy.js?3",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.js?4",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.js?5",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "dummy.js?6",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "dummy.js?7",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.js?8",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+]
+
+const kExpectedRequestsForScriptsInBodyDisabled = [
+ { fileNameAndSuffix: "dummy.js?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.js?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.js?3",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.js?4",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.js?5",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.js?6",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.js?7",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.js?8",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+]
+
+export const kTestFolderName = "script-tests";
+
+const kExpectedRequestsForNonModuleAsyncAndDeferredScripts = [
+ { fileNameAndSuffix: "dummy.js?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "dummy.js?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "dummy.js?3",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "dummy.js?4",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+]
+
+const kExpectedRequestsForNonModuleAsyncAndDeferredScriptsDisabled = [
+ { fileNameAndSuffix: "dummy.js?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.js?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.js?3",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.js?4",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+]
+
+// Chromium's desired behavior is under discussion:
+// <https://bugs.chromium.org/p/chromium/issues/detail?id=1475635>.
+const kExpectedRequestsForModuleScripts = [
+ { fileNameAndSuffix: "dummy.js?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
+ },
+ { fileNameAndSuffix: "dummy.js?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "dummy.js?3",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+ { fileNameAndSuffix: "dummy.js?4",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
+ },
+]
+
+const kExpectedRequestsForModuleScriptsDisabled = [
+ { fileNameAndSuffix: "dummy.js?1",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.js?2",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.js?3",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+ { fileNameAndSuffix: "dummy.js?4",
+ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
+ },
+]
+
+export const kTestData = [
+ { testFileName: "script-initial-load-head.h2.html",
+ expectedRequests: kExpectedRequestsForScriptsInHead
+ },
+ { testFileName: "script-initial-load-body.h2.html",
+ expectedRequests: kExpectedRequestsForScriptsInBody
+ },
+ { testFileName: "async-script-initial-load.h2.html",
+ expectedRequests: kExpectedRequestsForNonModuleAsyncAndDeferredScripts
+ },
+ { testFileName: "deferred-script-initial-load.h2.html",
+ expectedRequests: kExpectedRequestsForNonModuleAsyncAndDeferredScripts
+ },
+ { testFileName: "module-script-initial-load.h2.html",
+ expectedRequests: kExpectedRequestsForModuleScripts
+ },
+ { testFileName: "async-module-script-initial-load.h2.html",
+ expectedRequests: kExpectedRequestsForModuleScripts
+ },
+ // Dynamic insertion executes non-speculative-parsing
+ // (https://developer.mozilla.org/en-US/docs/Glossary/speculative_parsing)
+ // code paths. Moreover such inserted scripts are loaded asynchronously.
+ { testFileName: "script-dynamic-insertion.h2.html",
+ expectedRequests: kExpectedRequestsForNonModuleAsyncAndDeferredScripts
+ },
+ { testFileName: "module-script-dynamic-insertion.h2.html",
+ expectedRequests: kExpectedRequestsForModuleScripts
+ }
+];
+
+export const kTestDataDisabled = [
+ { testFileName: "script-initial-load-head.h2.html",
+ expectedRequests: kExpectedRequestsForScriptsInHeadDisabled
+ },
+ { testFileName: "script-initial-load-body.h2.html",
+ expectedRequests: kExpectedRequestsForScriptsInBodyDisabled
+ },
+ { testFileName: "async-script-initial-load.h2.html",
+ expectedRequests: kExpectedRequestsForNonModuleAsyncAndDeferredScriptsDisabled
+ },
+ { testFileName: "deferred-script-initial-load.h2.html",
+ expectedRequests: kExpectedRequestsForNonModuleAsyncAndDeferredScriptsDisabled
+ },
+ { testFileName: "module-script-initial-load.h2.html",
+ expectedRequests: kExpectedRequestsForModuleScriptsDisabled
+ },
+ { testFileName: "async-module-script-initial-load.h2.html",
+ expectedRequests: kExpectedRequestsForModuleScriptsDisabled
+ },
+ { testFileName: "script-dynamic-insertion.h2.html",
+ expectedRequests: kExpectedRequestsForNonModuleAsyncAndDeferredScriptsDisabled
+ },
+ { testFileName: "module-script-dynamic-insertion.h2.html",
+ expectedRequests: kExpectedRequestsForModuleScriptsDisabled
+ }
+];
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/async-module-script-initial-load.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/async-module-script-initial-load.h2.html
new file mode 100644
index 0000000000..6b8b0977b7
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/async-module-script-initial-load.h2.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+ <script type="module" async src="../resources/dummy.js?1" fetchpriority="low"></script>
+ <script type="module" async src="../resources/dummy.js?2" fetchpriority="high"></script>
+ <script type="module" async src="../resources/dummy.js?3" fetchpriority="auto"></script>
+ <script type="module" async src="../resources/dummy.js?4"></script>
+</head>
+<body>
+<script>
+ onload = function() {
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/async-script-initial-load.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/async-script-initial-load.h2.html
new file mode 100644
index 0000000000..f6ac1c9a4f
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/async-script-initial-load.h2.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+ <script async src="../resources/dummy.js?1" fetchpriority="low"></script>
+ <script async src="../resources/dummy.js?2" fetchpriority="high"></script>
+ <script async src="../resources/dummy.js?3" fetchpriority="auto"></script>
+ <script async src="../resources/dummy.js?4"></script>
+</head>
+<body>
+<script>
+ onload = function() {
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/deferred-script-initial-load.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/deferred-script-initial-load.h2.html
new file mode 100644
index 0000000000..99a4b8b3b9
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/deferred-script-initial-load.h2.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+ <script defer src="../resources/dummy.js?1" fetchpriority="low"></script>
+ <script defer src="../resources/dummy.js?2" fetchpriority="high"></script>
+ <script defer src="../resources/dummy.js?3" fetchpriority="auto"></script>
+ <script defer src="../resources/dummy.js?4"></script>
+</head>
+<body>
+<script>
+ onload = function() {
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/module-script-dynamic-insertion.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/module-script-dynamic-insertion.h2.html
new file mode 100644
index 0000000000..13e5b8c91d
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/module-script-dynamic-insertion.h2.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+</head>
+<body>
+<script>
+ onload = function() {
+ const kData = [
+ { src: "../resources/dummy.js?1", fetchPriority: "low"},
+ { src: "../resources/dummy.js?2", fetchPriority: "high"},
+ { src: "../resources/dummy.js?3", fetchPriority: "auto"},
+ { src: "../resources/dummy.js?4"}
+ ];
+
+ let allScriptElements = [];
+ for (data of kData) {
+ let scriptElement = document.createElement("script");
+ scriptElement.src = data.src;
+
+ scriptElement.type = "module";
+
+ if ("fetchPriority" in data) {
+ scriptElement.fetchPriority = data.fetchPriority;
+ }
+
+ allScriptElements.push(scriptElement);
+ }
+
+ document.head.append(...allScriptElements)
+
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/module-script-initial-load.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/module-script-initial-load.h2.html
new file mode 100644
index 0000000000..52c5d0e9ca
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/module-script-initial-load.h2.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+ <script type="module" src="../resources/dummy.js?1" fetchpriority="low"></script>
+ <script type="module" src="../resources/dummy.js?2" fetchpriority="high"></script>
+ <script type="module" src="../resources/dummy.js?3" fetchpriority="auto"></script>
+ <script type="module" src="../resources/dummy.js?4"></script>
+</head>
+<body>
+<script>
+ onload = function() {
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/script-dynamic-insertion.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/script-dynamic-insertion.h2.html
new file mode 100644
index 0000000000..27103c81c1
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/script-dynamic-insertion.h2.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+</head>
+<body>
+<script>
+ onload = function() {
+ const kData = [
+ { src: "../resources/dummy.js?1", fetchPriority: "low"},
+ { src: "../resources/dummy.js?2", fetchPriority: "high"},
+ { src: "../resources/dummy.js?3", fetchPriority: "auto"},
+ { src: "../resources/dummy.js?4"}
+ ];
+
+ let allScriptElements = [];
+ for (data of kData) {
+ let scriptElement = document.createElement("script");
+ scriptElement.src = data.src;
+
+ if ("fetchPriority" in data) {
+ scriptElement.fetchPriority = data.fetchPriority;
+ }
+
+ allScriptElements.push(scriptElement);
+ }
+
+ document.head.append(...allScriptElements)
+
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/script-initial-load-body.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/script-initial-load-body.h2.html
new file mode 100644
index 0000000000..dd1c7eb60e
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/script-initial-load-body.h2.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+</head>
+<body>
+ <script src="../resources/dummy.js?1" fetchpriority="low"></script>
+ <script src="../resources/dummy.js?2" fetchpriority="high"></script>
+ <script src="../resources/dummy.js?3" fetchpriority="auto"></script>
+ <script src="../resources/dummy.js?4"></script>
+ <img src="../resources/square_25px_x_25px.png">
+ <!-- The image makes the external in-body
+ (https://html.spec.whatwg.org/#parsing-main-inbody) scripts considered "late"
+ (https://web.dev/articles/fetch-priority#browser_priority_and_fetchpriority).
+ -->
+ <script src="../resources/dummy.js?5" fetchpriority="low"></script>
+ <script src="../resources/dummy.js?6" fetchpriority="high"></script>
+ <script src="../resources/dummy.js?7" fetchpriority="auto"></script>
+ <script src="../resources/dummy.js?8"></script>
+ <script>
+ onload = function() {
+ opener.postMessage("ChildLoaded");
+ }
+ </script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/script-initial-load-head.h2.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/script-initial-load-head.h2.html
new file mode 100644
index 0000000000..519bddf22f
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/script-initial-load-head.h2.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>fetchpriority</title>
+ <script src="../resources/dummy.js?1" fetchpriority="low"></script>
+ <script src="../resources/dummy.js?2" fetchpriority="high"></script>
+ <script src="../resources/dummy.js?3" fetchpriority="auto"></script>
+ <script src="../resources/dummy.js?4"></script>
+</head>
+<body>
+<script>
+ onload = function() {
+ opener.postMessage("ChildLoaded", "*");
+ }
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/fetch/orb/tentative/content-range.sub.window.js b/testing/web-platform/mozilla/tests/fetch/orb/tentative/content-range.sub.window.js
new file mode 100644
index 0000000000..ffc0d0286f
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/orb/tentative/content-range.sub.window.js
@@ -0,0 +1,19 @@
+// META: script=/fetch/orb/resources/utils.js
+// META: script=resources/utils.js
+
+const url =
+ "http://{{domains[www1]}}:{{ports[http][0]}}/fetch/orb/resources/image.png";
+
+// Due to web compatibility we filter opaque Response object from the
+// fetch() function in the Fetch specification. See Bug 1823877. This
+// might be removed in the future.
+promise_internal_response_is_filtered(
+ testFetchNoCors(
+ url,
+ { headers: new Headers([["Range", "bytes 10-99"]]) },
+ header("Content-Range", "bytes 10-99/1010"),
+ "slice(10,100)",
+ "status(206)"
+ ),
+ "ORB should filter opaque range of image/png not starting at zero, that isn't subsequent"
+);
diff --git a/testing/web-platform/mozilla/tests/fetch/orb/tentative/img-mime-types-coverage.tentative.sub.html b/testing/web-platform/mozilla/tests/fetch/orb/tentative/img-mime-types-coverage.tentative.sub.html
new file mode 100644
index 0000000000..d5ab1a4cd7
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/orb/tentative/img-mime-types-coverage.tentative.sub.html
@@ -0,0 +1,43 @@
+<!-- Test verifies that cross-origin, nosniff images are 1) blocked when their
+ MIME type is covered by ORB and 2) allowed otherwise.
+
+ This test is very similar to fetch/orb/img-mime-types-coverage.tentative.sub.html,
+ except that it focuses on MIME types relevant to ORB.
+-->
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<div id=log></div>
+<script>
+ var passes = [
+ // These are exceptions that allow more MIME types than the ORB spec does.
+ // This is due to web compat, but might be removed in the future.
+ // See Bug 1828375
+ "application/dash+xml",
+ "application/vnd.apple.mpegurl",
+ "audio/mpegurl",
+ "audio/mpeg",
+ "text/vtt",
+ ]
+
+ const get_url = (mime) => {
+ // www1 is cross-origin, so the HTTP response is ORB-eligible -->
+ url = "http://{{domains[www1]}}:{{ports[http][0]}}"
+ url = url + "/fetch/nosniff/resources/image.py"
+ if (mime != null) {
+ url += "?type=" + encodeURIComponent(mime)
+ }
+ return url
+ }
+
+ passes.forEach(function (mime) {
+ async_test(function (t) {
+ var img = document.createElement("img")
+ img.onerror = t.unreached_func("Unexpected error event")
+ img.onload = t.step_func_done(function () {
+ assert_equals(img.width, 96)
+ })
+ img.src = get_url(mime)
+ document.body.appendChild(img)
+ }, "ORB should allow the response if Content-Type is: '" + mime + "'. ")
+ })
+</script>
diff --git a/testing/web-platform/mozilla/tests/fetch/orb/tentative/known-mime-type.sub.window.js b/testing/web-platform/mozilla/tests/fetch/orb/tentative/known-mime-type.sub.window.js
new file mode 100644
index 0000000000..0e2dd937c0
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/orb/tentative/known-mime-type.sub.window.js
@@ -0,0 +1,48 @@
+// META: script=/fetch/orb/resources/utils.js
+// META: script=resources/utils.js
+
+const path = "http://{{domains[www1]}}:{{ports[http][0]}}/fetch/orb/resources";
+
+// Due to web compatibility we filter opaque Response object from the
+// fetch() function in the Fetch specification. See Bug 1823877. This
+// might be removed in the future.
+promise_internal_response_is_filtered(
+ testFetchNoCors(`${path}/font.ttf`, null, contentType("font/ttf")),
+ "ORB should filter opaque font/ttf"
+);
+
+// Due to web compatibility we filter opaque Response object from the
+// fetch() function in the Fetch specification. See Bug 1823877. This
+// might be removed in the future.
+promise_internal_response_is_filtered(
+ testFetchNoCors(`${path}/text.txt`, null, contentType("text/plain")),
+ "ORB should filter opaque text/plain"
+);
+
+// Due to web compatibility we filter opaque Response object from the
+// fetch() function in the Fetch specification. See Bug 1823877. This
+// might be removed in the future.
+promise_internal_response_is_filtered(
+ testFetchNoCors(`${path}/data.json`, null, contentType("application/json")),
+ "ORB should filter opaque application/json (non-empty)"
+);
+
+// Due to web compatibility we filter opaque Response object from the
+// fetch() function in the Fetch specification. See Bug 1823877. This
+// might be removed in the future.
+promise_internal_response_is_filtered(
+ testFetchNoCors(`${path}/empty.json`, null, contentType("application/json")),
+ "ORB should filter opaque application/json (empty)"
+);
+
+// Due to web compatibility we filter opaque Response object from the
+// fetch() function in the Fetch specification. See Bug 1823877. This
+// might be removed in the future.
+promise_internal_response_is_filtered(
+ testFetchNoCors(
+ `${path}/data_non_ascii.json`,
+ null,
+ contentType("application/json")
+ ),
+ "ORB should filter opaque application/json which contains non ascii characters"
+);
diff --git a/testing/web-platform/mozilla/tests/fetch/orb/tentative/nosniff.sub.window.js b/testing/web-platform/mozilla/tests/fetch/orb/tentative/nosniff.sub.window.js
new file mode 100644
index 0000000000..4588b657c0
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/orb/tentative/nosniff.sub.window.js
@@ -0,0 +1,43 @@
+// META: script=/fetch/orb/resources/utils.js
+// META: script=resources/utils.js
+
+const path = "http://{{domains[www1]}}:{{ports[http][0]}}/fetch/orb/resources";
+
+// This is an exception that allow more MIME types than the ORB spec does.
+// This is due to web compatibility, but might be removed in the future.
+// See Bug 1828375
+promise_test(
+ t => testFetchNoCors(
+ `${path}/text.txt`,
+ null,
+ contentType("text/plain"),
+ contentTypeOptions("nosniff")
+ ),
+ "ORB shouldn't block opaque text/plain with nosniff"
+);
+
+// Due to web compatibility we filter opaque Response object from the
+// fetch() function in the Fetch specification. See Bug 1823877. This
+// might be removed in the future.
+promise_internal_response_is_filtered(
+ testFetchNoCors(
+ `${path}/data.json`,
+ null,
+ contentType("application/json"),
+ contentTypeOptions("nosniff")
+ ),
+ "ORB should filter opaque-response-blocklisted MIME type with nosniff"
+);
+
+// Due to web compatibility we filter opaque Response object from the
+// fetch() function in the Fetch specification. See Bug 1823877. This
+// might be removed in the future.
+promise_internal_response_is_filtered(
+ testFetchNoCors(
+ `${path}/data.json`,
+ null,
+ contentType(""),
+ contentTypeOptions("nosniff")
+ ),
+ "ORB should filter opaque response with empty Content-Type and nosniff"
+);
diff --git a/testing/web-platform/mozilla/tests/fetch/orb/tentative/resources/utils.js b/testing/web-platform/mozilla/tests/fetch/orb/tentative/resources/utils.js
new file mode 100644
index 0000000000..bc8210f46b
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/orb/tentative/resources/utils.js
@@ -0,0 +1,28 @@
+function testFetchNoCors(file, options, ...pipe) {
+ return fetch(`${file}${pipe.length ? `?pipe=${pipe.join("|")}` : ""}`, {
+ ...(options || {}),
+ mode: "no-cors",
+ });
+}
+
+function promise_internal_response_is_filtered(fetchPromise, message) {
+ return promise_test(async () => {
+ const response = await fetchPromise;
+
+ // A parent filtered opaque response is defined here as a response that isn't just an
+ // opaque response, but also where the internal response has been made unavailable.
+ // `Response.cloneUnfiltered` is used to inspect the state of the internal response,
+ // which is exactly what we want to be missing in this case.
+ const unfiltered = SpecialPowers.wrap(response).cloneUnfiltered();
+ assert_equals(
+ await SpecialPowers.unwrap(unfiltered).text(),
+ "",
+ "The internal response should be empty"
+ );
+ assert_equals(
+ Array.from(await SpecialPowers.unwrap(unfiltered).headers).length,
+ 0,
+ "The internal response should have no headers"
+ );
+ }, message);
+}
diff --git a/testing/web-platform/mozilla/tests/fetch/orb/tentative/status.sub.window.js b/testing/web-platform/mozilla/tests/fetch/orb/tentative/status.sub.window.js
new file mode 100644
index 0000000000..c09e4a1b24
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/fetch/orb/tentative/status.sub.window.js
@@ -0,0 +1,30 @@
+// META: script=/fetch/orb/resources/utils.js
+// META: script=resources/utils.js
+
+const path = "http://{{domains[www1]}}:{{ports[http][0]}}/fetch/orb/resources";
+
+// Due to web compatibility we filter opaque Response object from the
+// fetch() function in the Fetch specification. See Bug 1823877. This
+// might be removed in the future.
+promise_internal_response_is_filtered(
+ testFetchNoCors(
+ `${path}/data.json`,
+ null,
+ contentType("application/json"),
+ "status(206)"
+ ),
+ "ORB should filter opaque-response-blocklisted MIME type with status 206"
+);
+
+// Due to web compatibility we filter opaque Response object from the
+// fetch() function in the Fetch specification. See Bug 1823877. This
+// might be removed in the future.
+promise_internal_response_is_filtered(
+ testFetchNoCors(
+ `${path}/data.json`,
+ null,
+ contentType("application/json"),
+ "status(302)"
+ ),
+ "ORB should filter opaque range of image/png not starting at zero, that isn't subsequent"
+);