Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-block.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-block.html b/third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-block.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7e4457b377b1b317b648efb15a137fc60bdef150 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-block.html |
| @@ -0,0 +1,24 @@ |
| +<!DOCTYPE html> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script> |
| + var t = async_test('Makes sure synchronous third-party scripts in document.write are blocked'); |
|
Bryan McQuade
2016/04/05 12:46:11
Since these scripts are loaded synchronously you m
shivanisha
2016/04/05 20:37:14
Sounds good. changing to sync.
|
| + var src = './resources/js-loaded.js'; |
| + var jsLoaded = false; |
| + if (window.internals){ |
| + internals.settings.setDisallowFetchForDocWrittenScriptsInMainFrame(true); |
| + internals.setNetworkStateNotifierTestOnly(true); |
| + internals.setNetworkConnectionInfo('cellular2g', 2.0); |
| + } |
| + document.write('<scr' + 'ipt src="' + src + '"></scr' + 'ipt>'); |
|
Bryan McQuade
2016/04/05 12:46:11
though it makes the test a bit longer, i tend to l
shivanisha
2016/04/05 20:37:14
sounds good. Added 4 tests in 1 html file:
cross
|
| +</script> |
| +<script> |
| + window.addEventListener("load", t.step_func(function() { |
| + assert_true(jsLoaded, "Same domain doc.written scripts are not blocked"); |
| + t.done(); |
| + })); |
| + window.addEventListener('beforeunload', function() { |
| + internals.setNetworkStateNotifierTestOnly(false); |
| + internals.settings.setDisallowFetchForDocWrittenScriptsInMainFrame(false); |
| + }, false); |
| +</script> |