Bug 617478: clear CollectionKeys on startOver. r=philiKON.

This commit is contained in:
Richard Newman 2010-12-07 16:30:06 -08:00
Родитель d9a0b60f3c
Коммит df46a7337e
3 изменённых файлов: 19 добавлений и 0 удалений

Просмотреть файл

@ -168,6 +168,13 @@ function CollectionKeyManager() {
// Note that the last modified time needs to be preserved.
CollectionKeyManager.prototype = {
clear: function clear() {
this._log.info("Clearing CollectionKeys...");
this._lastModified = 0;
this._collections = {};
this._default = null;
},
keyForCollection: function(collection) {
// Moderately temporary debugging code.

Просмотреть файл

@ -845,6 +845,9 @@ WeaveSvc.prototype = {
Svc.Prefs.resetBranch("");
this._ignorePrefObserver = false;
// Clear keys.
CollectionKeys.clear();
Svc.Prefs.set("lastversion", WEAVE_VERSION);
// Find weave logins and remove them.
this.password = "";

Просмотреть файл

@ -1,3 +1,4 @@
Cu.import("resource://services-sync/base_records/crypto.js");
Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/util.js");
@ -62,6 +63,14 @@ function test_withEngineList() {
}
}
function test_startOver_clears_keys() {
CollectionKeys.generateNewKeys();
do_check_true(!!CollectionKeys.keyForCollection());
Service.startOver();
do_check_false(!!CollectionKeys.keyForCollection());
}
function run_test() {
test_withEngineList();
test_startOver_clears_keys();
}