content/base/test/csp/file_CSP_inlinestyle_main_spec_compliant.html

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

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 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <title>CSP inline script tests</title>
michael@0 5 <!-- content= "div#linkstylediv { color: #0f0; }" -->
michael@0 6 <link rel="stylesheet" type="text/css"
michael@0 7 href='file_CSP.sjs?type=text/css&content=div%23linkstylediv%20%7B%20color%3A%20%230f0%3B%20%7D' />
michael@0 8 <!-- content= "div#modifycsstextdiv { color: #0f0; }" -->
michael@0 9 <link rel="stylesheet" type="text/css"
michael@0 10 href='file_CSP.sjs?type=text/css&content=div%23modifycsstextdiv%20%7B%20color%3A%20%23f00%3B%20%7D' />
michael@0 11 <script>
michael@0 12 function cssTest() {
michael@0 13 var elem = document.getElementById('csstextstylediv');
michael@0 14 elem.style.cssText = "color: #00FF00;";
michael@0 15 getComputedStyle(elem, null).color;
michael@0 16
michael@0 17 document.styleSheets[1].cssRules[0].style.cssText = "color: #00FF00;";
michael@0 18 elem = document.getElementById('modifycsstextdiv');
michael@0 19 getComputedStyle(elem, null).color;
michael@0 20 }
michael@0 21 </script>
michael@0 22 </head>
michael@0 23 <body onload='cssTest()'>
michael@0 24
michael@0 25 <style type="text/css">
michael@0 26 div#inlinestylediv {
michael@0 27 color: #FF0000;
michael@0 28 }
michael@0 29 </style>
michael@0 30
michael@0 31 <div id='linkstylediv'>Link tag (external) stylesheet test (should be green)</div>
michael@0 32 <div id='inlinestylediv'>Inline stylesheet test (should be black)</div>
michael@0 33 <div id='attrstylediv' style="color: #FF0000;">Attribute stylesheet test (should be black)</div>
michael@0 34 <div id='csstextstylediv'>cssText test (should be black)</div>
michael@0 35 <div id='modifycsstextdiv'> modify rule from style sheet via cssText(should be green) </div>
michael@0 36
michael@0 37 <!-- tests for SMIL stuff - animations -->
michael@0 38 <svg xmlns="http://www.w3.org/2000/svg"
michael@0 39 xmlns:xlink="http://www.w3.org/1999/xlink"
michael@0 40 width="100%"
michael@0 41 height="100px">
michael@0 42
michael@0 43 <!-- Animates XML attribute, which is mapped into style. -->
michael@0 44 <text id="xmlTest" x="0" y="15">
michael@0 45 This shouldn't be red since the animation should be blocked by CSP.
michael@0 46
michael@0 47 <animate attributeName="fill" attributeType="XML"
michael@0 48 values="red;orange;red" dur="2s"
michael@0 49 repeatCount="indefinite" />
michael@0 50 </text>
michael@0 51
michael@0 52 <!-- Animates override value for CSS property. -->
michael@0 53 <text id="cssOverrideTest" x="0" y="35">
michael@0 54 This shouldn't be red since the animation should be blocked by CSP.
michael@0 55
michael@0 56 <animate attributeName="fill" attributeType="CSS"
michael@0 57 values="red;orange;red" dur="2s"
michael@0 58 repeatCount="indefinite" />
michael@0 59 </text>
michael@0 60
michael@0 61 <!-- Animates override value for CSS property targeted via ID. -->
michael@0 62 <text id="cssOverrideTestById" x="0" y="55">
michael@0 63 This shouldn't be red since the animation should be blocked by CSP.
michael@0 64 </text>
michael@0 65 <animate xlink:href="#cssOverrideTestById"
michael@0 66 attributeName="fill"
michael@0 67 values="red;orange;red"
michael@0 68 dur="2s" repeatCount="indefinite" />
michael@0 69
michael@0 70 <!-- Sets value for CSS property targeted via ID. -->
michael@0 71 <text id="cssSetTestById" x="0" y="75">
michael@0 72 This shouldn't be red since the &lt;set&gt; should be blocked by CSP.
michael@0 73 </text>
michael@0 74 <set xlink:href="#cssSetTestById"
michael@0 75 attributeName="fill"
michael@0 76 to="red" />
michael@0 77 </svg>
michael@0 78 </body>
michael@0 79 </html>

mercurial