Skip to content

Commit

Permalink
Make <link rel=preload as=style> not block onload incorrectly.
Browse files Browse the repository at this point in the history
And fix the only WPT for this while at it which was using the wrong URL
(and thus would always pass).

This actually makes me a bit uncomfortable given the amount of times
I've seen the pattern:

    <link href="important.css" rel="preload" as="style" onload="this.rel = 'stylesheet'">

As that means that important.css won't block the load event. But let's
try.

Differential Revision: https://phabricator.services.mozilla.com/D86049

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1657173
gecko-commit: d1e2ee395d42d652a84ce64be679cbe2048fa792
gecko-integration-branch: autoland
gecko-reviewers: mayhemer
  • Loading branch information
emilio authored and jgraham committed Sep 9, 2020
1 parent 3e6d145 commit 7ee662b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions preload/avoid-delaying-onload-link-preload-style.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/preload/resources/preload_helper.js"></script>
<script>
var t = async_test('Makes sure link preload preloaded resources are not delaying onload');
</script>
<link rel=preload href="resources/dummy.css?pipe=trickle(d5)" as=style>
<script>
window.addEventListener("load", t.step_func(function() {
verifyPreloadAndRTSupport();
verifyNumberOfResourceTimingEntries("resources/dummy.css?pipe=trickle(d5)", 0);
t.done();
}));
</script>
2 changes: 1 addition & 1 deletion preload/avoid-delaying-onload-link-preload.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<script>
window.addEventListener("load", t.step_func(function() {
verifyPreloadAndRTSupport();
verifyNumberOfResourceTimingEntries("/resources/dummy.js?pipe=trickle(d5)", 0);
verifyNumberOfResourceTimingEntries("resources/dummy.js?pipe=trickle(d5)", 0);
t.done();
}));
</script>

0 comments on commit 7ee662b

Please sign in to comment.