Bug 504387 - Cache keys after creating/PUTting them instead of after GETting. r=thunder

Set the record manager for CryptoMetas, PubKeys, PrivKeys after uploading keys.
This commit is contained in:
Edward Lee 2009-07-16 23:13:58 -07:00
parent fd0528fc6b
commit baa48207f2
2 changed files with 6 additions and 0 deletions

View File

@ -297,6 +297,9 @@ SyncEngine.prototype = {
meta.addUnwrappedKey(pubkey, symkey);
let res = new Resource(meta.uri);
res.put(meta.serialize());
// Cache the cryto meta that we just put on the server
CryptoMetas.set(meta.uri, meta);
}
// first sync special case: upload all items

View File

@ -712,7 +712,10 @@ WeaveSvc.prototype = {
let keys = PubKeys.createKeypair(passphrase, PubKeys.defaultKeyUri,
PrivKeys.defaultKeyUri);
try {
// Upload and cache the keypair
PubKeys.uploadKeypair(keys);
PubKeys.set(keys.pubkey.uri, keys.pubkey);
PrivKeys.set(keys.privkey.uri, keys.privkey);
return true;
} catch (e) {
this._setSyncFailure(KEYS_UPLOAD_FAIL);