Add reftest for tokenization and parsing of CSS url() function.
authorL. David Baron <dbaron@dbaron.org>
Fri, 22 Jan 2010 14:51:11 -0800
changeset 37421 ab6e1ab7d3d87bd25c65ab4689b9eb000dd48fcf
parent 37420 5956c9cd849d50001fc0ce9c8e97bd29f43863bb
child 37422 b27f05c8743bfc54b5ab6c15544a0cb73a44b749
push idunknown
push userunknown
push dateunknown
milestone1.9.3a1pre
Add reftest for tokenization and parsing of CSS url() function.
layout/reftests/css-parsing/invalid-url-handling-partial.xhtml
layout/reftests/css-parsing/invalid-url-handling-ref.xhtml
layout/reftests/css-parsing/invalid-url-handling.xhtml
layout/reftests/css-parsing/reftest.list
layout/reftests/reftest.list
new file mode 100644
--- /dev/null
+++ b/layout/reftests/css-parsing/invalid-url-handling-partial.xhtml
@@ -0,0 +1,102 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+  <title>CSS Test: handling of invalid url() functions</title>
+  <link rel="author" title="L. David Baron" href="http://dbaron.org/" />
+  <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" />
+  <link rel="help" href="http://www.w3.org/TR/CSS21/syndata.html#tokenization" />
+  <link rel="help" href="http://www.w3.org/TR/CSS21/syndata.html#parsing-errors" />
+  <meta name="flags" content="invalid" />
+  <style type="text/css">
+  div { background-color: red }
+  </style>
+  <style type="text/css">
+  /* not a URI token, but handled according to rules for parsing errors */
+  #one { background: url(foo"bar") }
+  #one { background-color: green; }
+  </style>
+  <style type="text/css">
+  /* not a URI token, but handled according to rules for parsing errors */
+  #foo { background: url(foo"bar
+  ) }
+  #two { background-color: green; }
+  </style>
+  <style type="text/css">
+  /* not a URI token; the unterminated string ends at end of line, so
+     the brace never matches */
+  #three { background-color: green; }
+  #foo { background: url(foo"bar) }
+  #three { background-color: red; }
+  </style>
+  <style type="text/css">
+  /* not a URI token; the unterminated string ends at end of line */
+  #foo { background: url(foo"bar) }
+  ) }
+  #four { background-color: green; }
+  </style>
+  <style type="text/css">
+  /* not a URI token; the unterminated string ends at end of line, so
+     the brace never matches */
+  #five { background-color: green; }
+  #foo { background: url("bar) }
+  #five { background-color: red; }
+  </style>
+  <style type="text/css">
+  /* not a URI token; the unterminated string ends at end of line */
+  #foo { background: url("bar) }
+  ) }
+  #six { background-color: green; }
+  </style>
+  <style type="text/css">
+  /* not a URI token, but brace matching should work */
+  #seven { background: url(()); background-color: green; }
+  </style>
+  <style type="text/css">
+  /* not a URI token, but brace matching should work */
+  #eight { background: url([{}]); background-color: green; }
+  </style>
+  <style type="text/css">
+  /* not a URI token, but brace matching should work */
+  #nine { background: url([)]); background-color: green; }
+  </style>
+  <style type="text/css">
+  /* perfectly good URI token (image is a 404, though) */
+  #ten { background: url({) green; }
+  </style>
+  <style type="text/css">
+  /* perfectly good URI token (image is a 404, though) */
+  #eleven { background: url([) green; }
+  </style>
+  <style type="text/css">
+  /* not a URI token, but brace matching should work */
+  /* COMMENT OUT THIS TEST IN THE PARTIAL VERSION SINCE IT FAILS */
+  #twelve { /* background: url({"")}); */ background-color: green; }
+  </style>
+  <style type="text/css">
+  /* not a URI token, but brace matching should work */
+  #thirteen { background: url(["")]); background-color: green; }
+  </style>
+  <style type="text/css">
+  /* not a URI token; the opening ( is never matched */
+  #fourteen { background-color: green; }
+  #foo { background: url(() }
+  #fourteen { background-color: red; }
+  </style>
+ </head>
+ <body>
+  <div id="one">This should have a green background</div>
+  <div id="two">This should have a green background</div>
+  <div id="three">This should have a green background</div>
+  <div id="four">This should have a green background</div>
+  <div id="five">This should have a green background</div>
+  <div id="six">This should have a green background</div>
+  <div id="seven">This should have a green background</div>
+  <div id="eight">This should have a green background</div>
+  <div id="nine">This should have a green background</div>
+  <div id="ten">This should have a green background</div>
+  <div id="eleven">This should have a green background</div>
+  <div id="twelve">This should have a green background</div>
+  <div id="thirteen">This should have a green background</div>
+  <div id="fourteen">This should have a green background</div>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/css-parsing/invalid-url-handling-ref.xhtml
@@ -0,0 +1,27 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+  <title>CSS Test: handling of invalid url() functions (reference)</title>
+  <link rel="author" title="L. David Baron" href="http://dbaron.org/" />
+  <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" />
+  <style type="text/css">
+  div { background-color: green }
+  </style>
+ </head>
+ <body>
+  <div id="one">This should have a green background</div>
+  <div id="two">This should have a green background</div>
+  <div id="three">This should have a green background</div>
+  <div id="four">This should have a green background</div>
+  <div id="five">This should have a green background</div>
+  <div id="six">This should have a green background</div>
+  <div id="seven">This should have a green background</div>
+  <div id="eight">This should have a green background</div>
+  <div id="nine">This should have a green background</div>
+  <div id="ten">This should have a green background</div>
+  <div id="eleven">This should have a green background</div>
+  <div id="twelve">This should have a green background</div>
+  <div id="thirteen">This should have a green background</div>
+  <div id="fourteen">This should have a green background</div>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/css-parsing/invalid-url-handling.xhtml
@@ -0,0 +1,101 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+  <title>CSS Test: handling of invalid url() functions</title>
+  <link rel="author" title="L. David Baron" href="http://dbaron.org/" />
+  <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" />
+  <link rel="help" href="http://www.w3.org/TR/CSS21/syndata.html#tokenization" />
+  <link rel="help" href="http://www.w3.org/TR/CSS21/syndata.html#parsing-errors" />
+  <meta name="flags" content="invalid" />
+  <style type="text/css">
+  div { background-color: red }
+  </style>
+  <style type="text/css">
+  /* not a URI token, but handled according to rules for parsing errors */
+  #one { background: url(foo"bar") }
+  #one { background-color: green; }
+  </style>
+  <style type="text/css">
+  /* not a URI token, but handled according to rules for parsing errors */
+  #foo { background: url(foo"bar
+  ) }
+  #two { background-color: green; }
+  </style>
+  <style type="text/css">
+  /* not a URI token; the unterminated string ends at end of line, so
+     the brace never matches */
+  #three { background-color: green; }
+  #foo { background: url(foo"bar) }
+  #three { background-color: red; }
+  </style>
+  <style type="text/css">
+  /* not a URI token; the unterminated string ends at end of line */
+  #foo { background: url(foo"bar) }
+  ) }
+  #four { background-color: green; }
+  </style>
+  <style type="text/css">
+  /* not a URI token; the unterminated string ends at end of line, so
+     the brace never matches */
+  #five { background-color: green; }
+  #foo { background: url("bar) }
+  #five { background-color: red; }
+  </style>
+  <style type="text/css">
+  /* not a URI token; the unterminated string ends at end of line */
+  #foo { background: url("bar) }
+  ) }
+  #six { background-color: green; }
+  </style>
+  <style type="text/css">
+  /* not a URI token, but brace matching should work */
+  #seven { background: url(()); background-color: green; }
+  </style>
+  <style type="text/css">
+  /* not a URI token, but brace matching should work */
+  #eight { background: url([{}]); background-color: green; }
+  </style>
+  <style type="text/css">
+  /* not a URI token, but brace matching should work */
+  #nine { background: url([)]); background-color: green; }
+  </style>
+  <style type="text/css">
+  /* perfectly good URI token (image is a 404, though) */
+  #ten { background: url({) green; }
+  </style>
+  <style type="text/css">
+  /* perfectly good URI token (image is a 404, though) */
+  #eleven { background: url([) green; }
+  </style>
+  <style type="text/css">
+  /* not a URI token, but brace matching should work */
+  #twelve { background: url({"")}); background-color: green; }
+  </style>
+  <style type="text/css">
+  /* not a URI token, but brace matching should work */
+  #thirteen { background: url(["")]); background-color: green; }
+  </style>
+  <style type="text/css">
+  /* not a URI token; the opening ( is never matched */
+  #fourteen { background-color: green; }
+  #foo { background: url(() }
+  #fourteen { background-color: red; }
+  </style>
+ </head>
+ <body>
+  <div id="one">This should have a green background</div>
+  <div id="two">This should have a green background</div>
+  <div id="three">This should have a green background</div>
+  <div id="four">This should have a green background</div>
+  <div id="five">This should have a green background</div>
+  <div id="six">This should have a green background</div>
+  <div id="seven">This should have a green background</div>
+  <div id="eight">This should have a green background</div>
+  <div id="nine">This should have a green background</div>
+  <div id="ten">This should have a green background</div>
+  <div id="eleven">This should have a green background</div>
+  <div id="twelve">This should have a green background</div>
+  <div id="thirteen">This should have a green background</div>
+  <div id="fourteen">This should have a green background</div>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/css-parsing/reftest.list
@@ -0,0 +1,2 @@
+fails == invalid-url-handling.xhtml invalid-url-handling-ref.xhtml # Bug 541434
+== invalid-url-handling-partial.xhtml invalid-url-handling-ref.xhtml
--- a/layout/reftests/reftest.list
+++ b/layout/reftests/reftest.list
@@ -48,16 +48,19 @@ include css-charset/reftest.list
 include css-gradients/reftest.list
 
 # css media queries (tests for print mode)
 include css-mediaqueries/reftest.list
 
 # css namespaces
 include css-namespace/reftest.list
 
+# css parsing
+include css-parsing/reftest.list
+
 # css transitions
 include css-transitions/reftest.list
 
 # css values and units
 include css-valuesandunits/reftest.list
 
 # columns/
 include columns/reftest.list