Open Bug 1157230 Opened 10 years ago Updated 2 years ago

Style-editor lists too many stylesheets on pages loaded via chrome://

Categories

(DevTools :: Style Editor, defect, P3)

defect

Tracking

(Not tracked)

REOPENED

People

(Reporter: pbro, Unassigned)

Details

I stumbled upon this behavior while working on a new test for the style-editor. My test case was very simple: const TESTCASE_URI = TEST_BASE + "missing.html"; add_task(function* () { let { ui } = yield openStyleEditorForURL(TESTCASE_URI); is(ui.editors.length, 1, "The UI contains one style sheet."); }); TEST_BASE is defined in head.js as "chrome://mochitests/content/browser/browser/devtools/styleeditor/test/" So, when my test was running (./mach mochitest-devtools browser/devtools/styleeditor/test/browser....) it was loading the test page from: chrome://mochitests/content/browser/browser/devtools/styleeditor/test/missing.html Now, my missing.html page is: <!doctype html> <html> <head> <meta charset="utf-8"> <title>missing stylesheet testcase</title> <link rel="stylesheet" charset="utf-8" type="text/css" media="screen" href="missing-stylesheet.css"/> <link rel="stylesheet" charset="utf-8" type="text/css" media="screen" href="simple.css"/> </head> <body> </body> </html> So it only has 2 stylesheets attached. However, when the test runs, the style-editor shows a lot more stylesheets: svg.css, ua.css, html.css, counterstyles.css, minimal-xul.css, xul.css, quirk.css, forms.css, number-control.css, scrollbars.css, pluginFinderBinding.css, pluginProblemBinding.css, data:text/css;charset=utf-8, highlighter.css This seems to be the list of UA stylesheets which the style-editor sees because the page is loaded with chrome:// It doesn't see those for pages loaded with http://
So, this is done on purpose here: http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/stylesheets.js#158 If isChrome is true, we get all the stylesheets using DOMUtils.getAllStyleSheets which also retrieves the UA stylesheets apparently. Added in bug 1049199, which I reviewed :|
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
Re-opening. As discussed with Gijs today: let's filter out the UA stylesheets in the toolbox, for chrome documents. As long as XBL styles are still shown (which is what bug 1049199 was about), no need to show these ones. On a related note, it seems that some XBL styles aren't shown, see bug 1157292. Here's what I suggest we do: - in the toolbox, use `sheet.isSystem` in StyleEditorUI.prototype._resetStyleSheetList to skip UA stylesheets if true, - in the browser-toolbox, show them, always.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
(In reply to Patrick Brosset [:pbrosset] [:patrick] from comment #2) > - in the browser-toolbox, show them, always. It's easy to have something work only in the BrowserToolbox, by adding a pref that is false by default, and set to true automatically in the toolbox process: https://dxr.mozilla.org/mozilla-central/source/browser/devtools/framework/toolbox-process-window.js?from=toolbox-process-window.js#55
Mentor: pbrosset
Inspector bug triage (filter on CLIMBING SHOES).
Priority: -- → P3
Product: Firefox → DevTools

Is this bug still Open ? If so I'd like to try working on this. I am new to Open Source programming and looking for a first few bugs to work on this. Thanks.

Mentor: patrickbrosset+bugzilla
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.