// All the requests are sent to test_accept_header.sjs which will return
// different content based on the queryString. When the queryString is 'get',
// test_accept_header.sjs returns a JSON object with the latest request and its
// accept header value.
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,*/*;q=0.8");
};
document.body.appendChild(ifr);
}
function test_image() {
let i = new 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");
}
}
function test_style() {
let head = document.getElementsByTagName("head")[0];
let link = document.createElement("link"); link.rel = "stylesheet"; link.type = "text/css"; link.href = "test_accept_header.sjs?style"; link.onload = () => {
test_last_request_and_continue("style", "text/css,*/*;q=0.1");
}; head.appendChild(link);
}
function test_worker() {
let w = new Worker("test_accept_header.sjs?worker");
w.onmessage = function() {
test_last_request_and_continue("worker", "*/*");
}
}
let tests = [
test_iframe,
test_image,
test_style,
test_worker,
];
function next() {
if (!tests.length) {
SimpleTest.finish();
return;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.