OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
4 <script> | 4 <script> |
5 var src = 'http://localhost:8000/loading/resources/js-loaded.js'; | |
6 var jsLoaded = false; | |
7 var loadSuccess = false; | |
8 if (window.internals) { | 5 if (window.internals) { |
9 internals.settings.setDisallowFetchForDocWrittenScriptsInMainFrameOnSlow Connections(true); | 6 internals.settings.setDisallowFetchForDocWrittenScriptsInMainFrameOnSlow Connections(true); |
10 internals.setNetworkStateNotifierTestOnly(true); | 7 internals.setNetworkStateNotifierTestOnly(true); |
11 internals.setNetworkConnectionInfo('cellular3g', 2.0); | 8 internals.setNetworkConnectionInfo('cellular2g', 1.0); |
12 internals.evictAllResources(); | 9 internals.evictAllResources(); |
13 | 10 |
11 // Reset the state of the singleton network state notifier. | |
14 window.addEventListener('beforeunload', function() { | 12 window.addEventListener('beforeunload', function() { |
13 internals.settings.setDisallowFetchForDocWrittenScriptsInMainFrameOn SlowConnections(false); | |
15 internals.setNetworkStateNotifierTestOnly(false); | 14 internals.setNetworkStateNotifierTestOnly(false); |
16 internals.settings.setDisallowFetchForDocWrittenScriptsInMainFrameOn SlowConnections(false); | |
17 }, false); | 15 }, false); |
18 } | 16 } |
19 document.write('<scr' + 'ipt src="' + src + '" onload="loadSuccess=true"></s cr' + 'ipt>'); | 17 |
18 var crossOrigin = 'http://localhost:8000' | |
19 var filePath = '/loading/resources/js-loaded.js' | |
20 var jsLoaded = false; | |
21 var loadSuccess = false; | |
22 | |
23 // First time the script will be blocked and onError will reload the page. | |
24 // On reload the script should not be blocked and thus the subsequent assert s | |
25 // will be true. | |
26 // forceReload(true) sets the reload to bypass cache. | |
27 src = crossOrigin + filePath; | |
28 document.write('<scr' + 'ipt src="' + src + '" onload="loadSuccess=true" onE rror="internals.forceReload(true)"></scr' + 'ipt>'); | |
jkarlin
2016/04/13 18:38:36
This whole file is a copy of the other except for
shivanisha
2016/04/14 17:59:55
done.
| |
20 </script> | 29 </script> |
30 | |
21 <script> | 31 <script> |
22 test(function () { | 32 test(function () { |
23 assert_true(jsLoaded); | 33 assert_true(jsLoaded); |
24 assert_true(loadSuccess); | 34 assert_true(loadSuccess); |
25 }, "Document.written scripts are not blocked in a fast connection"); | 35 }, "cross origin doc.written scripts are not blocked in a page reload"); |
26 </script> | 36 </script> |
OLD | NEW |