commit a02a3ce634015d230f8c167fdbd350ea849e04a6
parent e61decc637d578f55313111a23b4a48e94228317
Author: Eitan Isaacson <eitan@monotonous.org>
Date: Fri, 24 Oct 2025 14:31:33 +0000
Bug 1994455 - P1: Allow setting empty string attributes in invokeSetAttribute. r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D268944
Diffstat:
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/accessible/tests/browser/e10s/browser_treeupdate_image.js b/accessible/tests/browser/e10s/browser_treeupdate_image.js
@@ -159,7 +159,7 @@ addAccessibleTask(
// Remove the presentation role. The accessible should be created.
info(`Removing presentation role from img id ${IMG_ID}`);
const shown = waitForEvent(EVENT_SHOW, IMG_ID);
- await invokeSetAttribute(browser, IMG_ID, "role", "");
+ await invokeSetAttribute(browser, IMG_ID, "role");
await shown;
let tree = {
role: ROLE_GRAPHIC,
diff --git a/accessible/tests/browser/shared-head.js b/accessible/tests/browser/shared-head.js
@@ -150,8 +150,8 @@ let Logger = {
* attribute
* @return {Promise} promise indicating that attribute is set/removed
*/
-function invokeSetAttribute(browser, id, attr, value) {
- if (value) {
+function invokeSetAttribute(browser, id, attr, value = null) {
+ if (value !== null) {
Logger.log(`Setting ${attr} attribute to ${value} for node with id: ${id}`);
} else {
Logger.log(`Removing ${attr} attribute from node with id: ${id}`);
@@ -162,7 +162,7 @@ function invokeSetAttribute(browser, id, attr, value) {
[id, attr, value],
(contentId, contentAttr, contentValue) => {
let elm = content.document.getElementById(contentId);
- if (contentValue) {
+ if (contentValue !== null) {
elm.setAttribute(contentAttr, contentValue);
} else {
elm.removeAttribute(contentAttr);