mirror of
https://github.com/servo/servo.git
synced 2025-08-26 23:58:20 +01:00
net: Fix initial indexeddb version storage (#38836)
#38819 made a step in the right direction. Unfortunately sqlite doesn't support unsigned integers, so I've been storing them as i64s internally, but deserializing the bytes to u64s. This allows for an extra bit of information, but by inserting 0 into the table, it was interpreted `u64::from_ne_bytes([1,0,0,0....,0])` (or whatever the internal bit representation of `0_i64` is on the platform), which is not intended. Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
This commit is contained in:
parent
39f3ce7a2e
commit
cd5226adc2
1 changed files with 2 additions and 1 deletions
|
@ -125,10 +125,11 @@ impl SqliteEngine {
|
||||||
// From https://w3c.github.io/IndexedDB/#database-version:
|
// From https://w3c.github.io/IndexedDB/#database-version:
|
||||||
// "When a database is first created, its version is 0 (zero)."
|
// "When a database is first created, its version is 0 (zero)."
|
||||||
connection.execute(
|
connection.execute(
|
||||||
"INSERT INTO database (name, origin, version) VALUES (?, ?, 0)",
|
"INSERT INTO database (name, origin, version) VALUES (?, ?, ?)",
|
||||||
params![
|
params![
|
||||||
db_info.name.to_owned(),
|
db_info.name.to_owned(),
|
||||||
db_info.origin.to_owned().ascii_serialization(),
|
db_info.origin.to_owned().ascii_serialization(),
|
||||||
|
i64::from_ne_bytes(0_u64.to_ne_bytes())
|
||||||
],
|
],
|
||||||
)?;
|
)?;
|
||||||
Ok(connection)
|
Ok(connection)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue