| Index: third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-block-all-conn-types.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-block-all-conn-types.html b/third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-block-all-conn-types.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c2f0e4b49f66989f0e9c8d2c3390936d22312eb2
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-block-all-conn-types.html
|
| @@ -0,0 +1,45 @@
|
| +<!DOCTYPE html>
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
| +<script>
|
| + var src = 'http://localhost:8000/loading/resources/js-loaded.js';
|
| + var jsLoaded = false;
|
| + var loadSuccess = false;
|
| + var loadFailed = false;
|
| + document.write('<scr' + 'ipt src="' + src + '?a" onload="loadSuccess=true" onError="loadFailed=true"></scr' + 'ipt>');
|
| +</script>
|
| +
|
| +<script>
|
| + test(function () {
|
| + assert_true(jsLoaded);
|
| + assert_true(loadSuccess);
|
| + assert_false(loadFailed);
|
| + }, "Document.written scripts are not blocked by default.");
|
| +</script>
|
| +
|
| +<script>
|
| + if (window.internals) {
|
| + internals.settings.setDisallowFetchForDocWrittenScriptsInMainFrame(true);
|
| + internals.setNetworkStateNotifierTestOnly(true);
|
| + internals.setNetworkConnectionInfo('wifi', 2.0);
|
| + internals.evictAllResources();
|
| +
|
| + window.addEventListener('beforeunload', function() {
|
| + internals.setNetworkStateNotifierTestOnly(false);
|
| + internals.settings.setDisallowFetchForDocWrittenScriptsInMainFrame(false);
|
| + }, false);
|
| + }
|
| + jsLoaded = false;
|
| + loadSuccess = false;
|
| + loadFailed = false;
|
| + // Append a distinct query string to the URL to avoid hitting the cache.
|
| + // doc.written scripts are only blocked if they are not in cache.
|
| + document.write('<scr' + 'ipt src="' + src + '?b" onload="loadSuccess=true" onError="loadFailed=true"></scr' + 'ipt>');
|
| +</script>
|
| +<script>
|
| + test(function () {
|
| + assert_false(jsLoaded);
|
| + assert_false(loadSuccess);
|
| + assert_true(loadFailed);
|
| + }, "Document.written scripts are blocked on all connections when disallowFetchForDocWrittenScriptsInMainFrame is specified.");
|
| +</script>
|
|
|