commit e3649ec3becfec722636182bb9ef21e518057743
parent 2d982220aee3f98cd28c1e93b6f5cf3e25460a3e
Author: Edgar Chen <echen@mozilla.com>
Date: Thu, 8 Jan 2026 09:10:14 +0000
Bug 2001749 - Add exception from a11y_checks for clipboard security popup tests; r=ayeddi
Differential Revision: https://phabricator.services.mozilla.com/D273728
Diffstat:
5 files changed, 19 insertions(+), 75 deletions(-)
diff --git a/dom/events/test/clipboard/browser.toml b/dom/events/test/clipboard/browser.toml
@@ -47,7 +47,6 @@ support-files = [
]
skip-if = [
"headless", # bug 1989339
- "a11y_checks", # bug 2001749
]
["browser_navigator_clipboard_contextmenu_suppression_ext.js"]
@@ -72,7 +71,6 @@ skip-if = [
support-files = ["simple_page_ext.html"]
skip-if = [
"headless", # bug 1989339
- "a11y_checks", # bug 2001749
]
["browser_navigator_clipboard_readText_multiple.js"]
@@ -88,7 +86,6 @@ skip-if = [
support-files = ["simple_page_ext.html"]
skip-if = [
"headless", # bug 1989339
- "a11y_checks", # bug 2001749
]
["browser_navigator_clipboard_touch.js"]
diff --git a/dom/events/test/clipboard/browser_navigator_clipboard_contextmenu_suppression.js b/dom/events/test/clipboard/browser_navigator_clipboard_contextmenu_suppression.js
@@ -366,6 +366,13 @@ if (
set: [["middlemouse.paste", true]],
});
+ // We intentionally turn off this a11y check, because the following click
+ // is send on an arbitrary web content that is not expected to be tested
+ // by itself with the browser mochitests, therefore this rule check shall
+ // be ignored by a11y-checks suite.
+ AccessibilityUtils.setEnv({
+ mustHaveAccessibleRule: false,
+ });
await SpecialPowers.spawn(browser, [], async () => {
EventUtils.synthesizeMouse(
content.document.documentElement,
@@ -375,6 +382,7 @@ if (
content.window
);
});
+ AccessibilityUtils.resetEnv();
},
true,
"middle click"
diff --git a/dom/events/test/clipboard/browser_navigator_clipboard_read.js b/dom/events/test/clipboard/browser_navigator_clipboard_read.js
@@ -39,14 +39,8 @@ add_task(async function test_paste_button_position() {
await BrowserTestUtils.withNewTab(kContentFileUrl, async function (browser) {
const pasteButtonIsShown = promisePasteButtonIsShown();
- // We intentionally turn off this a11y check, because the following click
- // is send on an arbitrary web content that is not expected to be tested
- // by itself with the browser mochitests, therefore this rule check shall
- // be ignored by a11y-checks suite.
- AccessibilityUtils.setEnv({ mustHaveAccessibleRule: false });
const coordsOfClickInContentRelativeToScreenInDevicePixels =
await promiseClickContentToTriggerClipboardRead(browser, false);
- AccessibilityUtils.resetEnv();
info(
"coordsOfClickInContentRelativeToScreenInDevicePixels: " +
coordsOfClickInContentRelativeToScreenInDevicePixels.x +
@@ -104,13 +98,7 @@ add_task(async function test_accepting_paste_button() {
await BrowserTestUtils.withNewTab(kContentFileUrl, async function (browser) {
const pasteButtonIsShown = promisePasteButtonIsShown();
- // We intentionally turn off this a11y check, because the following click
- // is send on an arbitrary web content that is not expected to be tested
- // by itself with the browser mochitests, therefore this rule check shall
- // be ignored by a11y-checks suite.
- AccessibilityUtils.setEnv({ mustHaveAccessibleRule: false });
await promiseClickContentToTriggerClipboardRead(browser, false);
- AccessibilityUtils.resetEnv();
await pasteButtonIsShown;
const pasteButtonIsHidden = promisePasteButtonIsHidden();
const mutatedReadResultFromContentElement =
@@ -130,13 +118,7 @@ add_task(async function test_accepting_paste_button() {
add_task(async function test_dismissing_paste_button() {
await BrowserTestUtils.withNewTab(kContentFileUrl, async function (browser) {
const pasteButtonIsShown = promisePasteButtonIsShown();
- // We intentionally turn off this a11y check, because the following click
- // is send on an arbitrary web content that is not expected to be tested
- // by itself with the browser mochitests, therefore this rule check shall
- // be ignored by a11y-checks suite.
- AccessibilityUtils.setEnv({ mustHaveAccessibleRule: false });
await promiseClickContentToTriggerClipboardRead(browser, false);
- AccessibilityUtils.resetEnv();
await pasteButtonIsShown;
const pasteButtonIsHidden = promisePasteButtonIsHidden();
const mutatedReadResultFromContentElement =
@@ -162,13 +144,7 @@ add_task(
kContentFileUrl,
async function (browser) {
const pasteButtonIsShown = promisePasteButtonIsShown();
- // We intentionally turn off this a11y check, because the following click
- // is send on an arbitrary web content that is not expected to be tested
- // by itself with the browser mochitests, therefore this rule check shall
- // be ignored by a11y-checks suite.
- AccessibilityUtils.setEnv({ mustHaveAccessibleRule: false });
await promiseClickContentToTriggerClipboardRead(browser, true);
- AccessibilityUtils.resetEnv();
await pasteButtonIsShown;
const mutatedReadResultFromContentElement =
promiseMutatedReadResultFromContentElement(browser);
@@ -196,14 +172,8 @@ add_task(async function test_new_user_activation_shows_paste_button_again() {
for (let i = 0; i < 2; ++i) {
const pasteButtonIsShown = promisePasteButtonIsShown();
- // We intentionally turn off this a11y check, because the following click
- // is send on an arbitrary web content that is not expected to be tested
- // by itself with the browser mochitests, therefore this rule check shall
- // be ignored by a11y-checks suite.
- AccessibilityUtils.setEnv({ mustHaveAccessibleRule: false });
// A click initiates a new user activation.
await promiseClickContentToTriggerClipboardRead(browser, false);
- AccessibilityUtils.resetEnv();
await pasteButtonIsShown;
const pasteButtonIsHidden = promisePasteButtonIsHidden();
diff --git a/dom/events/test/clipboard/browser_navigator_clipboard_readText.js b/dom/events/test/clipboard/browser_navigator_clipboard_readText.js
@@ -42,13 +42,6 @@ add_task(async function test_paste_button_position() {
await BrowserTestUtils.withNewTab(kContentFileUrl, async function (browser) {
const pasteButtonIsShown = promisePasteButtonIsShown();
- // We intentionally turn off this a11y check, because the following click
- // is send on an arbitrary web content that is not expected to be tested
- // by itself with the browser mochitests, therefore this rule check shall
- // be ignored by a11y-checks suite.
- AccessibilityUtils.setEnv({
- mustHaveAccessibleRule: false,
- });
const coordsOfClickInContentRelativeToScreenInDevicePixels =
await promiseClickContentToTriggerClipboardReadText(browser, false);
info(
@@ -57,7 +50,6 @@ add_task(async function test_paste_button_position() {
", " +
coordsOfClickInContentRelativeToScreenInDevicePixels.y
);
- AccessibilityUtils.resetEnv();
const pasteButtonCoordsRelativeToScreenInDevicePixels =
await pasteButtonIsShown;
@@ -109,15 +101,7 @@ add_task(async function test_accepting_paste_button() {
await BrowserTestUtils.withNewTab(kContentFileUrl, async function (browser) {
const pasteButtonIsShown = promisePasteButtonIsShown();
- // We intentionally turn off this a11y check, because the following click
- // is send on an arbitrary web content that is not expected to be tested
- // by itself with the browser mochitests, therefore this rule check shall
- // be ignored by a11y-checks suite.
- AccessibilityUtils.setEnv({
- mustHaveAccessibleRule: false,
- });
await promiseClickContentToTriggerClipboardReadText(browser, false);
- AccessibilityUtils.resetEnv();
await pasteButtonIsShown;
const pasteButtonIsHidden = promisePasteButtonIsHidden();
const mutatedReadTextResultFromContentElement =
@@ -137,15 +121,7 @@ add_task(async function test_accepting_paste_button() {
add_task(async function test_dismissing_paste_button() {
await BrowserTestUtils.withNewTab(kContentFileUrl, async function (browser) {
const pasteButtonIsShown = promisePasteButtonIsShown();
- // We intentionally turn off this a11y check, because the following click
- // is send on an arbitrary web content that is not expected to be tested
- // by itself with the browser mochitests, therefore this rule check shall
- // be ignored by a11y-checks suite.
- AccessibilityUtils.setEnv({
- mustHaveAccessibleRule: false,
- });
await promiseClickContentToTriggerClipboardReadText(browser, false);
- AccessibilityUtils.resetEnv();
await pasteButtonIsShown;
const pasteButtonIsHidden = promisePasteButtonIsHidden();
const mutatedReadTextResultFromContentElement =
@@ -171,15 +147,7 @@ add_task(
kContentFileUrl,
async function (browser) {
const pasteButtonIsShown = promisePasteButtonIsShown();
- // We intentionally turn off this a11y check, because the following click
- // is send on an arbitrary web content that is not expected to be tested
- // by itself with the browser mochitests, therefore this rule check shall
- // be ignored by a11y-checks suite.
- AccessibilityUtils.setEnv({
- mustHaveAccessibleRule: false,
- });
await promiseClickContentToTriggerClipboardReadText(browser, true);
- AccessibilityUtils.resetEnv();
await pasteButtonIsShown;
const mutatedReadTextResultFromContentElement =
promiseMutatedReadTextResultFromContentElement(browser);
@@ -207,16 +175,8 @@ add_task(async function test_new_user_activation_shows_paste_button_again() {
for (let i = 0; i < 2; ++i) {
const pasteButtonIsShown = promisePasteButtonIsShown();
- // We intentionally turn off this a11y check, because the following click
- // is send on an arbitrary web content that is not expected to be tested
- // by itself with the browser mochitests, therefore this rule check shall
- // be ignored by a11y-checks suite.
- AccessibilityUtils.setEnv({
- mustHaveAccessibleRule: false,
- });
// A click initiates a new user activation.
await promiseClickContentToTriggerClipboardReadText(browser, false);
- AccessibilityUtils.resetEnv();
await pasteButtonIsShown;
const pasteButtonIsHidden = promisePasteButtonIsHidden();
diff --git a/dom/events/test/clipboard/head.js b/dom/events/test/clipboard/head.js
@@ -180,8 +180,15 @@ async function promiseDismissPasteButton() {
// @param aBrowser browser object of the content tab.
// @param aContentElementId the ID of the element to be clicked.
-function promiseClickContentElement(aBrowser, aContentElementId) {
- return SpecialPowers.spawn(
+async function promiseClickContentElement(aBrowser, aContentElementId) {
+ // We intentionally turn off this a11y check, because the following click
+ // is send on an arbitrary web content that is not expected to be tested
+ // by itself with the browser mochitests, therefore this rule check shall
+ // be ignored by a11y-checks suite.
+ AccessibilityUtils.setEnv({
+ mustHaveAccessibleRule: false,
+ });
+ let result = await SpecialPowers.spawn(
aBrowser,
[aContentElementId],
async _contentElementId => {
@@ -201,6 +208,8 @@ function promiseClickContentElement(aBrowser, aContentElementId) {
return promise;
}
);
+ AccessibilityUtils.resetEnv();
+ return result;
}
// @param aBrowser browser object of the content tab.