content/base/test/csp/file_CSP_inlinestyle_main_spec_compliant.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/csp/file_CSP_inlinestyle_main_spec_compliant.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,79 @@
     1.4 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
     1.5 +<html>
     1.6 +  <head>
     1.7 +    <title>CSP inline script tests</title>
     1.8 +    <!-- content= "div#linkstylediv { color: #0f0; }" -->
     1.9 +    <link rel="stylesheet" type="text/css"
    1.10 +          href='file_CSP.sjs?type=text/css&content=div%23linkstylediv%20%7B%20color%3A%20%230f0%3B%20%7D' />
    1.11 +    <!-- content= "div#modifycsstextdiv { color: #0f0; }" -->
    1.12 +    <link rel="stylesheet" type="text/css"
    1.13 +          href='file_CSP.sjs?type=text/css&content=div%23modifycsstextdiv%20%7B%20color%3A%20%23f00%3B%20%7D' />
    1.14 +    <script>
    1.15 +      function cssTest() {
    1.16 +        var elem = document.getElementById('csstextstylediv');
    1.17 +        elem.style.cssText = "color: #00FF00;";
    1.18 +        getComputedStyle(elem, null).color;
    1.19 +
    1.20 +        document.styleSheets[1].cssRules[0].style.cssText = "color: #00FF00;";
    1.21 +        elem = document.getElementById('modifycsstextdiv');
    1.22 +        getComputedStyle(elem, null).color;
    1.23 +      }
    1.24 +    </script>
    1.25 +  </head>
    1.26 +  <body onload='cssTest()'>
    1.27 +
    1.28 +    <style type="text/css">
    1.29 +      div#inlinestylediv {
    1.30 +        color: #FF0000;
    1.31 +      }
    1.32 +    </style>
    1.33 +
    1.34 +    <div id='linkstylediv'>Link tag (external) stylesheet test (should be green)</div>
    1.35 +    <div id='inlinestylediv'>Inline stylesheet test (should be black)</div>
    1.36 +    <div id='attrstylediv' style="color: #FF0000;">Attribute stylesheet test (should be black)</div>
    1.37 +    <div id='csstextstylediv'>cssText test (should be black)</div>
    1.38 +    <div id='modifycsstextdiv'> modify rule from style sheet via cssText(should be green) </div>
    1.39 +
    1.40 +    <!-- tests for SMIL stuff - animations -->
    1.41 +    <svg xmlns="http://www.w3.org/2000/svg"
    1.42 +         xmlns:xlink="http://www.w3.org/1999/xlink"
    1.43 +         width="100%"
    1.44 +         height="100px">
    1.45 +
    1.46 +      <!-- Animates XML attribute, which is mapped into style. -->
    1.47 +      <text id="xmlTest" x="0" y="15">
    1.48 +         This shouldn't be red since the animation should be blocked by CSP.
    1.49 +
    1.50 +        <animate attributeName="fill" attributeType="XML"
    1.51 +                  values="red;orange;red" dur="2s"
    1.52 +                  repeatCount="indefinite" />
    1.53 +      </text>
    1.54 +
    1.55 +      <!-- Animates override value for CSS property. -->
    1.56 +      <text id="cssOverrideTest" x="0" y="35">
    1.57 +         This shouldn't be red since the animation should be blocked by CSP.
    1.58 +
    1.59 +        <animate attributeName="fill" attributeType="CSS"
    1.60 +                  values="red;orange;red" dur="2s"
    1.61 +                  repeatCount="indefinite" />
    1.62 +      </text>
    1.63 +
    1.64 +      <!-- Animates override value for CSS property targeted via ID. -->
    1.65 +      <text id="cssOverrideTestById" x="0" y="55">
    1.66 +         This shouldn't be red since the animation should be blocked by CSP.
    1.67 +      </text>
    1.68 +      <animate xlink:href="#cssOverrideTestById"
    1.69 +               attributeName="fill"
    1.70 +               values="red;orange;red"
    1.71 +               dur="2s" repeatCount="indefinite" />
    1.72 +
    1.73 +      <!-- Sets value for CSS property targeted via ID. -->
    1.74 +      <text id="cssSetTestById" x="0" y="75">
    1.75 +         This shouldn't be red since the &lt;set&gt; should be blocked by CSP.
    1.76 +      </text>
    1.77 +      <set xlink:href="#cssSetTestById"
    1.78 +               attributeName="fill"
    1.79 +               to="red" />
    1.80 +    </svg>
    1.81 +  </body>
    1.82 +</html>

mercurial