Reviewed by Dave Hyatt.
authorkevino@webkit.org <kevino@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Mar 2008 02:02:28 +0000 (02:02 +0000)
committerkevino@webkit.org <kevino@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Mar 2008 02:02:28 +0000 (02:02 +0000)
Gracefully handle a CSS rule containing an invalid value.
(Fixes http://bugs.webkit.org/show_bug.cgi?id=16898)

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@30704 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/css/invalid-rule-value-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/invalid-rule-value.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/css/CSSGrammar.y

index cfdf6d071b60d33f845545bc58be0f3a67399df3..444b4b74af71b3f008953b775fb1281719f4a86d 100644 (file)
@@ -1,3 +1,13 @@
+2008-03-02  Kevin Ollivier  <kevino@theolliviers.com>
+
+        Reviewed by Dave Hyatt.
+
+        Gracefully handle a CSS rule containing an invalid value.
+        (Fixes http://bugs.webkit.org/show_bug.cgi?id=16898)
+
+        * fast/css/invalid-rule-value-expected.txt: Added.
+        * fast/css/invalid-rule-value.html: Added.
+
 2008-03-01  Oliver Hunt  <oliver@apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/LayoutTests/fast/css/invalid-rule-value-expected.txt b/LayoutTests/fast/css/invalid-rule-value-expected.txt
new file mode 100644 (file)
index 0000000..7492c3d
--- /dev/null
@@ -0,0 +1,10 @@
+This test checks that a rule with an invalid value does not halt other style rules from being applied.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.getElementById('test-invalid-rule').style.getPropertyValue('color') is 'rgb(0, 128, 0)'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/css/invalid-rule-value.html b/LayoutTests/fast/css/invalid-rule-value.html
new file mode 100644 (file)
index 0000000..677d87c
--- /dev/null
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<div id="test-invalid-rule" style="weight: *; color: rgb(0, 128, 0)"></div>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("This test checks that a rule with an invalid value does not halt other style rules from being applied.");
+
+shouldBe("document.getElementById('test-invalid-rule').style.getPropertyValue('color')", "'rgb(0, 128, 0)'");
+
+var successfullyParsed = true;
+</script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
index f91d1489d594671947d85faf8d36353a4e63d5d0..016809c16f9019152219fb96cc6071589ae59351 100644 (file)
@@ -1,3 +1,12 @@
+2008-03-02  Kevin Ollivier  <kevino@theolliviers.com>
+
+        Reviewed by Dave Hyatt.
+
+        Gracefully handle a CSS rule containing an invalid value.
+        (Fixes http://bugs.webkit.org/show_bug.cgi?id=16898)
+
+        * css/CSSGrammar.y:
+
 2008-03-02  Alp Toker  <alp@atoker.com>
 
         Reviewed by Mark Rowe.
index b7afd566a61f8071909a2c730c6b65951d9b91f6..c91ca328074f511e96485d215734208a71b2cacd 100644 (file)
@@ -985,6 +985,11 @@ declaration:
         /* div { font-family: } Just reduce away this property with no value. */
         $$ = false;
     }
+    |
+    property ':' maybe_space error {
+        /* if we come across rules with invalid values like this case: p { weight: *; }, just discard the rule */
+        $$ = false;
+    }
   ;
 
 property: