Closed Bug 383075 Opened 17 years ago Closed 17 years ago

"red;" (with a semicolon) should not be accepted as a color

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9alpha6

People

(Reporter: jruderman, Assigned: MatsPalmgren_bugz)

References

Details

(Keywords: testcase)

Attachments

(5 files)

Attached file testcase
Setting elem.style.background to "red;" or even "red; yellow" turns the element red.  I think it should have no effect, like in WebKit trunk and Opera, and cause an error message to appear in the error console.
Attached file Testcase #2
It affects all properties.
Assignee: nobody → mats.palmgren
Status: NEW → ASSIGNED
Attached patch Patch rev. 1Splinter Review
Attachment #267138 - Flags: superreview?(dbaron)
Attachment #267138 - Flags: review?(dbaron)
Comment on attachment 267138 [details] [diff] [review]
Patch rev. 1

>+    if (parsedOK) {
>+      // Junk at end of property value.
>+      REPORT_UNEXPECTED_TOKEN(PEExpectEndProperty);
>+      errorCode = NS_ERROR_FAILURE;
>+    }

This should come at the very beginning of the else to be consistent with other types of error reporting, I think.

With that, and if you add a mochitest for the bug, r+sr=dbaron.
Attachment #267138 - Flags: superreview?(dbaron)
Attachment #267138 - Flags: superreview+
Attachment #267138 - Flags: review?(dbaron)
Attachment #267138 - Flags: review+
Should the mochitest for this bug be in the form of modifying the existing comprehensive tests (/layout/style/test/) to try every valid property value with a semicolon at the end, and make sure it's not accepted?  Or would that be overkill?
Please remove the XXXbz comment before the function in question, since you're fixing the thing it complains about?

And doesn't this change make such sets throw NS_ERROR_FAILURE?  Is that really what we want?  I'd think not...
Flags: in-testsuite?
OS: Mac OS X → All
Hardware: PC → All
1. remove the XXX comment
2. move the error message as dbaron suggested
3. leave errorCode as is, which should be NS_OK in this case
The mochitest tests both style.prop=val and style.setProperty(..., null)
but it doesn't test style.setProperty(..., "important") because that takes
a different path through the code and we have bugs there too.
I'll file a separate bug on that.
Checked in to trunk at 2007-06-06 10:56 PDT.

-> FIXED
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Flags: in-testsuite? → in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9alpha6
Filed bug 383488 on style.setProperty(..., "important")
Depends on: 441555
Blocks: 441555
No longer depends on: 441555
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: