mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 17:55:07 +02:00
Currently these tests work, because we are lucky to have fetched response body available in `load_document()` to correctly sniff the MIME type. This is a preparation for upcoming change that makes fetching unbuffered, which will break these test unless we explicitly set the `Content-Type` header.
40 lines
1.3 KiB
HTML
40 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
asyncTest(async (done) => {
|
|
const httpServer = httpTestServer();
|
|
const url = await httpServer.createEcho("GET", "/http-content-language-test", {
|
|
status: 200,
|
|
headers: {
|
|
"Access-Control-Allow-Origin": "*",
|
|
"Access-Control-Expose-Headers": "Content-Language",
|
|
"Content-Language": "ko",
|
|
"Content-Type": "text/html",
|
|
},
|
|
body: `
|
|
<style>
|
|
div { width: 50px; }
|
|
#box:lang(ko) { width: 100px; }
|
|
</style>
|
|
<body><div id="box">TEST</div></body>
|
|
<script>
|
|
if (document.getElementById("box").offsetWidth == 100) {
|
|
parent.postMessage("OK", "*")
|
|
} else {
|
|
parent.postMessage("FAIL", "*")
|
|
}
|
|
<\/script>`,
|
|
});
|
|
|
|
const frame = document.createElement('iframe');
|
|
frame.src = url;
|
|
|
|
addEventListener("message", (event) => {
|
|
println(event.data);
|
|
done();
|
|
}, false);
|
|
|
|
document.body.appendChild(frame);
|
|
});
|
|
</script>
|