summaryrefslogtreecommitdiffstats
path: root/services/sync/modules/engines
diff options
context:
space:
mode:
Diffstat (limited to 'services/sync/modules/engines')
-rw-r--r--services/sync/modules/engines/addons.js13
-rw-r--r--services/sync/modules/engines/bookmarks.js6
-rw-r--r--services/sync/modules/engines/clients.js19
-rw-r--r--services/sync/modules/engines/forms.js8
-rw-r--r--services/sync/modules/engines/history.js11
-rw-r--r--services/sync/modules/engines/passwords.js4
-rw-r--r--services/sync/modules/engines/prefs.js6
-rw-r--r--services/sync/modules/engines/tabs.js6
8 files changed, 41 insertions, 32 deletions
diff --git a/services/sync/modules/engines/addons.js b/services/sync/modules/engines/addons.js
index ab3131c30..3081e3e87 100644
--- a/services/sync/modules/engines/addons.js
+++ b/services/sync/modules/engines/addons.js
@@ -33,7 +33,7 @@
*/
"use strict";
-const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://services-sync/addonutils.js");
Cu.import("resource://services-sync/addonsreconciler.js");
@@ -150,7 +150,7 @@ AddonsEngine.prototype = {
*/
getChangedIDs: function getChangedIDs() {
let changes = {};
- for (let [id, modified] in Iterator(this._tracker.changedIDs)) {
+ for (let [id, modified] of Object.entries(this._tracker.changedIDs)) {
changes[id] = modified;
}
@@ -160,7 +160,7 @@ AddonsEngine.prototype = {
// we assume this function is only called from within a sync.
let reconcilerChanges = this._reconciler.getChangesSinceDate(lastSyncDate);
let addons = this._reconciler.addons;
- for each (let change in reconcilerChanges) {
+ for (let change of reconcilerChanges) {
let changeTime = change[0];
let id = change[2];
@@ -291,7 +291,7 @@ AddonsStore.prototype = {
id: record.addonID,
syncGUID: record.id,
enabled: record.enabled,
- requireSecureURI: !Svc.Prefs.get("addons.ignoreRepositoryChecking", false),
+ requireSecureURI: this._extensionsPrefs.get("install.requireSecureOrigin", true),
}], cb);
// This will throw if there was an error. This will get caught by the sync
@@ -299,7 +299,7 @@ AddonsStore.prototype = {
let results = cb.wait();
let addon;
- for each (let a in results.addons) {
+ for (let a of results.addons) {
if (a.id == record.addonID) {
addon = a;
break;
@@ -443,7 +443,8 @@ AddonsStore.prototype = {
let ids = {};
let addons = this.reconciler.addons;
- for each (let addon in addons) {
+ for (let id in addons) {
+ let addon = addons[id];
if (this.isAddonSyncable(addon)) {
ids[addon.guid] = true;
}
diff --git a/services/sync/modules/engines/bookmarks.js b/services/sync/modules/engines/bookmarks.js
index 1936afc3f..42d91f57e 100644
--- a/services/sync/modules/engines/bookmarks.js
+++ b/services/sync/modules/engines/bookmarks.js
@@ -6,9 +6,9 @@ this.EXPORTED_SYMBOLS = ['BookmarksEngine', "PlacesItem", "Bookmark",
"BookmarkFolder", "BookmarkQuery",
"Livemark", "BookmarkSeparator"];
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cu = Components.utils;
Cu.import("resource://gre/modules/PlacesUtils.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
diff --git a/services/sync/modules/engines/clients.js b/services/sync/modules/engines/clients.js
index f423242c9..6c8e37a7b 100644
--- a/services/sync/modules/engines/clients.js
+++ b/services/sync/modules/engines/clients.js
@@ -7,7 +7,7 @@ this.EXPORTED_SYMBOLS = [
"ClientsRec"
];
-const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://services-common/stringbundle.js");
Cu.import("resource://services-sync/constants.js");
@@ -66,10 +66,13 @@ ClientEngine.prototype = {
numClients: 1,
};
- for each (let {name, type} in this._store._remoteClients) {
- stats.hasMobile = stats.hasMobile || type == "mobile";
- stats.names.push(name);
- stats.numClients++;
+ for (let id in this._store._remoteClients) {
+ let {name, type, stale} = this._store._remoteClients[id];
+ if (!stale) {
+ stats.hasMobile = stats.hasMobile || type == DEVICE_TYPE_MOBILE;
+ stats.names.push(name);
+ stats.numClients++;
+ }
}
return stats;
@@ -85,7 +88,11 @@ ClientEngine.prototype = {
counts.set(this.localType, 1);
- for each (let record in this._store._remoteClients) {
+ for (let id in this._store._remoteClients) {
+ let record = this._store._remoteClients[id];
+ if (record.stale) {
+ continue; // pretend "stale" records don't exist.
+ }
let type = record.type;
if (!counts.has(type)) {
counts.set(type, 0);
diff --git a/services/sync/modules/engines/forms.js b/services/sync/modules/engines/forms.js
index d26d57176..26b289119 100644
--- a/services/sync/modules/engines/forms.js
+++ b/services/sync/modules/engines/forms.js
@@ -4,9 +4,9 @@
this.EXPORTED_SYMBOLS = ['FormEngine', 'FormRec'];
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://services-sync/engines.js");
@@ -30,7 +30,7 @@ FormRec.prototype = {
Utils.deferGetSet(FormRec, "cleartext", ["name", "value"]);
-let FormWrapper = {
+var FormWrapper = {
_log: Log.repository.getLogger("Sync.Engine.Forms"),
_getEntryCols: ["fieldname", "value"],
diff --git a/services/sync/modules/engines/history.js b/services/sync/modules/engines/history.js
index 99ecb4506..7c8aabf83 100644
--- a/services/sync/modules/engines/history.js
+++ b/services/sync/modules/engines/history.js
@@ -4,10 +4,10 @@
this.EXPORTED_SYMBOLS = ['HistoryEngine', 'HistoryRec'];
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-const Cr = Components.results;
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cu = Components.utils;
+var Cr = Components.results;
const HISTORY_TTL = 5184000; // 60 days
@@ -51,7 +51,8 @@ function HistoryStore(name, engine) {
// Explicitly nullify our references to our cached services so we don't leak
Svc.Obs.add("places-shutdown", function() {
- for each ([query, stmt] in Iterator(this._stmts)) {
+ for (let query in this._stmts) {
+ let stmt = this._stmts;
stmt.finalize();
}
this._stmts = {};
diff --git a/services/sync/modules/engines/passwords.js b/services/sync/modules/engines/passwords.js
index 994b59767..2837b6a10 100644
--- a/services/sync/modules/engines/passwords.js
+++ b/services/sync/modules/engines/passwords.js
@@ -4,7 +4,7 @@
this.EXPORTED_SYMBOLS = ['PasswordEngine', 'LoginRec'];
-const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://services-sync/record.js");
Cu.import("resource://services-sync/constants.js");
@@ -83,7 +83,7 @@ PasswordEngine.prototype = {
this._store._sleep(0); // Yield back to main thread after synchronous operation.
// Look for existing logins that match the hostname, but ignore the password.
- for each (let local in logins) {
+ for (let local of logins) {
if (login.matches(local, true) && local instanceof Ci.nsILoginMetaInfo) {
return local.guid;
}
diff --git a/services/sync/modules/engines/prefs.js b/services/sync/modules/engines/prefs.js
index 82091d5b4..792e0c66a 100644
--- a/services/sync/modules/engines/prefs.js
+++ b/services/sync/modules/engines/prefs.js
@@ -4,9 +4,9 @@
this.EXPORTED_SYMBOLS = ['PrefsEngine', 'PrefRec'];
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cu = Components.utils;
const SYNC_PREFS_PREFIX = "services.sync.prefs.sync.";
diff --git a/services/sync/modules/engines/tabs.js b/services/sync/modules/engines/tabs.js
index 1fce737d2..167faf625 100644
--- a/services/sync/modules/engines/tabs.js
+++ b/services/sync/modules/engines/tabs.js
@@ -4,7 +4,7 @@
this.EXPORTED_SYMBOLS = ["TabEngine", "TabSetRecord"];
-const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
const TABS_TTL = 604800; // 7 days.
const TAB_ENTRIES_LIMIT = 25; // How many URLs to include in tab history.
@@ -302,7 +302,7 @@ TabTracker.prototype = {
_registerListenersForWindow: function (window) {
this._log.trace("Registering tab listeners in window");
- for each (let topic in this._topics) {
+ for (let topic of this._topics) {
window.addEventListener(topic, this.onTab, false);
}
window.addEventListener("unload", this._unregisterListeners, false);
@@ -315,7 +315,7 @@ TabTracker.prototype = {
_unregisterListenersForWindow: function (window) {
this._log.trace("Removing tab listeners in window");
window.removeEventListener("unload", this._unregisterListeners, false);
- for each (let topic in this._topics) {
+ for (let topic of this._topics) {
window.removeEventListener(topic, this.onTab, false);
}
},