Closed Bug 1014223 Opened 11 years ago Closed 11 years ago

CSS coverage should not use the same identifier for <style> elements in the same HTML document

Categories

(DevTools :: Style Editor, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 33

People

(Reporter: jwalker, Assigned: jwalker)

References

Details

Attachments

(1 file, 2 obsolete files)

Assignee: nobody → jwalker
Status: NEW → ASSIGNED
Attachment #8436937 - Flags: review?(fayearthur)
FWIW, I'd like to change -> to → before we land this.
Attachment #8436937 - Attachment is obsolete: true
Attachment #8436937 - Flags: review?(fayearthur)
Attachment #8438559 - Flags: review?(fayearthur)
That update did the -> to → that I mentioned.
Comment on attachment 8438559 [details] [diff] [review] 0001-Bug-1014223-Use-unique-identifier-for-style-elements.patch Review of attachment 8438559 [details] [diff] [review]: ----------------------------------------------------------------- I'd like to get rid of the _testOnly methods if possible. Open to discussion though. ::: toolkit/devtools/server/actors/csscoverage.js @@ +21,5 @@ > + return require("devtools/server/actors/stylesheets"); > +}); > +loader.lazyGetter(this, "CssLogic", () => { > + return require("devtools/styleinspector/css-logic").CssLogic; > +}); Doesn't look like you ended up using CssLogic. @@ +438,3 @@ > * For testing only. Is css coverage running. > */ > _testOnly_isRunning: method(function() { There's no reason for this to be test-only I think. If it's useful to us, it could be useful for someone else. Another option is to keep a '.running' variable up-to-date on the Front. That's what I do for instance in the MediaRuleFront in stylesheets.js, I keep the .matches property up to date by listening for events. @@ +445,5 @@ > > + /** > + * For testing only. What pages did we visit. > + */ > + _testOnly_visitedPages: method(function() { There's got to be another way. Can you have rules on each page, and check that a rule from each page shows up? @@ +454,5 @@ > + > + /** > + * For testing only. What pages/sheets/rules did we discover. > + */ > + _testOnly_dump: method(function() { This method isn't used anywhere. I'd get rid of this. @@ +700,5 @@ > + if (stylesheet.ownerNode) { > + let document = stylesheet.ownerNode.ownerDocument; > + let sheets = [...document.querySelectorAll("style")]; > + let index = sheets.indexOf(stylesheet.ownerNode); > + return getURL(document) + ' → <style> index ' + index; If you don't want to mess with "->", ":" would be good I think.
Attachment #8438559 - Flags: review?(fayearthur)
(In reply to Heather Arthur [:harth] from comment #6) > Comment on attachment 8438559 [details] [diff] [review] > 0001-Bug-1014223-Use-unique-identifier-for-style-elements.patch > > Review of attachment 8438559 [details] [diff] [review]: > ----------------------------------------------------------------- > > I'd like to get rid of the _testOnly methods if possible. Open to discussion > though. > > ::: toolkit/devtools/server/actors/csscoverage.js > @@ +21,5 @@ > > + return require("devtools/server/actors/stylesheets"); > > +}); > > +loader.lazyGetter(this, "CssLogic", () => { > > + return require("devtools/styleinspector/css-logic").CssLogic; > > +}); > > Doesn't look like you ended up using CssLogic. One of the coverage commands is currently broken because it's missing. So it is needed even though I didn't add the > @@ +438,3 @@ > > * For testing only. Is css coverage running. > > */ > > _testOnly_isRunning: method(function() { > > There's no reason for this to be test-only I think. If it's useful to us, it > could be useful for someone else. > > Another option is to keep a '.running' variable up-to-date on the Front. > That's what I do for instance in the MediaRuleFront in stylesheets.js, I > keep the .matches property up to date by listening for events. The reason it's _testOnly_ is that it's dangerous to do "if (usage.isRunning) usage.stop", but I think it's something we should be testing, and in testing we can be sure that only one thing is attacking it at a time. So the theory is that normal use only needs start/stop/toggle. Maybe we'll need this for a start/stop button in the UI though. > @@ +445,5 @@ > > > > + /** > > + * For testing only. What pages did we visit. > > + */ > > + _testOnly_visitedPages: method(function() { > > There's got to be another way. Can you have rules on each page, and check > that a rule from each page shows up? Is there a problem with _testOnly methods? I'm not sure what the issue is. > @@ +700,5 @@ > > + if (stylesheet.ownerNode) { > > + let document = stylesheet.ownerNode.ownerDocument; > > + let sheets = [...document.querySelectorAll("style")]; > > + let index = sheets.indexOf(stylesheet.ownerNode); > > + return getURL(document) + ' → <style> index ' + index; > > If you don't want to mess with "->", ":" would be good I think. Got it working OK now, temporarily tripped up by the ACSII delivery of JS by mochitest. I kind of like →.
(In reply to Joe Walker [:jwalker] from comment #7) > Is there a problem with _testOnly methods? I'm not sure what the issue is. API aesthetics and usage. I still think we could get rid of the _testOnly_dump since it's not being used.
(In reply to Heather Arthur [:harth] from comment #8) > (In reply to Joe Walker [:jwalker] from comment #7) > > Is there a problem with _testOnly methods? I'm not sure what the issue is. > > API aesthetics and usage. I still think we could get rid of the > _testOnly_dump since it's not being used. I've got rid of _testOnly_dump. I raised bug 1025044 which should allow us to get rid of _testOnly_isRunning, and I think we'll need it anyway. I've got 3 options with _testOnly_visitedPages: 1. Create a non-ugly version that is exposed properly, and only used for testing except that we need to maintain backwards compatibility on it. I very much don't like this solution. 2. Just delete the test 3. Keep a deliberately ugly function that we can change without worrying about breaking things I'm happy to hear better solutions, but right now 3. seems like the best option.
Attachment #8438559 - Attachment is obsolete: true
Attachment #8439969 - Flags: review?(fayearthur)
Comment on attachment 8439969 [details] [diff] [review] 0001-Bug-1014223-Use-unique-identifier-for-style-elements.patch Review of attachment 8439969 [details] [diff] [review]: ----------------------------------------------------------------- Sounds good to me.
Attachment #8439969 - Flags: review?(fayearthur) → review+
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 33
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: