LibWeb/HTML: Enforce quota limit for local and session storage

Fixes a timeout/crash for the two commited WPT tests.
This commit is contained in:
Shannon Booth 2024-12-23 19:10:01 +13:00 committed by Andreas Kling
commit f3ecd23a21
Notes: github-actions[bot] 2025-01-02 10:39:50 +00:00
7 changed files with 74 additions and 8 deletions

View file

@ -0,0 +1,22 @@
<script src="../../include.js"></script>
<script>
// FIXME: This should be an import of WPT from webstorage/storage_local_setitem_quotaexceedederr.window.html
test(() => {
localStorage.clear();
var index = 0;
var key = "name";
var val = "x".repeat(1024);
try {
while (true) {
index++;
localStorage.setItem("" + key + index, "" + val + index);
}
} catch (e) {
println(e);
}
localStorage.clear();
});
</script>

View file

@ -0,0 +1,22 @@
<script src="../../include.js"></script>
<script>
// FIXME: This should be an import of WPT from webstorage/storage_session_setitem_quotaexceedederr.window.html
test(() => {
sessionStorage.clear();
var index = 0;
var key = "name";
var val = "x".repeat(1024);
try {
while (true) {
index++;
sessionStorage.setItem("" + key + index, "" + val + index);
}
} catch (e) {
println(e);
}
sessionStorage.clear();
});
</script>