content/base/test/file_bug503481b_inner.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <head>
     4 <!-- Async script that isn't preloaded -->
     5 <script async src="file_bug503481.sjs?blockOn=R&body=runFirst();"></script>
     6 <script>
     7 firstRan = false;
     8 secondRan = false;
     9 thirdRan = false;
    10 forthRan = false;
    11 function runFirst() {
    12   firstRan = true;
    13 }
    14 function runThird() {
    15   parent.is(forthRan, false, "forth should still be blocked");
    16   unblock("T");
    17   thirdRan = true;
    18 }
    19 function runForth() {
    20   forthRan = true;
    21 }
    23 function done() {
    24   parent.is(firstRan, true, "first should have run by onload");
    25   parent.is(secondRan, true, "second should have run by onload");
    26   parent.is(thirdRan, true, "third should have run by onload");
    27   parent.is(forthRan, true, "forth should have run by onload");
    28   parent.SimpleTest.finish();
    29 }
    31 var reqs = [];
    32 function unblock(s) {
    33   xhr = new XMLHttpRequest();
    34   xhr.open("GET", "file_bug503481.sjs?unblock=" + s);
    35   xhr.send();
    36   reqs.push(xhr);
    37 }
    40 parent.is(firstRan, false, "First async script shouldn't have run");
    41 unblock("R");
    42 </script>
    44 <!-- test that inline async isn't actually async -->
    45 <script async>
    46 secondRan = true;
    47 </script>
    48 <script>
    49 parent.is(secondRan, true, "Second script shouldn't be async");
    50 </script>
    52 <!-- test that setting both defer and async treats the script as async -->
    53 <script defer async src="file_bug503481.sjs?blockOn=S&body=runThird();"></script>
    54 <script>
    55 parent.is(thirdRan, false, "third should not have run yet");
    56 unblock("S");
    57 </script>
    58 <script src="file_bug503481.sjs?blockOn=T&body=runForth();"></script>
    60 </head>
    62 <body onload="done()">

mercurial