Bug 549636 - Don't unnecessarily [wrap] cleartext for JSON.stringify [r=mconnor]

Remove the unnecessary indirection now that JSON.stringify can take strings.
This commit is contained in:
Edward Lee 2010-03-16 16:31:56 -07:00
parent 00f548581e
commit eca5bad2df

View File

@ -66,7 +66,7 @@ CryptoWrapper.prototype = {
let meta = CryptoMetas.get(this.encryption);
let symkey = meta.getKey(privkey, passphrase);
this.ciphertext = Svc.Crypto.encrypt(JSON.stringify([this.cleartext]),
this.ciphertext = Svc.Crypto.encrypt(JSON.stringify(this.cleartext),
symkey, meta.bulkIV);
this.cleartext = null;
},
@ -82,9 +82,8 @@ CryptoWrapper.prototype = {
let meta = CryptoMetas.get(this.encryption);
let symkey = meta.getKey(privkey, passphrase);
// note: payload is wrapped in an array, see _encrypt
this.cleartext = JSON.parse(Svc.Crypto.decrypt(this.ciphertext,
symkey, meta.bulkIV))[0];
symkey, meta.bulkIV));
this.ciphertext = null;
return this.cleartext;