tor-browser

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

file_script_module.html (1240B)


      1 <html>
      2 <body>
      3  <script>
      4 // Helper methods.
      5 function ok(a, msg) {
      6  parent.postMessage({ check: !!a, msg }, "*")
      7 }
      8 
      9 function is(a, b, msg) {
     10  ok(a === b, msg);
     11 }
     12 
     13 function finish() {
     14  parent.postMessage({ done: true }, "*");
     15 }
     16  </script>
     17 
     18  <script id="a" nomodule>42</script>
     19  <script id="b">42</script>
     20  <script>
     21 // Let's test the behavior of nomodule attribute and noModule getter/setter.
     22 var a = document.getElementById("a");
     23 is(a.noModule, true, "HTMLScriptElement with nomodule attribute has noModule set to true");
     24 a.removeAttribute("nomodule");
     25 is(a.noModule, false, "HTMLScriptElement without nomodule attribute has noModule set to false");
     26 a.noModule = true;
     27 ok(a.hasAttribute('nomodule'), "HTMLScriptElement.noModule = true add the nomodule attribute");
     28 
     29 var b = document.getElementById("b");
     30 is(b.noModule, false, "HTMLScriptElement without nomodule attribute has noModule set to false");
     31 b.noModule = true;
     32 ok(b.hasAttribute('nomodule'), "HTMLScriptElement.noModule = true add the nomodule attribute");
     33  </script>
     34 
     35  <script>var foo = 42;</script>
     36  <script nomodule>foo = 43;</script>
     37  <script>
     38 is(foo, 42, "nomodule HTMLScriptElements should not be executed in modern browsers");
     39 finish();
     40  </script>
     41 </body>
     42 </html>