ladybird/Tests/LibWeb/Text/input/FileAPI/Blob-partitioning.html
Shannon Booth 00cef330ef LibWeb: Partition Blob URL fetches by Storage Key
This was a security mechanism introduced in the fetch spec, with
supporting AOs added to the FileAPI spec.
2025-01-21 19:22:07 +00:00

42 lines
1.3 KiB
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": "*",
},
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>