Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=577974 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 577974</title> |
michael@0 | 8 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 10 | <style id="style"> |
michael@0 | 11 | |
michael@0 | 12 | @keyframes bounce { |
michael@0 | 13 | from { |
michael@0 | 14 | margin-left: 0 |
michael@0 | 15 | } |
michael@0 | 16 | |
michael@0 | 17 | /* |
michael@0 | 18 | * These rules should get dropped due to syntax errors. The script |
michael@0 | 19 | * below tests that the 25% rule following them is at cssRules[1]. |
michael@0 | 20 | */ |
michael@0 | 21 | from, { margin-left: 0 } |
michael@0 | 22 | from , { margin-left: 0 } |
michael@0 | 23 | , from { margin-left: 0 } |
michael@0 | 24 | ,from { margin-left: 0 } |
michael@0 | 25 | from from { margin-left: 0 } |
michael@0 | 26 | from, 1 { margin-left: 0 } |
michael@0 | 27 | 1 { margin-left: 0 } |
michael@0 | 28 | 1, from { margin-left: 0 } |
michael@0 | 29 | from, 1.0 { margin-left: 0 } |
michael@0 | 30 | 1.0 { margin-left: 0 } |
michael@0 | 31 | 1.0, from { margin-left: 0 } |
michael@0 | 32 | |
michael@0 | 33 | 25% { |
michael@0 | 34 | margin-left: 25px; |
michael@0 | 35 | } |
michael@0 | 36 | |
michael@0 | 37 | 75%, 85% { |
michael@0 | 38 | margin-left: 90px; |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | 100% { |
michael@0 | 42 | margin-left: 100px; |
michael@0 | 43 | } |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | </style> |
michael@0 | 47 | </head> |
michael@0 | 48 | <body> |
michael@0 | 49 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=577974">Mozilla Bug 577974</a> |
michael@0 | 50 | <p id="display"></p> |
michael@0 | 51 | <div id="content" style="display: none"> |
michael@0 | 52 | |
michael@0 | 53 | </div> |
michael@0 | 54 | <pre id="test"> |
michael@0 | 55 | <script type="application/javascript"> |
michael@0 | 56 | |
michael@0 | 57 | /** Test for Bug 577974 **/ |
michael@0 | 58 | |
michael@0 | 59 | var sheet = document.getElementById("style").sheet; |
michael@0 | 60 | |
michael@0 | 61 | var bounce = sheet.cssRules[0]; |
michael@0 | 62 | is(bounce.type, CSSRule.KEYFRAMES_RULE, "bounce.type"); |
michael@0 | 63 | is(bounce.type, 7, "bounce.type"); |
michael@0 | 64 | is(bounce.name, "bounce", "bounce.name"); |
michael@0 | 65 | bounce.name = "bouncier"; |
michael@0 | 66 | is(bounce.name, "bouncier", "setting bounce.name"); |
michael@0 | 67 | |
michael@0 | 68 | is(bounce.cssRules[0].type, CSSRule.KEYFRAME_RULE, "keyframe rule type"); |
michael@0 | 69 | is(bounce.cssRules[0].type, 8, "keyframe rule type"); |
michael@0 | 70 | is(bounce.cssRules[0].keyText, "0%", "keyframe rule keyText"); |
michael@0 | 71 | is(bounce.cssRules[1].keyText, "25%", "keyframe rule keyText"); |
michael@0 | 72 | is(bounce.cssRules[2].keyText, "75%, 85%", "keyframe rule keyText"); |
michael@0 | 73 | is(bounce.cssRules[3].keyText, "100%", "keyframe rule keyText"); |
michael@0 | 74 | is(bounce.cssRules[0].style.marginLeft, "0px", "keyframe rule style"); |
michael@0 | 75 | is(bounce.cssRules[1].style.marginLeft, "25px", "keyframe rule style"); |
michael@0 | 76 | |
michael@0 | 77 | is(bounce.cssRules[0].cssText, "0% { margin-left: 0px; }"); |
michael@0 | 78 | is(bounce.cssText, "@keyframes bouncier {\n" + |
michael@0 | 79 | "0% { margin-left: 0px; }\n" + |
michael@0 | 80 | "25% { margin-left: 25px; }\n" + |
michael@0 | 81 | "75%, 85% { margin-left: 90px; }\n" + |
michael@0 | 82 | "100% { margin-left: 100px; }\n" + |
michael@0 | 83 | "}"); |
michael@0 | 84 | |
michael@0 | 85 | bounce.cssRules[1].keyText = "from, 1"; // syntax error |
michael@0 | 86 | bounce.cssRules[1].keyText = "from, x"; // syntax error |
michael@0 | 87 | bounce.cssRules[1].keyText = "from,"; // syntax error |
michael@0 | 88 | bounce.cssRules[1].keyText = "from x"; // syntax error |
michael@0 | 89 | bounce.cssRules[1].keyText = "x"; // syntax error |
michael@0 | 90 | is(bounce.cssRules[1].keyText, "25%", "keyframe rule keyText parsing"); |
michael@0 | 91 | bounce.cssRules[1].keyText = "from, 10%"; |
michael@0 | 92 | is(bounce.cssRules[1].keyText, "0%, 10%", "keyframe rule keyText parsing"); |
michael@0 | 93 | bounce.cssRules[1].keyText = "from, 0%"; |
michael@0 | 94 | is(bounce.cssRules[1].keyText, "0%, 0%", "keyframe rule keyText parsing"); |
michael@0 | 95 | bounce.cssRules[1].keyText = "from, from, from"; |
michael@0 | 96 | is(bounce.cssRules[1].keyText, "0%, 0%, 0%", "keyframe rule keyText parsing"); |
michael@0 | 97 | |
michael@0 | 98 | is(bounce.findRule("75%"), null, "findRule should match all keys"); |
michael@0 | 99 | is(bounce.findRule("85%, 75%"), null, |
michael@0 | 100 | "findRule should match all keys in order"); |
michael@0 | 101 | is(bounce.findRule("75%,85%"), bounce.cssRules[2], |
michael@0 | 102 | "findRule should match all keys in order, parsed"); |
michael@0 | 103 | is(bounce.findRule("to"), bounce.cssRules[3], |
michael@0 | 104 | "findRule should match keys as parsed"); |
michael@0 | 105 | is(bounce.findRule("100%"), bounce.cssRules[3], |
michael@0 | 106 | "findRule should match keys as parsed"); |
michael@0 | 107 | is(bounce.findRule("100%, 100%"), null, |
michael@0 | 108 | "findRule should match key list"); |
michael@0 | 109 | is(bounce.findRule("100%,"), null, |
michael@0 | 110 | "findRule should fail when given bad selector"); |
michael@0 | 111 | is(bounce.findRule(",100%"), null, |
michael@0 | 112 | "findRule should fail when given bad selector"); |
michael@0 | 113 | is(bounce.cssRules.length, 4, "length of css rules"); |
michael@0 | 114 | bounce.deleteRule("85%"); |
michael@0 | 115 | is(bounce.cssRules.length, 4, "deleteRule should match all keys"); |
michael@0 | 116 | bounce.deleteRule("85%, 75%"); |
michael@0 | 117 | is(bounce.cssRules.length, 4, "deleteRule should match key list"); |
michael@0 | 118 | bounce.deleteRule("75% ,85%"); |
michael@0 | 119 | is(bounce.cssRules.length, 3, "deleteRule should match keys in order, parsed"); |
michael@0 | 120 | bounce.deleteRule("0%"); |
michael@0 | 121 | is(bounce.cssRules.length, 2, "deleteRule should match keys in order, parsed"); |
michael@0 | 122 | bounce.appendRule("from { color: blue }"); |
michael@0 | 123 | is(bounce.cssRules.length, 3, "appendRule should append"); |
michael@0 | 124 | is(bounce.cssRules[2].keyText, "0%", "appendRule should append"); |
michael@0 | 125 | bounce.appendRule("from { color: blue }"); |
michael@0 | 126 | is(bounce.cssRules.length, 4, "appendRule should append"); |
michael@0 | 127 | is(bounce.cssRules[3].keyText, "0%", "appendRule should append"); |
michael@0 | 128 | bounce.appendRule("from { color: blue } to { color: green }"); |
michael@0 | 129 | is(bounce.cssRules.length, 4, "appendRule should ignore garbage at end"); |
michael@0 | 130 | |
michael@0 | 131 | </script> |
michael@0 | 132 | </pre> |
michael@0 | 133 | </body> |
michael@0 | 134 | </html> |