Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/utils.js"></script>
<script src="/common/dispatcher/dispatcher.js"></script>
<script src="../resources/utils.js"></script>
<script src="resources/utils.sub.js"></script>
<link rel="stylesheet" href="/css/cssom/support/black.css">
<body>
<script type="speculationrules">
{
"prefetch": [{
"where": { "href_matches": "*prefetch.py*" },
"eagerness":"immediate"
}]
}
</script>
<script>
setup(() => assertSpeculationRulesIsSupported());
promise_test(async t => {
const url = getPrefetchUrl();
addLink(url);
await new Promise(resolve => t.step_timeout(resolve, 2000));
assert_equals(await isUrlPrefetched(url), 1, 'URL should be prefetched');
}, 'Inline speculation rules script after an external stylesheet should work');
</script>
</body>
</html>