1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/style/test/test_bug413958.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,78 @@ 1.4 +<!doctype html> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=413958 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 413958</title> 1.11 + <meta charset="UTF-8"> 1.12 + <script src="/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <link rel="stylesheet" href="/tests/SimpleTest/test.css"> 1.14 +</head> 1.15 +<body> 1.16 +<style>span { color: red }</style><!-- backstop --> 1.17 +<p><a target="_blank" 1.18 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=413958" 1.19 + >Mozilla Bug 413958</a>. All text below should be black on white.</p> 1.20 +<p>Sheet: <span id="s1">1</span> 1.21 + <span id="s2">2</span> 1.22 + <span id="s3">3</span>. 1.23 + Style attr: <span id="setStyle">4</span>. 1.24 + Properties: <span id="setStyleProp" style="">5</span>.</p> 1.25 +<script> 1.26 +var tests = [ 1.27 + function() { 1.28 + var s = document.createTextNode( 1.29 +"#s1{nosuchprop:auto; color:black}\n"+ 1.30 +"#s2{nosuchprop:auto; color:black}invalid?sel{}#s3{color:black}"), 1.31 + e = document.createElement("style"); 1.32 + e.appendChild(s); 1.33 + document.body.appendChild(e); 1.34 + }, 1.35 + function() { 1.36 + document.getElementById("setStyle") 1.37 + .setAttribute("style", "width:200;color:black"); 1.38 + }, 1.39 + function() { 1.40 + var s = document.getElementById("setStyleProp").style; 1.41 + s.width = "200"; 1.42 + s.color = "black"; 1.43 + }, 1.44 +]; 1.45 +var results = [ 1.46 + [ { errorMessage: /Unknown property 'nosuchprop'/, 1.47 + lineNumber: 1, columnNumber: 14, 1.48 + sourceLine: "#s1{nosuchprop:auto; color:black}" }, 1.49 + { errorMessage: /Unknown property 'nosuchprop'/, 1.50 + lineNumber: 2, columnNumber: 14, sourceLine: 1.51 + "#s2{nosuchprop:auto; color:black}invalid?sel{}#s3{color:black}" }, 1.52 + { errorMessage: /Ruleset ignored due to bad selector/, 1.53 + lineNumber: 2, columnNumber: 40, sourceLine: 1.54 + "#s2{nosuchprop:auto; color:black}invalid?sel{}#s3{color:black}" } ], 1.55 + [ { errorMessage: /parsing value for 'width'/, 1.56 + lineNumber: 0, columnNumber: 6, 1.57 + sourceLine: "width:200;color:black" } ], 1.58 + [ { errorMessage: /parsing value for 'width'/, 1.59 + lineNumber: 0, columnNumber: 0, 1.60 + sourceLine: "200" } ], 1.61 +]; 1.62 +var curTest = -1; 1.63 + 1.64 +function doTest() { 1.65 + if (++curTest == tests.length) { 1.66 + var ss = document.getElementsByTagName("span"); 1.67 + for (var i = 0; i < ss.length; i++) { 1.68 + is(window.getComputedStyle(ss[i], "").color, "rgb(0, 0, 0)", 1.69 + "recovery | " + ss[i].id); 1.70 + } 1.71 + SimpleTest.finish(); 1.72 + } else { 1.73 + SimpleTest.expectConsoleMessages(tests[curTest], results[curTest], doTest); 1.74 + } 1.75 +} 1.76 + 1.77 +SimpleTest.waitForExplicitFinish(); 1.78 +doTest(); 1.79 +</script> 1.80 +</body> 1.81 +</html>