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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/loading/doc-write-async-third-party-script.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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/loading/doc-write-async-third-party-script-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/loading/doc-write-async-third-party-script.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/download_only_supported_stylesheet_types.html b/third_party/WebKit/LayoutTests/http/tests/loading/doc-write-async-third-party-script.html
similarity index 22%
copy from third_party/WebKit/LayoutTests/http/tests/loading/download_only_supported_stylesheet_types.html
copy to third_party/WebKit/LayoutTests/http/tests/loading/doc-write-async-third-party-script.html
index 3fc2d0632ccbcb83be17b480696ef84768162968..430d6eb4cc41507dc5ebfc4e65129a973360c49e 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/download_only_supported_stylesheet_types.html
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/doc-write-async-third-party-script.html
@@ -2,26 +2,27 @@
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>
- var t = async_test('Makes sure that unsupported stylesheet types are neither preloaded nor loaded');
- var cssLoaded = false;
+ var t = async_test('Cross origin but asynchronous doc.written scripts are not blocked');
+ var src = 'http://localhost:8000/loading/resources/js-loaded.js?2';
var jsLoaded = false;
- var noTypeLoaded = false;
+ var loadSuccess = false;
+ if (window.internals) {
+ internals.settings.setDisallowFetchForDocWrittenScriptsInMainFrame(true);
+ internals.setNetworkStateNotifierTestOnly(true);
+ internals.setNetworkConnectionInfo('cellular2g', 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" async></scr' + 'ipt>');
</script>
-<script src="../resources/slow-script.pl?delay=500"></script>
-<link rel=stylesheet href="../resources/dummy.css?1" type="text/css" onload="cssLoaded = true;">
-<link rel=stylesheet href="../resources/dummy.css?2" type="application/javascript" onload="jsLoaded = true;">
-<link rel=stylesheet href="../resources/dummy.css?3" onload="noTypeLoaded = true;">
<script>
window.addEventListener("load", t.step_func(function() {
- var entries = performance.getEntriesByType("resource");
- for (var i = 0; i < entries.length; ++i) {
- console.log(entries[i].name);
- }
- assert_equals(entries.length, 5);
- assert_true(cssLoaded, "text/css triggered load event");
- assert_false(jsLoaded, "application/javascript triggered load event");
- assert_true(noTypeLoaded, "no type triggered load event");
+ assert_true(loadSuccess, "Script loaded successfully");
+ assert_true(jsLoaded, "Cross origin but asynchronous doc.written scripts are not blocked");
t.done();
}));
</script>
-
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/loading/doc-write-async-third-party-script-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698