Make accentcolor, textcolor, headerURL optional

NEW
Assigned to
(NeedInfo from)

Status

(NEW bug which will not be worked on by staff, but a patch will be accepted awaiting an answer on a request for information)

Toolkit
WebExtensions: Frontend
P5
normal
9 days ago
3 hours ago

People

(Reporter: ntim, Assigned: ntim, NeedInfo)

Tracking

(Blocks: 1 bug)

unspecified
---
Points:
---

Firefox Tracking Flags

(firefox57 wontfix)

Tracking Status
firefox57 --- wontfix

Details

1 vote
Attach File
(Assignee)

Description

9 days ago
Making them mandatory only 
made sense when we only supported those 3 properties. Now we support 
many more properties, so these shouldn't be mandatory.
(Assignee)

Comment 1

9 days ago
What do you think about this?
Flags: needinfo?(mdeboer@mozilla.com)
Flags: needinfo?(jaws@mozilla.com)
(Assignee)

Comment 2

9 days ago
Some investigation into 
this: removing the check that makes the 3 properties mandatory doesn't 
work well.

There is a theme existence check in LightweightThemeConsumer.jsm based 
on headerURL, and not specifying that makes the check falsy.


Also, a lot of lightweight theme CSS is based on the assumption that 
accentcolor/textcolor/headerURL are always defined.
Assignee: nobody@mozilla.org → ntim.bugs@gmail.com
(Assignee)

Comment 3

9 days ago
A very simple fix would be 
adding:

if (!details.images || !details.images.headerURL) {
  details.images.headerURL = "";
}

to ext-theme.js and removing the checks making 
accentcolor/textcolor/headerURL mandatory.

A better fix would be refactoring LightweightThemeConsumer.jsm to stop 
using `active = !!aData.headerURL` as "theme is active" check, but 
that's quite complicated to do with the current setup unfortunately.

Comment 4

8 days ago
These properties are 
mandatory, because we don't want theme authors to create invalid 
Light-Weight Themes.
If you want the properties to become optional, then we need to move this
 validation to ext-theme.js:

 1. If only LWT properties are present in the manifest, kick off 
validation that none of them is missing.
    Ex.: When only 'accentcolor' is defined in the manifest, then we 
should assume that it's trying to 'behave' like a LWT,
         thus we should fail validation, saying 'textcolor' and 
'headerURL' are also required in this case.
 2. Exempt the theme.update() function from this requirement & skip 
the validation step. LWTs are manifest-only (near future, I know), so we
 needn't impose this restriction to other theme API consumers.
Flags: needinfo?(mdeboer@mozilla.com)

Updated

8 days ago
status-firefox57: --- → wontfix

Updated

3 hours ago
Priority: -- → P5
Resolve as