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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/prefetch/prefetch_added_after_onload.html

Issue 2751973005: Link prefetch fetches deferred until onload
Patch Set: Fixed post onload addition and crash Created 3 years, 9 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/prefetch/prefetch_deferred_after_onload.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/prefetch/prefetch_added_after_onload.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/prefetch/prefetch_added_after_onload.html b/third_party/WebKit/LayoutTests/http/tests/prefetch/prefetch_added_after_onload.html
new file mode 100644
index 0000000000000000000000000000000000000000..4c5472316c84647b6c7ecc9eb19db780c86fa2e4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/prefetch/prefetch_added_after_onload.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script>
+ var t = async_test('Makes sure that prefetched resources are downloaded when added after window.onload fired.');
+</script>
+<body>
+<script>
+ function loadedPrefetch() {
+ var entries = performance.getEntriesByType("resource");
+ for (var i = 0; i < entries.length; ++i) {
+ if (entries[i].name.indexOf("prefetch") != -1)
+ return true;
+ }
+ return false;
+ }
+ window.addEventListener("load", t.step_func(function() {
+ var link = document.createElement("link");
+ link.rel = "prefetch";
+ link.href = "../resources/slow-script.pl?delay=100;prefetch";
+ document.body.appendChild(link);
+ var loaded = loadedPrefetch();
+ assert_false(loaded);
+ t.step_timeout(function() {
+ assert_true(loadedPrefetch());
+ t.done();
+ }, 400);
+ }));
+</script>
+</body>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/prefetch/prefetch_deferred_after_onload.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698