Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-block1.html

Issue 1849223002: Blocking synchronous and third party doc.written scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added layout tests and review comments incorporation Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-block1.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-block1.html b/third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-block1.html
new file mode 100644
index 0000000000000000000000000000000000000000..800b86ed36b9662c487a189540a50c13c7ba4806
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-block1.html
@@ -0,0 +1,25 @@
+<!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');
+ var src = 'http://localhost:8000/loading/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>');
+</script>
+<script>
+ window.addEventListener("load", t.step_func(function() {
+ assert_false(jsLoaded, "third party and sync doc.written scripts are blocked");
Bryan McQuade 2016/04/05 12:46:11 For this and other tests, let's also assert that t
shivanisha 2016/04/05 20:37:14 It seems asserts provided by testharness.js only w
+ t.done();
+ }));
+ window.addEventListener('beforeunload', function() {
+ internals.setNetworkStateNotifierTestOnly(false);
+ internals.settings.setDisallowFetchForDocWrittenScriptsInMainFrame(false);
+ }, false);
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698