Open Bug 876585 Opened 12 years ago Updated 2 years ago

nsCSSScanner::Backup doesn't handle escapes correctly

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

People

(Reporter: dbaron, Unassigned)

Details

(Keywords: css3)

Attachments

(4 files)

As I pointed out in bug 543151 comment 81 (which I noticed while reviewing bug 750388), nsCSSScanner::Backup behaves incorrectly when it's being used where escapes are involved. I don't see an obvious fix here. I haven't yet managed to find a testcase where we incorrectly accept something that we should reject, but it wouldn't surprise me if such a testcase exists.
Attachment #754678 - Attachment description: testcase (post-bug 750388) → testcase (post-bug 876570)
Attached file another testcase
Here's another testcase: Firefox 21 displays alternating green and blue rows, trunk displays all green. This may be functionally equivalent to attachment 754683 [details] but I'm not sure. We can fix most of this pretty easily by abandoning the notion of backing up, instead parsing 'b' directly out of the dimension suffix when necessary. However, when the value of 'b' consists entirely of escaped digits (as in this testcase) I'm not sure whether it's supposed to be accepted.
Assignee: nobody → zackw
Correction: Firefox 20 is the one that displays alternating green and blue rows on attachment 754835 [details].
Attached patch WIP patchSplinter Review
Here's a patch which attempts to handle an+b without backing up at all. It's not quite right yet: in particular, :nth-child(n-/**/2) is rejected, contra test_selectors.html's expectations. Also, ExtractInteger is probably reinventing the wheel. Still, this should be good enough for am-I-barking-up-the-wrong-tree-entirely reactions.
Attachment #754861 - Flags: feedback?(dbaron)
We might want to wait on this until the current discussion on www-style about an+b syntax finishes up...
(In reply to David Baron [:dbaron] (don't cc:, use needinfo? instead) from comment #6) > We might want to wait on this until the current discussion on www-style > about an+b syntax finishes up... OK, I sent a note to www-style so they know about this wrinkle as well as the other stuff being discussed under that head.
Attachment #754861 - Flags: feedback?(dbaron)
Resetting owner to default per Zack's request.
Assignee: zackw → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: