Closed Bug 1191024 Opened 9 years ago Closed 9 years ago

getRuleLocation sometimes computes incorrect start line

Categories

(DevTools :: Inspector, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1013814

People

(Reporter: tromey, Assigned: tromey)

References

Details

Attachments

(1 file, 1 obsolete file)

stylesheets.js:getRuleLocation can sometimes incorrectly compute the start line for a rule. In particular I saw it happen with an inline style sheet where the first rule was @supports. In this case the check here: https://dxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/stylesheets.js#963 ... fails, leading it to use the second rule to compute the absolute start line. I think the fix is to change the check to use Ci.nsIDOMCSSRule rather than nsIDOMCSSStyleRule. I have a fix for this; just need to write a test case.
Attached patch widen instanceof test in getRuleLocation (obsolete) (deleted) — Splinter Review
Here's the patch without tests.
Now with test.
Attachment #8644570 - Attachment is obsolete: true
Attachment #8645735 - Flags: review?(pbrosset)
Comment on attachment 8645735 [details] [diff] [review] widen instanceof test in getRuleLocation Review of attachment 8645735 [details] [diff] [review]: ----------------------------------------------------------------- Seems fine to me.
Attachment #8645735 - Flags: review?(pbrosset) → review+
The try run showed that this is flawed; some rules don't use a "{" for their location but rather the token following the @-keyword. Then it occurred to me that even expanding the heuristic to check this would be wrong, because an invalid @-keyword would be recognized by a naive scanner but be ignored by the real parser. Then I found bug 1013814. I've decided to try to fix this the real way.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: