Bug 1711622 - Update tests r=necko-reviewers,devtools-reviewers,kershaw

Differential Revision: https://phabricator.services.mozilla.com/D203115
This commit is contained in:
Valentin Gosu 2024-05-20 11:53:58 +00:00
parent e1fec6aab6
commit d4e1eb0d58
4 changed files with 8 additions and 5 deletions

View File

@ -42,7 +42,7 @@ add_task(async function () {
`${method} ${SIMPLE_URL.split("example.com")[1]} ${httpVersion}`,
"Host: example.com",
"User-Agent: " + navigator.userAgent + "",
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8",
"Accept-Language: " + navigator.languages.join(",") + ";q=0.5",
"Accept-Encoding: gzip, deflate",
"Connection: keep-alive",

View File

@ -51,7 +51,7 @@ function expectedImageAcceptHeader() {
return (
(Services.prefs.getBoolPref("image.avif.enabled") ? "image/avif," : "") +
(Services.prefs.getBoolPref("image.jxl.enabled") ? "image/jxl," : "") +
"image/webp,*/*"
"image/webp,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5"
);
}

View File

@ -6,7 +6,10 @@ function handleRequest(request, response) {
file.append("test");
file.append("mochitest");
if (request.getHeader("Accept") == "image/avif,image/webp,*/*") {
if (
request.getHeader("Accept") ==
"image/avif,image/webp,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5"
) {
file.append("blue.png");
} else {
file.append("red.png");

View File

@ -26,7 +26,7 @@ function test_iframe() {
let ifr = document.createElement("iframe");
ifr.src = "test_accept_header.sjs?iframe";
ifr.onload = () => {
test_last_request_and_continue("iframe", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8");
test_last_request_and_continue("iframe", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8");
};
document.body.appendChild(ifr);
}
@ -36,7 +36,7 @@ function test_image() {
i.src = "test_accept_header.sjs?image";
i.onload = function() {
// Fetch spec says we should have: "image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5"
test_last_request_and_continue("image", "image/avif,image/webp,*/*");
test_last_request_and_continue("image", "image/avif,image/webp,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5");
}
}