summaryrefslogtreecommitdiffstats
path: root/testing/mochitest
diff options
context:
space:
mode:
Diffstat (limited to 'testing/mochitest')
-rw-r--r--testing/mochitest/BrowserTestUtils/BrowserTestUtils.sys.mjs10
-rw-r--r--testing/mochitest/shutdown-leaks-collector.js2
-rw-r--r--testing/mochitest/tests/Harness_sanity/xpcshell.toml2
-rw-r--r--testing/mochitest/tests/SimpleTest/AccessibilityUtils.js27
-rw-r--r--testing/mochitest/tests/SimpleTest/EventUtils.js4
5 files changed, 32 insertions, 13 deletions
diff --git a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.sys.mjs b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.sys.mjs
index 1793a6646f..463be20cec 100644
--- a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.sys.mjs
+++ b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.sys.mjs
@@ -745,7 +745,7 @@ export var BrowserTestUtils = {
* @resolves With the {xul:tab} when a tab is opened and its location changes
* to the given URL and optionally that browser has loaded.
*
- * NB: this method will not work if you open a new tab with e.g. BrowserOpenTab
+ * NB: this method will not work if you open a new tab with e.g. BrowserCommands.openTab
* and the tab does not load a URL, because no onLocationChange will fire.
*/
waitForNewTab(
@@ -1737,7 +1737,7 @@ export var BrowserTestUtils = {
},
/**
- * Versions of EventUtils.jsm synthesizeMouse functions that synthesize a
+ * Versions of EventUtils.sys.mjs synthesizeMouse functions that synthesize a
* mouse event in a child process and return promises that resolve when the
* event has fired and completed. Instead of a window, a browser or
* browsing context is required to be passed to this function.
@@ -1754,7 +1754,7 @@ export var BrowserTestUtils = {
* @param {integer} offsetY
* y offset from target's top bounding edge
* @param {Object} event object
- * Additional arguments, similar to the EventUtils.jsm version
+ * Additional arguments, similar to the EventUtils.sys.mjs version
* @param {BrowserContext|MozFrameLoaderOwner} browsingContext
* Browsing context or browser element, must not be null
* @param {boolean} handlingUserInput
@@ -1792,7 +1792,7 @@ export var BrowserTestUtils = {
},
/**
- * Versions of EventUtils.jsm synthesizeTouch functions that synthesize a
+ * Versions of EventUtils.sys.mjs synthesizeTouch functions that synthesize a
* touch event in a child process and return promises that resolve when the
* event has fired and completed. Instead of a window, a browser or
* browsing context is required to be passed to this function.
@@ -1809,7 +1809,7 @@ export var BrowserTestUtils = {
* @param {integer} offsetY
* y offset from target's top bounding edge
* @param {Object} event object
- * Additional arguments, similar to the EventUtils.jsm version
+ * Additional arguments, similar to the EventUtils.sys.mjs version
* @param {BrowserContext|MozFrameLoaderOwner} browsingContext
* Browsing context or browser element, must not be null
*
diff --git a/testing/mochitest/shutdown-leaks-collector.js b/testing/mochitest/shutdown-leaks-collector.js
index 2d7030f3c3..30a1debe2d 100644
--- a/testing/mochitest/shutdown-leaks-collector.js
+++ b/testing/mochitest/shutdown-leaks-collector.js
@@ -4,7 +4,7 @@
/* eslint-env mozilla/frame-script */
-// We run this code in a .jsm rather than here to avoid keeping the current
+// We run this code in a sys.mjs rather than here to avoid keeping the current
// compartment alive.
ChromeUtils.importESModule(
"chrome://mochikit/content/ShutdownLeaksCollector.sys.mjs"
diff --git a/testing/mochitest/tests/Harness_sanity/xpcshell.toml b/testing/mochitest/tests/Harness_sanity/xpcshell.toml
index f203c1ef9f..e426c515fe 100644
--- a/testing/mochitest/tests/Harness_sanity/xpcshell.toml
+++ b/testing/mochitest/tests/Harness_sanity/xpcshell.toml
@@ -1,5 +1,7 @@
[DEFAULT]
["test_SpecialPowersSandbox.js"]
+prefs = ["dom.security.https_first=false"] #Disable https-first because createHttpServer does not support https
["test_SpecialPowersSpawn.js"]
+prefs = ["dom.security.https_first=false"] #Disable https-first because createHttpServer does not support https
diff --git a/testing/mochitest/tests/SimpleTest/AccessibilityUtils.js b/testing/mochitest/tests/SimpleTest/AccessibilityUtils.js
index cf4daaf416..27a0bdf1f5 100644
--- a/testing/mochitest/tests/SimpleTest/AccessibilityUtils.js
+++ b/testing/mochitest/tests/SimpleTest/AccessibilityUtils.js
@@ -614,12 +614,13 @@ this.AccessibilityUtils = (function () {
(node.tagName == "menuitem" &&
node.classList.contains("urlbarView-result-menuitem"));
+ let parentNode = node.getRootNode().host ?? node.parentNode;
const isParentMenu =
- node.parentNode.getAttribute("role") == "menu" ||
- (node.parentNode.tagName == "richlistbox" &&
- node.parentNode.classList.contains("autocomplete-richlistbox")) ||
- (node.parentNode.tagName == "menupopup" &&
- node.parentNode.classList.contains("urlbarView-result-menu"));
+ parentNode.getAttribute("role") == "menu" ||
+ (parentNode.tagName == "richlistbox" &&
+ parentNode.classList.contains("autocomplete-richlistbox")) ||
+ (parentNode.tagName == "menupopup" &&
+ parentNode.classList.contains("urlbarView-result-menu"));
return (
isMenuItem &&
isParentMenu &&
@@ -1078,6 +1079,22 @@ this.AccessibilityUtils = (function () {
}
// Walk a11y ancestors until we find one which is interactive.
for (; acc; acc = acc.parent) {
+ const relation = acc.getRelationByType(
+ Ci.nsIAccessibleRelation.RELATION_LABEL_FOR
+ );
+ if (
+ acc.role === Ci.nsIAccessibleRole.ROLE_LABEL &&
+ relation.targetsCount > 0
+ ) {
+ // If a <label> was clicked to activate a radiobutton or a checkbox,
+ // return the accessible of the related input.
+ // Note: aria-labelledby doesn't give the node a role of label, so this
+ // won't work for aria-labelledby cases. That said, aria-labelledby also
+ // doesn't have implicit click behaviour either and there's not really
+ // any way we can check for that.
+ const targetAcc = relation.getTarget(0);
+ return targetAcc;
+ }
if (INTERACTIVE_ROLES.has(acc.role)) {
return acc;
}
diff --git a/testing/mochitest/tests/SimpleTest/EventUtils.js b/testing/mochitest/tests/SimpleTest/EventUtils.js
index 8833b8bc59..59ad054714 100644
--- a/testing/mochitest/tests/SimpleTest/EventUtils.js
+++ b/testing/mochitest/tests/SimpleTest/EventUtils.js
@@ -42,8 +42,8 @@ window.__defineGetter__("_EU_ChromeUtils", function () {
window.__defineGetter__("_EU_OS", function () {
delete this._EU_OS;
try {
- this._EU_OS = _EU_ChromeUtils.import(
- "resource://gre/modules/AppConstants.jsm"
+ this._EU_OS = _EU_ChromeUtils.importESModule(
+ "resource://gre/modules/AppConstants.sys.mjs"
).platform;
} catch (ex) {
this._EU_OS = null;