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

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

Issue 1849223002: Blocking synchronous and third party doc.written scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolved conflicts with latest 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-conn-type.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/preload/meta-viewport-link-headers.html b/third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-conn-type.html
similarity index 17%
copy from third_party/WebKit/LayoutTests/http/tests/preload/meta-viewport-link-headers.html
copy to third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-conn-type.html
index 947bb3fdc020e21ec0663bfeb83248b0fb4b19c9..99854a8d8ca5a0b54c12469b6e7e813d523a2b74 100644
--- a/third_party/WebKit/LayoutTests/http/tests/preload/meta-viewport-link-headers.html
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-conn-type.html
@@ -1,29 +1,27 @@
<!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;
if (window.internals) {
- window.internals.settings.setViewportEnabled(true);
- window.internals.settings.setViewportMetaEnabled(true);
- }
- if (window.testRunner) {
- testRunner.setCanOpenWindows(true);
- testRunner.setCloseRemainingWindowsWhenComplete(true);
+ internals.settings.setDisallowFetchForDocWrittenScriptsInMainFrame(true);
+ internals.setNetworkStateNotifierTestOnly(true);
+ internals.setNetworkConnectionInfo('cellular3g', 2.0);
+ internals.evictAllResources();
+
+ window.addEventListener('beforeunload', function() {
+ internals.setNetworkStateNotifierTestOnly(false);
+ internals.settings.setDisallowFetchForDocWrittenScriptsInMainFrame(false);
+ }, false);
}
+ document.write('<scr' + 'ipt src="' + src + '" onload="loadSuccess=true"></scr' + 'ipt>');
</script>
-<meta name="viewport" content="width=160">
-<script src="../resources/testharness.js"></script>
-<script src="../resources/testharnessreport.js"></script>
<script>
- var t = async_test('Makes sure that Link headers support the media attribute and respond to <meta content=viewport>');
- addEventListener("message", t.step_func(function(event) {
- if (event.data == "largeloaded")
- assert_unreached("FAIL: large resource was loaded");
- if (event.data == "smallnotloaded")
- assert_unreached("FAIL: small resource was not loaded");
- t.done();
- }, false));
- var w = window.open("resources/media-link-headers.php");
- if (w.internals) {
- w.internals.settings.setViewportEnabled(true);
- w.internals.settings.setViewportMetaEnabled(true);
- }
+ test(function () {
+ assert_true(jsLoaded);
+ assert_true(loadSuccess);
+ }, "Document.written scripts are not blocked in a fast connection");
+
</script>

Powered by Google App Engine
This is Rietveld 408576698