browser.theme.getCurrent() no longer returns empty object (`{}`) when default theme is enabled
Categories
(WebExtensions :: Themes, defect, P3)
Tracking
(Not tracked)
People
(Reporter: ntim, Assigned: robwu)
References
(Regression)
Details
(Keywords: regression)
Now returns:
{
"colors": null,
"icons": null,
"images": null,
"properties": null
}
instead.
Reporter | ||
Updated•6 years ago
|
Comment 1•6 years ago
|
||
The priority flag is not set for this bug.
:mikedeboer, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•6 years ago
|
I think browser.theme.getCurrent()
should return the colours used by the default theme.
That way, it’d possible to write theme agnostic code without needing to hardcode Photon theme values.
Reporter | ||
Comment 3•6 years ago
|
||
(In reply to ExE Boss from comment #2)
I think
browser.theme.getCurrent()
should return the colours used by the default theme.That way, it’d possible to write theme agnostic code without needing to hardcode Photon theme values.
This bug is just about restoring the old behaviour to avoid breaking add-ons, returning default theme colors is a different bug.
Comment 4•5 years ago
|
||
This is a defect compared to what it used to do, but what it used to do was different based on what the built-ins were.
Now that they're static themes, we should revisit the question of what they should return. I assume that's the call of the Front-end team?
Updated•5 years ago
|
Assignee | ||
Comment 5•5 years ago
|
||
I checked all public add-ons on AMO, and none of them rely on the existence of the key.
They typically check with if (theme.colors) {
instead of something like if ("colors" in theme) {
. Given that, and the absence of other bug reports, I'm going to:
- WONTFIX this bug.
- Update the documentation at https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/Theme/getCurrent
- Let the API deterministically return
{ colors: null, images: null, properties: null }
by default (https://bugzilla.mozilla.org/show_bug.cgi?id=1581886#c11).
Assignee | ||
Comment 6•5 years ago
|
||
Tim, does comment 5 sound like an acceptable approach?
Reporter | ||
Comment 7•5 years ago
|
||
I guess the change in behaviour for theme.getCurrent() is fine if it doesn't break add-ons, but it'd be nice if we had a clear definition of the ideal behaviour that's not just a side effect of implementation.
Updated•3 years ago
|
Assignee | ||
Comment 8•3 years ago
|
||
All tasks from comment 5 have been completed.
Updated•3 years ago
|
Description
•