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.
This commit is contained in:
Shannon Booth 2025-01-19 19:02:18 +13:00 committed by Tim Ledbetter
commit 00cef330ef
Notes: github-actions[bot] 2025-01-21 19:23:08 +00:00
6 changed files with 146 additions and 22 deletions

View file

@ -0,0 +1,42 @@
<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>