1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/style/test/test_unclosed_parentheses.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,289 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=575672 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 575672</title> 1.11 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <style type="text/css" id="style"></style> 1.13 + <style type="text/css"> 1.14 + #display { position: relative } 1.15 + </style> 1.16 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.17 +</head> 1.18 +<body> 1.19 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=575672">Mozilla Bug 575672</a> 1.20 +<p id="display"></p> 1.21 +<div id="content" style="display: none"> 1.22 + 1.23 +</div> 1.24 +<pre id="test"> 1.25 +<script type="application/javascript"> 1.26 + 1.27 +/** Test for unclosed parentheses in CSS values. **/ 1.28 + 1.29 +// Each of the following semicolon-terminated @-rules should have a 1.30 +// single missing ')' in the value. 1.31 +var semirules = [ 1.32 + "@import (", 1.33 + "@import url(", 1.34 + "@import url(foo", 1.35 + "@import url('foo'", 1.36 + "@import foo(", 1.37 +]; 1.38 + 1.39 +// Each of the following declarations should have a single missing ')' 1.40 +// in the value. 1.41 +var declarations = [ 1.42 + "content: url(", 1.43 + "content: url( ", 1.44 + "content: url(http://www.foo.com", 1.45 + "content: url('http://www.foo.com'", 1.46 + "content: foobar(", 1.47 + "content: foobar( ", 1.48 + "content: foobar(http://www.foo.com", 1.49 + "content: foobar('http://www.foo.com'", 1.50 + "color: url(", 1.51 + "color: url( ", 1.52 + "color: url(http://www.foo.com", 1.53 + "color: url('http://www.foo.com'", 1.54 + "background-image: linear-gradient(", 1.55 + "background-image: linear-gradient( ", 1.56 + "background-image: linear-gradient(to", 1.57 + "background-image: linear-gradient(to top", 1.58 + "background-image: linear-gradient(to top left", 1.59 + "background-image: linear-gradient(to top left,", 1.60 + "background-image: repeating-linear-gradient(to top left, red, blue", 1.61 + "background-image: linear-gradient(to top left, red, yellow, blue", 1.62 + "background-image: linear-gradient(to top left, red 1px, yellow 5px, blue 10px", 1.63 + "background-image: linear-gradient(to top left, red, yellow, rgb(0, 0, 255)", 1.64 + "background-image: -moz-linear-gradient(", 1.65 + "background-image: -moz-linear-gradient( ", 1.66 + "background-image: -moz-linear-gradient(red, blue", 1.67 + "background-image: -moz-linear-gradient(red, yellow, blue", 1.68 + "background-image: -moz-linear-gradient(red 1px, yellow 5px, blue 10px", 1.69 + "background-image: -moz-linear-gradient(red, yellow, rgb(0, 0, 255)", 1.70 + "background-image: -moz-linear-gradient(to", 1.71 + "background-image: -moz-linear-gradient(to top", 1.72 + "background-image: -moz-linear-gradient(to top left", 1.73 + "background-image: -moz-linear-gradient(to top left,", 1.74 + "background-image: -moz-repeating-linear-gradient(to top left, red, blue", 1.75 + "background-image: -moz-linear-gradient(to top left, red, yellow, blue", 1.76 + "background-image: -moz-linear-gradient(to top left, red 1px, yellow 5px, blue 10px", 1.77 + "background-image: -moz-linear-gradient(to top left, red, yellow, rgb(0, 0, 255)", 1.78 + "background-image: -moz-repeating-linear-gradient(top left, red, blue", 1.79 + "background-image: -moz-linear-gradient(top left, red, yellow, blue", 1.80 + "background-image: -moz-linear-gradient(top left, red 1px, yellow 5px, blue 10px", 1.81 + "background-image: -moz-linear-gradient(top left, red, yellow, rgb(0, 0, 255)", 1.82 + "background-image: radial-gradient(", 1.83 + "background-image: radial-gradient( ", 1.84 + "background-image: radial-gradient(at", 1.85 + "background-image: radial-gradient(at ", 1.86 + "background-image: radial-gradient(at center", 1.87 + "background-image: radial-gradient(at center,", 1.88 + "background-image: radial-gradient(at center ", 1.89 + "background-image: radial-gradient(closest-corner", 1.90 + "background-image: radial-gradient(farthest-side ", 1.91 + "background-image: radial-gradient(closest-corner ellipse", 1.92 + "background-image: radial-gradient(farthest-side circle ", 1.93 + "background-image: radial-gradient(closest-corner ellipse at", 1.94 + "background-image: radial-gradient(farthest-side circle at ", 1.95 + "background-image: radial-gradient(closest-corner ellipse at center", 1.96 + "background-image: radial-gradient(farthest-side circle at center ", 1.97 + "background-image: radial-gradient(50px", 1.98 + "background-image: radial-gradient(50px,", 1.99 + "background-image: radial-gradient(50px ", 1.100 + "background-image: radial-gradient(50px at", 1.101 + "background-image: radial-gradient(50px at ", 1.102 + "background-image: radial-gradient(50px at center", 1.103 + "background-image: radial-gradient(50px at center ", 1.104 + "background-image: radial-gradient(50px at center,", 1.105 + "background-image: radial-gradient(50px 50px", 1.106 + "background-image: radial-gradient(50px 50px,", 1.107 + "background-image: radial-gradient(50px 50px ", 1.108 + "background-image: radial-gradient(50px 50px at", 1.109 + "background-image: radial-gradient(50px 50px at ", 1.110 + "background-image: radial-gradient(50px 50px at center", 1.111 + "background-image: radial-gradient(50px 50px at center ", 1.112 + "background-image: radial-gradient(50px 50px at center,", 1.113 + "background-image: radial-gradient(50px 50px at center, red, blue", 1.114 + "background-image: radial-gradient(ellipse at", 1.115 + "background-image: radial-gradient(ellipse at ", 1.116 + "background-image: radial-gradient(circle", 1.117 + "background-image: radial-gradient(circle ", 1.118 + "background-image: radial-gradient(circle closest-corner", 1.119 + "background-image: radial-gradient(circle farthest-side ", 1.120 + "background-image: radial-gradient(ellipse closest-corner at center", 1.121 + "background-image: radial-gradient(ellipse farthest-side at center,", 1.122 + "background-image: radial-gradient(circle at center", 1.123 + "background-image: radial-gradient(circle at center,", 1.124 + "background-image: radial-gradient(circle at center ", 1.125 + "background-image: radial-gradient(circle at 50px center", 1.126 + "background-image: radial-gradient(circle at 50px center ", 1.127 + "background-image: radial-gradient(ellipse 50px", 1.128 + "background-image: radial-gradient(ellipse 50px ", 1.129 + "background-image: radial-gradient(ellipse 50px 50px", 1.130 + "background-image: radial-gradient(ellipse 50px 50px,", 1.131 + "background-image: radial-gradient(ellipse 50px 50px ", 1.132 + "background-image: radial-gradient(ellipse 50px 50px at", 1.133 + "background-image: radial-gradient(ellipse 50px 50px at ", 1.134 + "background-image: radial-gradient(ellipse 50px 50px at center", 1.135 + "background-image: radial-gradient(ellipse 50px 50px at center ", 1.136 + "background-image: radial-gradient(ellipse 50px 50px at center,", 1.137 + "background-image: radial-gradient(ellipse 50px 50px at center, red, blue", 1.138 + "background-image: repeating-radial-gradient(50%", 1.139 + "background-image: repeating-radial-gradient(50% ", 1.140 + "background-image: repeating-radial-gradient(50% 50%", 1.141 + "background-image: repeating-radial-gradient(50% 50%,", 1.142 + "background-image: repeating-radial-gradient(50% 50%, red, blue", 1.143 + "background-image: -moz-radial-gradient(", 1.144 + "background-image: -moz-radial-gradient( ", 1.145 + "background-image: -moz-radial-gradient(top left 45deg, red, blue", 1.146 + "background-image: -moz-radial-gradient(cover, red, blue", 1.147 + "background-image: -moz-repeating-radial-gradient(circle, red, blue", 1.148 + "background-image: -moz-radial-gradient(ellipse closest-corner, red, hsl(240, 50%, 50%)", 1.149 + "background-image: -moz-radial-gradient(farthest-side circle, red, blue", 1.150 + "background-image: -moz-image-rect(", 1.151 + "background-image: -moz-image-rect( ", 1.152 + "background-image: -moz-image-rect(url(foo.jpg)", 1.153 + "background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10", 1.154 + "background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10 ", 1.155 + "background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10,", 1.156 + "background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10, ", 1.157 + "background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10, 10", 1.158 + "background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10, 10 ", 1.159 + "background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10, 10,", 1.160 + "background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10, 10, ", 1.161 + "color: rgb(", 1.162 + "color: rgb( ", 1.163 + "color: rgb(128, 0", 1.164 + "color: rgb(128, 0, 128", 1.165 + "color: rgb(128, 0, 128, 128", 1.166 + "color: rgba(", 1.167 + "color: rgba( ", 1.168 + "color: rgba(128, 0", 1.169 + "color: rgba(128, 0, 128", 1.170 + "color: rgba(128, 0, 128, 1", 1.171 + "color: rgba(128, 0, 128, 1, 1", 1.172 + "color: hsl(", 1.173 + "color: hsl( ", 1.174 + "color: hsl(240, 50%", 1.175 + "color: hsl(240, 50%, 50%", 1.176 + "color: hsl(240, 50%, 50%, 50%", 1.177 + "color: hsla(", 1.178 + "color: hsla( ", 1.179 + "color: hsla(240, 50%", 1.180 + "color: hsla(240, 50%, 50%", 1.181 + "color: hsla(240, 50%, 50%, 1", 1.182 + "color: hsla(240, 50%, 50%, 1, 1", 1.183 + "content: counter(", 1.184 + "content: counter( ", 1.185 + "content: counter(foo", 1.186 + "content: counter(foo ", 1.187 + "content: counter(foo,", 1.188 + "content: counter(foo, ", 1.189 + "content: counter(foo, upper-roman", 1.190 + "content: counter(foo, upper-roman ", 1.191 + "content: counter(foo, upper-roman,", 1.192 + "content: counter(foo, upper-roman, ", 1.193 + "content: counters(", 1.194 + "content: counters( ", 1.195 + "content: counters(foo, ','", 1.196 + "content: counters(foo, ',' ", 1.197 + "content: counters(foo, ',',", 1.198 + "content: counters(foo, ',', ", 1.199 + "content: counters(foo, ',', upper-roman", 1.200 + "content: counters(foo, ',', upper-roman ", 1.201 + "content: counters(foo, ',', upper-roman,", 1.202 + "content: counters(foo, ',', upper-roman, ", 1.203 + "content: attr(", 1.204 + "content: attr( ", 1.205 + "content: attr(href", 1.206 + "content: attr(href ", 1.207 + "content: attr(html", 1.208 + "content: attr(html ", 1.209 + "content: attr(html|", 1.210 + "content: attr(html| ", 1.211 + "content: attr(html|href", 1.212 + "content: attr(html|href ", 1.213 + "content: attr(|", 1.214 + "content: attr(| ", 1.215 + "content: attr(|href", 1.216 + "content: attr(|href ", 1.217 + "transition-timing-function: cubic-bezier(", 1.218 + "transition-timing-function: cubic-bezier( ", 1.219 + "transition-timing-function: cubic-bezier(0, 0, 1", 1.220 + "transition-timing-function: cubic-bezier(0, 0, 1 ", 1.221 + "transition-timing-function: cubic-bezier(0, 0, 1,", 1.222 + "transition-timing-function: cubic-bezier(0, 0, 1, ", 1.223 + "transition-timing-function: cubic-bezier(0, 0, 1, 1", 1.224 + "transition-timing-function: cubic-bezier(0, 0, 1, 1 ", 1.225 + "transition-timing-function: cubic-bezier(0, 0, 1, 1,", 1.226 + "transition-timing-function: cubic-bezier(0, 0, 1, 1, ", 1.227 + "border-top-width: calc(", 1.228 + "border-top-width: calc( ", 1.229 + "border-top-width: calc(2em", 1.230 + "border-top-width: calc(2em ", 1.231 + "border-top-width: calc(2em +", 1.232 + "border-top-width: calc(2em + ", 1.233 + "border-top-width: calc(2em *", 1.234 + "border-top-width: calc(2em * ", 1.235 + "border-top-width: calc((2em)", 1.236 + "border-top-width: calc((2em) ", 1.237 +]; 1.238 + 1.239 +var selectors = [ 1.240 + ":not(", 1.241 + ":not( ", 1.242 + ":not(-", 1.243 + ":not(- ", 1.244 + ":not(>", 1.245 + ":not(> ", 1.246 + ":not(div p", 1.247 + ":not(div p ", 1.248 + ":not(div >", 1.249 + ":not(div > ", 1.250 +]; 1.251 + 1.252 +var textNode = document.createTextNode(""); 1.253 +document.getElementById("style").appendChild(textNode); 1.254 +var cs = getComputedStyle(document.getElementById("display"), ""); 1.255 + 1.256 +for (var i = 0; i < semirules.length; ++i) { 1.257 + var sheet = semirules[i] + 1.258 + "p#display { color: red } ) ; p { color: green; z-index: " + (i + 1) + " }"; 1.259 + textNode.data = sheet; 1.260 + is(cs.color, "rgb(0, 128, 0)", 1.261 + "color for rule '" + semirules[i] + "'"); 1.262 + is(cs.zIndex, i+1, 1.263 + "z-index for rule '" + semirules[i] + "'"); 1.264 +} 1.265 + 1.266 +for (var i = 0; i < declarations.length; ++i) { 1.267 + var sheet = "@namespace html url(http://www.w3.org/1999/xhtml);\n" + 1.268 + "#display { color: green; " + declarations[i] + 1.269 + " x x x x x x x ; color: red; ) ; z-index: " + (i + 1) + " }"; 1.270 + textNode.data = sheet; 1.271 + is(cs.color, "rgb(0, 128, 0)", 1.272 + "color for declaration '" + declarations[i] + "'"); 1.273 + is(cs.zIndex, i+1, 1.274 + "z-index for declaration '" + declarations[i] + "'"); 1.275 +} 1.276 + 1.277 +for (var i = 0; i < selectors.length; ++i) { 1.278 + var sheet = "@namespace html url(http://www.w3.org/1999/xhtml);\n" + 1.279 + "#display { color: green } " + 1.280 + selectors[i] + " x x x x x x x , #display { color: red } #display { color: red } ) , #display { color: red } " + 1.281 + "#display { z-index: " + (i + 1) + " }"; 1.282 + textNode.data = sheet; 1.283 + is(cs.color, "rgb(0, 128, 0)", 1.284 + "color for selector '" + selectors[i] + "'"); 1.285 + is(cs.zIndex, i+1, 1.286 + "z-index for selector '" + selectors[i] + "'"); 1.287 +} 1.288 + 1.289 +</script> 1.290 +</pre> 1.291 +</body> 1.292 +</html>