OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 |
| 4 <head> |
| 5 <!-- Programmatically converted from a WebKit Reftest, please forgive result
ing idiosyncracies.--> |
| 6 <title>stylehash-allowed</title> |
| 7 <script src="/resources/testharness.js"></script> |
| 8 <script src="/resources/testharnessreport.js"></script> |
| 9 <script src="../support/logTest.sub.js?logs=[]"></script> |
| 10 <script> |
| 11 var t_alert = async_test('Expecting alerts: ["PASS (1/4): The \'#p1\' el
ement\'s text is green, which means the style was correctly applied.","PASS (2/4
): The \'#p2\' element\'s text is green, which means the style was correctly app
lied.","PASS (3/4): The \'#p3\' element\'s text is green, which means the style
was correctly applied.","PASS (4/4): The \'#p4\' element\'s text is green, which
means the style was correctly applied."]'); |
| 12 var expected_alerts = ["PASS (1/4): The '#p1' element's text is green, w
hich means the style was correctly applied.", "PASS (2/4): The '#p2' element's t
ext is green, which means the style was correctly applied.", "PASS (3/4): The '#
p3' element's text is green, which means the style was correctly applied.", "PAS
S (4/4): The '#p4' element's text is green, which means the style was correctly
applied."]; |
| 13 |
| 14 function alert_assert(msg) { |
| 15 t_alert.step(function() { |
| 16 if (msg.match(/^FAIL/i)) { |
| 17 assert_unreached(msg); |
| 18 t_alert.done(); |
| 19 } |
| 20 for (var i = 0; i < expected_alerts.length; i++) { |
| 21 if (expected_alerts[i] == msg) { |
| 22 assert_true(expected_alerts[i] == msg); |
| 23 expected_alerts.splice(i, 1); |
| 24 if (expected_alerts.length == 0) { |
| 25 t_alert.done(); |
| 26 } |
| 27 return; |
| 28 } |
| 29 } |
| 30 assert_unreached('unexpected alert: ' + msg); |
| 31 t_log.done(); |
| 32 }); |
| 33 } |
| 34 |
| 35 </script> |
| 36 <!-- enforcing policy: |
| 37 style-src 'sha256-pAKi9r4/WB7fHydbE3F3t8i8602ij2JN8zHJpL2T5BM=' 'sha256-hndjYvzU
zy2Ykuad81Cwsl1FOXX/qYs/aDVyUyNZwBw=' 'sha384-bSVm1i3sjPBRM4TwZtYTDjk9JxZMExYHWb
FmP1SxDhJH4ue0Wu9OPOkY5hcqRcSt' 'sha512-440MmBLtj9Kp5Bqloogn9BqGDylY8vFsv5/zXL1z
H2fJVssCoskRig4gyM+9KqwvCSapSz5CVoUGHQcxv43UQg=='; script-src 'self' 'unsafe-inl
ine'; connect-src 'self'; |
| 38 --> |
| 39 </head> |
| 40 |
| 41 <body> |
| 42 <p id="p1">This tests the result of a valid style hash. It passes if this te
xt is green, and a "PASS" alert for p1 is fired.</p> |
| 43 <p id="p2">This tests the result of a valid style hash. It passes if this te
xt is green, and a "PASS" alert for p2 is fired.</p> |
| 44 <p id="p3">This tests the result of a valid style hash. It passes if this te
xt is green, and a "PASS" alert for p3 is fired.</p> |
| 45 <p id="p4">This tests the result of a valid style hash. It passes if this te
xt is green, and a "PASS" alert for p4 is fired.</p> |
| 46 <style>p#p1 { color: green; }</style> |
| 47 <style>p#p2 { color: green; }</style> |
| 48 <style>p#p3 { color: green; }</style> |
| 49 <style>p#p4 { color: green; }</style> |
| 50 <script> |
| 51 var color = window.getComputedStyle(document.querySelector('#p1')).color
; |
| 52 if (color === "rgb(0, 128, 0)") |
| 53 alert_assert("PASS (1/4): The '#p1' element's text is green, which m
eans the style was correctly applied."); |
| 54 else |
| 55 alert_assert("FAIL (1/4): The '#p1' element's text is " + color + ",
which means the style was incorrectly applied."); |
| 56 var color = window.getComputedStyle(document.querySelector('#p2')).color
; |
| 57 if (color === "rgb(0, 128, 0)") |
| 58 alert_assert("PASS (2/4): The '#p2' element's text is green, which m
eans the style was correctly applied."); |
| 59 else |
| 60 alert_assert("FAIL (2/4): The '#p2' element's text is " + color + ",
which means the style was incorrectly applied."); |
| 61 var color = window.getComputedStyle(document.querySelector('#p3')).color
; |
| 62 if (color === "rgb(0, 128, 0)") |
| 63 alert_assert("PASS (3/4): The '#p3' element's text is green, which m
eans the style was correctly applied."); |
| 64 else |
| 65 alert_assert("FAIL (3/4): The '#p3' element's text is " + color + ",
which means the style was incorrectly applied."); |
| 66 var color = window.getComputedStyle(document.querySelector('#p4')).color
; |
| 67 if (color === "rgb(0, 128, 0)") |
| 68 alert_assert("PASS (4/4): The '#p4' element's text is green, which m
eans the style was correctly applied."); |
| 69 else |
| 70 alert_assert("FAIL (4/4): The '#p4' element's text is " + color + ",
which means the style was incorrectly applied."); |
| 71 |
| 72 </script> |
| 73 <div id="log"></div> |
| 74 <script async defer src="../support/checkReport.sub.js?reportExists=false"><
/script> |
| 75 </body> |
| 76 |
| 77 </html> |
OLD | NEW |