Closed Bug 1427107 Opened 6 years ago Closed 6 years ago

Invalid badge background color behaves as null


(WebExtensions :: Frontend, defect, P5)



(firefox59 verified, firefox60 verified)

Tracking Status
firefox59 --- verified
firefox60 --- verified


(Reporter: Oriol, Assigned: Oriol)



(3 files, 1 obsolete file)

Attached file test.xpi (obsolete) —
Run this code:

  browser.browserAction.setBadgeBackgroundColor({color: "red"});
  browser.browserAction.setBadgeBackgroundColor({tabId, color: "green"});
  browser.browserAction.setBadgeBackgroundColor({tabId, color: "invalid"});

Since "invalid" is not a color, it behaves as null, i.e. it removes the tab-specific green color and the tab inherits the global red color.

However, Chrome behaves differently. There the "invalid" color is ignored, so the tab continues having a green tab-specific color. And a warning is logged.

I think compatibility with Chrome should be preferred, if someone wants to remove a tab-specific color, since bug 1419940 they can explicitly use null, which is less hacky than an invalid color.
Attached file test.xpi
There was a mistake in the attached test webext
Attachment #8938893 - Attachment is obsolete: true
Priority: -- → P5
Assignee: nobody → oriol-bugzilla
Summary: Invalid badge background color behaves an null → Invalid badge background color behaves as null
Comment on attachment 8941904 [details]
Bug 1427107 - Reject setBadgeBackgroundColor promise for invalid string colors
Attachment #8941904 - Flags: review?(mixedpuppy) → review+
Keywords: checkin-needed
We're sorry, Autoland could not rebase your commits for you automatically. Please manually rebase your commits and try again.

hg error in cmd: hg rebase -s ee783915e508a3257642d4fc4eb183b020963b09 -d 7be74a94e766: rebasing 442801:ee783915e508 "Bug 1427107 - Reject setBadgeBackgroundColor promise for invalid string colors r=mixedpuppy" (tip)
merging browser/components/extensions/ext-browserAction.js
merging browser/components/extensions/test/browser/browser_ext_browserAction_context.js
warning: conflicts while merging browser/components/extensions/ext-browserAction.js! (edit, then use 'hg resolve --mark')
unresolved conflicts (see hg resolve, then hg rebase --continue)
The code base has been updated and the patch fails to apply now. Please push fix the issue and push the updated patch to review board. Thank you.
Flags: needinfo?(oriol-bugzilla)
Keywords: checkin-needed
Flags: needinfo?(oriol-bugzilla)
Keywords: checkin-needed
Pushed by
Reject setBadgeBackgroundColor promise for invalid string colors r=mixedpuppy
Keywords: checkin-needed
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
Tested with the latest build and the only difference I see from before the fix is that the color of the "abcd" background is red by default and in the latest fix it's green. Is this the desired behavior along with the "Reading manifest: Error processing background.persistent: Event pages are not currently supported. This will run as a persistent background page." warning?
Flags: needinfo?(oriol-bugzilla)
Yes, the desired behavior is that the badge background color should be green on the tab where you installed the extension, just like Chrome. The event pages warning is unrelated.
Flags: needinfo?(oriol-bugzilla)
As per setting this issue to verified on Windows 10 64 Bit Firefox 60.0a1 (20180123102017).
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.