tor-browser

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

async_005.htm (1703B)


      1 <!DOCTYPE html>
      2 <html>
      3    <head>
      4        <title>A script element with both async and defer set should execute asynchronously</title>
      5        <meta name="timeout" content="long">
      6        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
      7        <meta description="This test ensures a script element with both async and defer set should execute asynchronously." />
      8        <link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
      9        <link rel="help" href="https://html.spec.whatwg.org/multipage/#attr-script-async"/>
     10        <script src="/resources/testharness.js"></script>
     11        <script src="/resources/testharnessreport.js"></script>
     12    </head>
     13    <body>
     14 <div id=log></div>
     15        <script type="text/javascript">
     16        var t = async_test("A script element with both async and defer set should execute asynchronously");
     17 
     18        function timeout()
     19        {
     20            t.step(function(){
     21                var actual = document.getElementById("testresult").innerHTML;
     22                assert_in_array(actual, ["2134", "2341"]);
     23            });
     24            t.done();
     25        }
     26 
     27        var timer = setTimeout(timeout, 5000);
     28 
     29        function log(text)
     30        {
     31            var textNode = document.createTextNode(text);
     32            document.getElementById("testresult").appendChild(textNode);
     33        }
     34        </script>
     35 
     36        <span id="testresult"></span>
     37 
     38        <script type="text/javascript" src="log.py?sec=1&id=1" defer async></script>
     39        <script type="text/javascript">log('2');</script>
     40        <script type="text/javascript" src="log.py?sec=3&id=3"></script>
     41        <script type="text/javascript">log('4');</script>
     42    </body>
     43 </html>