Bug 1802411 - Set disabled state on the action button for extension widgets. r=rpl

Differential Revision: https://phabricator.services.mozilla.com/D163100
This commit is contained in:
William Durand 2022-11-25 14:53:59 +00:00
parent c2c8c4709e
commit 28ef9c8b3c
3 changed files with 5 additions and 4 deletions

View File

@ -897,9 +897,9 @@ this.browserAction = class extends ExtensionAPIPersistent {
}
if (tabData.enabled) {
node.removeAttribute("disabled");
button.removeAttribute("disabled");
} else {
node.setAttribute("disabled", "true");
button.setAttribute("disabled", "true");
}
let serializeColor = ([r, g, b, a]) =>

View File

@ -164,7 +164,7 @@ async function runTests(options) {
is(button.getAttribute("label"), title, "image label is correct");
is(button.getAttribute("badge"), details.badge, "badge text is correct");
is(
node.getAttribute("disabled") == "true",
button.getAttribute("disabled") == "true",
!details.enabled,
"disabled state is correct"
);

View File

@ -192,8 +192,9 @@ add_task(async function testBrowserActionDisabled() {
let browserAction = browserActionFor(ext);
let widget = getBrowserActionWidget(extension).forWindow(window);
let button = widget.node.firstElementChild;
is(widget.node.getAttribute("disabled"), "true", "Button is disabled");
is(button.getAttribute("disabled"), "true", "Button is disabled");
is(browserAction.pendingPopup, null, "Have no pending popup prior to click");
// Test canceled click.