Provide Javascript Access to User Agent Style Sheets.




10 years ago
3 years ago


(Reporter: johnjbarton, Unassigned)


({helpwanted, student-project})

1.9.1 Branch
Windows XP
helpwanted, student-project
Dependency tree / graph
Bug Flags:
wanted1.9.2 +

Firefox Tracking Flags

(status1.9.1 ?)


(Whiteboard: [firebug-p2])



10 years ago
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

10 years ago
Boris, please set blocking/wanting flags according to your estimate of how hard this would be to implement.
Whiteboard: [firebug-p1]
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.
Keywords: helpwanted, student-project
Flags: wanted1.9.1.x?
Flags: blocking1.9.2?

Comment 3

10 years ago
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

10 years ago
You'll need test cases to succeed and test cases will illustrate the proposed API, so I encourage you to start there.

Comment 5

10 years ago
I would rather prefer having this exposed via nsIStyleSheetService - so that user stylesheets are exposed as well.
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.
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

10 years ago
(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.
No, you can get the document sheets.  User sheets are not in that collection.
Flags: blocking1.9.2? → wanted1.9.2+
status1.9.1: --- → ?
Flags: wanted1.9.1.x?
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)


9 years ago
Whiteboard: [firebug-p1] → [firebug-p2]
You need to log in before you can comment on or make changes to this bug.