mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-27 20:41:58 +03:00
When calculating kvvfs sessionStorage/localStorage size, multiply it by 2 to account for JS using 16-bit characters.
FossilOrigin-Name: 52d1b185b9f6cee1eb3dec436f47e0f52e4621a127abfad8c27f92fd78147889
This commit is contained in:
@ -818,7 +818,7 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
||||
string (the default) then both are counted. Only storage keys
|
||||
which match the pattern used by kvvfs are counted. The returned
|
||||
value is the "length" value of every matching key and value,
|
||||
noting that the kvvf uses only ASCII keys and values.
|
||||
noting that JavaScript stores each character in 2 bytes.
|
||||
|
||||
Note that the returned size is not authoritative from the
|
||||
perspective of how much data can fit into localStorage and
|
||||
@ -839,7 +839,7 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
||||
}
|
||||
}
|
||||
});
|
||||
return sz;
|
||||
return sz * 2 /* because JS uses UC16 encoding */;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -77,7 +77,7 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
return sz;
|
||||
return sz * 2 /* for 16-bit-char encoding */;
|
||||
};
|
||||
const clearStorage = function(){
|
||||
sessionStorage.clear();
|
||||
|
Reference in New Issue
Block a user