add a stylesheet service module

RESOLVED WONTFIX

Status

Add-on SDK
General
--
enhancement
RESOLVED WONTFIX
6 years ago
6 years ago

People

(Reporter: Gregg Lind (Fx Strategy and Insights - Shield - Heartbeat ), Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Wrapping stylesheet service might help implementation of toolbar, widget, panel, etc.  It's hard to touch style chrome elements without styling xbl.  It's hard to style xbl without style-sheets :(


possible code:

   let tb = window.document.createElement('toolbarbutton')
   tb.id = "newbutton"
   require("stylesheet").register(data.url("tb.css"), 'agent')
   

https://developer.mozilla.org/en-US/docs/Using_the_Stylesheet_Service
https://raw.github.com/KWierso/rtse/rtse-lite/lib/stylesheetservice.js
https://github.com/gregglind/lotsa_addons/blob/master/feedback/lib/stylesheet.js


Open questions?

1.  allow AGENT_SHEET ?
2.  where to do url conversion?  Should the assumption be that data.url is in there?  In geneal, url conversion to 'ios' urls is inconsistent in the sdk already!
Hey! I've got a very similar system going with this https://gist.github.com/clarkbw/4999903

(In reply to Gregg Lind (User Research - Test Pilot) from comment #0)
> Open questions?
> 
> 1.  allow AGENT_SHEET ?

I haven't had need for the AGENT_SHEET but I'm not working with anonymous content areas, it might be a good optional option to offer but I would think to default to the safer USER_SHEET.

> 2.  where to do url conversion?  Should the assumption be that data.url is
> in there?  In geneal, url conversion to 'ios' urls is inconsistent in the
> sdk already!

The url module has a function that could be re-purposed, that is the code I used for converting my data.url into a URI.  I'd suggest that you be able to pass a data.url and we just do some checking to handle either a URL or URI passed in much like the toFilename function does in the url module.
https://github.com/mozilla/addon-sdk/blob/master/lib/sdk/url.js#L22

For a unit test I'm using some code to look through all the style sheets that exist and ensure that our registered sheet is loaded and unloaded properly.

Here's that code: https://gist.github.com/clarkbw/5000940
That is now 3 separate people who have built this service with slightly different feature sets :)  This is suggestive there is real need for it!
here is another: https://github.com/voldsoftware/userstyles-jplib
OS: Mac OS X → All
Hardware: x86 → All
Summary: stylesheet service → add a stylesheet service module
We're wontfixing this as Erik's module solves the issue and it is unclear to us how useful this module is to most developers. I certainly see that the UX team finds some use for this, granted.

One of the gaping holes in the jetpack effort is providing an easy way to share and use 3rd party modules, but we're hoping to make progress here this year.
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.