2017-01-03 19:20:52 +03:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<script src="/resources/testharness.js"></script>
|
|
|
|
<script src="/resources/testharnessreport.js"></script>
|
2017-02-16 01:30:36 +03:00
|
|
|
<script src="/preload/resources/preload_helper.js"></script>
|
2017-01-03 19:20:52 +03:00
|
|
|
<script>
|
|
|
|
var t = async_test('Makes sure that Link headers preload resources and block window.onload after resource discovery');
|
|
|
|
</script>
|
|
|
|
<body>
|
|
|
|
<style>
|
|
|
|
#background {
|
|
|
|
width: 200px;
|
|
|
|
height: 200px;
|
|
|
|
background-image: url(resources/square.png?background);
|
|
|
|
}
|
|
|
|
</style>
|
2017-07-10 16:06:05 +03:00
|
|
|
<link rel="stylesheet" href="resources/dummy.css?link-header-preload-delay-onload">
|
|
|
|
<script src="resources/dummy.js?link-header-preload-delay-onload"></script>
|
2017-01-03 19:20:52 +03:00
|
|
|
<div id="background"></div>
|
|
|
|
<script>
|
2017-07-10 16:06:05 +03:00
|
|
|
document.write('<img src="resources/square.png?link-header-preload-delay-onload">');
|
2017-01-03 19:20:52 +03:00
|
|
|
window.addEventListener("load", t.step_func(function() {
|
2017-02-16 01:30:36 +03:00
|
|
|
verifyPreloadAndRTSupport();
|
2017-01-03 19:20:52 +03:00
|
|
|
var entries = performance.getEntriesByType("resource");
|
|
|
|
var found_background_first = false;
|
|
|
|
for (var i = 0; i < entries.length; ++i) {
|
|
|
|
var entry = entries[i];
|
|
|
|
if (entry.name.indexOf("square") != -1) {
|
|
|
|
if (entry.name.indexOf("background") != -1)
|
|
|
|
found_background_first = true;
|
2017-02-16 01:30:36 +03:00
|
|
|
break;
|
2017-01-03 19:20:52 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
assert_true(found_background_first);
|
2017-07-10 16:06:05 +03:00
|
|
|
verifyNumberOfDownloads("resources/square.png?link-header-preload-delay-onload", 1);
|
2017-02-16 01:30:36 +03:00
|
|
|
verifyNumberOfDownloads("resources/square.png?background", 1);
|
2017-07-10 16:06:05 +03:00
|
|
|
verifyNumberOfDownloads("resources/dummy.js?link-header-preload-delay-onload", 1);
|
|
|
|
verifyNumberOfDownloads("resources/dummy.css?link-header-preload-delay-onload", 1);
|
2017-01-03 19:20:52 +03:00
|
|
|
t.done();
|
|
|
|
}));
|
|
|
|
</script>
|