mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
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:
parent
70df8122b1
commit
00cef330ef
Notes:
github-actions[bot]
2025-01-21 19:23:08 +00:00
Author: https://github.com/shannonbooth
Commit: 00cef330ef
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3303
Reviewed-by: https://github.com/tcl3 ✅
6 changed files with 146 additions and 22 deletions
42
Tests/LibWeb/Text/input/FileAPI/Blob-partitioning.html
Normal file
42
Tests/LibWeb/Text/input/FileAPI/Blob-partitioning.html
Normal 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>
|
Loading…
Add table
Add a link
Reference in a new issue