diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
commit | 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch) | |
tree | a4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /testing/web-platform/mozilla/tests/fetch | |
parent | Adding debian version 124.0.1-1. (diff) | |
download | firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/mozilla/tests/fetch')
14 files changed, 374 insertions, 75 deletions
diff --git a/testing/web-platform/mozilla/tests/fetch/fetchpriority/fetchpriority-adjustments.html b/testing/web-platform/mozilla/tests/fetch/fetchpriority/fetchpriority-adjustments.html new file mode 100644 index 0000000000..71bfbcc0b5 --- /dev/null +++ b/testing/web-platform/mozilla/tests/fetch/fetchpriority/fetchpriority-adjustments.html @@ -0,0 +1,53 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>fetchpriority: verify basic invariants for adjustments</title> +<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1880528"/> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> + const fetchpriorities = ["auto", "low", "high"]; + const prioritiesWhenFetchpriorityDisabled = { + "link-preload-script": SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST, + "module-script": SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL, + "async-or-defer-script": SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL, + "script-in-head": SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL, + "other-script": SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL, + "link-preload-font": SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH, + "link-preload-fetch": SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL, + "deferred-style": SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL, + "link-preload-style": SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST, + "non-deferred-style": SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL, + "global-fetch-api": SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL, + "images": SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW, + }; + for (const name in prioritiesWhenFetchpriorityDisabled) { + let adjustments = {}; + for (const fetchpriority of fetchpriorities) { + adjustments[fetchpriority] = SpecialPowers.getIntPref(`network.fetchpriority.adjustments.${name}.${fetchpriority}`); + } + test(() => { + // The higher the internal priority, the smaller the integer value. + assert_less_than_equal(adjustments.high, adjustments.auto, "Internal priority for high is at most the one for auto"); + assert_less_than_equal(adjustments.auto, adjustments.low, "Internal priority for auto is at most the one for low"); + }, `${name}: adjusted priorities for low/auto/high have proper ordering.`); + + test(() => { + assert_less_than(adjustments.high, adjustments.low, "Internal priority for high is less than the one for low"); + }, `${name}: at least one of fetchpriority="high" or fetchpriority="low" has any effect.`); + + test(() => { + const priority = prioritiesWhenFetchpriorityDisabled[name]; + const predefinedPriorities = [ + SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST, + SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH, + SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL, + SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW, + SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOWEST + ]; + for (const fetchpriority of fetchpriorities) { + const adjustedPriority = priority + adjustments[fetchpriority]; + assert_true(predefinedPriorities.includes(adjustedPriority), `Internal priority for ${fetchpriority} is in the predefined set of priorities.`); + } + }, `${name}: adjusted priorities belong to the predefined set.`); + } +</script> 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 index 4edb3ae171..7f5f77628c 100644 --- 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 @@ -1,36 +1,106 @@ export const kTestFolderName = "fetch-tests"; +// Use RequestInit's priority if specified, or RequestionInfo's priority otherwise. const kExpectedRequestsOfFetchAPI = [ { fileNameAndSuffix: "dummy.css?1", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW }, { fileNameAndSuffix: "dummy.css?2", internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH }, { fileNameAndSuffix: "dummy.css?3", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL }, { fileNameAndSuffix: "dummy.css?4", internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW }, { fileNameAndSuffix: "dummy.css?5", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW }, { fileNameAndSuffix: "dummy.css?6", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH }, { fileNameAndSuffix: "dummy.css?7", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL }, { fileNameAndSuffix: "dummy.css?8", internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH }, { fileNameAndSuffix: "dummy.css?9", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW }, { fileNameAndSuffix: "dummy.css?10", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH + }, + { fileNameAndSuffix: "dummy.css?11", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL + }, + { fileNameAndSuffix: "dummy.css?12", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL + }, + { fileNameAndSuffix: "dummy.css?13", internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW - } + }, + { fileNameAndSuffix: "dummy.css?14", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH + }, + { fileNameAndSuffix: "dummy.css?15", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL + }, + { fileNameAndSuffix: "dummy.css?16", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL + }, +]; + +const kExpectedRequestsOfFetchAPIDisabled = [ + { 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 + }, + { fileNameAndSuffix: "dummy.css?13", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL + }, + { fileNameAndSuffix: "dummy.css?14", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL + }, + { fileNameAndSuffix: "dummy.css?15", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL + }, + { fileNameAndSuffix: "dummy.css?16", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL + }, ]; export const kTestData = [ @@ -38,3 +108,9 @@ export const kTestData = [ expectedRequests: kExpectedRequestsOfFetchAPI } ]; + +export const kTestDataDisabled = [ + { testFileName: "fetch-init.h2.html", + expectedRequests: kExpectedRequestsOfFetchAPIDisabled + } +]; 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 index 0e267b0a3a..d91dd5450f 100644 --- 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 @@ -10,51 +10,66 @@ 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_info: new Request(`${resource_url}?1`, {priority: 'low'}), + request_init: {priority: 'low'} + }, + { + request_info: new Request(`${resource_url}?2`, {priority: 'low'}), 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_info: new Request(`${resource_url}?3`, {priority: 'low'}), 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: {} + request_info: new Request(`${resource_url}?4`, {priority: 'low'}) }, { - 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_info: new Request(`${resource_url}?5`, {priority: 'high'}), 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_info: new Request(`${resource_url}?6`, {priority: 'high'}), 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_info: new Request(`${resource_url}?7`, {priority: 'high'}), + request_init: {priority: 'auto'} + }, + { + request_info: new Request(`${resource_url}?8`, {priority: 'high'}) + }, + { + request_info: new Request(`${resource_url}?9`, {priority: 'auto'}), 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'}) + request_info: new Request(`${resource_url}?10`, {priority: 'auto'}), + request_init: {priority: 'high'} + }, + { + request_info: new Request(`${resource_url}?11`, {priority: 'auto'}), + request_init: {priority: 'auto'} + }, + { + request_info: new Request(`${resource_url}?12`, {priority: 'auto'}), + }, + { + request_info: `${resource_url}?13`, + request_init: {priority: 'low'} }, { - 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'}) + request_info: `${resource_url}?14`, + request_init: {priority: 'high'} }, { - 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`) + request_info: `${resource_url}?15`, + request_init: {priority: 'auto'} }, { - 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'}) - } + request_info: `${resource_url}?16`, + request_init: {} + }, ]; for (const data of kData) { const response = fetch(data.request_info, data.request_init); 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 index c3ee532d9e..9cc171b5dd 100644 --- 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 @@ -5,8 +5,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="low" src="../resources/square_25px_x_25px.png?1" alt="img"> + <img fetchpriority="high" src="../resources/square_25px_x_25px.png?2" 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> 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 index 16e59f2fd9..1606894e2e 100644 --- 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 @@ -2,28 +2,28 @@ export const kTestFolderName = "link-tests"; const kExpectedRequestsOfLoadStylesheet = [ { fileNameAndSuffix: "dummy.css?1", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL }, { fileNameAndSuffix: "dummy.css?2", internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST }, { fileNameAndSuffix: "dummy.css?3", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL }, { fileNameAndSuffix: "dummy.css?4", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL }, { fileNameAndSuffix: "dummy.css?5", internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW }, { fileNameAndSuffix: "dummy.css?6", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL }, { fileNameAndSuffix: "dummy.css?7", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL }, { fileNameAndSuffix: "dummy.css?8", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL }, // `media=print` doesn't match the environment // (https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#matches-the-environment) @@ -32,13 +32,13 @@ const kExpectedRequestsOfLoadStylesheet = [ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW }, { fileNameAndSuffix: "dummy.css?10", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL }, { fileNameAndSuffix: "dummy.css?11", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL }, { fileNameAndSuffix: "dummy.css?12", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL }, ]; @@ -113,16 +113,16 @@ const kExpectedRequestsOfLinkPreloadFontDisabled = [ const kExpectedRequestsOfLinkPreloadImage = [ { fileNameAndSuffix: "dummy.image?1", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW + 1 }, { fileNameAndSuffix: "dummy.image?2", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH + 1 }, { fileNameAndSuffix: "dummy.image?3", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW + 1 }, { fileNameAndSuffix: "dummy.image?4", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW + 1 }, ]; @@ -176,13 +176,13 @@ const kExpectedRequestsOfPreloadScript = [ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW }, { fileNameAndSuffix: "dummy.js?2", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST }, { fileNameAndSuffix: "dummy.js?3", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST }, { fileNameAndSuffix: "dummy.js?4", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGHEST }, ]; 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 index 8f3b2033ad..d712d8391a 100644 --- 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 @@ -17,10 +17,10 @@ const kExpectedRequestsForScriptsInHead = [ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH }, { fileNameAndSuffix: kFetchPriorityAutoRequestFileNameAndSuffix, - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL }, { fileNameAndSuffix: kNoFetchPriorityRequestFileNameAndSuffix, - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL } ]; @@ -39,6 +39,7 @@ const kExpectedRequestsForScriptsInHeadDisabled = [ } ]; +// TODO(bug 1872654): Should we align on Chromium for "early" in-body scripts? const kExpectedRequestsForScriptsInBody = [ { fileNameAndSuffix: "dummy.js?1", internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW @@ -46,7 +47,6 @@ const kExpectedRequestsForScriptsInBody = [ { 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 }, @@ -54,10 +54,10 @@ const kExpectedRequestsForScriptsInBody = [ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL }, { fileNameAndSuffix: "dummy.js?5", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL }, { fileNameAndSuffix: "dummy.js?6", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL }, { fileNameAndSuffix: "dummy.js?7", internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL @@ -65,6 +65,30 @@ const kExpectedRequestsForScriptsInBody = [ { fileNameAndSuffix: "dummy.js?8", internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL }, + { fileNameAndSuffix: "dummy.js?9", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW + }, + { fileNameAndSuffix: "dummy.js?10", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH + }, + { fileNameAndSuffix: "dummy.js?11", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL + }, + { fileNameAndSuffix: "dummy.js?12", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL + }, + { fileNameAndSuffix: "dummy.js?13", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL + }, + { fileNameAndSuffix: "dummy.js?14", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL + }, + { fileNameAndSuffix: "dummy.js?15", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL + }, + { fileNameAndSuffix: "dummy.js?16", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL + }, ] const kExpectedRequestsForScriptsInBodyDisabled = [ @@ -92,6 +116,30 @@ const kExpectedRequestsForScriptsInBodyDisabled = [ { fileNameAndSuffix: "dummy.js?8", internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL }, + { fileNameAndSuffix: "dummy.js?9", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL + }, + { fileNameAndSuffix: "dummy.js?10", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL + }, + { fileNameAndSuffix: "dummy.js?11", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL + }, + { fileNameAndSuffix: "dummy.js?12", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL + }, + { fileNameAndSuffix: "dummy.js?13", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL + }, + { fileNameAndSuffix: "dummy.js?14", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL + }, + { fileNameAndSuffix: "dummy.js?15", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL + }, + { fileNameAndSuffix: "dummy.js?16", + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL + }, ] export const kTestFolderName = "script-tests"; @@ -104,10 +152,22 @@ const kExpectedRequestsForNonModuleAsyncAndDeferredScripts = [ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH }, { fileNameAndSuffix: "dummy.js?3", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL }, { fileNameAndSuffix: "dummy.js?4", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW + 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 }, ] @@ -124,6 +184,18 @@ const kExpectedRequestsForNonModuleAsyncAndDeferredScriptsDisabled = [ { 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 + }, ] // Chromium's desired behavior is under discussion: @@ -136,10 +208,22 @@ const kExpectedRequestsForModuleScripts = [ internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH }, { fileNameAndSuffix: "dummy.js?3", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH + internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL }, { fileNameAndSuffix: "dummy.js?4", - internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH + 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 }, ] @@ -156,6 +240,18 @@ const kExpectedRequestsForModuleScriptsDisabled = [ { 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 kTestData = [ 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 index 6b8b0977b7..feb46d49f5 100644 --- 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 @@ -9,6 +9,10 @@ <script type="module" async src="../resources/dummy.js?4"></script> </head> <body> + <svg><script type="module" async href="../resources/dummy.js?5" fetchpriority="low"></script></svg> + <svg><script type="module" async href="../resources/dummy.js?6" fetchpriority="high"></script></svg> + <svg><script type="module" async href="../resources/dummy.js?7" fetchpriority="auto"></script></svg> + <svg><script type="module" async href="../resources/dummy.js?8"></script></svg> <script> onload = function() { opener.postMessage("ChildLoaded", "*"); 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 index f6ac1c9a4f..dbd26a8807 100644 --- 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 @@ -9,6 +9,10 @@ <script async src="../resources/dummy.js?4"></script> </head> <body> + <svg><script async href="../resources/dummy.js?5" fetchpriority="low"></script></svg> + <svg><script async href="../resources/dummy.js?6" fetchpriority="high"></script></svg> + <svg><script async href="../resources/dummy.js?7" fetchpriority="auto"></script></svg> + <svg><script async href="../resources/dummy.js?8"></script></svg> <script> onload = function() { opener.postMessage("ChildLoaded", "*"); 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 index 99a4b8b3b9..166e0999a1 100644 --- 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 @@ -9,6 +9,10 @@ <script defer src="../resources/dummy.js?4"></script> </head> <body> + <svg><script defer href="../resources/dummy.js?5" fetchpriority="low"></script></svg> + <svg><script defer href="../resources/dummy.js?6" fetchpriority="high"></script></svg> + <svg><script defer href="../resources/dummy.js?7" fetchpriority="auto"></script></svg> + <svg><script defer href="../resources/dummy.js?8"></script></svg> <script> onload = function() { opener.postMessage("ChildLoaded", "*"); 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 index 13e5b8c91d..572fe5ae7e 100644 --- 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 @@ -8,16 +8,33 @@ <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"} + { src: "../resources/dummy.js?1", fetchPriority: "low", svg: false}, + { src: "../resources/dummy.js?2", fetchPriority: "high", svg: false}, + { src: "../resources/dummy.js?3", fetchPriority: "auto", svg: false}, + { src: "../resources/dummy.js?4", svg: false}, + { src: "../resources/dummy.js?5", fetchPriority: "low", svg: true}, + { src: "../resources/dummy.js?6", fetchPriority: "high", svg: true}, + { src: "../resources/dummy.js?7", fetchPriority: "auto", svg: true}, + { src: "../resources/dummy.js?8", svg: true}, ]; let allScriptElements = []; for (data of kData) { - let scriptElement = document.createElement("script"); - scriptElement.src = data.src; + if (!data.svg) { + scriptElement = document.createElement("script"); + scriptElement.src = data.src; + if ("fetchPriority" in data) { + scriptElement.fetchPriority = data.fetchPriority; + } + } else { + const namespaceURI = "http://www.w3.org/2000/svg"; + scriptElement = document.createElementNS(namespaceURI, "script"); + scriptElement.href.baseVal = data.src; + // Use setAttribute as SVGScriptElement has no fetchPriority property. + if ("fetchPriority" in data) { + scriptElement.setAttribute("fetchPriority", data.fetchPriority); + } + } scriptElement.type = "module"; 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 index 52c5d0e9ca..c2ff305500 100644 --- 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 @@ -9,6 +9,10 @@ <script type="module" src="../resources/dummy.js?4"></script> </head> <body> + <svg><script type="module" href="../resources/dummy.js?5" fetchpriority="low"></script></svg> + <svg><script type="module" href="../resources/dummy.js?6" fetchpriority="high"></script></svg> + <svg><script type="module" href="../resources/dummy.js?7" fetchpriority="auto"></script></svg> + <svg><script type="module" href="../resources/dummy.js?8"></script></svg> <script> onload = function() { opener.postMessage("ChildLoaded", "*"); 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 index 27103c81c1..8ed2ae7e01 100644 --- 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 @@ -8,19 +8,34 @@ <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"} + { src: "../resources/dummy.js?1", fetchPriority: "low", svg: false}, + { src: "../resources/dummy.js?2", fetchPriority: "high", svg: false}, + { src: "../resources/dummy.js?3", fetchPriority: "auto", svg: false}, + { src: "../resources/dummy.js?4", svg: false}, + { src: "../resources/dummy.js?5", fetchPriority: "low", svg: true}, + { src: "../resources/dummy.js?6", fetchPriority: "high", svg: true}, + { src: "../resources/dummy.js?7", fetchPriority: "auto", svg: true}, + { src: "../resources/dummy.js?8", svg: true}, ]; let allScriptElements = []; for (data of kData) { - let scriptElement = document.createElement("script"); - scriptElement.src = data.src; - - if ("fetchPriority" in data) { - scriptElement.fetchPriority = data.fetchPriority; + let scriptElement; + if (!data.svg) { + scriptElement = document.createElement("script"); + scriptElement.src = data.src; + if ("fetchPriority" in data) { + scriptElement.fetchPriority = data.fetchPriority; + } + } else { + const namespaceURI = "http://www.w3.org/2000/svg"; + scriptElement = document.createElementNS(namespaceURI, "script"); + scriptElement.href.baseVal = data.src; + // Use setAttribute as SVGScriptElement has no fetchPriority property. + scriptElement.setAttribute("href", data.src); + if ("fetchPriority" in data) { + scriptElement.setAttribute("fetchPriority", data.fetchPriority); + } } allScriptElements.push(scriptElement); 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 index dd1c7eb60e..61453561b3 100644 --- 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 @@ -9,15 +9,23 @@ <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> + <svg><script href="../resources/dummy.js?5" fetchpriority="low"></script></svg> + <svg><script href="../resources/dummy.js?6" fetchpriority="high"></script></svg> + <svg><script href="../resources/dummy.js?7" fetchpriority="auto"></script></svg> + <svg><script href="../resources/dummy.js?8"></script></svg> <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 src="../resources/dummy.js?9" fetchpriority="low"></script> + <script src="../resources/dummy.js?10" fetchpriority="high"></script> + <script src="../resources/dummy.js?11" fetchpriority="auto"></script> + <script src="../resources/dummy.js?12"></script> + <svg><script href="../resources/dummy.js?13" fetchpriority="low"></script></svg> + <svg><script href="../resources/dummy.js?14" fetchpriority="high"></script></svg> + <svg><script href="../resources/dummy.js?15" fetchpriority="auto"></script></svg> + <svg><script href="../resources/dummy.js?16"></script></svg> <script> onload = function() { opener.postMessage("ChildLoaded"); 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 index 519bddf22f..5ca9d84db8 100644 --- 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 @@ -7,6 +7,9 @@ <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> + <!-- We don't test in-head SVG <script> elements. The HTML parser ignores + explicit SVG namespace on such elements and moves any <svg> wrapper + into the body. --> </head> <body> <script> |