tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

integrity.html (1657B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>&lt;script> integrity="" with CSS modules</title>
      4 <link rel="help" href="https://html.spec.whatwg.org/multipage/#prepare-a-script">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 
      8 <script>
      9 window.matchesLog = [];
     10 window.matchesEvents = [];
     11 
     12 window.mismatchesLog = [];
     13 window.mismatchesEvents = [];
     14 </script>
     15 <script type="module" src="resources/integrity-matches.js" integrity="sha384-KtvB2Fgbhx2NAEizVeuGMa+QgvBzlBvVRxdpRnIECuGUvzzQsnVejyDL5J0fVP9M"  onload="window.matchesEvents.push('load');" onerror="window.matchesEvents.push('error')"></script>
     16 <script type="module" src="resources/integrity-mismatches.js" integrity="sha384-doesnotmatch" onload="window.mismatchesEvents.push('load');" onerror="window.mismatchesEvents.push('error')"></script>
     17 
     18 <script type="module">
     19 test(() => {
     20  assert_array_equals(window.matchesLog, ["integrity-matches,css:#test { background-color: rgb(255, 0, 0); }"], "The module and its dependency must have executed");
     21  assert_array_equals(window.matchesEvents, ["load"], "The load event must have fired");
     22 }, "The integrity attribute must be verified on the top-level of a module loading a CSS module and allow it to execute when it matches");
     23 
     24 test(() => {
     25  assert_array_equals(window.mismatchesLog, [], "The module and its dependency must not have executed");
     26  assert_array_equals(window.mismatchesEvents, ["error"], "The error event must have fired");
     27 }, "The integrity attribute must be verified on the top-level of a module loading a CSS module and not allow it to execute when there's a mismatch");
     28 </script>