forked from mirrors/gecko-dev
Backed out 2 changesets (bug 1711622) for causing reftest failures on accept-image-catchall.html. CLOSED TREE
Backed out changeset 877d9c37605a (bug 1711622) Backed out changeset c315e89b6e4b (bug 1711622)
This commit is contained in:
parent
a26386f006
commit
7af8c65261
5 changed files with 13 additions and 32 deletions
|
|
@ -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,image/png,image/svg+xml,*/*;q=0.8",
|
||||
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
||||
"Accept-Language: " + navigator.languages.join(",") + ";q=0.5",
|
||||
"Accept-Encoding: gzip, deflate",
|
||||
"Connection: keep-alive",
|
||||
|
|
|
|||
|
|
@ -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/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5"
|
||||
"image/webp,*/*"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,7 @@ function handleRequest(request, response) {
|
|||
file.append("test");
|
||||
file.append("mochitest");
|
||||
|
||||
if (
|
||||
request.getHeader("Accept") ==
|
||||
"image/avif,image/webp,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5"
|
||||
) {
|
||||
if (request.getHeader("Accept") == "image/avif,image/webp,*/*") {
|
||||
file.append("blue.png");
|
||||
} else {
|
||||
file.append("red.png");
|
||||
|
|
|
|||
|
|
@ -216,33 +216,17 @@ static nsCString ImageAcceptHeader() {
|
|||
mimeTypes.Append("image/jxl,");
|
||||
}
|
||||
|
||||
mimeTypes.Append("image/webp,");
|
||||
|
||||
// Default value as specified by fetch standard
|
||||
// https://fetch.spec.whatwg.org/commit-snapshots/8dd73dbecfefdbef8f432164fb3a5b9785f7f520/#ref-for-header-list-contains%E2%91%A7
|
||||
mimeTypes.Append("image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5");
|
||||
mimeTypes.Append("image/webp,*/*");
|
||||
|
||||
return mimeTypes;
|
||||
}
|
||||
|
||||
static nsCString DocumentAcceptHeader() {
|
||||
// https://fetch.spec.whatwg.org/#document-accept-header-value
|
||||
// The value specified by the fetch standard is
|
||||
// `text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8`
|
||||
// but we also insert all of the image formats before */*
|
||||
nsCString mimeTypes("text/html,application/xhtml+xml,application/xml;q=0.9,");
|
||||
static nsCString DocumentAcceptHeader(const nsCString& aImageAcceptHeader) {
|
||||
nsPrintfCString mimeTypes(
|
||||
"text/html,application/xhtml+xml,application/xml;q=0.9,%s;q=0.8",
|
||||
aImageAcceptHeader.get());
|
||||
|
||||
if (mozilla::StaticPrefs::image_avif_enabled()) {
|
||||
mimeTypes.Append("image/avif,");
|
||||
}
|
||||
|
||||
if (mozilla::StaticPrefs::image_jxl_enabled()) {
|
||||
mimeTypes.Append("image/jxl,");
|
||||
}
|
||||
|
||||
mimeTypes.Append("image/webp,image/png,image/svg+xml,*/*;q=0.8");
|
||||
|
||||
return mimeTypes;
|
||||
return std::move(mimeTypes);
|
||||
}
|
||||
|
||||
nsHttpHandler::nsHttpHandler()
|
||||
|
|
@ -251,7 +235,7 @@ nsHttpHandler::nsHttpHandler()
|
|||
PR_SecondsToInterval(StaticPrefs::network_http_http2_timeout())),
|
||||
mResponseTimeout(PR_SecondsToInterval(300)),
|
||||
mImageAcceptHeader(ImageAcceptHeader()),
|
||||
mDocumentAcceptHeader(DocumentAcceptHeader()),
|
||||
mDocumentAcceptHeader(DocumentAcceptHeader(ImageAcceptHeader())),
|
||||
mLastUniqueID(NowInSeconds()),
|
||||
mDebugObservations(false),
|
||||
mEnableAltSvc(false),
|
||||
|
|
@ -1763,7 +1747,7 @@ void nsHttpHandler::PrefsChanged(const char* pref) {
|
|||
}
|
||||
|
||||
if (userSetDocumentAcceptHeader.IsEmpty()) {
|
||||
mDocumentAcceptHeader.Assign(DocumentAcceptHeader());
|
||||
mDocumentAcceptHeader.Assign(DocumentAcceptHeader(mImageAcceptHeader));
|
||||
} else {
|
||||
mDocumentAcceptHeader.Assign(userSetDocumentAcceptHeader);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,image/png,image/svg+xml,*/*;q=0.8");
|
||||
test_last_request_and_continue("iframe", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;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,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5");
|
||||
test_last_request_and_continue("image", "image/avif,image/webp,*/*");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue