1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/test/file_bug503481b_inner.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,62 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<head> 1.7 +<!-- Async script that isn't preloaded --> 1.8 +<script async src="file_bug503481.sjs?blockOn=R&body=runFirst();"></script> 1.9 +<script> 1.10 +firstRan = false; 1.11 +secondRan = false; 1.12 +thirdRan = false; 1.13 +forthRan = false; 1.14 +function runFirst() { 1.15 + firstRan = true; 1.16 +} 1.17 +function runThird() { 1.18 + parent.is(forthRan, false, "forth should still be blocked"); 1.19 + unblock("T"); 1.20 + thirdRan = true; 1.21 +} 1.22 +function runForth() { 1.23 + forthRan = true; 1.24 +} 1.25 + 1.26 +function done() { 1.27 + parent.is(firstRan, true, "first should have run by onload"); 1.28 + parent.is(secondRan, true, "second should have run by onload"); 1.29 + parent.is(thirdRan, true, "third should have run by onload"); 1.30 + parent.is(forthRan, true, "forth should have run by onload"); 1.31 + parent.SimpleTest.finish(); 1.32 +} 1.33 + 1.34 +var reqs = []; 1.35 +function unblock(s) { 1.36 + xhr = new XMLHttpRequest(); 1.37 + xhr.open("GET", "file_bug503481.sjs?unblock=" + s); 1.38 + xhr.send(); 1.39 + reqs.push(xhr); 1.40 +} 1.41 + 1.42 + 1.43 +parent.is(firstRan, false, "First async script shouldn't have run"); 1.44 +unblock("R"); 1.45 +</script> 1.46 + 1.47 +<!-- test that inline async isn't actually async --> 1.48 +<script async> 1.49 +secondRan = true; 1.50 +</script> 1.51 +<script> 1.52 +parent.is(secondRan, true, "Second script shouldn't be async"); 1.53 +</script> 1.54 + 1.55 +<!-- test that setting both defer and async treats the script as async --> 1.56 +<script defer async src="file_bug503481.sjs?blockOn=S&body=runThird();"></script> 1.57 +<script> 1.58 +parent.is(thirdRan, false, "third should not have run yet"); 1.59 +unblock("S"); 1.60 +</script> 1.61 +<script src="file_bug503481.sjs?blockOn=T&body=runForth();"></script> 1.62 + 1.63 +</head> 1.64 + 1.65 +<body onload="done()">