2010-01-08 Yuzo Fujishima <yuzo@google.com>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Jan 2010 21:31:31 +0000 (21:31 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Jan 2010 21:31:31 +0000 (21:31 +0000)
        Reviewed by Darin Adler.

        Skip invalid blocks in CSS property declarations.
        https://bugs.webkit.org/show_bug.cgi?id=31231
        https://bugs.webkit.org/show_bug.cgi?id=26619

        This patch makes the CSS parser skip property declarations containing invalid blocks.

        * fast/css/parsing-error-recovery-expected.txt: Added.
        * fast/css/parsing-error-recovery.html: Added.
2010-01-08  Yuzo Fujishima  <yuzo@google.com>

        Reviewed by Darin Adler.

        Skip invalid blocks in CSS property declarations.
        https://bugs.webkit.org/show_bug.cgi?id=31231
        https://bugs.webkit.org/show_bug.cgi?id=26619

        This patch makes the CSS parser skip property declarations containing invalid blocks.

        Test: fast/css/parsing-error-recovery.html

        * css/CSSGrammar.y:

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

LayoutTests/ChangeLog
LayoutTests/fast/css/parsing-error-recovery-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/parsing-error-recovery.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/css/CSSGrammar.y

index b801221..a7bb88e 100644 (file)
@@ -1,3 +1,16 @@
+2010-01-08  Yuzo Fujishima  <yuzo@google.com>
+
+        Reviewed by Darin Adler.
+
+        Skip invalid blocks in CSS property declarations.
+        https://bugs.webkit.org/show_bug.cgi?id=31231
+        https://bugs.webkit.org/show_bug.cgi?id=26619
+
+        This patch makes the CSS parser skip property declarations containing invalid blocks.
+
+        * fast/css/parsing-error-recovery-expected.txt: Added.
+        * fast/css/parsing-error-recovery.html: Added.
+
 2010-01-08  Chris Marrin  <cmarrin@apple.com>
 
         Fixed media test failures caused by http://trac.webkit.org/changeset/52998.
diff --git a/LayoutTests/fast/css/parsing-error-recovery-expected.txt b/LayoutTests/fast/css/parsing-error-recovery-expected.txt
new file mode 100644 (file)
index 0000000..7ef22e9
--- /dev/null
@@ -0,0 +1 @@
+PASS
diff --git a/LayoutTests/fast/css/parsing-error-recovery.html b/LayoutTests/fast/css/parsing-error-recovery.html
new file mode 100644 (file)
index 0000000..d78141a
--- /dev/null
@@ -0,0 +1,53 @@
+<html>
+<head>
+    <script type="text/javascript">
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+    </script>
+    <style>
+        .to_be_shown {
+          display:none;
+          color:green;
+        }
+        .to_be_hidden {
+          display:block;
+          color:red;
+        }
+
+        /* Expression containing an invalid block should be skipped */
+        #test1 {
+            behavior:expression((function(){})());
+            display:none;
+        }
+
+        /* Value containing an invalid block should be skipped */
+        .malformed1 {
+          height:{}
+        }
+        #test2 {
+            display:none;
+        }
+
+        /* Malformed declaration list should be skipped */
+        .malformed2 {
+            a:link { color: blue;}
+            a:active { color: red;}
+        }
+        #test3 {
+            display:none;
+        }
+
+        /* Successfully parsed */
+        #last {
+            display:block;
+        }
+    </style>
+</head>
+<body>
+  <div class="to_be_hidden" id="test1">FAIL: Test 1</div>
+  <div class="to_be_hidden" id="test2">FAIL: Test 2</div>
+  <div class="to_be_hidden" id="test3">FAIL: Test 3</div>
+  <div class="to_be_shown" id="last">PASS</div>
+</body>
+</html>
+
index 62d1bbe..b95f5b2 100644 (file)
@@ -1,3 +1,17 @@
+2010-01-08  Yuzo Fujishima  <yuzo@google.com>
+
+        Reviewed by Darin Adler.
+
+        Skip invalid blocks in CSS property declarations.
+        https://bugs.webkit.org/show_bug.cgi?id=31231
+        https://bugs.webkit.org/show_bug.cgi?id=26619
+
+        This patch makes the CSS parser skip property declarations containing invalid blocks.
+
+        Test: fast/css/parsing-error-recovery.html
+
+        * css/CSSGrammar.y:
+
 2010-01-08  Chris Fleizach  <cfleizach@apple.com>
 
         Reviewed by Beth Dakin.
index ed26935..63e8eed 100644 (file)
@@ -97,7 +97,7 @@ static int cssyylex(YYSTYPE* yylval, void* parser)
 
 %}
 
-%expect 48
+%expect 53
 
 %nonassoc LOWEST_PREC
 
@@ -1208,6 +1208,9 @@ decl_list:
     declaration ';' maybe_space {
         $$ = $1;
     }
+    | declaration invalid_block_list maybe_space {
+        $$ = false;
+    }
     | declaration invalid_block_list ';' maybe_space {
         $$ = false;
     }
@@ -1325,6 +1328,9 @@ expr:
             $$->addValue(p->sinkFloatingValue($3));
         }
     }
+    | expr invalid_block_list {
+        $$ = 0;
+    }
     | expr error {
         $$ = 0;
     }