layout/style/test/test_bug652486.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=652486
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 652486</title>
michael@0 8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 10 </head>
michael@0 11 <body>
michael@0 12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=652486">Mozilla Bug 652486</a>
michael@0 13
michael@0 14 <p id="display"></p>
michael@0 15 <div id="content" style="display: none">
michael@0 16 <div id="t"></div>
michael@0 17 </div>
michael@0 18 <pre id="test">
michael@0 19 <script class="testbody" type="text/javascript">
michael@0 20
michael@0 21 /** Test for Bug 652486 **/
michael@0 22
michael@0 23 function c() {
michael@0 24 return document.defaultView.getComputedStyle($('t'), "").
michael@0 25 getPropertyValue("text-decoration");
michael@0 26 }
michael@0 27
michael@0 28 function cval() {
michael@0 29 var val = document.defaultView.getComputedStyle($('t'), "").
michael@0 30 getPropertyCSSValue("text-decoration");
michael@0 31 return val ? val.getStringValue() : val;
michael@0 32 }
michael@0 33
michael@0 34 var tests = [
michael@0 35 // When only text-decoration was specified, text-decoration should look like
michael@0 36 // a longhand property.
michael@0 37 { decoration: "none",
michael@0 38 line: null, color: null, style: null,
michael@0 39 expectedValue: "none", expectedCSSValue: "none" },
michael@0 40 { decoration: "underline",
michael@0 41 line: null, color: null, style: null,
michael@0 42 expectedValue: "underline", expectedCSSValue: "underline" },
michael@0 43 { decoration: "overline",
michael@0 44 line: null, color: null, style: null,
michael@0 45 expectedValue: "overline", expectedCSSValue: "overline" },
michael@0 46 { decoration: "line-through",
michael@0 47 line: null, color: null, style: null,
michael@0 48 expectedValue: "line-through", expectedCSSValue: "line-through" },
michael@0 49 { decoration: "blink",
michael@0 50 line: null, color: null, style: null,
michael@0 51 expectedValue: "blink", expectedCSSValue: "blink" },
michael@0 52 { decoration: "underline overline",
michael@0 53 line: null, color: null, style: null,
michael@0 54 expectedValue: "underline overline",
michael@0 55 expectedCSSValue: "underline overline" },
michael@0 56 { decoration: "underline line-through",
michael@0 57 line: null, color: null, style: null,
michael@0 58 expectedValue: "underline line-through",
michael@0 59 expectedCSSValue: "underline line-through" },
michael@0 60 { decoration: "blink underline",
michael@0 61 line: null, color: null, style: null,
michael@0 62 expectedValue: "underline blink",
michael@0 63 expectedCSSValue: "underline blink" },
michael@0 64 { decoration: "underline blink",
michael@0 65 line: null, color: null, style: null,
michael@0 66 expectedValue: "underline blink",
michael@0 67 expectedCSSValue: "underline blink" },
michael@0 68
michael@0 69 // When only text-decoration-line or text-blink was specified,
michael@0 70 // text-decoration should look like a longhand property.
michael@0 71 { decoration: null,
michael@0 72 line: "blink", color: null, style: null,
michael@0 73 expectedValue: "blink", expectedCSSValue: "blink" },
michael@0 74 { decoration: null,
michael@0 75 line: "underline", color: null, style: null,
michael@0 76 expectedValue: "underline", expectedCSSValue: "underline" },
michael@0 77 { decoration: null,
michael@0 78 line: "overline", color: null, style: null,
michael@0 79 expectedValue: "overline", expectedCSSValue: "overline" },
michael@0 80 { decoration: null,
michael@0 81 line: "line-through", color: null, style: null,
michael@0 82 expectedValue: "line-through", expectedCSSValue: "line-through" },
michael@0 83 { decoration: null,
michael@0 84 line: "blink underline", color: null, style: null,
michael@0 85 expectedValue: "underline blink", expectedCSSValue: "underline blink" },
michael@0 86
michael@0 87 // When text-decoration-color isn't its initial value,
michael@0 88 // text-decoration should be a shorthand property.
michael@0 89 { decoration: "blink",
michael@0 90 line: null, color: "rgb(0, 0, 0)", style: null,
michael@0 91 expectedValue: "", expectedCSSValue: null },
michael@0 92 { decoration: "underline",
michael@0 93 line: null, color: "black", style: null,
michael@0 94 expectedValue: "", expectedCSSValue: null },
michael@0 95 { decoration: "overline",
michael@0 96 line: null, color: "#ff0000", style: null,
michael@0 97 expectedValue: "", expectedCSSValue: null },
michael@0 98 { decoration: "line-through",
michael@0 99 line: null, color: "initial", style: null,
michael@0 100 expectedValue: "line-through", expectedCSSValue: "line-through" },
michael@0 101 { decoration: "blink underline",
michael@0 102 line: null, color: "currentColor", style: null,
michael@0 103 expectedValue: "underline blink", expectedCSSValue: "underline blink" },
michael@0 104 { decoration: "underline line-through",
michael@0 105 line: null, color: "-moz-use-text-color", style: null,
michael@0 106 expectedValue: "underline line-through",
michael@0 107 expectedCSSValue: "underline line-through" },
michael@0 108
michael@0 109 // When text-decoration-style isn't its initial value,
michael@0 110 // text-decoration should be a shorthand property.
michael@0 111 { decoration: "blink",
michael@0 112 line: null, color: null, style: "-moz-none",
michael@0 113 expectedValue: "", expectedCSSValue: null },
michael@0 114 { decoration: "underline",
michael@0 115 line: null, color: null, style: "dotted",
michael@0 116 expectedValue: "", expectedCSSValue: null },
michael@0 117 { decoration: "overline",
michael@0 118 line: null, color: null, style: "dashed",
michael@0 119 expectedValue: "", expectedCSSValue: null },
michael@0 120 { decoration: "line-through",
michael@0 121 line: null, color: null, style: "double",
michael@0 122 expectedValue: "", expectedCSSValue: null },
michael@0 123 { decoration: "blink underline",
michael@0 124 line: null, color: null, style: "wavy",
michael@0 125 expectedValue: "", expectedCSSValue: null },
michael@0 126 { decoration: "underline blink overline line-through",
michael@0 127 line: null, color: null, style: "solid",
michael@0 128 expectedValue: "underline overline line-through blink",
michael@0 129 expectedCSSValue: "underline overline line-through blink" },
michael@0 130 { decoration: "line-through overline underline",
michael@0 131 line: null, color: null, style: "initial",
michael@0 132 expectedValue: "underline overline line-through",
michael@0 133 expectedCSSValue: "underline overline line-through" }
michael@0 134 ];
michael@0 135
michael@0 136 function makeDeclaration(aTest)
michael@0 137 {
michael@0 138 var str = "";
michael@0 139 if (aTest.decoration) {
michael@0 140 str += "text-decoration: " + aTest.decoration + "; ";
michael@0 141 }
michael@0 142 if (aTest.color) {
michael@0 143 str += "-moz-text-decoration-color: " + aTest.color + "; ";
michael@0 144 }
michael@0 145 if (aTest.line) {
michael@0 146 str += "-moz-text-decoration-line: " + aTest.line + "; ";
michael@0 147 }
michael@0 148 if (aTest.style) {
michael@0 149 str += "-moz-text-decoration-style: " + aTest.style + "; ";
michael@0 150 }
michael@0 151 return str;
michael@0 152 }
michael@0 153
michael@0 154 function clearStyleObject()
michael@0 155 {
michael@0 156 $('t').style.textDecoration = null;
michael@0 157 }
michael@0 158
michael@0 159 for (var i = 0; i < tests.length; ++i) {
michael@0 160 var test = tests[i];
michael@0 161 if (test.decoration) {
michael@0 162 $('t').style.textDecoration = test.decoration;
michael@0 163 }
michael@0 164 if (test.color) {
michael@0 165 $('t').style.MozTextDecorationColor = test.color;
michael@0 166 }
michael@0 167 if (test.line) {
michael@0 168 $('t').style.MozTextDecorationLine = test.line;
michael@0 169 }
michael@0 170 if (test.style) {
michael@0 171 $('t').style.MozTextDecorationStyle = test.style;
michael@0 172 }
michael@0 173
michael@0 174 var dec = makeDeclaration(test);
michael@0 175 is(c(), test.expectedValue, "Test1 (computed value): " + dec);
michael@0 176 is(cval(), test.expectedCSSValue, "Test1 (CSS value): " + dec);
michael@0 177
michael@0 178 clearStyleObject();
michael@0 179
michael@0 180 $('t').setAttribute("style", dec);
michael@0 181
michael@0 182 is(c(), test.expectedValue, "Test2 (computed value): " + dec);
michael@0 183 is(cval(), test.expectedCSSValue, "Test2 (CSS value): " + dec);
michael@0 184
michael@0 185 $('t').removeAttribute("style");
michael@0 186 }
michael@0 187
michael@0 188 </script>
michael@0 189 </pre>
michael@0 190 </body>
michael@0 191 </html>

mercurial