summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/mozilla/tests/fetch/fetchpriority/support
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/fetchpriority/support
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/fetchpriority/support')
-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
46 files changed, 1831 insertions, 0 deletions
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>