summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/mozilla/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /testing/web-platform/mozilla/tests
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-adbda400be353e676059e335c3c0aaf99e719475.tar.xz
firefox-adbda400be353e676059e335c3c0aaf99e719475.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/mozilla/tests')
-rw-r--r--testing/web-platform/mozilla/tests/common/reftest-zoom.js29
-rw-r--r--testing/web-platform/mozilla/tests/css/bug1833279-001.html38
-rw-r--r--testing/web-platform/mozilla/tests/css/css-contain/content-visibility/content-visibility-auto-relevancy-updates-stop-ticking-002.html55
-rw-r--r--testing/web-platform/mozilla/tests/css/resources/bug1833279-iframe.html35
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/fetchpriority-adjustments.html53
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/fetch-tests-data.js90
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/fetch-tests/fetch-init.h2.html59
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests/image-initial-load.h2.html4
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests-data.js32
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests-data.js114
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/async-module-script-initial-load.h2.html4
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/async-script-initial-load.h2.html4
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/deferred-script-initial-load.h2.html4
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/module-script-dynamic-insertion.h2.html29
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/module-script-initial-load.h2.html4
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/script-dynamic-insertion.h2.html33
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/script-initial-load-body.h2.html16
-rw-r--r--testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/script-initial-load-head.h2.html3
-rw-r--r--testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/clamp-full-zoom-001-ref.html4
-rw-r--r--testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/clamp-full-zoom-001.html9
-rw-r--r--testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/clamp-full-zoom-002-ref.html4
-rw-r--r--testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/clamp-full-zoom-002.html9
-rw-r--r--testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-001-ref.html4
-rw-r--r--testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-001.html8
-rw-r--r--testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-002-ref.html4
-rw-r--r--testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-002.html8
-rw-r--r--testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-003-ref.html4
-rw-r--r--testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-003.html9
-rw-r--r--testing/web-platform/mozilla/tests/mathml/README.md13
-rw-r--r--testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-001-ref.html (renamed from testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-seudo-units-001-ref.html)0
-rw-r--r--testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-001.html (renamed from testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-seudo-units-001.html)2
-rw-r--r--testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-002-ref.html15
-rw-r--r--testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-002.html19
-rw-r--r--testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-003-ref.html15
-rw-r--r--testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-003.html19
-rw-r--r--testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-004-ref.html15
-rw-r--r--testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-004.html19
-rw-r--r--testing/web-platform/mozilla/tests/mathml/operator-stretching/overbar-width-1-ref.xhtml26
-rw-r--r--testing/web-platform/mozilla/tests/mathml/operator-stretching/overbar-width-1.xhtml27
-rw-r--r--testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-001-ref.html24
-rw-r--r--testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-001.html48
-rw-r--r--testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-002-ref.html24
-rw-r--r--testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-002.html48
-rw-r--r--testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-003-ref.html25
-rw-r--r--testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-003.html50
-rw-r--r--testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-004-ref.html25
-rw-r--r--testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-004.html50
-rw-r--r--testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-005-ref.html12
-rw-r--r--testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-005.html20
-rw-r--r--testing/web-platform/mozilla/tests/mathml/operator-stretching/stretch-equal-sign-with-default-font-ref.html14
-rw-r--r--testing/web-platform/mozilla/tests/mathml/operator-stretching/stretch-equal-sign-with-default-font.html18
-rw-r--r--testing/web-platform/mozilla/tests/mathml/operator-stretching/underbar-width-1-ref.xhtml26
-rw-r--r--testing/web-platform/mozilla/tests/mathml/operator-stretching/underbar-width-1.xhtml27
-rw-r--r--testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-001-ref.html3
-rw-r--r--testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-001.html6
-rw-r--r--testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-002-ref.html3
-rw-r--r--testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-002.html6
-rw-r--r--testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-003-ref.html3
-rw-r--r--testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-003.html6
-rw-r--r--testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-004-ref.html3
-rw-r--r--testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-004.html6
-rw-r--r--testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-005-ref.html3
-rw-r--r--testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-005.html6
-rw-r--r--testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-006-ref.html3
-rw-r--r--testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-006.html6
-rw-r--r--testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-007-ref.html3
-rw-r--r--testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-007.html6
-rw-r--r--testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-008-ref.html3
-rw-r--r--testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-008.html6
-rw-r--r--testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-009-ref.html3
-rw-r--r--testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-009.html6
-rw-r--r--testing/web-platform/mozilla/tests/mathml/scripts/mmultiscripts-empty-scripts-ref.html75
-rw-r--r--testing/web-platform/mozilla/tests/mathml/scripts/mmultiscripts-empty-scripts.html77
-rw-r--r--testing/web-platform/mozilla/tests/mathml/scripts/munderover-empty-scripts-ref.html38
-rw-r--r--testing/web-platform/mozilla/tests/mathml/scripts/munderover-empty-scripts.html38
-rw-r--r--testing/web-platform/mozilla/tests/mathml/scripts/scriptlevel-movablelimits-accent-ref.html28
-rw-r--r--testing/web-platform/mozilla/tests/mathml/scripts/scriptlevel-movablelimits-accent.html38
-rw-r--r--testing/web-platform/mozilla/tests/mathml/scripts/subscript-italic-correction.html62
-rw-r--r--testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-1.html50
-rw-r--r--testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-1a.html51
-rw-r--r--testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-1b.html51
-rw-r--r--testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-1c.html51
-rw-r--r--testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-1d.html51
-rw-r--r--testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-2.html49
-rw-r--r--testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-2a.html50
-rw-r--r--testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-2b.html50
-rw-r--r--testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-2c.html50
-rw-r--r--testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-2d.html50
-rw-r--r--testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-3.html49
-rw-r--r--testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-3a.html50
-rw-r--r--testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-3b.html50
-rw-r--r--testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-3c.html50
-rw-r--r--testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-3d.html50
-rw-r--r--testing/web-platform/mozilla/tests/webdriver/bidi/browsing_context/navigate/error.py14
-rw-r--r--testing/web-platform/mozilla/tests/webdriver/bidi/storage/delete_cookies/__init__.py0
-rw-r--r--testing/web-platform/mozilla/tests/webdriver/bidi/storage/delete_cookies/partition.py114
-rw-r--r--testing/web-platform/mozilla/tests/webdriver/bidi/storage/get_cookies/partition.py53
-rw-r--r--testing/web-platform/mozilla/tests/webdriver/bidi/storage/set_cookie/partition.py25
-rw-r--r--testing/web-platform/mozilla/tests/webdriver/cdp/port_file.py5
-rw-r--r--testing/web-platform/mozilla/tests/webdriver/classic/new_session/conftest.py2
-rw-r--r--testing/web-platform/mozilla/tests/webdriver/classic/new_session/profile_root.py4
-rw-r--r--testing/web-platform/mozilla/tests/webdriver/classic/protocol/marionette_port.py3
-rw-r--r--testing/web-platform/mozilla/tests/webdriver/harness/preferences_marionette.py (renamed from testing/web-platform/mozilla/tests/webdriver/harness/preferences.py)2
-rw-r--r--testing/web-platform/mozilla/tests/webdriver/harness/preferences_remote_agent.py37
-rw-r--r--testing/web-platform/mozilla/tests/webdriver/support/fixtures.py367
-rw-r--r--testing/web-platform/mozilla/tests/webdriver/support/helpers.py324
106 files changed, 2947 insertions, 442 deletions
diff --git a/testing/web-platform/mozilla/tests/common/reftest-zoom.js b/testing/web-platform/mozilla/tests/common/reftest-zoom.js
new file mode 100644
index 0000000000..a20f2cc800
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/common/reftest-zoom.js
@@ -0,0 +1,29 @@
+// This JS file allows to emulate reftest-zoom.
+// See https://firefox-source-docs.mozilla.org/layout/Reftest.html#zoom-tests-reftest-zoom-float
+
+// Retrieve reftest-zoom attribute.
+const reftestZoom = "reftest-zoom";
+const root = document.documentElement;
+if (!root.hasAttribute(reftestZoom)) {
+ throw new Error(`${reftestZoom} attribute not found on the root element.`);
+}
+
+// Parse reftest-zoom value.
+let zoom = parseFloat(root.getAttribute(reftestZoom));
+if (Number.isNaN(zoom)) {
+ throw new Error(`${reftestZoom} is not a float number.`);
+}
+
+// Clamp reftest-zoom value.
+let minZoom = SpecialPowers.getIntPref("zoom.minPercent") / 100;
+let maxZoom = SpecialPowers.getIntPref("zoom.maxPercent") / 100;
+zoom = Math.min(Math.max(zoom, minZoom), maxZoom);
+
+// Ensure the original zoom level is restored after the screenshot.
+const originalZoom = SpecialPowers.getFullZoom(window);
+window.addEventListener("beforeunload", () => {
+ SpecialPowers.setFullZoom(window, originalZoom);
+});
+
+// Set the zoom level to the specified value.
+SpecialPowers.setFullZoom(window, zoom);
diff --git a/testing/web-platform/mozilla/tests/css/bug1833279-001.html b/testing/web-platform/mozilla/tests/css/bug1833279-001.html
new file mode 100644
index 0000000000..ecbdf934de
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/css/bug1833279-001.html
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML>
+<meta charset="utf-8">
+<title>Test for bug 1833279</title>
+<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1833279">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+ setup({ single_test: true });
+
+ // The following callback-function gets called twice by our iframe inner-doc:
+ // 1. when the iframe's document finishes printing.
+ // 2. when the iframe's document finishes loading its own <object> child-document.
+ // When those two steps have completed, we're past the situation that would
+ // trigger a fatal assertion when the object document gets cycle-collected.
+ // So at that point we remove our iframe, and (after a rAF tick) trigger a
+ // GC and CC, and then consider the test as having passed if we're still
+ // alive at that point.
+ const MAX_STEPS = 2;
+ let stepsComplete = 0;
+
+ function iframeStepComplete() {
+ stepsComplete++;
+ if (stepsComplete < MAX_STEPS) {
+ return;
+ }
+ requestAnimationFrame(()=> {
+ myIframe.remove();
+ requestAnimationFrame(()=> {
+ SpecialPowers.DOMWindowUtils.garbageCollect();
+ SpecialPowers.DOMWindowUtils.cycleCollect();
+ assert_true(true, "successfully completed without crashing");
+ done();
+ });
+ });
+ }
+</script>
+<iframe id="myIframe" src="resources/bug1833279-iframe.html"></iframe>
diff --git a/testing/web-platform/mozilla/tests/css/css-contain/content-visibility/content-visibility-auto-relevancy-updates-stop-ticking-002.html b/testing/web-platform/mozilla/tests/css/css-contain/content-visibility/content-visibility-auto-relevancy-updates-stop-ticking-002.html
new file mode 100644
index 0000000000..1b64e43a1d
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/css/css-contain/content-visibility/content-visibility-auto-relevancy-updates-stop-ticking-002.html
@@ -0,0 +1,55 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>Content Visibility: stop ticking after relevancy updates</title>
+<!--
+ Adapted from testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-intrinsic-size-001.html
+-->
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1880928">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/rendering-utils.js"></script>
+
+<style>
+ #container {
+ position: sticky;
+ }
+ #container > div {
+ content-visibility: auto;
+ contain-intrinsic-size: 1px 5000px;
+ }
+</style>
+<div id="container">
+ <div>X</div>
+ <div id="target">XX</div>
+ <div>XXX</div>
+ <div>XXXX</div>
+</div>
+<script>
+ target.scrollIntoView();
+</script>
+
+<script>
+function hasPendingTick() {
+ return SpecialPowers.wrap(window).windowUtils.refreshDriverHasPendingTick;
+}
+
+// See comment in layout/base/tests/test_bug1756118.html about why the timeouts
+// etc.
+async function expectTicksToStop() {
+ for (let i = 0; i < 100; i++) {
+ await new Promise(r => setTimeout(r, 8));
+ if(!hasPendingTick()) {
+ break;
+ }
+ }
+ assert_false(hasPendingTick(), "refresh driver should have eventually stopped ticking");
+}
+
+promise_test(async function(t) {
+ await new Promise(resolve => { window.addEventListener("load", resolve); });
+ await SpecialPowers.pushPrefEnv({'set':
+ [['layout.keep_ticking_after_load_ms', 0]]});
+ await waitForAtLeastOneFrame();
+ await expectTicksToStop();
+});
+</script>
diff --git a/testing/web-platform/mozilla/tests/css/resources/bug1833279-iframe.html b/testing/web-platform/mozilla/tests/css/resources/bug1833279-iframe.html
new file mode 100644
index 0000000000..ac646e75d3
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/css/resources/bug1833279-iframe.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<script src="foo" type="text/javascript"></script>
+<script>
+// Note: this file gets loaded twice in the course of this test: first, in an
+// iframe hosted in the top-level test; and second, in an <object> inside that
+// iframe's document. (The object element gets created dynamically in the
+// script below.)
+window.onload = () => {
+ // For efficiency: check our window.location, to be sure we only run this
+ // logic in the iframe, and *not* in the <object> that ends up getting loaded
+ // with the same URL plus a "?" at the end:
+ let locationStr = "" + location;
+ if (!locationStr.endsWith("?")) {
+ window.print();
+
+ // Add an object whose location is set to '?' (which means our same
+ // base URL plus a "?" character):
+ let a = document.createElement("object");
+ a.data = "?";
+ document.documentElement.appendChild(a)
+ } else if (parent.parent && parent.parent.iframeStepComplete) {
+ // We're the nested document in the `<object>` tag that was created above.
+ // Signal the outer document (our grandparent) that we've completed the
+ // step of loading this inner object document.
+ parent.parent.iframeStepComplete();
+ }
+}
+
+window.onafterprint = () => {
+ // We've finished printing; signal to our outer document that we've completed
+ // that step.
+ parent.iframeStepComplete();
+}
+</script>
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>
diff --git a/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/clamp-full-zoom-001-ref.html b/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/clamp-full-zoom-001-ref.html
new file mode 100644
index 0000000000..1b394e0d4f
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/clamp-full-zoom-001-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<html style="zoom: .5">
+ <div style="width: 500px; height: 500px; background: green"></div>
+</html>
diff --git a/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/clamp-full-zoom-001.html b/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/clamp-full-zoom-001.html
new file mode 100644
index 0000000000..83fc95510f
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/clamp-full-zoom-001.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html reftest-zoom="0">
+ <link rel="help" href="https://firefox-source-docs.mozilla.org/layout/Reftest.html#zoom-tests-reftest-zoom-float"/>
+ <link rel="match" href="clamp-full-zoom-001-ref.html"/>
+ <!-- zoom.minPercent is set to 50 in the corresponding ini file. -->
+ <meta name="assert" content="Zoom is at least by zoom.minPercent."/>
+ <script src="/_mozilla/common/reftest-zoom.js"></script>
+ <div style="width: 500px; height: 500px; background: green"></div>
+</html>
diff --git a/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/clamp-full-zoom-002-ref.html b/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/clamp-full-zoom-002-ref.html
new file mode 100644
index 0000000000..e2dd42fc86
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/clamp-full-zoom-002-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<html style="zoom: 2">
+ <div style="width: 250px; height: 250px; background: green"></div>
+</html>
diff --git a/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/clamp-full-zoom-002.html b/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/clamp-full-zoom-002.html
new file mode 100644
index 0000000000..4fbe7edca1
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/clamp-full-zoom-002.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html reftest-zoom="10">
+ <link rel="help" href="https://firefox-source-docs.mozilla.org/layout/Reftest.html#zoom-tests-reftest-zoom-float"/>
+ <link rel="match" href="clamp-full-zoom-002-ref.html"/>
+ <!-- zoom.maxPercent is set to 200 in the corresponding ini file. -->
+ <meta name="assert" content="Zoom is at most by zoom.maxPercent."/>
+ <script src="/_mozilla/common/reftest-zoom.js"></script>
+ <div style="width: 250px; height: 250px; background: green"></div>
+</html>
diff --git a/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-001-ref.html b/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-001-ref.html
new file mode 100644
index 0000000000..1b394e0d4f
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-001-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<html style="zoom: .5">
+ <div style="width: 500px; height: 500px; background: green"></div>
+</html>
diff --git a/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-001.html b/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-001.html
new file mode 100644
index 0000000000..15c07de20d
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-001.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html reftest-zoom=".5">
+ <link rel="help" href="https://firefox-source-docs.mozilla.org/layout/Reftest.html#zoom-tests-reftest-zoom-float"/>
+ <link rel="match" href="set-full-zoom-001-ref.html"/>
+ <meta name="assert" content="Zoom less than one scales down the rect."/>
+ <script src="/_mozilla/common/reftest-zoom.js"></script>
+ <div style="width: 500px; height: 500px; background: green"></div>
+</html>
diff --git a/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-002-ref.html b/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-002-ref.html
new file mode 100644
index 0000000000..e2dd42fc86
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-002-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<html style="zoom: 2">
+ <div style="width: 250px; height: 250px; background: green"></div>
+</html>
diff --git a/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-002.html b/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-002.html
new file mode 100644
index 0000000000..f5d5e6a777
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-002.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html reftest-zoom="2">
+ <link rel="help" href="https://firefox-source-docs.mozilla.org/layout/Reftest.html#zoom-tests-reftest-zoom-float"/>
+ <link rel="match" href="set-full-zoom-002-ref.html"/>
+ <meta name="assert" content="Zoom more than one scales up the rect."/>
+ <script src="/_mozilla/common/reftest-zoom.js"></script>
+ <div style="width: 250px; height: 250px; background: green"></div>
+</html>
diff --git a/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-003-ref.html b/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-003-ref.html
new file mode 100644
index 0000000000..ab500f2a2e
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-003-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<html style="zoom: 1">
+ <div style="width: 250px; height: 250px; background: green"></div>
+</html>
diff --git a/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-003.html b/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-003.html
new file mode 100644
index 0000000000..b4bf803a89
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-003.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <link rel="match" href="set-full-zoom-003-ref.html"/>
+ <meta name="assert" content="Initial zoom is equal to one."/>
+ <!-- Note that when running all the tests by alphabetical order, this test
+ would fail if set-zoom-002.html does not reset the zoom to one.
+ It would pass when re-running after a browser restart, though. -->
+ <div style="width: 250px; height: 250px; background: green"></div>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/README.md b/testing/web-platform/mozilla/tests/mathml/README.md
index 092dae0251..d579f67987 100644
--- a/testing/web-platform/mozilla/tests/mathml/README.md
+++ b/testing/web-platform/mozilla/tests/mathml/README.md
@@ -46,6 +46,17 @@ any specification:
interpretation is unclear in current version of MathML Core.
See [issue 132](https://github.com/w3c/mathml-core/issues/132).
+- `operator-stretching`: Tests for operator stretching, using Gecko-specific
+ methods that are not part of the current version of MathML Core.
+
+- `rtl`: Tests for RTL MathML, for aspects not completely defined in
+ MathML Core or for which we use things like scale transform for
+ mirroring.
+ See [issue 67](https://github.com/w3c/mathml-core/issues/67).
+
+- `scripts`: Tests for MathML scripted elements, for Gecko features
+ that are not defined in MathML Core or in contradiction with the spec.
+
- `tables`: Tests for
[table features](https://www.w3.org/TR/MathML3/chapter3.html#presm.tabmat)
that are in the initial version of MathML Core.
@@ -55,3 +66,5 @@ any specification:
[whitespace trimming in token elements](https://www.w3.org/TR/MathML3/chapter2.html#fund.collapse)
which is not described in the initial version of MathML Core.
See [issue 149](https://github.com/w3c/mathml-core/issues/149).
+
+- `zoom`: Tests to check MathML rendering at different zoom levels.
diff --git a/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-seudo-units-001-ref.html b/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-001-ref.html
index 0b6efcbafc..0b6efcbafc 100644
--- a/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-seudo-units-001-ref.html
+++ b/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-001-ref.html
diff --git a/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-seudo-units-001.html b/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-001.html
index 80ba835109..5f976e63de 100644
--- a/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-seudo-units-001.html
+++ b/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-001.html
@@ -3,7 +3,7 @@
<head>
<title>Test mpadded</title>
<meta name="assert" content="Verify basic rendering of mpadded with pseudo units.">
- <link rel="match" href="mpadded-seudo-units-001-ref.html">
+ <link rel="match" href="mpadded-pseudo-units-001-ref.html">
</head>
<body>
<math>
diff --git a/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-002-ref.html b/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-002-ref.html
new file mode 100644
index 0000000000..50f14246ee
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-002-ref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Test mpadded</title>
+ </head>
+ <body>
+ <math>
+ <mpadded mathbackground="red" height="100height" depth="0">
+ <mphantom>
+ <mtext>&#x1D687;<!-- Mathematical Monospace Capital X --></mtext>
+ </mphantom>
+ </mpadded>
+ </math>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-002.html b/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-002.html
new file mode 100644
index 0000000000..62e72310c4
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-002.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Test mpadded</title>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=685628">
+ <link rel="match" href="mpadded-pseudo-units-002-ref.html">
+ <meta name="assert" content="height pseudo unit in mpadded@height refers to logical (not ink) metrics.">
+ </head>
+ <body>
+ <math>
+ <!--height in term of height should not depend on the characters-->
+ <mpadded mathbackground="red" height="100height" depth="0">
+ <mphantom>
+ <mtext>&#x1D692;<!-- Mathematical Monospace Small I --></mtext>
+ </mphantom>
+ </mpadded>
+ </math>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-003-ref.html b/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-003-ref.html
new file mode 100644
index 0000000000..e01e6498f2
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-003-ref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Test mpadded</title>
+ </head>
+ <body>
+ <math>
+ <mpadded mathbackground="red" height="100width" depth="0">
+ <mphantom>
+ <mtext>&#x1D687;<!-- Mathematical Monospace Capital X --></mtext>
+ </mphantom>
+ </mpadded>
+ </math>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-003.html b/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-003.html
new file mode 100644
index 0000000000..9089c2cd5e
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-003.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Test mpadded</title>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=685628">
+ <link rel="match" href="mpadded-pseudo-units-003-ref.html">
+ <meta name="assert" content="width pseudo unit in mpadded@height refers to logical (not ink) metrics.">
+ </head>
+ <body>
+ <math>
+ <!--height in term of width should not depend on the characters-->
+ <mpadded mathbackground="red" height="100width" depth="0">
+ <mphantom>
+ <mtext>&#x1D692;<!-- Mathematical Monospace Small I --></mtext>
+ </mphantom>
+ </mpadded>
+ </math>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-004-ref.html b/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-004-ref.html
new file mode 100644
index 0000000000..e2a4943edd
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-004-ref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Test mpadded</title>
+ </head>
+ <body>
+ <math>
+ <mpadded mathbackground="red" width="100width">
+ <mphantom>
+ <mtext>&#x1D687;<!-- Mathematical Monospace Capital X --></mtext>
+ </mphantom>
+ </mpadded>
+ </math>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-004.html b/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-004.html
new file mode 100644
index 0000000000..e2433ef045
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/mpadded/mpadded-pseudo-units-004.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Test mpadded</title>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=685628">
+ <link rel="match" href="mpadded-pseudo-units-004-ref.html">
+ <meta name="assert" content="pseudo unit specified in mpadded@width does not affect the height/depth">
+ </head>
+ <body>
+ <math>
+ <!--with fixed width, height + depth should not depend on the characters-->
+ <mpadded mathbackground="red" width="100width">
+ <mphantom>
+ <mtext>&#x1D692;<!-- Mathematical Monospace Small I --></mtext>
+ </mphantom>
+ </mpadded>
+ </math>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/operator-stretching/overbar-width-1-ref.xhtml b/testing/web-platform/mozilla/tests/mathml/operator-stretching/overbar-width-1-ref.xhtml
new file mode 100644
index 0000000000..64e89f403f
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/operator-stretching/overbar-width-1-ref.xhtml
@@ -0,0 +1,26 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <style type="text/css">
+ html { background-color: grey; }
+ div { display: inline-block;
+ font-size: 30px;
+ line-height: 60px; /* Ensure space for overbar */
+ border: 1px solid white;
+ padding: 2px; /* 10% error allowed in char selection */
+ background-color: black;
+ color: red; }
+ </style>
+ </head>
+<body>
+ <div>
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <mphantom>
+ <mover>
+ <mi>ai</mi>
+ <mo>&#xaf;</mo>
+ </mover>
+ </mphantom>
+ </math>
+ </div>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/operator-stretching/overbar-width-1.xhtml b/testing/web-platform/mozilla/tests/mathml/operator-stretching/overbar-width-1.xhtml
new file mode 100644
index 0000000000..317504a007
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/operator-stretching/overbar-width-1.xhtml
@@ -0,0 +1,27 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Check width of stretchy OverBar</title>
+ <link rel="match" href="overbar-width-1.xhtml"/>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=427666"/>
+ <style type="text/css">
+ html { background-color: grey; }
+ div { display: inline-block;
+ font-size: 30px;
+ line-height: 60px; /* Ensure space for overbar */
+ border: 1px solid white;
+ padding: 2px; /* 10% error allowed in char selection */
+ background-color: black;
+ color: black; }
+ </style>
+ </head>
+<body>
+ <div>
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <mover>
+ <mi>ai</mi>
+ <mo>&#xaf;</mo>
+ </mover>
+ </math>
+ </div>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-001-ref.html b/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-001-ref.html
new file mode 100644
index 0000000000..36a2a574f8
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-001-ref.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8"/>
+ <title>Maximal size for a vertical arrow stretched by scaling</title>
+ </head>
+ <body>
+ <table style="position: absolute;">
+ <tr>
+ <td><div style="height: 200px; width: 5px; background: black"/></td>
+ <td>
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <mrow>
+ <mspace height="50px" depth="50px" width="5px"
+ style="background: yellow" />
+ <mspace height="55px" depth="55px" width="50px"
+ style="background: red;"/>
+ </mrow>
+ </math>
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-001.html b/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-001.html
new file mode 100644
index 0000000000..77b355f404
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-001.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8"/>
+ <title>Maximal size for a vertical arrow stretched by scaling</title>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=414277">
+ <link rel="match" href="scale-stretchy-001-ref.html">
+ <meta name="assert" content="Verify maximal height of vertical operator stretched by scaling.">
+ </head>
+ <body>
+ <!-- This assumes that the system fonts do not provide a way to draw a
+ bigger U+290B DOWNWARDS TRIPLE ARROW and that preference
+ `mathml.scale_stretchy_operators` is enabled, so that we exercise
+ stretching of largeop using a scale. This test may still pass if
+ stretching is not performed via a scale though. -->
+ <table style="position: absolute;">
+ <tr>
+ <td><div style="height: 200px; width: 5px; background: black"/></td>
+ <td>
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <mrow>
+ <mspace height="50px" depth="50px" width="5px"
+ style="background: yellow" />
+ <mo style="color: blue;">⤋</mo>
+ </mrow>
+ </math>
+ </td>
+ </tr>
+ </table>
+ <!-- The red rect is slightly taller than the target size so it should
+ completely cover the operator. -->
+ <table style="position: absolute;">
+ <tr>
+ <td><div style="height: 200px; width: 5px; background: black"/></td>
+ <td>
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <mrow>
+ <mspace height="50px" depth="50px" width="5px"
+ style="background: yellow" />
+ <mspace height="55px" depth="55px" width="50px"
+ style="background: red;"/>
+ </mrow>
+ </math>
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-002-ref.html b/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-002-ref.html
new file mode 100644
index 0000000000..7b0e084364
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-002-ref.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8"/>
+ <title>Minimal size for a vertical arrow stretched by scaling</title>
+ </head>
+ <body>
+ <table style="position: absolute;">
+ <tr>
+ <td><div style="height: 200px; width: 5px; background: black"/></td>
+ <td>
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <mrow>
+ <mspace height="50px" depth="50px" width="5px"
+ style="background: yellow" />
+ <mspace height="44px" depth="44px" width="50px"
+ style="background: green;"/>
+ </mrow>
+ </math>
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-002.html b/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-002.html
new file mode 100644
index 0000000000..db39cc97cc
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-002.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8"/>
+ <title>Minimal size for a vertical arrow stretched by scaling</title>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=414277">
+ <link rel="mismatch" href="scale-stretchy-002-ref.html">
+ <meta name="assert" content="Verify minimal height of vertical operator stretched by scaling.">
+ </head>
+ <body>
+ <!-- This assumes that the system fonts do not provide a way to draw a
+ bigger U+290B DOWNWARDS TRIPLE ARROW and that preference
+ `mathml.scale_stretchy_operators` is enabled, so that we exercise
+ stretching of largeop using a scale. This test may still pass if
+ stretching is not performed via a scale though. -->
+ <table style="position: absolute;">
+ <tr>
+ <td><div style="height: 200px; width: 5px; background: black"/></td>
+ <td>
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <mrow>
+ <mspace height="50px" depth="50px" width="5px"
+ style="background: yellow" />
+ <mo style="color: blue;">⤋</mo>
+ </mrow>
+ </math>
+ </td>
+ </tr>
+ </table>
+ <!-- The green rect is slightly shorter than the target size so it should
+ not completely cover the operator. -->
+ <table style="position: absolute;">
+ <tr>
+ <td><div style="height: 200px; width: 5px; background: black"/></td>
+ <td>
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <mrow>
+ <mspace height="50px" depth="50px" width="5px"
+ style="background: yellow" />
+ <mspace height="44px" depth="44px" width="50px"
+ style="background: green;"/>
+ </mrow>
+ </math>
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-003-ref.html b/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-003-ref.html
new file mode 100644
index 0000000000..b5935f306a
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-003-ref.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8"/>
+ <title>Maximal size for a horizontal arrow stretched by scaling</title>
+ </head>
+ <body>
+ <table style="position: absolute;">
+ <tr align="center">
+ <td><div style="width: 200px; height: 5px; background: black"/></td>
+ </tr>
+ <tr align="center">
+ <td>
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <munder accentunder="false">
+ <mspace width="100px" height="5px" style="background: yellow"/>
+ <mspace width="110px" height="25px" depth="25px"
+ style="background: red;"/>
+ </munder>
+ </math>
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-003.html b/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-003.html
new file mode 100644
index 0000000000..7191a329b4
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-003.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8"/>
+ <title>Maximal size for a horizontal arrow stretched by scaling</title>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=414277">
+ <link rel="match" href="scale-stretchy-003-ref.html">
+ <meta name="assert" content="Verify maximal height of horizontal operator stretched by scaling.">
+ </head>
+ <body>
+ <!-- This assumes that the system fonts do not provide a way to draw a
+ bigger U+21DB RIGHTWARDS TRIPLE ARROW and that preference
+ `mathml.scale_stretchy_operators` is enabled, so that we exercise
+ stretching of largeop using a scale. This test may still pass if
+ stretching is not performed via a scale though. -->
+ <table style="position: absolute;">
+ <tr align="center">
+ <td><div style="width: 200px; height: 5px; background: black"/></td>
+ </tr>
+ <tr align="center">
+ <td>
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <munder accentunder="false">
+ <mspace width="100px" height="5px" style="background: yellow"/>
+ <mo style="color: blue;">⇛</mo>
+ </munder>
+ </math>
+ </td>
+ </tr>
+ </table>
+ <!-- The red rect is slightly wider than the target size so it should
+ completely cover the operator. -->
+ <table style="position: absolute;">
+ <tr align="center">
+ <td><div style="width: 200px; height: 5px; background: black"/></td>
+ </tr>
+ <tr align="center">
+ <td>
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <munder accentunder="false">
+ <mspace width="100px" height="5px" style="background: yellow"/>
+ <mspace width="110px" height="25px" depth="25px"
+ style="background: red;"/>
+ </munder>
+ </math>
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-004-ref.html b/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-004-ref.html
new file mode 100644
index 0000000000..ad797c46d1
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-004-ref.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8"/>
+ <title>Minimal size for a horizontal arrow stretched by scaling (reference)</title>
+ </head>
+ <body>
+ <table style="position: absolute;">
+ <tr align="center">
+ <td><div style="width: 200px; height: 5px; background: black"/></td>
+ </tr>
+ <tr align="center">
+ <td>
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <munder>
+ <mspace width="100px" height="5px" style="background: yellow"/>
+ <mspace width="88px" height="25px" depth="25px"
+ style="background: green;"/>
+ </munder>
+ </math>
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-004.html b/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-004.html
new file mode 100644
index 0000000000..f7d36b36e2
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-004.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8"/>
+ <title>Minimal size for a horizontal arrow stretched by scaling</title>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=414277">
+ <link rel="mismatch" href="scale-stretchy-004-ref.html">
+ <meta name="assert" content="Verify minimal width of horizontal operator stretched by scaling.">
+ </head>
+ <body>
+ <!-- This assumes that the system fonts do not provide a way to draw a
+ bigger U+21DB RIGHTWARDS TRIPLE ARROW and that preference
+ `mathml.scale_stretchy_operators` is enabled, so that we exercise
+ stretching of largeop using a scale. This test may still pass if
+ stretching is not performed via a scale though. -->
+ <table style="position: absolute;">
+ <tr align="center">
+ <td><div style="width: 200px; height: 5px; background: black"/></td>
+ </tr>
+ <tr align="center">
+ <td>
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <munder>
+ <mspace width="100px" height="5px" style="background: yellow"/>
+ <mo style="color: blue;">⇛</mo>
+ </munder>
+ </math>
+ </td>
+ </tr>
+ </table>
+ <!-- The green rect is slightly narrower than the target size so it should
+ not completely cover the operator. -->
+ <table style="position: absolute;">
+ <tr align="center">
+ <td><div style="width: 200px; height: 5px; background: black"/></td>
+ </tr>
+ <tr align="center">
+ <td>
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <munder>
+ <mspace width="100px" height="5px" style="background: yellow"/>
+ <mspace width="88px" height="25px" depth="25px"
+ style="background: green;"/>
+ </munder>
+ </math>
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-005-ref.html b/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-005-ref.html
new file mode 100644
index 0000000000..c1bd50201b
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-005-ref.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8"/>
+ <title>Largeop in display mode stretched by scaling (reference)</title>
+ </head>
+ <body>
+ <math display="block">
+ <mo largeop="false">⨌</mo>
+ </math>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-005.html b/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-005.html
new file mode 100644
index 0000000000..3f20eed587
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/operator-stretching/scale-stretchy-005.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8"/>
+ <title>Largeop in display mode stretched by scaling</title>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=414277">
+ <link rel="mismatch" href="scale-stretchy-005-ref.html">
+ <meta name="assert" content="Verify that a displaystyle largeop can be drawn bigger by scaling.">
+ </head>
+ <body>
+ <!-- This assumes that the system fonts do not provide a way to draw a
+ bigger U+2A0C QUADRUPLE INTEGRAL OPERATOR and that preference
+ `mathml.scale_stretchy_operators` is enabled, so that we exercise
+ stretching of largeop using a scale. This test may still pass if
+ stretching is not performed via a scale though. -->
+ <math display="block">
+ <mo largeop="true">⨌</mo>
+ </math>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/operator-stretching/stretch-equal-sign-with-default-font-ref.html b/testing/web-platform/mozilla/tests/mathml/operator-stretching/stretch-equal-sign-with-default-font-ref.html
new file mode 100644
index 0000000000..074d0e0415
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/operator-stretching/stretch-equal-sign-with-default-font-ref.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Horizontal stretching of equal of U+003D EQUAL SIGN with default font (reference)</title>
+ </head>
+ <body>
+ <math>
+ <munder>
+ <mi>AVERYLONGBASE</mi>
+ <mo stretchy="false">=</mo>
+ </munder>
+ </math>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/operator-stretching/stretch-equal-sign-with-default-font.html b/testing/web-platform/mozilla/tests/mathml/operator-stretching/stretch-equal-sign-with-default-font.html
new file mode 100644
index 0000000000..2ddcdbe683
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/operator-stretching/stretch-equal-sign-with-default-font.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Horizontal stretching of U+003D EQUAL SIGN with default font</title>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=854339">
+ <link rel="help" href="https://w3c.github.io/mathml-core/#unicode-based-glyph-assemblies">
+ <link rel="mismatch" href="stretch-equal-sign-with-default-font-ref.html">
+ <meta name="assert" content="Verify EQUAL SIGN can be stretched horizontally with default fonts.">
+ </head>
+ <body>
+ <math>
+ <munder>
+ <mi>AVERYLONGBASE</mi>
+ <mo stretchy="true">=</mo>
+ </munder>
+ </math>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/operator-stretching/underbar-width-1-ref.xhtml b/testing/web-platform/mozilla/tests/mathml/operator-stretching/underbar-width-1-ref.xhtml
new file mode 100644
index 0000000000..737673ccb1
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/operator-stretching/underbar-width-1-ref.xhtml
@@ -0,0 +1,26 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <style type="text/css">
+ html { background-color: grey; }
+ div { display: inline-block;
+ font-size: 30px;
+ line-height: 60px; /* Ensure space for underbar */
+ border: 1px solid white;
+ padding: 2px; /* 10% error allowed in char selection */
+ background-color: black;
+ color: red; }
+ </style>
+ </head>
+<body>
+ <div>
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <mphantom>
+ <munder>
+ <mn>1</mn>
+ <mo>&#x332;</mo>
+ </munder>
+ </mphantom>
+ </math>
+ </div>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/operator-stretching/underbar-width-1.xhtml b/testing/web-platform/mozilla/tests/mathml/operator-stretching/underbar-width-1.xhtml
new file mode 100644
index 0000000000..d2539d74ec
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/operator-stretching/underbar-width-1.xhtml
@@ -0,0 +1,27 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Check width of stretchy UnderBar</title>
+ <link rel="match" href="underbar-width-1.xhtml"/>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=428863"/>
+ <style type="text/css">
+ html { background-color: grey; }
+ div { display: inline-block;
+ font-size: 30px;
+ line-height: 60px; /* Ensure space for underbar */
+ border: 1px solid white;
+ padding: 2px; /* 10% error allowed in char selection */
+ background-color: black;
+ color: black; }
+ </style>
+ </head>
+<body>
+ <div>
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <munder>
+ <mn>1</mn>
+ <mo>&#x332;</mo>
+ </munder>
+ </math>
+ </div>
+</body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-001-ref.html b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-001-ref.html
new file mode 100644
index 0000000000..9430d2d7f9
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-001-ref.html
@@ -0,0 +1,3 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<math><mo>(</mo></math>
diff --git a/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-001.html b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-001.html
new file mode 100644
index 0000000000..38a322f725
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-001.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=208309">
+<link rel="mismatch" href="mirror-op-001-ref.html">
+<meta name="assert" content="fence is mirrored in RTL mode">
+<math dir="rtl"><mo>(</mo></math>
diff --git a/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-002-ref.html b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-002-ref.html
new file mode 100644
index 0000000000..2273b3a1e5
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-002-ref.html
@@ -0,0 +1,3 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<math><mo>)</mo></math>
diff --git a/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-002.html b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-002.html
new file mode 100644
index 0000000000..82f0b0d669
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-002.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=208309">
+<link rel="mismatch" href="mirror-op-002-ref.html">
+<meta name="assert" content="fence is mirrored in RTL mode">
+<math dir="rtl"><mo>)</mo></math>
diff --git a/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-003-ref.html b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-003-ref.html
new file mode 100644
index 0000000000..83522ce6bd
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-003-ref.html
@@ -0,0 +1,3 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<math><mo>[</mo></math>
diff --git a/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-003.html b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-003.html
new file mode 100644
index 0000000000..773f44a71d
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-003.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=208309">
+<link rel="mismatch" href="mirror-op-003-ref.html">
+<meta name="assert" content="fence is mirrored in RTL mode">
+<math dir="rtl"><mo>[</mo></math>
diff --git a/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-004-ref.html b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-004-ref.html
new file mode 100644
index 0000000000..1bc501a43e
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-004-ref.html
@@ -0,0 +1,3 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<math><mo>]</mo></math>
diff --git a/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-004.html b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-004.html
new file mode 100644
index 0000000000..0292d8e976
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-004.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=208309">
+<link rel="mismatch" href="mirror-op-004-ref.html">
+<meta name="assert" content="fence is mirrored in RTL mode">
+<math dir="rtl"><mo>]</mo></math>
diff --git a/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-005-ref.html b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-005-ref.html
new file mode 100644
index 0000000000..5dec3e3c0a
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-005-ref.html
@@ -0,0 +1,3 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<math><mo>{</mo></math>
diff --git a/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-005.html b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-005.html
new file mode 100644
index 0000000000..121928e03f
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-005.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=208309">
+<link rel="mismatch" href="mirror-op-005-ref.html">
+<meta name="assert" content="fence is mirrored in RTL mode">
+<math dir="rtl"><mo>{</mo></math>
diff --git a/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-006-ref.html b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-006-ref.html
new file mode 100644
index 0000000000..765c29e858
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-006-ref.html
@@ -0,0 +1,3 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<math><mo>}</mo></math>
diff --git a/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-006.html b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-006.html
new file mode 100644
index 0000000000..431e636ba9
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-006.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=208309">
+<link rel="mismatch" href="mirror-op-006-ref.html">
+<meta name="assert" content="fence is mirrored in RTL mode">
+<math dir="rtl"><mo>}</mo></math>
diff --git a/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-007-ref.html b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-007-ref.html
new file mode 100644
index 0000000000..efe4bf1f89
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-007-ref.html
@@ -0,0 +1,3 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<math><mo>∑</mo></math>
diff --git a/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-007.html b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-007.html
new file mode 100644
index 0000000000..4266e71a97
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-007.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=208309">
+<link rel="mismatch" href="mirror-op-007-ref.html">
+<meta name="assert" content="sum is mirrored in RTL mode">
+<math dir="rtl"><mo>∑</mo></math>
diff --git a/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-008-ref.html b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-008-ref.html
new file mode 100644
index 0000000000..813900251d
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-008-ref.html
@@ -0,0 +1,3 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<math><mo>√</mo></math>
diff --git a/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-008.html b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-008.html
new file mode 100644
index 0000000000..edee9f5f14
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-008.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=208309">
+<link rel="mismatch" href="mirror-op-008-ref.html">
+<meta name="assert" content="square root is mirrored in RTL mode">
+<math dir="rtl"><mo>√</mo></math>
diff --git a/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-009-ref.html b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-009-ref.html
new file mode 100644
index 0000000000..efc9648228
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-009-ref.html
@@ -0,0 +1,3 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<math><mo>∫</mo></math>
diff --git a/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-009.html b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-009.html
new file mode 100644
index 0000000000..d90e4701a3
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/rtl/mirror-op-009.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=208309">
+<link rel="mismatch" href="mirror-op-009-ref.html">
+<meta name="assert" content="integral is mirrored in RTL mode">
+<math dir="rtl"><mo>∫</mo></math>
diff --git a/testing/web-platform/mozilla/tests/mathml/scripts/mmultiscripts-empty-scripts-ref.html b/testing/web-platform/mozilla/tests/mathml/scripts/mmultiscripts-empty-scripts-ref.html
new file mode 100644
index 0000000000..2b47eb4d1b
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/scripts/mmultiscripts-empty-scripts-ref.html
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+ <title>Comparison of script elements</title>
+ </head>
+ <body>
+ msubsup:
+ <math>
+ <mmultiscripts style="background: red;">
+ <mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
+ <mtext style="background-color: rgba(0, 255, 0, 0.4);">bbb</mtext>
+ <mtext style="background-color: rgba(0, 255, 0, 0.4);">ccc</mtext>
+ </mmultiscripts>
+ </math>
+
+ <br><br>
+
+ msubsup:
+ <math>
+ <mmultiscripts style="background: red;">
+ <mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
+ <mtext style="background-color: rgba(0, 255, 0, 0.4);">bbb</mtext>
+ <none/>
+ </mmultiscripts>
+ </math>
+
+ <br><br>
+
+ msup / msubsup:
+ <math>
+ <mmultiscripts style="background: red;">
+ <mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
+ <none/>
+ <mtext style="background-color: rgba(0, 255, 0, 0.4);">bbb</mtext>
+ </mmultiscripts>
+ </math>
+
+ <math>
+ <mmultiscripts style="background: red;">
+ <mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
+ <none/>
+ <mtext style="background-color: rgba(0, 255, 0, 0.4);">bbb</mtext>
+ </mmultiscripts>
+ </math>
+
+ <br><br>
+
+
+ mrow / msub:
+ <math>
+ <mrow style="background: red;">
+ <mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
+ </mrow>
+ </math>
+
+ <math>
+ <mrow style="background: red;">
+ <mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
+ </mrow>
+ </math>
+
+ <br><br>
+
+ msupsub:
+ <math>
+ <mmultiscripts style="background: red;">
+ <mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
+ <none />
+ <none />
+ </mmultiscripts>
+ </math>
+
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/scripts/mmultiscripts-empty-scripts.html b/testing/web-platform/mozilla/tests/mathml/scripts/mmultiscripts-empty-scripts.html
new file mode 100644
index 0000000000..31473c2a72
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/scripts/mmultiscripts-empty-scripts.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Comparison of script elements</title>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=669932">
+ <link rel="match" href="mmultiscripts-empty-scripts-ref.html">
+ <meta name="assert" content="Verify elements with empty sub/sup scripts render the same as equivalent elements with less scripts.">
+ </head>
+ <body>
+ msubsup:
+ <math>
+ <msubsup style="background: red;">
+ <mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
+ <mtext style="background-color: rgba(0, 255, 0, 0.4);">bbb</mtext>
+ <mtext style="background-color: rgba(0, 255, 0, 0.4);">ccc</mtext>
+ </msubsup>
+ </math>
+
+ <br><br>
+
+ <!-- Different rules apply to msub, so it won't provide equivalent output -->
+ msubsup:
+ <math>
+ <msubsup style="background: red;">
+ <mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
+ <mtext style="background-color: rgba(0, 255, 0, 0.4);">bbb</mtext>
+ <mrow></mrow>
+ </msubsup>
+ </math>
+
+ <br><br>
+
+ msup / msubsup:
+ <math>
+ <msup style="background: red;">
+ <mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
+ <mtext style="background-color: rgba(0, 255, 0, 0.4);">bbb</mtext>
+ </msup>
+ </math>
+
+ <math>
+ <msubsup style="background: red;">
+ <mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
+ <mrow></mrow>
+ <mtext style="background-color: rgba(0, 255, 0, 0.4);">bbb</mtext>
+ </msubsup>
+ </math>
+
+ <br><br>
+
+ mrow / msub:
+ <math>
+ <mrow style="background: red;">
+ <mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
+ </mrow>
+ </math>
+
+ <math>
+ <msub style="background: red;">
+ <mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
+ <mrow></mrow>
+ </msub>
+ </math>
+
+ <br><br>
+
+ msupsub:
+ <math>
+ <msubsup style="background: red;">
+ <mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
+ <mrow></mrow>
+ <mrow></mrow>
+ </msubsup>
+ </math>
+
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/scripts/munderover-empty-scripts-ref.html b/testing/web-platform/mozilla/tests/mathml/scripts/munderover-empty-scripts-ref.html
new file mode 100644
index 0000000000..5e0ba0bac1
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/scripts/munderover-empty-scripts-ref.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Test munderover with empty scripts</title>
+ </head>
+ <body>
+
+ <p>munder / munderover with empty overscript:
+ <math>
+ <munderover style="background: red;">
+ <mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
+ <mtext style="background-color: rgba(0, 255, 0, 0.4);">bbb</mtext>
+ <mspace></mspace>
+ </munderover>
+ </math>
+ </p>
+
+ <p>mover / munderover with empty underscript:
+ <math>
+ <munderover style="background: red;">
+ <mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
+ <mspace></mspace>
+ <mtext style="background-color: rgba(0, 255, 0, 0.4);">bbb</mtext>
+ </munderover>
+ </math>
+ </p>
+
+ <p>mrow / munder with empty scripts:
+ <math>
+ <munderover style="background: red;">
+ <mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
+ <mspace></mspace>
+ <mspace></mspace>
+ </munderover>
+ </math>
+ </p>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/scripts/munderover-empty-scripts.html b/testing/web-platform/mozilla/tests/mathml/scripts/munderover-empty-scripts.html
new file mode 100644
index 0000000000..671c889211
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/scripts/munderover-empty-scripts.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Test munderover with empty scripts</title>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=669932">
+ <link rel="match" href="munderover-empty-scripts-ref.html">
+ <meta name="assert" content="Verify elements with empty under/over scripts render the same as equivalent elements with less scripts.">
+ </head>
+ <body>
+
+ <p>munder / munderover with empty overscript:
+ <math>
+ <munder style="background: red;">
+ <mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
+ <mtext style="background-color: rgba(0, 255, 0, 0.4);">bbb</mtext>
+ </munder>
+ </math>
+ </p>
+
+ <p>mover / munderover with empty underscript:
+ <math>
+ <mover style="background: red;">
+ <mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
+ <mtext style="background-color: rgba(0, 255, 0, 0.4);">bbb</mtext>
+ </mover>
+ </math>
+ </p>
+
+ <p>mrow / munder with empty scripts:
+ <math>
+ <mrow style="background: red;">
+ <mtext style="background-color: rgba(0, 0, 255, 0.4);">AAA</mtext>
+ </mrow>
+ </math>
+ </p>
+
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/scripts/scriptlevel-movablelimits-accent-ref.html b/testing/web-platform/mozilla/tests/mathml/scripts/scriptlevel-movablelimits-accent-ref.html
new file mode 100644
index 0000000000..20a0f65ec7
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/scripts/scriptlevel-movablelimits-accent-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Test accent/accentunder (reference)</title>
+ </head>
+ <body>
+ <math displaystyle="false">
+ <munderover>
+ <mo>∑</mo>
+ <mi>a</mi>
+ <mi>b</mi>
+ </munderover>
+ </math>
+ <math displaystyle="false">
+ <munder>
+ <mo>∑</mo>
+ <mi>a</mi>
+ </munder>
+ </math>
+ <math displaystyle="false">
+ <mover>
+ <mo>∑</mo>
+ <mi>a</mi>
+ </mover>
+ </math>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/scripts/scriptlevel-movablelimits-accent.html b/testing/web-platform/mozilla/tests/mathml/scripts/scriptlevel-movablelimits-accent.html
new file mode 100644
index 0000000000..4da97dadbf
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/scripts/scriptlevel-movablelimits-accent.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Test accent/accentunder</title>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=669713">
+ <link rel="help" href="https://www.w3.org/TR/MathML3/chapter3.html#presm.munder">
+ <link rel="help" href="https://www.w3.org/TR/MathML3/chapter3.html#presm.mover">
+ <link rel="help" href="https://www.w3.org/TR/MathML3/chapter3.html#presm.munderover">
+ <link rel="match" href="scriptlevel-movablelimits-accent-ref.html">
+ <meta name="assert" content="Verify accentunder='true' or accent='true' is ignored when an underover element is laid out as a subsup element.">
+ </head>
+ <body>
+ <!-- Per MathML3, setting accentunder/accent to true prevents scriptlevel
+ from being incremented, however such attributes should be ignored when
+ scripts are drawn as subcript/superscript, which is the case here
+ because U+2211 N-ARY SUMMATION defaults to movablelimits="true". -->
+ <math displaystyle="false">
+ <munderover accentunder="true" accent="true">
+ <mo>∑</mo>
+ <mi>a</mi>
+ <mi>b</mi>
+ </munderover>
+ </math>
+ <math displaystyle="false">
+ <munder accentunder="true">
+ <mo>∑</mo>
+ <mi>a</mi>
+ </munder>
+ </math>
+ <math displaystyle="false">
+ <mover accent="true">
+ <mo>∑</mo>
+ <mi>a</mi>
+ </mover>
+ </math>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/scripts/subscript-italic-correction.html b/testing/web-platform/mozilla/tests/mathml/scripts/subscript-italic-correction.html
new file mode 100644
index 0000000000..2c39d825ff
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/scripts/subscript-italic-correction.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>italic correction for subscripts</title>
+ <meta charset="utf-8"/>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=945254">
+ <link rel="help" href="https://w3c.github.io/mathml-core/#dfn-italic-correction">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script type="text/javascript">
+ function verifyItalicCorrections()
+ {
+ var epsilon = 2;
+ for (var i = 0; i < 8; i += 2) {
+ var sub = document.getElementById("s" + i);
+ var sup = document.getElementById("s" + (i+1));
+ var italicCorrection =
+ sup.getBoundingClientRect().left - sub.getBoundingClientRect().left;
+ assert_greater_than(italicCorrection, epsilon);
+ }
+ }
+
+ promise_test(() => {
+ return new Promise(resolve => {
+ window.addEventListener("load", resolve);
+ }).then(verifyItalicCorrections);
+ }, "Italic correction of base is used to place subscripts.");
+ </script>
+ <style>
+ math { font-size: 50px; }
+ </style>
+ </head>
+ <body>
+
+ <div>
+ <math>
+ <msubsup>
+ <mi mathbackground="#5f5">f</mi>
+ <mspace id="s0" width="50px" height="50px" mathbackground="blue"/>
+ <mspace id="s1" width="50px" height="50px" mathbackground="blue"/>
+ </msubsup>
+ </math>
+ </div>
+
+ <br/>
+
+ <div>
+ <math>
+ <mmultiscripts>
+ <mi mathbackground="#5f5">f</mi>
+ <mspace id="s2" width="50px" height="50px" mathbackground="blue"/>
+ <mspace id="s3" width="50px" height="50px" mathbackground="blue"/>
+ <mspace id="s4" width="50px" height="50px" mathbackground="blue"/>
+ <mspace id="s5" width="50px" height="50px" mathbackground="blue"/>
+ <mspace id="s6" width="50px" height="50px" mathbackground="blue"/>
+ <mspace id="s7" width="50px" height="50px" mathbackground="blue"/>
+ </mmultiscripts>
+ </math>
+ </div>
+
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-1.html b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-1.html
new file mode 100644
index 0000000000..1882b78275
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-1.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <link rel="mismatch" href="about:blank"/>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1011020"/>
+ <!-- Default to invisible text -->
+ <style type="text/css" media="screen, print">
+ .hidden {
+ color: white;
+ }
+ .visible {
+ color: black;
+ }
+ </style>
+ </head>
+ <body>
+ <!-- Nest successive radicals and test that the horizontal bar of one of them is drawn.
+ Because the comparison is for inequality with about:blank, at most one can be visible -->
+ <math>
+ <mrow>
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="visible">
+ <mspace width="20em" height="1em" />
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </mrow>
+ </math>
+
+ <!-- Block out all but the horizontal bar of the visible radical -->
+ <div style="position: absolute; top: 5px; left: 0px;
+ width: 20em; height: 10em; background: white;"></div>
+
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-1a.html b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-1a.html
new file mode 100644
index 0000000000..9d48a0971f
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-1a.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html reftest-zoom=".5">
+ <head>
+ <link rel="mismatch" href="about:blank"/>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1011020"/>
+ <script src="/_mozilla/common/reftest-zoom.js"></script>
+ <!-- Default to invisible text -->
+ <style type="text/css" media="screen, print">
+ .hidden {
+ color: white;
+ }
+ .visible {
+ color: black;
+ }
+ </style>
+ </head>
+ <body>
+ <!-- Nest successive radicals and test that the horizontal bar of one of them is drawn.
+ Because the comparison is for inequality with about:blank, at most one can be visible -->
+ <math>
+ <mrow>
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="visible">
+ <mspace width="20em" height="1em" />
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </mrow>
+ </math>
+
+ <!-- Block out all but the horizontal bar of the visible radical -->
+ <div style="position: absolute; top: 5px; left: 0px;
+ width: 20em; height: 10em; background: white;"></div>
+
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-1b.html b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-1b.html
new file mode 100644
index 0000000000..d72cb252c7
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-1b.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html reftest-zoom=".4">
+ <head>
+ <link rel="mismatch" href="about:blank"/>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1011020"/>
+ <script src="/_mozilla/common/reftest-zoom.js"></script>
+ <!-- Default to invisible text -->
+ <style type="text/css" media="screen, print">
+ .hidden {
+ color: white;
+ }
+ .visible {
+ color: black;
+ }
+ </style>
+ </head>
+ <body>
+ <!-- Nest successive radicals and test that the horizontal bar of one of them is drawn.
+ Because the comparison is for inequality with about:blank, at most one can be visible -->
+ <math>
+ <mrow>
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="visible">
+ <mspace width="20em" height="1em" />
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </mrow>
+ </math>
+
+ <!-- Block out all but the horizontal bar of the visible radical -->
+ <div style="position: absolute; top: 5px; left: 0px;
+ width: 20em; height: 10em; background: white;"></div>
+
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-1c.html b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-1c.html
new file mode 100644
index 0000000000..d0708973f0
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-1c.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html reftest-zoom=".3">
+ <head>
+ <link rel="mismatch" href="about:blank"/>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1011020"/>
+ <script src="/_mozilla/common/reftest-zoom.js"></script>
+ <!-- Default to invisible text -->
+ <style type="text/css" media="screen, print">
+ .hidden {
+ color: white;
+ }
+ .visible {
+ color: black;
+ }
+ </style>
+ </head>
+ <body>
+ <!-- Nest successive radicals and test that the horizontal bar of one of them is drawn.
+ Because the comparison is for inequality with about:blank, at most one can be visible -->
+ <math>
+ <mrow>
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="visible">
+ <mspace width="20em" height="1em" />
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </mrow>
+ </math>
+
+ <!-- Block out all but the horizontal bar of the visible radical -->
+ <div style="position: absolute; top: 5px; left: 0px;
+ width: 20em; height: 10em; background: white;"></div>
+
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-1d.html b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-1d.html
new file mode 100644
index 0000000000..91004d1acd
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-1d.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html reftest-zoom=".2">
+ <head>
+ <link rel="mismatch" href="about:blank"/>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1011020"/>
+ <script src="/_mozilla/common/reftest-zoom.js"></script>
+ <!-- Default to invisible text -->
+ <style type="text/css" media="screen, print">
+ .hidden {
+ color: white;
+ }
+ .visible {
+ color: black;
+ }
+ </style>
+ </head>
+ <body>
+ <!-- Nest successive radicals and test that the horizontal bar of one of them is drawn.
+ Because the comparison is for inequality with about:blank, at most one can be visible -->
+ <math>
+ <mrow>
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="visible">
+ <mspace width="20em" height="1em" />
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </mrow>
+ </math>
+
+ <!-- Block out all but the horizontal bar of the visible radical -->
+ <div style="position: absolute; top: 5px; left: 0px;
+ width: 20em; height: 10em; background: white;"></div>
+
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-2.html b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-2.html
new file mode 100644
index 0000000000..2b5df8e97b
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-2.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <link rel="mismatch" href="about:blank"/>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1011020"/>
+ <!-- Default to invisible text -->
+ <style type="text/css" media="screen, print">
+ .hidden {
+ color: white;
+ }
+ .visible {
+ color: black;
+ }
+ </style>
+ </head>
+ <body>
+ <!-- Nest successive radicals and test that the horizontal bar of one of them is drawn.
+ Because the comparison is for inequality with about:blank, at most one can be visible -->
+ <math>
+ <mrow>
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="visible">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="20em" height="1em" />
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </mrow>
+ </math>
+
+ <!-- Block out all but the horizontal bar of the visible radical -->
+ <div style="position: absolute; top: 5px; left: 0px;
+ width: 20em; height: 10em; background: white;"></div>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-2a.html b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-2a.html
new file mode 100644
index 0000000000..33368521ad
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-2a.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html reftest-zoom="0.5">
+ <head>
+ <link rel="mismatch" href="about:blank"/>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1011020"/>
+ <script src="/_mozilla/common/reftest-zoom.js"></script>
+ <!-- Default to invisible text -->
+ <style type="text/css" media="screen, print">
+ .hidden {
+ color: white;
+ }
+ .visible {
+ color: black;
+ }
+ </style>
+ </head>
+ <body>
+ <!-- Nest successive radicals and test that the horizontal bar of one of them is drawn.
+ Because the comparison is for inequality with about:blank, at most one can be visible -->
+ <math>
+ <mrow>
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="visible">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="20em" height="1em" />
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </mrow>
+ </math>
+
+ <!-- Block out all but the horizontal bar of the visible radical -->
+ <div style="position: absolute; top: 5px; left: 0px;
+ width: 20em; height: 10em; background: white;"></div>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-2b.html b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-2b.html
new file mode 100644
index 0000000000..b88f094c79
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-2b.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html reftest-zoom="0.4">
+ <head>
+ <link rel="mismatch" href="about:blank"/>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1011020"/>
+ <script src="/_mozilla/common/reftest-zoom.js"></script>
+ <!-- Default to invisible text -->
+ <style type="text/css" media="screen, print">
+ .hidden {
+ color: white;
+ }
+ .visible {
+ color: black;
+ }
+ </style>
+ </head>
+ <body>
+ <!-- Nest successive radicals and test that the horizontal bar of one of them is drawn.
+ Because the comparison is for inequality with about:blank, at most one can be visible -->
+ <math>
+ <mrow>
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="visible">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="20em" height="1em" />
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </mrow>
+ </math>
+
+ <!-- Block out all but the horizontal bar of the visible radical -->
+ <div style="position: absolute; top: 5px; left: 0px;
+ width: 20em; height: 10em; background: white;"></div>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-2c.html b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-2c.html
new file mode 100644
index 0000000000..b9c83c19a3
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-2c.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html reftest-zoom="0.3">
+ <head>
+ <link rel="mismatch" href="about:blank"/>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1011020"/>
+ <script src="/_mozilla/common/reftest-zoom.js"></script>
+ <!-- Default to invisible text -->
+ <style type="text/css" media="screen, print">
+ .hidden {
+ color: white;
+ }
+ .visible {
+ color: black;
+ }
+ </style>
+ </head>
+ <body>
+ <!-- Nest successive radicals and test that the horizontal bar of one of them is drawn.
+ Because the comparison is for inequality with about:blank, at most one can be visible -->
+ <math>
+ <mrow>
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="visible">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="20em" height="1em" />
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </mrow>
+ </math>
+
+ <!-- Block out all but the horizontal bar of the visible radical -->
+ <div style="position: absolute; top: 5px; left: 0px;
+ width: 20em; height: 10em; background: white;"></div>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-2d.html b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-2d.html
new file mode 100644
index 0000000000..836f12b4e9
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-2d.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html reftest-zoom="0.2">
+ <head>
+ <link rel="mismatch" href="about:blank"/>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1011020"/>
+ <script src="/_mozilla/common/reftest-zoom.js"></script>
+ <!-- Default to invisible text -->
+ <style type="text/css" media="screen, print">
+ .hidden {
+ color: white;
+ }
+ .visible {
+ color: black;
+ }
+ </style>
+ </head>
+ <body>
+ <!-- Nest successive radicals and test that the horizontal bar of one of them is drawn.
+ Because the comparison is for inequality with about:blank, at most one can be visible -->
+ <math>
+ <mrow>
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="visible">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="20em" height="1em" />
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </mrow>
+ </math>
+
+ <!-- Block out all but the horizontal bar of the visible radical -->
+ <div style="position: absolute; top: 5px; left: 0px;
+ width: 20em; height: 10em; background: white;"></div>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-3.html b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-3.html
new file mode 100644
index 0000000000..245a1d6b6b
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-3.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <link rel="mismatch" href="about:blank"/>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1011020"/>
+ <!-- Default to invisible text -->
+ <style type="text/css" media="screen, print">
+ .hidden {
+ color: white;
+ }
+ .visible {
+ color: black;
+ }
+ </style>
+ </head>
+ <body>
+ <!-- Nest successive radicals and test that the horizontal bar of one of them is drawn.
+ Because the comparison is for inequality with about:blank, at most one can be visible -->
+ <math>
+ <mrow>
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="visible">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="20em" height="1em" />
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </mrow>
+ </math>
+
+ <!-- Block out all but the horizontal bar of the visible radical -->
+ <div style="position: absolute; top: 5px; left: 0px;
+ width: 20em; height: 10em; background: white;"></div>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-3a.html b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-3a.html
new file mode 100644
index 0000000000..30017437e5
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-3a.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html reftest-zoom="0.5">
+ <head>
+ <link rel="mismatch" href="about:blank"/>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1011020"/>
+ <script src="/_mozilla/common/reftest-zoom.js"></script>
+ <!-- Default to invisible text -->
+ <style type="text/css" media="screen, print">
+ .hidden {
+ color: white;
+ }
+ .visible {
+ color: black;
+ }
+ </style>
+ </head>
+ <body>
+ <!-- Nest successive radicals and test that the horizontal bar of one of them is drawn.
+ Because the comparison is for inequality with about:blank, at most one can be visible -->
+ <math>
+ <mrow>
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="visible">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="20em" height="1em" />
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </mrow>
+ </math>
+
+ <!-- Block out all but the horizontal bar of the visible radical -->
+ <div style="position: absolute; top: 5px; left: 0px;
+ width: 20em; height: 10em; background: white;"></div>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-3b.html b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-3b.html
new file mode 100644
index 0000000000..2f6ac92624
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-3b.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html reftest-zoom="0.4">
+ <head>
+ <link rel="mismatch" href="about:blank"/>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1011020"/>
+ <script src="/_mozilla/common/reftest-zoom.js"></script>
+ <!-- Default to invisible text -->
+ <style type="text/css" media="screen, print">
+ .hidden {
+ color: white;
+ }
+ .visible {
+ color: black;
+ }
+ </style>
+ </head>
+ <body>
+ <!-- Nest successive radicals and test that the horizontal bar of one of them is drawn.
+ Because the comparison is for inequality with about:blank, at most one can be visible -->
+ <math>
+ <mrow>
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="visible">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="20em" height="1em" />
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </mrow>
+ </math>
+
+ <!-- Block out all but the horizontal bar of the visible radical -->
+ <div style="position: absolute; top: 5px; left: 0px;
+ width: 20em; height: 10em; background: white;"></div>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-3c.html b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-3c.html
new file mode 100644
index 0000000000..5886cfeb63
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-3c.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html reftest-zoom="0.3">
+ <head>
+ <link rel="mismatch" href="about:blank"/>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1011020"/>
+ <script src="/_mozilla/common/reftest-zoom.js"></script>
+ <!-- Default to invisible text -->
+ <style type="text/css" media="screen, print">
+ .hidden {
+ color: white;
+ }
+ .visible {
+ color: black;
+ }
+ </style>
+ </head>
+ <body>
+ <!-- Nest successive radicals and test that the horizontal bar of one of them is drawn.
+ Because the comparison is for inequality with about:blank, at most one can be visible -->
+ <math>
+ <mrow>
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="visible">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="20em" height="1em" />
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </mrow>
+ </math>
+
+ <!-- Block out all but the horizontal bar of the visible radical -->
+ <div style="position: absolute; top: 5px; left: 0px;
+ width: 20em; height: 10em; background: white;"></div>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-3d.html b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-3d.html
new file mode 100644
index 0000000000..2802cb343e
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/mathml/zoom/radicalbar-3d.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html reftest-zoom="0.2">
+ <head>
+ <link rel="mismatch" href="about:blank"/>
+ <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1011020"/>
+ <script src="/_mozilla/common/reftest-zoom.js"></script>
+ <!-- Default to invisible text -->
+ <style type="text/css" media="screen, print">
+ .hidden {
+ color: white;
+ }
+ .visible {
+ color: black;
+ }
+ </style>
+ </head>
+ <body>
+ <!-- Nest successive radicals and test that the horizontal bar of one of them is drawn.
+ Because the comparison is for inequality with about:blank, at most one can be visible -->
+ <math>
+ <mrow>
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="visible">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="1em" height="1em" />
+ <msqrt class="hidden">
+ <mspace width="20em" height="1em" />
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </msqrt>
+ </mrow>
+ </math>
+
+ <!-- Block out all but the horizontal bar of the visible radical -->
+ <div style="position: absolute; top: 5px; left: 0px;
+ width: 20em; height: 10em; background: white;"></div>
+ </body>
+</html>
diff --git a/testing/web-platform/mozilla/tests/webdriver/bidi/browsing_context/navigate/error.py b/testing/web-platform/mozilla/tests/webdriver/bidi/browsing_context/navigate/error.py
index 374359d1ae..ea76b13727 100644
--- a/testing/web-platform/mozilla/tests/webdriver/bidi/browsing_context/navigate/error.py
+++ b/testing/web-platform/mozilla/tests/webdriver/bidi/browsing_context/navigate/error.py
@@ -1,4 +1,3 @@
-import os
from copy import deepcopy
import pytest
@@ -7,13 +6,12 @@ from tests.bidi.browsing_context.navigate import navigate_and_assert
pytestmark = pytest.mark.asyncio
-async def test_insecure_certificate(configuration, url, custom_profile, geckodriver):
- try:
- # Create a new profile and remove the certificate storage so that
- # loading a HTTPS page will cause an insecure certificate error
- os.remove(os.path.join(custom_profile.profile, "cert9.db"))
- except Exception:
- pass
+async def test_insecure_certificate(
+ configuration, url, create_custom_profile, geckodriver
+):
+ # Create a fresh profile without any item in the certificate storage so that
+ # loading a HTTPS page will cause an insecure certificate error
+ custom_profile = create_custom_profile(clone=False)
config = deepcopy(configuration)
config["capabilities"]["moz:firefoxOptions"]["args"] = [
diff --git a/testing/web-platform/mozilla/tests/webdriver/bidi/storage/delete_cookies/__init__.py b/testing/web-platform/mozilla/tests/webdriver/bidi/storage/delete_cookies/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/webdriver/bidi/storage/delete_cookies/__init__.py
diff --git a/testing/web-platform/mozilla/tests/webdriver/bidi/storage/delete_cookies/partition.py b/testing/web-platform/mozilla/tests/webdriver/bidi/storage/delete_cookies/partition.py
new file mode 100644
index 0000000000..d8e2729fe2
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/webdriver/bidi/storage/delete_cookies/partition.py
@@ -0,0 +1,114 @@
+import pytest
+from tests.bidi import recursive_compare
+from tests.support.helpers import get_origin_from_url
+from webdriver.bidi.modules.network import NetworkStringValue
+from webdriver.bidi.modules.storage import (
+ BrowsingContextPartitionDescriptor,
+ PartialCookie,
+)
+
+pytestmark = pytest.mark.asyncio
+
+
+@pytest.mark.parametrize(
+ "with_document_cookie",
+ [True, False],
+ ids=["with document cookie", "with set cookie"],
+)
+async def test_partition_context(
+ bidi_session,
+ new_tab,
+ test_page,
+ domain_value,
+ add_cookie,
+ set_cookie,
+ with_document_cookie,
+):
+ await bidi_session.browsing_context.navigate(
+ context=new_tab["context"], url=test_page, wait="complete"
+ )
+
+ cookie_name = "foo"
+ cookie_value = "bar"
+ source_origin = get_origin_from_url(test_page)
+ partition = BrowsingContextPartitionDescriptor(new_tab["context"])
+ if with_document_cookie:
+ await add_cookie(new_tab["context"], cookie_name, cookie_value)
+ else:
+ await set_cookie(
+ cookie=PartialCookie(
+ domain=domain_value(),
+ name=cookie_name,
+ value=NetworkStringValue(cookie_value),
+ ),
+ partition=partition,
+ )
+
+ result = await bidi_session.storage.delete_cookies(partition=partition)
+ recursive_compare({"partitionKey": {"sourceOrigin": source_origin}}, result)
+
+ result = await bidi_session.storage.get_cookies(partition=partition)
+ assert result["cookies"] == []
+
+
+@pytest.mark.parametrize("domain", ["", "alt"], ids=["same_origin", "cross_origin"])
+async def test_partition_context_iframe_with_set_cookie(
+ bidi_session, new_tab, inline, domain_value, domain, set_cookie
+):
+ iframe_url = inline("<div id='in-iframe'>foo</div>", domain=domain)
+ page_url = inline(f"<iframe src='{iframe_url}'></iframe>")
+ await bidi_session.browsing_context.navigate(
+ context=new_tab["context"], url=page_url, wait="complete"
+ )
+ source_origin = get_origin_from_url(iframe_url)
+
+ contexts = await bidi_session.browsing_context.get_tree(root=new_tab["context"])
+ iframe_context = contexts[0]["children"][0]
+
+ cookie_name = "foo"
+ cookie_value = "bar"
+ frame_partition = BrowsingContextPartitionDescriptor(iframe_context["context"])
+ await set_cookie(
+ cookie=PartialCookie(
+ domain=domain_value(domain),
+ name=cookie_name,
+ value=NetworkStringValue(cookie_value),
+ ),
+ partition=frame_partition,
+ )
+
+ result = await bidi_session.storage.delete_cookies(partition=frame_partition)
+ recursive_compare({"partitionKey": {"sourceOrigin": source_origin}}, result)
+
+ result = await bidi_session.storage.get_cookies(partition=frame_partition)
+ assert result["cookies"] == []
+
+
+# Because of Dynamic First-Party Isolation, adding the cookie with `document.cookie`
+# works only with same-origin iframes.
+async def test_partition_context_same_origin_iframe_with_document_cookie(
+ bidi_session,
+ new_tab,
+ inline,
+ add_cookie,
+):
+ iframe_url = inline("<div id='in-iframe'>foo</div>")
+ page_url = inline(f"<iframe src='{iframe_url}'></iframe>")
+ await bidi_session.browsing_context.navigate(
+ context=new_tab["context"], url=page_url, wait="complete"
+ )
+ source_origin = get_origin_from_url(iframe_url)
+
+ contexts = await bidi_session.browsing_context.get_tree(root=new_tab["context"])
+ iframe_context = contexts[0]["children"][0]
+
+ cookie_name = "foo"
+ cookie_value = "bar"
+ frame_partition = BrowsingContextPartitionDescriptor(iframe_context["context"])
+ await add_cookie(iframe_context["context"], cookie_name, cookie_value)
+
+ result = await bidi_session.storage.delete_cookies(partition=frame_partition)
+ recursive_compare({"partitionKey": {"sourceOrigin": source_origin}}, result)
+
+ result = await bidi_session.storage.get_cookies(partition=frame_partition)
+ assert result["cookies"] == []
diff --git a/testing/web-platform/mozilla/tests/webdriver/bidi/storage/get_cookies/partition.py b/testing/web-platform/mozilla/tests/webdriver/bidi/storage/get_cookies/partition.py
index b037c30038..5503f13224 100644
--- a/testing/web-platform/mozilla/tests/webdriver/bidi/storage/get_cookies/partition.py
+++ b/testing/web-platform/mozilla/tests/webdriver/bidi/storage/get_cookies/partition.py
@@ -59,18 +59,22 @@ async def test_partition_context(
)
recursive_compare(
- {"cookies": [], "partitionKey": {"sourceOrigin": source_origin_2}}, cookies
+ {
+ "cookies": [],
+ "partitionKey": {"sourceOrigin": source_origin_2, "userContext": "default"},
+ },
+ cookies,
)
-@pytest.mark.parametrize("domain", ["", "alt"], ids=["same_origin", "cross_origin"])
-async def test_partition_context_iframe(
- bidi_session, new_tab, inline, domain_value, domain, add_cookie
+# Because of Dynamic First-Party Isolation, adding the cookie with `document.cookie`
+# works only with same-origin iframes.
+async def test_partition_context_same_origin_iframe(
+ bidi_session, new_tab, inline, domain_value, add_cookie
):
- iframe_url = inline("<div id='in-iframe'>foo</div>", domain=domain)
- source_origin_for_iframe = get_origin_from_url(iframe_url)
+ iframe_url = inline("<div id='in-iframe'>foo</div>")
+ source_origin = get_origin_from_url(iframe_url)
page_url = inline(f"<iframe src='{iframe_url}'></iframe>")
- source_origin_for_page = get_origin_from_url(page_url)
await bidi_session.browsing_context.navigate(
context=new_tab["context"], url=page_url, wait="complete"
)
@@ -89,7 +93,7 @@ async def test_partition_context_iframe(
expected_cookies = [
{
- "domain": domain_value(domain=domain),
+ "domain": domain_value(),
"httpOnly": False,
"name": cookie_name,
"path": "/webdriver/tests/support",
@@ -99,10 +103,11 @@ async def test_partition_context_iframe(
"value": {"type": "string", "value": cookie_value},
}
]
+
recursive_compare(
{
"cookies": expected_cookies,
- "partitionKey": {"sourceOrigin": source_origin_for_iframe},
+ "partitionKey": {"sourceOrigin": source_origin},
},
cookies,
)
@@ -110,22 +115,16 @@ async def test_partition_context_iframe(
cookies = await bidi_session.storage.get_cookies(
partition=BrowsingContextPartitionDescriptor(new_tab["context"])
)
- # When the iframe is on the different domain we can verify that top context has no iframe cookie.
- if domain == "alt":
- recursive_compare(
- {
- "cookies": [],
- "partitionKey": {"sourceOrigin": source_origin_for_page},
- },
- cookies,
- )
- else:
- # When the iframe is on the same domain, since the browsing context partition is defined by user context and origin,
- # which will be the same for the page, we get the same cookies as for the iframe
- recursive_compare(
- {
- "cookies": expected_cookies,
- "partitionKey": {"sourceOrigin": source_origin_for_page},
+
+ # When the iframe is on the same domain, since the browsing context partition is defined by user context and origin,
+ # which will be the same for the page, we get the same cookies as for the iframe.
+ recursive_compare(
+ {
+ "cookies": expected_cookies,
+ "partitionKey": {
+ "sourceOrigin": source_origin,
+ "userContext": "default",
},
- cookies,
- )
+ },
+ cookies,
+ )
diff --git a/testing/web-platform/mozilla/tests/webdriver/bidi/storage/set_cookie/partition.py b/testing/web-platform/mozilla/tests/webdriver/bidi/storage/set_cookie/partition.py
index f8e2823dbc..a9b5d3a43a 100644
--- a/testing/web-platform/mozilla/tests/webdriver/bidi/storage/set_cookie/partition.py
+++ b/testing/web-platform/mozilla/tests/webdriver/bidi/storage/set_cookie/partition.py
@@ -42,7 +42,9 @@ async def test_partition_context(
partition=new_tab_partition,
)
- assert set_cookie_result == {"partitionKey": {"sourceOrigin": source_origin_1}}
+ assert set_cookie_result == {
+ "partitionKey": {"sourceOrigin": source_origin_1, "userContext": "default"}
+ }
# Check that added cookies are present on the right context.
cookies = await bidi_session.storage.get_cookies(partition=new_tab_partition)
@@ -72,7 +74,11 @@ async def test_partition_context(
)
recursive_compare(
- {"cookies": [], "partitionKey": {"sourceOrigin": source_origin_2}}, cookies
+ {
+ "cookies": [],
+ "partitionKey": {"sourceOrigin": source_origin_2, "userContext": "default"},
+ },
+ cookies,
)
@@ -121,7 +127,10 @@ async def test_partition_context_iframe(
recursive_compare(
{
"cookies": expected_cookies,
- "partitionKey": {"sourceOrigin": source_origin_for_iframe},
+ "partitionKey": {
+ "sourceOrigin": source_origin_for_iframe,
+ "userContext": "default",
+ },
},
cookies,
)
@@ -134,7 +143,10 @@ async def test_partition_context_iframe(
recursive_compare(
{
"cookies": [],
- "partitionKey": {"sourceOrigin": source_origin_for_page},
+ "partitionKey": {
+ "sourceOrigin": source_origin_for_page,
+ "userContext": "default",
+ },
},
cookies,
)
@@ -144,7 +156,10 @@ async def test_partition_context_iframe(
recursive_compare(
{
"cookies": expected_cookies,
- "partitionKey": {"sourceOrigin": source_origin_for_page},
+ "partitionKey": {
+ "sourceOrigin": source_origin_for_page,
+ "userContext": "default",
+ },
},
cookies,
)
diff --git a/testing/web-platform/mozilla/tests/webdriver/cdp/port_file.py b/testing/web-platform/mozilla/tests/webdriver/cdp/port_file.py
index aa294deb24..23c31906fa 100644
--- a/testing/web-platform/mozilla/tests/webdriver/cdp/port_file.py
+++ b/testing/web-platform/mozilla/tests/webdriver/cdp/port_file.py
@@ -4,7 +4,7 @@ from support.network import websocket_request
def test_devtools_active_port_file(browser):
- current_browser = browser(use_cdp=True)
+ current_browser = browser(use_cdp=True, clone_profile=False)
assert current_browser.remote_agent_port != 0
assert current_browser.debugger_address.startswith("/devtools/browser/")
@@ -12,9 +12,6 @@ def test_devtools_active_port_file(browser):
port_file = os.path.join(current_browser.profile.profile, "DevToolsActivePort")
assert os.path.exists(port_file)
- current_browser.quit(clean_profile=False)
- assert not os.path.exists(port_file)
-
def test_connect(browser):
current_browser = browser(use_cdp=True)
diff --git a/testing/web-platform/mozilla/tests/webdriver/classic/new_session/conftest.py b/testing/web-platform/mozilla/tests/webdriver/classic/new_session/conftest.py
index 1cab6784c2..63abd19f6a 100644
--- a/testing/web-platform/mozilla/tests/webdriver/classic/new_session/conftest.py
+++ b/testing/web-platform/mozilla/tests/webdriver/classic/new_session/conftest.py
@@ -2,7 +2,7 @@ import pytest
from webdriver.transport import HTTPWireProtocol
-@pytest.fixture(name="configuration")
+@pytest.fixture(name="configuration", scope="session")
def fixture_configuration(configuration):
"""Remove "acceptInsecureCerts" from capabilities if it exists.
diff --git a/testing/web-platform/mozilla/tests/webdriver/classic/new_session/profile_root.py b/testing/web-platform/mozilla/tests/webdriver/classic/new_session/profile_root.py
index fc3607bed9..97cb835e2c 100644
--- a/testing/web-platform/mozilla/tests/webdriver/classic/new_session/profile_root.py
+++ b/testing/web-platform/mozilla/tests/webdriver/classic/new_session/profile_root.py
@@ -4,7 +4,7 @@ import os
import pytest
-def test_profile_root(tmp_path, configuration, geckodriver, user_prefs):
+def test_profile_root(tmp_path, configuration, geckodriver, default_preferences):
profile_path = os.path.join(tmp_path, "geckodriver-test")
os.makedirs(profile_path)
@@ -12,7 +12,7 @@ def test_profile_root(tmp_path, configuration, geckodriver, user_prefs):
# Pass all the wpt preferences from the default profile's user.js via
# capabilities to allow geckodriver to create a new valid profile itself.
- config["capabilities"]["moz:firefoxOptions"]["prefs"] = user_prefs
+ config["capabilities"]["moz:firefoxOptions"]["prefs"] = default_preferences
# Ensure we don't set a profile in command line arguments
del config["capabilities"]["moz:firefoxOptions"]["args"]
diff --git a/testing/web-platform/mozilla/tests/webdriver/classic/protocol/marionette_port.py b/testing/web-platform/mozilla/tests/webdriver/classic/protocol/marionette_port.py
index 09951abc43..20b4e03324 100644
--- a/testing/web-platform/mozilla/tests/webdriver/classic/protocol/marionette_port.py
+++ b/testing/web-platform/mozilla/tests/webdriver/classic/protocol/marionette_port.py
@@ -14,9 +14,10 @@ def test_marionette_port(geckodriver, port):
def test_marionette_port_outdated_active_port_file(
- configuration, geckodriver, custom_profile
+ configuration, create_custom_profile, geckodriver
):
config = deepcopy(configuration)
+ custom_profile = create_custom_profile()
extra_args = ["--marionette-port", "0"]
# Prepare a Marionette active port file that contains a port which will
diff --git a/testing/web-platform/mozilla/tests/webdriver/harness/preferences.py b/testing/web-platform/mozilla/tests/webdriver/harness/preferences_marionette.py
index b5cf36bd5e..e5d18aeb6b 100644
--- a/testing/web-platform/mozilla/tests/webdriver/harness/preferences.py
+++ b/testing/web-platform/mozilla/tests/webdriver/harness/preferences_marionette.py
@@ -2,5 +2,5 @@ from support.fixtures import get_pref
def test_recommended_preferences(session):
- has_recommended_prefs = get_pref(session, "remote.prefs.recommended")
+ has_recommended_prefs = get_pref(session, "remote.prefs.recommended.applied")
assert has_recommended_prefs is True
diff --git a/testing/web-platform/mozilla/tests/webdriver/harness/preferences_remote_agent.py b/testing/web-platform/mozilla/tests/webdriver/harness/preferences_remote_agent.py
new file mode 100644
index 0000000000..59db5fa0e3
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/webdriver/harness/preferences_remote_agent.py
@@ -0,0 +1,37 @@
+import pytest
+from support.helpers import read_user_preferences
+from tests.support.sync import Poll
+
+
+@pytest.mark.parametrize(
+ "value",
+ [
+ {"pref_value": 1, "use_cdp": False, "use_bidi": True},
+ {"pref_value": 2, "use_cdp": True, "use_bidi": False},
+ {"pref_value": 3, "use_cdp": True, "use_bidi": True},
+ ],
+ ids=["bidi only", "cdp only", "bidi and cdp"],
+)
+def test_remote_agent_recommended_preferences_applied(browser, value):
+ # Marionette cannot be enabled for this test because it will also set the
+ # recommended preferences. Therefore only enable Remote Agent protocols.
+ current_browser = browser(
+ extra_prefs={
+ "remote.active-protocols": value["pref_value"],
+ },
+ use_cdp=value["use_cdp"],
+ use_bidi=value["use_bidi"],
+ )
+
+ def pref_is_set(_):
+ preferences = read_user_preferences(current_browser.profile.profile, "prefs.js")
+ return preferences.get("remote.prefs.recommended.applied", False)
+
+ # Without Marionette enabled preferences cannot be retrieved via script evaluation yet.
+ wait = Poll(
+ None,
+ timeout=5,
+ ignored_exceptions=FileNotFoundError,
+ message="""Preference "remote.prefs.recommended.applied" is not true""",
+ )
+ wait.until(pref_is_set)
diff --git a/testing/web-platform/mozilla/tests/webdriver/support/fixtures.py b/testing/web-platform/mozilla/tests/webdriver/support/fixtures.py
index e9dbf1cdfe..b788d874e5 100644
--- a/testing/web-platform/mozilla/tests/webdriver/support/fixtures.py
+++ b/testing/web-platform/mozilla/tests/webdriver/support/fixtures.py
@@ -1,40 +1,18 @@
-import argparse
-import json
-import os
-import re
-import socket
-import subprocess
-import threading
-import time
-from contextlib import suppress
-from urllib.parse import urlparse
-
import pytest
-import webdriver
-from mozprofile import Preferences, Profile
-from mozrunner import FirefoxRunner
-
-from .context import using_context
-
-
-def get_arg_value(arg_names, args):
- """Get an argument value from a list of arguments
- This assumes that argparse argument parsing is close enough to the target
- to be compatible, at least with the set of inputs we have.
-
- :param arg_names: - List of names for the argument e.g. ["--foo", "-f"]
- :param args: - List of arguments to parse
- :returns: - Optional string argument value
- """
- parser = argparse.ArgumentParser()
- parser.add_argument(*arg_names, action="store", dest="value", default=None)
- parsed, _ = parser.parse_known_args(args)
- return parsed.value
+from .helpers import (
+ Browser,
+ Geckodriver,
+ create_custom_profile,
+ get_pref,
+ get_profile_folder,
+ read_user_preferences,
+ set_pref,
+)
@pytest.fixture(scope="module")
-def browser(full_configuration):
+def browser(configuration, firefox_options):
"""Start a Firefox instance without using geckodriver.
geckodriver will automatically use the --remote-allow-hosts and
@@ -46,7 +24,13 @@ def browser(full_configuration):
"""
current_browser = None
- def _browser(use_bidi=False, use_cdp=False, extra_args=None, extra_prefs=None):
+ def _browser(
+ use_bidi=False,
+ use_cdp=False,
+ extra_args=None,
+ extra_prefs=None,
+ clone_profile=True,
+ ):
nonlocal current_browser
# If the requested preferences and arguments match the ones for the
@@ -66,12 +50,18 @@ def browser(full_configuration):
# to create a new instance for the provided preferences.
current_browser.quit()
- binary = full_configuration["browser"]["binary"]
- env = full_configuration["browser"]["env"]
- firefox_options = full_configuration["capabilities"]["moz:firefoxOptions"]
+ binary = configuration["browser"]["binary"]
+ env = configuration["browser"]["env"]
+
+ profile_path = get_profile_folder(firefox_options)
+ default_prefs = read_user_preferences(profile_path)
+ profile = create_custom_profile(
+ profile_path, default_prefs, clone=clone_profile
+ )
+
current_browser = Browser(
binary,
- firefox_options,
+ profile,
use_bidi=use_bidi,
use_cdp=use_cdp,
extra_args=extra_args,
@@ -89,20 +79,32 @@ def browser(full_configuration):
current_browser = None
-@pytest.fixture
-def profile_folder(configuration):
- firefox_options = configuration["capabilities"]["moz:firefoxOptions"]
- return get_arg_value(["--profile"], firefox_options["args"])
+@pytest.fixture(name="create_custom_profile")
+def fixture_create_custom_profile(default_preferences, profile_folder):
+ profile = None
+
+ def _create_custom_profile(clone=True):
+ profile = create_custom_profile(
+ profile_folder, default_preferences, clone=clone
+ )
+
+ return profile
+
+ yield _create_custom_profile
+
+ # if profile is not None:
+ if profile:
+ profile.cleanup()
@pytest.fixture
-def custom_profile(profile_folder):
- # Clone the known profile for automation preferences
- profile = Profile.clone(profile_folder)
+def default_preferences(profile_folder):
+ return read_user_preferences(profile_folder)
- yield profile
- profile.cleanup()
+@pytest.fixture(scope="session")
+def firefox_options(configuration):
+ return configuration["capabilities"]["moz:firefoxOptions"]
@pytest.fixture
@@ -128,277 +130,8 @@ def geckodriver(configuration):
@pytest.fixture
-def user_prefs(profile_folder):
- user_js = os.path.join(profile_folder, "user.js")
-
- prefs = {}
- for pref_name, pref_value in Preferences().read_prefs(user_js):
- prefs[pref_name] = pref_value
-
- return prefs
-
-
-class Browser:
- def __init__(
- self,
- binary,
- firefox_options,
- use_bidi=False,
- use_cdp=False,
- extra_args=None,
- extra_prefs=None,
- env=None,
- ):
- self.use_bidi = use_bidi
- self.bidi_port_file = None
- self.use_cdp = use_cdp
- self.cdp_port_file = None
- self.extra_args = extra_args
- self.extra_prefs = extra_prefs
-
- self.debugger_address = None
- self.remote_agent_host = None
- self.remote_agent_port = None
-
- # Prepare temporary profile
- _profile_arg, profile_folder = firefox_options["args"]
- self.profile = Profile.clone(profile_folder)
- if self.extra_prefs is not None:
- self.profile.set_preferences(self.extra_prefs)
-
- if use_cdp:
- self.cdp_port_file = os.path.join(
- self.profile.profile, "DevToolsActivePort"
- )
- with suppress(FileNotFoundError):
- os.remove(self.cdp_port_file)
- if use_bidi:
- self.webdriver_bidi_file = os.path.join(
- self.profile.profile, "WebDriverBiDiServer.json"
- )
- with suppress(FileNotFoundError):
- os.remove(self.webdriver_bidi_file)
-
- cmdargs = ["-no-remote"]
- if self.use_bidi or self.use_cdp:
- cmdargs.extend(["--remote-debugging-port", "0"])
- if self.extra_args is not None:
- cmdargs.extend(self.extra_args)
- self.runner = FirefoxRunner(
- binary=binary, profile=self.profile, cmdargs=cmdargs, env=env
- )
-
- @property
- def is_running(self):
- return self.runner.is_running()
-
- def start(self):
- # Start Firefox.
- self.runner.start()
-
- if self.use_bidi:
- # Wait until the WebDriverBiDiServer.json file is ready
- while not os.path.exists(self.webdriver_bidi_file):
- time.sleep(0.1)
-
- # Read the connection details from file
- data = json.loads(open(self.webdriver_bidi_file).read())
- self.remote_agent_host = data["ws_host"]
- self.remote_agent_port = int(data["ws_port"])
-
- if self.use_cdp:
- # Wait until the DevToolsActivePort file is ready
- while not os.path.exists(self.cdp_port_file):
- time.sleep(0.1)
-
- # Read the port if needed and the debugger address from the
- # DevToolsActivePort file
- lines = open(self.cdp_port_file).readlines()
- assert len(lines) == 2
-
- if self.remote_agent_port is None:
- self.remote_agent_port = int(lines[0].strip())
- self.debugger_address = lines[1].strip()
-
- def quit(self, clean_profile=True):
- if self.is_running:
- self.runner.stop()
- self.runner.cleanup()
-
- if clean_profile:
- self.profile.cleanup()
-
- def wait(self):
- if self.is_running is True:
- self.runner.wait()
-
-
-class Geckodriver:
- PORT_RE = re.compile(b".*Listening on [^ :]*:(\d+)")
-
- def __init__(self, configuration, hostname=None, extra_args=None):
- self.config = configuration["webdriver"]
- self.requested_capabilities = configuration["capabilities"]
- self.hostname = hostname or configuration["host"]
- self.extra_args = extra_args or []
- self.env = configuration["browser"]["env"]
-
- self.command = None
- self.proc = None
- self.port = None
- self.reader_thread = None
-
- self.capabilities = {"alwaysMatch": self.requested_capabilities}
- self.session = None
-
- @property
- def remote_agent_port(self):
- webSocketUrl = self.session.capabilities.get("webSocketUrl")
- assert webSocketUrl is not None
-
- return urlparse(webSocketUrl).port
-
- def start(self):
- self.command = (
- [self.config["binary"], "--port", "0"]
- + self.config["args"]
- + self.extra_args
- )
-
- print(f"Running command: {' '.join(self.command)}")
- self.proc = subprocess.Popen(self.command, env=self.env, stdout=subprocess.PIPE)
-
- self.reader_thread = threading.Thread(
- target=readOutputLine,
- args=(self.proc.stdout, self.processOutputLine),
- daemon=True,
- )
- self.reader_thread.start()
- # Wait for the port to become ready
- end_time = time.time() + 10
- while time.time() < end_time:
- returncode = self.proc.poll()
- if returncode is not None:
- raise ChildProcessError(
- f"geckodriver terminated with code {returncode}"
- )
- if self.port is not None:
- with socket.socket() as sock:
- if sock.connect_ex((self.hostname, self.port)) == 0:
- break
- else:
- time.sleep(0.1)
- else:
- if self.port is None:
- raise OSError(
- f"Failed to read geckodriver port started on {self.hostname}"
- )
- raise ConnectionRefusedError(
- f"Failed to connect to geckodriver on {self.hostname}:{self.port}"
- )
-
- self.session = webdriver.Session(
- self.hostname, self.port, capabilities=self.capabilities
- )
-
- return self
-
- def processOutputLine(self, line):
- if self.port is None:
- m = self.PORT_RE.match(line)
- if m is not None:
- self.port = int(m.groups()[0])
-
- def stop(self):
- if self.session is not None:
- self.delete_session()
- if self.proc:
- self.proc.kill()
- self.port = None
- if self.reader_thread is not None:
- self.reader_thread.join()
-
- def new_session(self):
- self.session.start()
-
- def delete_session(self):
- self.session.end()
-
-
-def readOutputLine(stream, callback):
- while True:
- line = stream.readline()
- if not line:
- break
-
- callback(line)
-
-
-def clear_pref(session, pref):
- """Clear the user-defined value from the specified preference.
-
- :param pref: Name of the preference.
- """
- with using_context(session, "chrome"):
- session.execute_script(
- """
- const { Preferences } = ChromeUtils.importESModule(
- "resource://gre/modules/Preferences.sys.mjs"
- );
- Preferences.reset(arguments[0]);
- """,
- args=(pref,),
- )
-
-
-def get_pref(session, pref):
- """Get the value of the specified preference.
-
- :param pref: Name of the preference.
- """
- with using_context(session, "chrome"):
- pref_value = session.execute_script(
- """
- const { Preferences } = ChromeUtils.importESModule(
- "resource://gre/modules/Preferences.sys.mjs"
- );
-
- let pref = arguments[0];
-
- prefs = new Preferences();
- return prefs.get(pref, null);
- """,
- args=(pref,),
- )
- return pref_value
-
-
-def set_pref(session, pref, value):
- """Set the value of the specified preference.
-
- :param pref: Name of the preference.
- :param value: The value to set the preference to. If the value is None,
- reset the preference to its default value. If no default
- value exists, the preference will cease to exist.
- """
- if value is None:
- clear_pref(session, pref)
- return
-
- with using_context(session, "chrome"):
- session.execute_script(
- """
- const { Preferences } = ChromeUtils.importESModule(
- "resource://gre/modules/Preferences.sys.mjs"
- );
-
- const [pref, value] = arguments;
-
- prefs = new Preferences();
- prefs.set(pref, value);
- """,
- args=(pref, value),
- )
+def profile_folder(firefox_options):
+ return get_profile_folder(firefox_options)
@pytest.fixture
diff --git a/testing/web-platform/mozilla/tests/webdriver/support/helpers.py b/testing/web-platform/mozilla/tests/webdriver/support/helpers.py
new file mode 100644
index 0000000000..6577289983
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/webdriver/support/helpers.py
@@ -0,0 +1,324 @@
+import argparse
+import json
+import os
+import re
+import socket
+import subprocess
+import tempfile
+import threading
+import time
+from contextlib import suppress
+from urllib.parse import urlparse
+
+import webdriver
+from mozprofile import Preferences, Profile
+from mozrunner import FirefoxRunner
+
+from .context import using_context
+
+
+class Browser:
+ def __init__(
+ self,
+ binary,
+ profile,
+ use_bidi=False,
+ use_cdp=False,
+ extra_args=None,
+ extra_prefs=None,
+ env=None,
+ ):
+ self.profile = profile
+ self.use_bidi = use_bidi
+ self.bidi_port_file = None
+ self.use_cdp = use_cdp
+ self.cdp_port_file = None
+ self.extra_args = extra_args
+ self.extra_prefs = extra_prefs
+
+ self.debugger_address = None
+ self.remote_agent_host = None
+ self.remote_agent_port = None
+
+ if self.extra_prefs is not None:
+ self.profile.set_preferences(self.extra_prefs)
+
+ if use_cdp:
+ self.cdp_port_file = os.path.join(
+ self.profile.profile, "DevToolsActivePort"
+ )
+ with suppress(FileNotFoundError):
+ os.remove(self.cdp_port_file)
+
+ if use_bidi:
+ self.webdriver_bidi_file = os.path.join(
+ self.profile.profile, "WebDriverBiDiServer.json"
+ )
+ with suppress(FileNotFoundError):
+ os.remove(self.webdriver_bidi_file)
+
+ cmdargs = ["-no-remote"]
+ if self.use_bidi or self.use_cdp:
+ cmdargs.extend(["--remote-debugging-port", "0"])
+ if self.extra_args is not None:
+ cmdargs.extend(self.extra_args)
+ self.runner = FirefoxRunner(
+ binary=binary, profile=self.profile, cmdargs=cmdargs, env=env
+ )
+
+ @property
+ def is_running(self):
+ return self.runner.is_running()
+
+ def start(self):
+ # Start Firefox.
+ self.runner.start()
+
+ if self.use_bidi:
+ # Wait until the WebDriverBiDiServer.json file is ready
+ while not os.path.exists(self.webdriver_bidi_file):
+ time.sleep(0.1)
+
+ # Read the connection details from file
+ data = json.loads(open(self.webdriver_bidi_file).read())
+ self.remote_agent_host = data["ws_host"]
+ self.remote_agent_port = int(data["ws_port"])
+
+ if self.use_cdp:
+ # Wait until the DevToolsActivePort file is ready
+ while not os.path.exists(self.cdp_port_file):
+ time.sleep(0.1)
+
+ # Read the port if needed and the debugger address from the
+ # DevToolsActivePort file
+ lines = open(self.cdp_port_file).readlines()
+ assert len(lines) == 2
+
+ if self.remote_agent_port is None:
+ self.remote_agent_port = int(lines[0].strip())
+ self.debugger_address = lines[1].strip()
+
+ def quit(self, clean_profile=True):
+ if self.is_running:
+ self.runner.stop()
+ self.runner.cleanup()
+
+ if clean_profile:
+ self.profile.cleanup()
+
+ def wait(self):
+ if self.is_running is True:
+ self.runner.wait()
+
+
+class Geckodriver:
+ PORT_RE = re.compile(rb".*Listening on [^ :]*:(\d+)")
+
+ def __init__(self, configuration, hostname=None, extra_args=None):
+ self.config = configuration["webdriver"]
+ self.requested_capabilities = configuration["capabilities"]
+ self.hostname = hostname or configuration["host"]
+ self.extra_args = extra_args or []
+ self.env = configuration["browser"]["env"]
+
+ self.command = None
+ self.proc = None
+ self.port = None
+ self.reader_thread = None
+
+ self.capabilities = {"alwaysMatch": self.requested_capabilities}
+ self.session = None
+
+ @property
+ def remote_agent_port(self):
+ webSocketUrl = self.session.capabilities.get("webSocketUrl")
+ assert webSocketUrl is not None
+
+ return urlparse(webSocketUrl).port
+
+ def start(self):
+ self.command = (
+ [self.config["binary"], "--port", "0"]
+ + self.config["args"]
+ + self.extra_args
+ )
+
+ print(f"Running command: {' '.join(self.command)}")
+ self.proc = subprocess.Popen(self.command, env=self.env, stdout=subprocess.PIPE)
+
+ self.reader_thread = threading.Thread(
+ target=readOutputLine,
+ args=(self.proc.stdout, self.processOutputLine),
+ daemon=True,
+ )
+ self.reader_thread.start()
+ # Wait for the port to become ready
+ end_time = time.time() + 10
+ while time.time() < end_time:
+ returncode = self.proc.poll()
+ if returncode is not None:
+ raise ChildProcessError(
+ f"geckodriver terminated with code {returncode}"
+ )
+ if self.port is not None:
+ with socket.socket() as sock:
+ if sock.connect_ex((self.hostname, self.port)) == 0:
+ break
+ else:
+ time.sleep(0.1)
+ else:
+ if self.port is None:
+ raise OSError(
+ f"Failed to read geckodriver port started on {self.hostname}"
+ )
+ raise ConnectionRefusedError(
+ f"Failed to connect to geckodriver on {self.hostname}:{self.port}"
+ )
+
+ self.session = webdriver.Session(
+ self.hostname, self.port, capabilities=self.capabilities
+ )
+
+ return self
+
+ def processOutputLine(self, line):
+ if self.port is None:
+ m = self.PORT_RE.match(line)
+ if m is not None:
+ self.port = int(m.groups()[0])
+
+ def stop(self):
+ if self.session is not None:
+ self.delete_session()
+ if self.proc:
+ self.proc.kill()
+ self.port = None
+ if self.reader_thread is not None:
+ self.reader_thread.join()
+
+ def new_session(self):
+ self.session.start()
+
+ def delete_session(self):
+ self.session.end()
+
+
+def clear_pref(session, pref):
+ """Clear the user-defined value from the specified preference.
+
+ :param pref: Name of the preference.
+ """
+ with using_context(session, "chrome"):
+ session.execute_script(
+ """
+ const { Preferences } = ChromeUtils.importESModule(
+ "resource://gre/modules/Preferences.sys.mjs"
+ );
+ Preferences.reset(arguments[0]);
+ """,
+ args=(pref,),
+ )
+
+
+def create_custom_profile(base_profile, default_preferences, clone=True):
+ if clone:
+ # Clone the current profile and remove the prefs.js file to only
+ # keep default preferences as set in user.js.
+ profile = Profile.clone(base_profile)
+ prefs_path = os.path.join(profile.profile, "prefs.js")
+ if os.path.exists(prefs_path):
+ os.remove(prefs_path)
+ else:
+ profile = Profile(tempfile.mkdtemp(prefix="wdspec-"))
+ profile.set_preferences(default_preferences)
+
+ return profile
+
+
+def get_arg_value(arg_names, args):
+ """Get an argument value from a list of arguments
+
+ This assumes that argparse argument parsing is close enough to the target
+ to be compatible, at least with the set of inputs we have.
+
+ :param arg_names: - List of names for the argument e.g. ["--foo", "-f"]
+ :param args: - List of arguments to parse
+ :returns: - Optional string argument value
+ """
+ parser = argparse.ArgumentParser()
+ parser.add_argument(*arg_names, action="store", dest="value", default=None)
+ parsed, _ = parser.parse_known_args(args)
+ return parsed.value
+
+
+def get_pref(session, pref):
+ """Get the value of the specified preference.
+
+ :param pref: Name of the preference.
+ """
+ with using_context(session, "chrome"):
+ pref_value = session.execute_script(
+ """
+ const { Preferences } = ChromeUtils.importESModule(
+ "resource://gre/modules/Preferences.sys.mjs"
+ );
+
+ let pref = arguments[0];
+
+ prefs = new Preferences();
+ return prefs.get(pref, null);
+ """,
+ args=(pref,),
+ )
+ return pref_value
+
+
+def get_profile_folder(firefox_options):
+ return get_arg_value(["--profile"], firefox_options["args"])
+
+
+def readOutputLine(stream, callback):
+ while True:
+ line = stream.readline()
+ if not line:
+ break
+
+ callback(line)
+
+
+def read_user_preferences(profile_path, filename="user.js"):
+ prefs_file = os.path.join(profile_path, filename)
+
+ prefs = {}
+ for pref_name, pref_value in Preferences().read_prefs(prefs_file):
+ prefs[pref_name] = pref_value
+
+ return prefs
+
+
+def set_pref(session, pref, value):
+ """Set the value of the specified preference.
+
+ :param pref: Name of the preference.
+ :param value: The value to set the preference to. If the value is None,
+ reset the preference to its default value. If no default
+ value exists, the preference will cease to exist.
+ """
+ if value is None:
+ clear_pref(session, pref)
+ return
+
+ with using_context(session, "chrome"):
+ session.execute_script(
+ """
+ const { Preferences } = ChromeUtils.importESModule(
+ "resource://gre/modules/Preferences.sys.mjs"
+ );
+
+ const [pref, value] = arguments;
+
+ prefs = new Preferences();
+ prefs.set(pref, value);
+ """,
+ args=(pref, value),
+ )