mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
[IndexedDB] Fix upgrade version operation (#37653)
Rejects version upgrade if the upgraded version is lower than the current database version. Also returns the actual version instead of the requested upgrade version. Testing: WPT tests might cover this Fixes: #25322 Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
This commit is contained in:
parent
94a7428912
commit
2265570c88
1 changed files with 8 additions and 7 deletions
|
@ -319,13 +319,14 @@ impl IndexedDBManager {
|
|||
},
|
||||
SyncOperation::UpgradeVersion(sender, origin, db_name, _txn, version) => {
|
||||
if let Some(db) = self.get_database_mut(origin, db_name) {
|
||||
db.version = version;
|
||||
};
|
||||
|
||||
// FIXME:(arihant2math) Get the version from the database instead
|
||||
// We never fail as of now, so we can just return it like this
|
||||
// for now...
|
||||
sender.send(Ok(version)).expect("Could not upgrade version");
|
||||
if version > db.version {
|
||||
db.version = version;
|
||||
}
|
||||
// erroring out if the version is not upgraded can be and non-replicable
|
||||
let _ = sender.send(Ok(db.version));
|
||||
} else {
|
||||
let _ = sender.send(Err(()));
|
||||
}
|
||||
},
|
||||
SyncOperation::CreateObjectStore(
|
||||
sender,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue