Closed Bug 286262 Opened 21 years ago Closed 21 years ago

unterminated strings handled incorrectly

Categories

(Core :: CSS Parsing and Computation, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla1.8beta2

People

(Reporter: dbaron, Assigned: dbaron)

References

()

Details

(Whiteboard: [patch])

Attachments

(2 files, 1 obsolete file)

In CSS, unterminated strings are implied to be terminated by a newline, but in that case they're an error and shouldn't be used. Steps to reproduce: load http://fantasai.inkedblade.net/style/tests/ad-hoc/parsing/001 Actual results: the first declaration is sans-serif and blue Expected results: all declarations should be serif, the first should be blue
Attached patch patchSplinter Review
(This makes us more compatible with other browsers, IIRC.)
Status: NEW → ASSIGNED
Priority: -- → P2
Whiteboard: [patch]
Target Milestone: --- → mozilla1.8beta2
Attachment #177508 - Flags: superreview?(bzbarsky)
Attachment #177508 - Flags: review?(bzbarsky)
Comment on attachment 177508 [details] [diff] [review] patch Makes sense. r+sr=bzbarsky
Attachment #177508 - Flags: superreview?(bzbarsky)
Attachment #177508 - Flags: superreview+
Attachment #177508 - Flags: review?(bzbarsky)
Attachment #177508 - Flags: review+
Fix checked in to trunk, 2005-03-15 10:58 -0800.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Actually, I'm not sure the fix is the right one now... The following code (at http://lxr.mozilla.org/mozilla/source/themes/modern/global/filepicker.css#73 for now, but soon hopefully to be fixed): .up-button { list-style-image: url("chrome://global/skin/filepicker/folder-up.gif"); min-width: 0%; // don't let XUL layout min-size override our max-width setting min-height: 0%; max-width: 36px; } causes us to ignore all of the sheet after the '\'', because we're inside SkipDeclaration, GetToken() returns false (unterminated string), we report what we think is EOF and bail out, which stops skipping at the newline and returns from ParseDeclarationBlock, so we start parsing the next declaration block with the text "min-height: 0%", and it's all bad from there...
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
That seems like a bug in SkipDeclaration or something similar; we'd have had the same incorrect behavior with a faulty escape, no?
Well, nsCSSScanner.h's header says that false means error or EOF, but there are clearly many assumptions that it's an EOF. Maybe we should create an ERROR token type instead.
Attached patch possible patch (obsolete) — Splinter Review
Not tested yet. Creates an error token type instead, which is probably much more compatible with existing code. I also removed the unneeded manual numbering of an enum.
Comment on attachment 177824 [details] [diff] [review] possible patch This also fixes the original bug. Does it fix the regression?
Attachment #177824 - Flags: superreview?(bzbarsky)
Attachment #177824 - Flags: review?(bzbarsky)
Status: REOPENED → ASSIGNED
Attached patch revised patchSplinter Review
Attachment #177824 - Attachment is obsolete: true
Attachment #177827 - Flags: superreview?(bzbarsky)
Attachment #177827 - Flags: review?(bzbarsky)
Comment on attachment 177827 [details] [diff] [review] revised patch r+sr=bzbarsky, though I suspect this will make us report errors twice in some cases....
Attachment #177827 - Flags: superreview?(bzbarsky)
Attachment #177827 - Flags: superreview+
Attachment #177827 - Flags: review?(bzbarsky)
Attachment #177827 - Flags: review+
Attachment #177824 - Flags: superreview?(bzbarsky)
Attachment #177824 - Flags: superreview-
Attachment #177824 - Flags: review?(bzbarsky)
Attachment #177824 - Flags: review-
The errors are a little verbose, but it's all in one message, so I think it's fine. Too much information is better than too little.
Fix checked in to trunk, 2005-03-17 22:56 -0800.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago21 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: