1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-29 16:30:56 -05:00

fix(webstorage): increase localStorage limit to 10MB (#11081)

This commit is contained in:
Yasser A.Idrissi 2021-06-23 10:59:08 +01:00 committed by Ryan Dahl
parent 99dc674a36
commit 843b5476ba

View file

@ -15,6 +15,8 @@ use std::path::PathBuf;
#[derive(Clone)]
struct OriginStorageDir(PathBuf);
const MAX_STORAGE_BYTES: u32 = 10 * 1024 * 1024;
pub fn init(origin_storage_dir: Option<PathBuf>) -> Extension {
Extension::builder()
.js(include_js_files!(
@ -136,7 +138,7 @@ pub fn op_webstorage_set(
conn.prepare("SELECT SUM(pgsize) FROM dbstat WHERE name = 'data'")?;
let size: u32 = stmt.query_row(params![], |row| row.get(0))?;
if size >= 5000000 {
if size >= MAX_STORAGE_BYTES {
return Err(
deno_web::DomExceptionQuotaExceededError::new(
"Exceeded maximum storage size",