зеркало из https://github.com/mozilla/pjs.git
load all modules directly from load-weave.js to get around bug 408412; fix uses of |let| not directly within a block
This commit is contained in:
Родитель
c5cd811a52
Коммит
3bee96c342
|
@ -98,7 +98,7 @@ WeaveCrypto.prototype = {
|
|||
|
||||
observe: function Sync_observe(subject, topic, data) {
|
||||
switch (topic) {
|
||||
case "extensions.weave.encryption":
|
||||
case "extensions.weave.encryption": {
|
||||
let branch = Cc["@mozilla.org/preferences-service;1"]
|
||||
.getService(Ci.nsIPrefBranch);
|
||||
|
||||
|
@ -121,7 +121,7 @@ WeaveCrypto.prototype = {
|
|||
}
|
||||
// FIXME: listen to this bad boy somewhere
|
||||
this._os.notifyObservers(null, "weave:encryption:algorithm-changed", "");
|
||||
break;
|
||||
} break;
|
||||
default:
|
||||
this._log.warn("Unknown encryption preference changed - ignoring");
|
||||
}
|
||||
|
@ -142,8 +142,8 @@ WeaveCrypto.prototype = {
|
|||
switch (algorithm) {
|
||||
case "none":
|
||||
ret = data;
|
||||
case "XXTEA":
|
||||
case "XXXTEA": // Weave 0.1.12.10 and below had this typo
|
||||
case "XXTEA": {
|
||||
this._log.debug("Encrypting data");
|
||||
let gen = this._xxtea.encrypt(data, identity.password);
|
||||
ret = gen.next();
|
||||
|
@ -154,7 +154,7 @@ WeaveCrypto.prototype = {
|
|||
}
|
||||
gen.close();
|
||||
this._log.debug("Done encrypting data");
|
||||
break;
|
||||
} break;
|
||||
default:
|
||||
throw "Unknown encryption algorithm: " + algorithm;
|
||||
}
|
||||
|
@ -184,8 +184,8 @@ WeaveCrypto.prototype = {
|
|||
case "none":
|
||||
ret = data;
|
||||
break;
|
||||
case "XXTEA":
|
||||
case "XXXTEA": // Weave 0.1.12.10 and below had this typo
|
||||
case "XXTEA": {
|
||||
this._log.debug("Decrypting data");
|
||||
let gen = this._xxtea.decrypt(data, identity.password);
|
||||
ret = gen.next();
|
||||
|
@ -196,7 +196,7 @@ WeaveCrypto.prototype = {
|
|||
}
|
||||
gen.close();
|
||||
this._log.debug("Done decrypting data");
|
||||
break;
|
||||
} break;
|
||||
default:
|
||||
throw "Unknown encryption algorithm: " + algorithm;
|
||||
}
|
||||
|
|
|
@ -485,7 +485,7 @@ Engine.prototype = {
|
|||
let status = resp.status;
|
||||
|
||||
switch (status) {
|
||||
case 200:
|
||||
case 200: {
|
||||
this._log.info("Got status file from server");
|
||||
|
||||
let status = eval(resp.responseText);
|
||||
|
@ -594,9 +594,9 @@ Engine.prototype = {
|
|||
ret.deltas = allDeltas;
|
||||
this._core.detectUpdates(cont, this._snapshot.data, snap.data);
|
||||
ret.updates = yield;
|
||||
break;
|
||||
|
||||
case 404:
|
||||
} break;
|
||||
|
||||
case 404: {
|
||||
this._log.info("Server has no status file, Initial upload to server");
|
||||
|
||||
this._snapshot.data = this._store.wrap();
|
||||
|
@ -620,8 +620,8 @@ Engine.prototype = {
|
|||
ret.snapshot = eval(uneval(this._snapshot.data));
|
||||
ret.deltas = [];
|
||||
ret.updates = [];
|
||||
break;
|
||||
|
||||
} break;
|
||||
|
||||
default:
|
||||
this._log.error("Could not get status file: unknown HTTP status code " +
|
||||
status);
|
||||
|
|
|
@ -402,7 +402,7 @@ BookmarksStore.prototype = {
|
|||
switch (command.data.type) {
|
||||
case "query":
|
||||
case "bookmark":
|
||||
case "microsummary":
|
||||
case "microsummary": {
|
||||
this._log.info(" -> creating bookmark \"" + command.data.title + "\"");
|
||||
let URI = makeURI(command.data.URI);
|
||||
newId = this._bms.insertBookmark(parentId,
|
||||
|
@ -422,7 +422,7 @@ BookmarksStore.prototype = {
|
|||
}
|
||||
catch(ex) { /* ignore "missing local generator" exceptions */ }
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
case "folder":
|
||||
this._log.info(" -> creating folder \"" + command.data.title + "\"");
|
||||
newId = this._bms.createFolder(parentId,
|
||||
|
@ -504,27 +504,27 @@ BookmarksStore.prototype = {
|
|||
this._bms.moveItem(itemId, this._bms.getFolderIdForItem(itemId),
|
||||
command.data.index);
|
||||
break;
|
||||
case "parentGUID":
|
||||
case "parentGUID": {
|
||||
let index = -1;
|
||||
if (command.data.index && command.data.index >= 0)
|
||||
index = command.data.index;
|
||||
this._bms.moveItem(
|
||||
itemId, this._bms.getItemIdForGUID(command.data.parentGUID), index);
|
||||
break;
|
||||
case "tags":
|
||||
} break;
|
||||
case "tags": {
|
||||
let tagsURI = this._bms.getBookmarkURI(itemId);
|
||||
this._ts.untagURI(URI, null);
|
||||
this._ts.tagURI(tagsURI, command.data.tags);
|
||||
break;
|
||||
} break;
|
||||
case "keyword":
|
||||
this._bms.setKeywordForBookmark(itemId, command.data.keyword);
|
||||
break;
|
||||
case "generatorURI":
|
||||
case "generatorURI": {
|
||||
let micsumURI = makeURI(this._bms.getBookmarkURI(itemId));
|
||||
let genURI = makeURI(command.data.generatorURI);
|
||||
let micsum = this._ms.createMicrosummary(micsumURI, genURI);
|
||||
this._ms.setMicrosummary(itemId, micsum);
|
||||
break;
|
||||
} break;
|
||||
case "siteURI":
|
||||
this._ls.setSiteURI(itemId, makeURI(command.data.siteURI));
|
||||
break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче