Automatic update from web-platform-tests [compression-dictionary] Add WPT test to ensure imagesrcset attribute is ignored. source set option is mentioned on [1] but really only used for [2], so it shouldn't interfer with rel=compression-dictionary. [1] https://html.spec.whatwg.org/multipage/semantics.html#create-link-options-from-element [2] https://html.spec.whatwg.org/multipage/links.html#link-type-preload:link-options-source-set Bug: 522338661, 40255884 Change-Id: I528c8b9a08859505863d647ef442414df521cfd7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8124456 Reviewed-by: Patrick Meenan <pmeenan@chromium.org> Commit-Queue: Frédéric Wang Nélar <fwang@igalia.com> Cr-Commit-Position: refs/heads/main@{#1664656} -- wpt-commits: 753696c188f12591469913adbf8e85ad692359b0 wpt-pr: 61413
42 lines
2.2 KiB
HTML
42 lines
2.2 KiB
HTML
<!DOCTYPE html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="timeout" content="long"/>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="./resources/compression-dictionary-util.sub.js"></script>
|
|
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#link-options-source-set">
|
|
<link rel="help" href="https://github.com/whatwg/html/pull/11620">
|
|
<link rel="preload" as="image" imagesrcset="/common/square.png?imagesrcsetPreloadWithoutHref 1x">
|
|
<link rel="preload" as="image" href="/common/square.png?hrefPreload" imagesrcset="/common/square.png?imagesrcsetPreloadWithHref 1x">
|
|
<link rel="compression-dictionary" imagesrcset="/common/square.png?imagesrcsetCompressionDictionaryWithoutHref 1x">
|
|
<link rel="compression-dictionary" href="./resources/register-dictionary.py?hrefCompressionDictionary" imagesrcset="/common/square.png?imagesrcsetCompressionDictionaryWithHref 1x">
|
|
<body>
|
|
<script>
|
|
let fetchedDictionaries = [];
|
|
const observer = new PerformanceObserver((list) => {
|
|
list.getEntries().forEach(entry => {
|
|
const url = new URL(entry.name);
|
|
if (url.pathname.endsWith("square.png") || url.pathname.endsWith("register-dictionary.py")) {
|
|
fetchedDictionaries.push(url.search);
|
|
}
|
|
});
|
|
});
|
|
observer.observe({ type: "resource", buffered: true });
|
|
|
|
compression_dictionary_promise_test(async t => {
|
|
let expectedEntries = [
|
|
"?hrefCompressionDictionary",
|
|
"?imagesrcsetPreloadWithHref",
|
|
"?imagesrcsetPreloadWithoutHref",
|
|
];
|
|
await t.step_wait(_ => fetchedDictionaries.length >= expectedEntries.length, `Expected fetches [${expectedEntries}] should have happened within 5s.`, 5000);
|
|
assert_array_equals(fetchedDictionaries.toSorted(), expectedEntries, "All <link rel=preload as=image> elements should fetch the image from imagesrcset and all <link rel=compression-dictionary> should fetch the dictionary specified by href.");
|
|
|
|
fetchedDictionaries = [];
|
|
await new Promise(resolve => t.step_timeout(resolve, 1000));
|
|
assert_equals(fetchedDictionaries.length, 0, "no more dictionary fetched.");
|
|
}, "imagesrcset is not supported on <link rel=compression-dictionary>");
|
|
</script>
|
|
</body>
|