aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api/sqlite3-api-prologue.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2022-09-16 12:49:45 +0000
committerstephan <stephan@noemail.net>2022-09-16 12:49:45 +0000
commit81439a07f01ddb8e72b6fd3c4d0a0f6ca345d38c (patch)
tree0b335543b9475057afdd5220542e6b1230e21b83 /ext/wasm/api/sqlite3-api-prologue.js
parent4c72171b60aa55475f1c4963d96ed7cfd3634bee (diff)
downloadsqlite-81439a07f01ddb8e72b6fd3c4d0a0f6ca345d38c.tar.gz
sqlite-81439a07f01ddb8e72b6fd3c4d0a0f6ca345d38c.zip
When calculating kvvfs sessionStorage/localStorage size, multiply it by 2 to account for JS using 16-bit characters.
FossilOrigin-Name: 52d1b185b9f6cee1eb3dec436f47e0f52e4621a127abfad8c27f92fd78147889
Diffstat (limited to 'ext/wasm/api/sqlite3-api-prologue.js')
-rw-r--r--ext/wasm/api/sqlite3-api-prologue.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/wasm/api/sqlite3-api-prologue.js b/ext/wasm/api/sqlite3-api-prologue.js
index 3d6d4c92b..1fc533da6 100644
--- a/ext/wasm/api/sqlite3-api-prologue.js
+++ b/ext/wasm/api/sqlite3-api-prologue.js
@@ -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 */;
};
/**