Closed Bug 422868 Opened 17 years ago Closed 16 years ago

[FIX]nsCSSScanner calls Pushback(-1) sometimes

Categories

(Core :: CSS Parsing and Computation, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.1a1

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(1 file)

Attached patch FixSplinter Review
There are two places in nsCSSScanner that can cause a Pushback(-1). The first is if a '@' is immediately followed by EOF (AT_KEYWORD token parsing). The second is if a ''|', '~', '^', '$', or '*' is immediately followed by EOF (INCLUDES and DASHMATCH token parsing). The upshot is that instead of getting EOF after the symbol token, we end up getting another ident token following the symbol token in these two situations (the PRUnichar(65536) in the pushback buffer is treated as non-ascii, hence part of an ident). I have no idea how to test this with current trunk. I suppose one way would be to attach a console listener and listen for the exact CSS error reported? I could do that if you like. It really doesn't matter much as things stand, though, since all these cases would just get thrown out, whatever the reason. Any sane test suite for bug 416317 will catch the second of these cases, though, since querySelectorAll("*") fails due to it being parsed as "*X" where 'X' is 0xFFFF. I figured it'd make sense to spin this little change out into its own bug for clarity's sake. I wasn't sure whether I could assert in Pushback() that the thing being pushed back is != PRUnichar(-1). If I can, I'll add the assert before checkin.
Attachment #309340 - Flags: superreview?(dbaron)
Attachment #309340 - Flags: review?(dbaron)
Comment on attachment 309340 [details] [diff] [review] Fix r+sr=dbaron
Attachment #309340 - Flags: superreview?(dbaron)
Attachment #309340 - Flags: superreview+
Attachment #309340 - Flags: review?(dbaron)
Attachment #309340 - Flags: review+
Fix checked in.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.1a1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: