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)
DevTools
Style Editor
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 33
People
(Reporter: jwalker, Assigned: jwalker)
References
Details
Attachments
(1 file, 2 obsolete files)
7.23 KB,
patch
|
harth
:
review+
|
Details | Diff | Splinter Review |
Assignee | ||
Comment 1•11 years ago
|
||
Assignee | ||
Comment 2•11 years ago
|
||
Assignee | ||
Comment 3•11 years ago
|
||
FWIW, I'd like to change -> to → before we land this.
Assignee | ||
Comment 4•11 years ago
|
||
Attachment #8436937 -
Attachment is obsolete: true
Attachment #8436937 -
Flags: review?(fayearthur)
Attachment #8438559 -
Flags: review?(fayearthur)
Assignee | ||
Comment 5•11 years ago
|
||
That update did the -> to → that I mentioned.
Comment 6•11 years ago
|
||
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)
Assignee | ||
Comment 7•11 years ago
|
||
(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 →.
Comment 8•11 years ago
|
||
(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.
Assignee | ||
Comment 9•11 years ago
|
||
(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.
Assignee | ||
Comment 10•11 years ago
|
||
Attachment #8438559 -
Attachment is obsolete: true
Attachment #8439969 -
Flags: review?(fayearthur)
Comment 11•11 years ago
|
||
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+
Assignee | ||
Comment 12•11 years ago
|
||
Comment 13•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 33
Updated•7 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•