1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +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:
stephan
2022-09-16 12:49:45 +00:00
parent 4c72171b60
commit 81439a07f0
4 changed files with 11 additions and 11 deletions

View File

@ -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 */;
};
/**

View File

@ -77,7 +77,7 @@
}
}
});
return sz;
return sz * 2 /* for 16-bit-char encoding */;
};
const clearStorage = function(){
sessionStorage.clear();