tor-browser

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

nomodule-set-on-inline-module-script.html (930B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <title>An inline module script with nomodule must run</title>
      5 <link rel="author" title="Yusuke Suzuki" href="mailto:utatane.tea@gmail.com">
      6 <link rel="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
      7 <script src="/resources/testharness.js"></script>
      8 <script src="/resources/testharnessreport.js"></script>
      9 </head>
     10 <body>
     11 <script nomodule type="module">
     12 import Cocoa from "./resources/cocoa-module.js";
     13 var cocoa = new Cocoa();
     14 window.exportedCocoa = cocoa;
     15 </script>
     16 <script>
     17 
     18 waitForLoadEvent = new Promise((resolve) => {
     19    window.onload = resolve;
     20 });
     21 
     22 promise_test(() => {
     23    return waitForLoadEvent.then(() => {
     24        assert_equals(typeof cocoa, 'undefined');
     25        assert_equals(typeof exportedCocoa, 'object');
     26        assert_equals(exportedCocoa.taste(), 'awesome');
     27    });
     28 }, 'An inline module script with nomodule content attribute must run');
     29 
     30 </script>
     31 </body>
     32 </html>