mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +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.
45 lines
1.4 KiB
HTML
45 lines
1.4 KiB
HTML
<!DOCTYPE html>
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
asyncTest(async (done) => {
|
|
try {
|
|
const httpServer = httpTestServer();
|
|
const url = await httpServer.createEcho("GET", "/blob-partitioned-fetched", {
|
|
status: 200,
|
|
headers: {
|
|
"Access-Control-Allow-Origin": "*",
|
|
"Content-Type": "text/html",
|
|
},
|
|
body: `
|
|
<script>
|
|
const blob = new Blob(["Hello, world!"], { type: "text/plain" });
|
|
const blobURL = URL.createObjectURL(blob);
|
|
window.parent.postMessage(blobURL, "*");
|
|
<\/script>
|
|
`
|
|
});
|
|
|
|
const options = {
|
|
method: 'GET',
|
|
mode: 'no-cors'
|
|
};
|
|
window.addEventListener("message", async (event) => {
|
|
const blobURL = event.data;
|
|
try {
|
|
const response = await fetch(blobURL, options);
|
|
} catch (e) {
|
|
println(e);
|
|
}
|
|
done();
|
|
});
|
|
|
|
const iframe = document.getElementById("testIframe");
|
|
iframe.src = url;
|
|
|
|
} catch (err) {
|
|
console.log("FAIL - " + err);
|
|
}
|
|
});
|
|
</script>
|
|
<iframe id="testIframe" src="about:blank"></iframe>
|