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