Beginning on October 25th, 2016, Persona will no longer be an option for authentication on BMO. For more details see Persona Deprecated.
Last Comment Bug 503007 - Provide Javascript Access to User Agent Style Sheets.
: Provide Javascript Access to User Agent Style Sheets.
Status: NEW
: helpwanted, student-project
Product: Core
Classification: Components
Component: CSS Parsing and Computation (show other bugs)
: 1.9.1 Branch
: x86 Windows XP
: -- normal with 2 votes (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
: Jet Villegas (:jet)
Depends on: 536379
Blocks: 343508
  Show dependency treegraph
Reported: 2009-07-07 21:40 PDT by John J. Barton
Modified: 2016-03-08 14:06 PST (History)
15 users (show)
roc: wanted1.9.2+
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description John J. Barton 2009-07-07 21:40:33 PDT
Firebug wants to apply the same workaround to User Agent Style sheets as we applied to page sheets in Bug 500365
Unfortunately we have no way to access the User Agent Sheets.

CSS editing is one of Firebug's top features and revealing the User Agent Sheets is a great way to help users understand CSS results. Currently editing User Agent sheets breaks Firefox, either making its UI fall apart or crash.

Firebug could try to implement read-only for the User Agent Sheet, but just then we will want the edit capability for Chromebug.
Comment 1 John J. Barton 2009-07-07 21:42:39 PDT
Boris, please set blocking/wanting flags according to your estimate of how hard this would be to implement.
Comment 2 Boris Zbarsky [:bz] (still a bit busy) 2009-07-07 21:47:28 PDT
Probably pretty easy, actually, via nsIDOMWindowUtils.  Could add a method that just returns a non-live array of user or UA sheets.

If someone wants to implement, I'm happy to point you to the relevant pieces.
Comment 3 Ondrej Donek 2009-07-08 09:20:06 PDT
I've noticed this bug on and because I have some free time and I wanted to improve my C++ skills I see this as a great opportunity how to start.
I've currently have the latest trunk and prepared build environment so I'll start with it this night.
I have only question if there is any other what I need to know - but the previous post is pretty clear.
Ondrej Donek
Comment 4 John J. Barton 2009-07-08 09:40:09 PDT
You'll need test cases to succeed and test cases will illustrate the proposed API, so I encourage you to start there.
Comment 5 Wladimir Palant 2009-07-11 07:38:22 PDT
I would rather prefer having this exposed via nsIStyleSheetService - so that user stylesheets are exposed as well.
Comment 6 Boris Zbarsky [:bz] (still a bit busy) 2009-07-11 16:21:46 PDT
John wants access to both, I think.

That said, this needs to be done per-document, so I'm not sure hanging it off of nsIStyleSheetService is a good approach; you'd have to have an API on there that takes a document or something.
Comment 7 Boris Zbarsky [:bz] (still a bit busy) 2009-07-11 16:22:48 PDT
That's assuming I diagnosed John's problem correctly, of course.  I looked again, and we only clone the quirks sheet; the other user/ua sheets are used as-is (we used to clone them, though).  So I'm not quite sure whether the issue John's seeing would be fixed by touching those sheets....
Comment 8 John J. Barton 2009-07-12 20:32:56 PDT
(In reply to comment #5)
> I would rather prefer having this exposed via nsIStyleSheetService - so that
> user stylesheets are exposed as well.

I can already get these from window.document.styleSheets.
Comment 9 Boris Zbarsky [:bz] (still a bit busy) 2009-07-12 22:02:51 PDT
No, you can get the document sheets.  User sheets are not in that collection.
Comment 10 David Baron :dbaron: ⌚️UTC-7 2009-12-29 06:25:46 PST
In order to make it ok for Firebug to mutate the UA sheets, we need to (1) ensure that the UA sheets get cloned in DocumentViewerImpl::CreateStyleSet or somewhere else and (2) ensure that they get unique inners before they're mutated (which bug 536379 should do for the get-style-rules case, and make it easy to do in other cases)

Note You need to log in before you can comment on or make changes to this bug.