Automatic update from web-platform-tests [compression dictionary] Add WPT test to check fetch timing for Link header and <link> element. This is currently not specified but there some discussions happening at https://github.com/whatwg/html/pull/11620 and this is important for performance reasons. Bug: 522338661, 40255884 Change-Id: Id1494aa3693b24afaf75dae4e0f5ef5909fce9e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7922747 Commit-Queue: Frédéric Wang Nélar <fwang@igalia.com> Reviewed-by: Patrick Meenan <pmeenan@chromium.org> Reviewed-by: Kent Tamura <tkent@chromium.org> Cr-Commit-Position: refs/heads/main@{#1655866} -- wpt-commits: b62d7567fd2df9b5a40788a2e9a42f9de756fc21 wpt-pr: 61030
33 lines
1.3 KiB
HTML
33 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<script>
|
|
let timedEntries = [];
|
|
const observer = new PerformanceObserver((list) => {
|
|
list.getEntries().forEach(entry => {
|
|
const url = new URL(entry.name);
|
|
timedEntries.push({pathname: url.pathname, search: url.search, time: entry.fetchStart});
|
|
});
|
|
});
|
|
observer.observe({ type: "resource", buffered: true});
|
|
</script>
|
|
<link rel="compression-dictionary" href="./register-dictionary.py?linkElement">
|
|
<link rel="stylesheet" href="/html/semantics/document-metadata/interactions-of-styling-and-scripting/stylesheet.py?delay=1">
|
|
<script src="/common/utils.js"></script>
|
|
<img src="/images/wide-gamut-pattern.png"/>
|
|
<script>
|
|
window.addEventListener("load", _ => {
|
|
timedEntries.push({name: "load event", time: performance.now()});
|
|
function waitForDictionaryLoad() {
|
|
if (timedEntries.find(e => e.search === "?linkHeader") &&
|
|
timedEntries.find(e => e.search === "?linkElement")) {
|
|
let sortedEvents = timedEntries.
|
|
sort((entry1, entry2) => entry1.time - entry2.time).
|
|
map(entry => entry.name || entry.pathname + entry.search);
|
|
window.parent.postMessage({sortedEvents});
|
|
return;
|
|
}
|
|
(window.requestIdleCallback || requestAnimationFrame)(waitForDictionaryLoad);
|
|
}
|
|
waitForDictionaryLoad();
|
|
});
|
|
</script>
|