summaryrefslogtreecommitdiffstats
path: root/services/sync
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-10-06 07:09:02 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-10-06 07:09:02 +0200
commit18473f1844a8230130e1fc23d7ebf7d33183316f (patch)
tree75d297ab7eac48e14af88e565dc1e19775de9df1 /services/sync
parent0c47c83e1b3b7d95681a43fbb0de0e17b2cd5b25 (diff)
downloadUXP-18473f1844a8230130e1fc23d7ebf7d33183316f.tar
UXP-18473f1844a8230130e1fc23d7ebf7d33183316f.tar.gz
UXP-18473f1844a8230130e1fc23d7ebf7d33183316f.tar.lz
UXP-18473f1844a8230130e1fc23d7ebf7d33183316f.tar.xz
UXP-18473f1844a8230130e1fc23d7ebf7d33183316f.zip
Update sync client for JS changes.
Diffstat (limited to 'services/sync')
-rw-r--r--services/sync/SyncComponents.manifest20
-rw-r--r--services/sync/Weave.js14
-rw-r--r--services/sync/locales/en-US/sync.properties4
-rw-r--r--services/sync/modules-testing/fakeservices.js4
-rw-r--r--services/sync/modules-testing/fxa_utils.js2
-rw-r--r--services/sync/modules-testing/rotaryengine.js4
-rw-r--r--services/sync/modules-testing/utils.js2
-rw-r--r--services/sync/modules/addonsreconciler.js26
-rw-r--r--services/sync/modules/addonutils.js12
-rw-r--r--services/sync/modules/browserid_identity.js6
-rw-r--r--services/sync/modules/engines.js27
-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
-rw-r--r--services/sync/modules/identity.js14
-rw-r--r--services/sync/modules/jpakeclient.js8
-rw-r--r--services/sync/modules/keys.js2
-rw-r--r--services/sync/modules/main.js16
-rw-r--r--services/sync/modules/notifications.js8
-rw-r--r--services/sync/modules/policies.js2
-rw-r--r--services/sync/modules/record.js12
-rw-r--r--services/sync/modules/resource.js12
-rw-r--r--services/sync/modules/rest.js2
-rw-r--r--services/sync/modules/service.js16
-rw-r--r--services/sync/modules/stages/cluster.js2
-rw-r--r--services/sync/modules/stages/declined.js6
-rw-r--r--services/sync/modules/stages/enginesync.js15
-rw-r--r--services/sync/modules/status.js8
-rw-r--r--services/sync/modules/userapi.js2
-rw-r--r--services/sync/modules/util.js16
-rw-r--r--services/sync/services-sync.js2
-rw-r--r--services/sync/tps/extensions/mozmill/resource/driver/controller.js17
-rw-r--r--services/sync/tps/extensions/mozmill/resource/driver/elementslib.js16
-rw-r--r--services/sync/tps/extensions/mozmill/resource/driver/mozelement.js6
-rw-r--r--services/sync/tps/extensions/mozmill/resource/driver/mozmill.js6
-rw-r--r--services/sync/tps/extensions/mozmill/resource/modules/assertions.js7
-rw-r--r--services/sync/tps/extensions/mozmill/resource/modules/frame.js12
-rw-r--r--services/sync/tps/extensions/mozmill/resource/modules/windows.js6
-rw-r--r--services/sync/tps/extensions/mozmill/resource/stdlib/EventUtils.js4
-rw-r--r--services/sync/tps/extensions/mozmill/resource/stdlib/os.js8
-rw-r--r--services/sync/tps/extensions/mozmill/resource/stdlib/securable-module.js3
-rw-r--r--services/sync/tps/extensions/mozmill/resource/stdlib/utils.js10
-rw-r--r--services/sync/tps/extensions/tps/resource/modules/addons.jsm2
-rw-r--r--services/sync/tps/extensions/tps/resource/modules/history.jsm10
-rw-r--r--services/sync/tps/extensions/tps/resource/modules/passwords.jsm2
-rw-r--r--services/sync/tps/extensions/tps/resource/modules/prefs.jsm2
-rw-r--r--services/sync/tps/extensions/tps/resource/modules/tabs.jsm10
-rw-r--r--services/sync/tps/extensions/tps/resource/modules/windows.jsm2
-rw-r--r--services/sync/tps/extensions/tps/resource/tps.jsm24
54 files changed, 256 insertions, 228 deletions
diff --git a/services/sync/SyncComponents.manifest b/services/sync/SyncComponents.manifest
index f6b631f5d..c58286277 100644
--- a/services/sync/SyncComponents.manifest
+++ b/services/sync/SyncComponents.manifest
@@ -1,28 +1,22 @@
-# WebappRT doesn't need these instructions, and they don't necessarily work
-# with it, but it does use a GRE directory that the GRE shares with Firefox,
-# so in order to prevent the instructions from being processed for WebappRT,
-# we need to restrict them to the applications that depend on them, i.e.:
+# WeaveService has to restrict its registration for the app-startup category
+# to the specific list of apps that use it so it doesn't get loaded in xpcshell.
+# Thus we restrict it to these apps:
#
# b2g: {3c2e2abc-06d4-11e1-ac3b-374f68613e61}
-# browser: {8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4}
+# basilisk: {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
+# pale moon: {8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4}
# mobile/android: {aa3c5121-dab2-40e2-81ca-7ea25febc110}
# mobile/xul: {a23983c0-fd0e-11dc-95ff-0800200c9a66}
# suite (comm): {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
-#
-# In theory we should do this for all these instructions, but in practice it is
-# sufficient to do it for the app-startup one, and the file is simpler that way.
+# graphene: {d1bfe7d9-c01e-4237-998b-7b5f960a4314}
# Weave.js
component {74b89fb0-f200-4ae8-a3ec-dd164117f6de} Weave.js
contract @mozilla.org/weave/service;1 {74b89fb0-f200-4ae8-a3ec-dd164117f6de}
-category app-startup WeaveService service,@mozilla.org/weave/service;1 application={3c2e2abc-06d4-11e1-ac3b-374f68613e61} application={8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66} application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
+category app-startup WeaveService service,@mozilla.org/weave/service;1 application={3c2e2abc-06d4-11e1-ac3b-374f68613e61} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66} application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} application={99bceaaa-e3c6-48c1-b981-ef9b46b67d60} application={d1bfe7d9-c01e-4237-998b-7b5f960a4314}
component {d28f8a0b-95da-48f4-b712-caf37097be41} Weave.js
contract @mozilla.org/network/protocol/about;1?what=sync-log {d28f8a0b-95da-48f4-b712-caf37097be41}
# Register resource aliases
# (Note, for tests these are also set up in addResourceAlias)
resource services-sync resource://gre/modules/services-sync/
-
-#ifdef MOZ_SERVICES_HEALTHREPORT
-category healthreport-js-provider-default SyncProvider resource://services-sync/healthreport.jsm
-#endif
diff --git a/services/sync/Weave.js b/services/sync/Weave.js
index d99c217c0..4c89aba13 100644
--- a/services/sync/Weave.js
+++ b/services/sync/Weave.js
@@ -72,13 +72,6 @@ WeaveService.prototype = {
Ci.nsISupportsWeakReference]),
ensureLoaded: function () {
- // XXX: We don't support FxA, so prevent migrator calls
- // to the Sync server from this module! Don't load it.
- // If we are loaded and not using FxA, load the migration module.
- //if (!this.fxAccountsEnabled) {
- // Cu.import("resource://services-sync/FxaMigrator.jsm");
- //}
-
Components.utils.import("resource://services-sync/main.js");
// Side-effect of accessing the service is that it is instantiated.
@@ -193,10 +186,13 @@ AboutWeaveLog.prototype = {
channel.originalURI = aURI;
// Ensure that the about page has the same privileges as a regular directory
- // view. That way links to files can be opened.
+ // view. That way links to files can be opened. make sure we use the correct
+ // origin attributes when creating the principal for accessing the
+ // about:sync-log data.
let ssm = Cc["@mozilla.org/scriptsecuritymanager;1"]
.getService(Ci.nsIScriptSecurityManager);
- let principal = ssm.getNoAppCodebasePrincipal(uri);
+ let principal = ssm.createCodebasePrincipal(uri, aLoadInfo.originAttributes);
+
channel.owner = principal;
return channel;
}
diff --git a/services/sync/locales/en-US/sync.properties b/services/sync/locales/en-US/sync.properties
index f605221b6..157fc225e 100644
--- a/services/sync/locales/en-US/sync.properties
+++ b/services/sync/locales/en-US/sync.properties
@@ -39,10 +39,10 @@ error.sync.quota.description = Sync failed because it exceeded the server quota.
error.sync.viewQuotaButton.label = View Quota
error.sync.viewQuotaButton.accesskey = V
warning.sync.eol.label = Service Shutting Down
-# %1: the app name (Firefox)
+# %1: the app name (Basilisk)
warning.sync.eol.description = Your Sync service is shutting down soon. Upgrade %1$S to keep syncing.
error.sync.eol.label = Service Unavailable
-# %1: the app name (Firefox)
+# %1: the app name (Basilisk)
error.sync.eol.description = Your Sync service is no longer available. You need to upgrade %1$S to keep syncing.
sync.eol.learnMore.label = Learn more
sync.eol.learnMore.accesskey = L
diff --git a/services/sync/modules-testing/fakeservices.js b/services/sync/modules-testing/fakeservices.js
index 0e265937b..d8f73e981 100644
--- a/services/sync/modules-testing/fakeservices.js
+++ b/services/sync/modules-testing/fakeservices.js
@@ -11,12 +11,12 @@ this.EXPORTED_SYMBOLS = [
"fakeSHA256HMAC",
];
-const {utils: Cu} = Components;
+var {utils: Cu} = Components;
Cu.import("resource://services-sync/record.js");
Cu.import("resource://services-sync/util.js");
-let btoa = Cu.import("resource://gre/modules/Log.jsm").btoa;
+var btoa = Cu.import("resource://gre/modules/Log.jsm").btoa;
this.FakeFilesystemService = function FakeFilesystemService(contents) {
this.fakeContents = contents;
diff --git a/services/sync/modules-testing/fxa_utils.js b/services/sync/modules-testing/fxa_utils.js
index 4c622660a..70aa17b03 100644
--- a/services/sync/modules-testing/fxa_utils.js
+++ b/services/sync/modules-testing/fxa_utils.js
@@ -4,7 +4,7 @@ this.EXPORTED_SYMBOLS = [
"initializeIdentityWithTokenServerResponse",
];
-const {utils: Cu} = Components;
+var {utils: Cu} = Components;
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://services-sync/main.js");
diff --git a/services/sync/modules-testing/rotaryengine.js b/services/sync/modules-testing/rotaryengine.js
index d86c1a75e..3b76cd995 100644
--- a/services/sync/modules-testing/rotaryengine.js
+++ b/services/sync/modules-testing/rotaryengine.js
@@ -11,7 +11,7 @@ this.EXPORTED_SYMBOLS = [
"RotaryTracker",
];
-const {utils: Cu} = Components;
+var {utils: Cu} = Components;
Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/record.js");
@@ -115,7 +115,7 @@ RotaryEngine.prototype = {
return "DUPE_LOCAL";
}
- for (let [id, value] in Iterator(this._store.items)) {
+ for (let [id, value] of Object.entries(this._store.items)) {
if (item.denomination == value) {
return id;
}
diff --git a/services/sync/modules-testing/utils.js b/services/sync/modules-testing/utils.js
index faea8fb04..fc14f2fbd 100644
--- a/services/sync/modules-testing/utils.js
+++ b/services/sync/modules-testing/utils.js
@@ -18,7 +18,7 @@ this.EXPORTED_SYMBOLS = [
"add_identity_test",
];
-const {utils: Cu} = Components;
+var {utils: Cu} = Components;
Cu.import("resource://services-sync/status.js");
Cu.import("resource://services-sync/identity.js");
diff --git a/services/sync/modules/addonsreconciler.js b/services/sync/modules/addonsreconciler.js
index 2e838e885..96752a511 100644
--- a/services/sync/modules/addonsreconciler.js
+++ b/services/sync/modules/addonsreconciler.js
@@ -17,7 +17,7 @@
"use strict";
-const Cu = Components.utils;
+var Cu = Components.utils;
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://services-sync/util.js");
@@ -218,11 +218,12 @@ AddonsReconciler.prototype = {
}
this._addons = json.addons;
- for each (let record in this._addons) {
+ for (let id in this._addons) {
+ let record = this._addons[id];
record.modified = new Date(record.modified);
}
- for each (let [time, change, id] in json.changes) {
+ for (let [time, change, id] of json.changes) {
this._changes.push([new Date(time), change, id]);
}
@@ -246,9 +247,9 @@ AddonsReconciler.prototype = {
let file = path || DEFAULT_STATE_FILE;
let state = {version: 1, addons: {}, changes: []};
- for (let [id, record] in Iterator(this._addons)) {
+ for (let [id, record] of Object.entries(this._addons)) {
state.addons[id] = {};
- for (let [k, v] in Iterator(record)) {
+ for (let [k, v] of Object.entries(record)) {
if (k == "modified") {
state.addons[id][k] = v.getTime();
}
@@ -258,7 +259,7 @@ AddonsReconciler.prototype = {
}
}
- for each (let [time, change, id] in this._changes) {
+ for (let [time, change, id] of this._changes) {
state.changes.push([time.getTime(), change, id]);
}
@@ -350,14 +351,14 @@ AddonsReconciler.prototype = {
AddonManager.getAllAddons(function (addons) {
let ids = {};
- for each (let addon in addons) {
+ for (let addon of addons) {
ids[addon.id] = true;
this.rectifyStateFromAddon(addon);
}
// Look for locally-defined add-ons that no longer exist and update their
// record.
- for (let [id, addon] in Iterator(this._addons)) {
+ for (let [id, addon] of Object.entries(this._addons)) {
if (id in ids) {
continue;
}
@@ -373,7 +374,7 @@ AddonsReconciler.prototype = {
}
let installFound = false;
- for each (let install in installs) {
+ for (let install of installs) {
if (install.addon && install.addon.id == id &&
install.state == AddonManager.STATE_INSTALLED) {
@@ -416,7 +417,7 @@ AddonsReconciler.prototype = {
* Addon instance being updated.
*/
rectifyStateFromAddon: function rectifyStateFromAddon(addon) {
- this._log.debug("Rectifying state for addon: " + addon.id);
+ this._log.debug(`Rectifying state for addon ${addon.name} (version=${addon.version}, id=${addon.id})`);
this._ensureStateLoaded();
let id = addon.id;
@@ -483,7 +484,7 @@ AddonsReconciler.prototype = {
this._log.info("Change recorded for " + state.id);
this._changes.push([date, change, state.id]);
- for each (let listener in this._listeners) {
+ for (let listener of this._listeners) {
try {
listener.changeListener.call(listener, date, change, state);
} catch (ex) {
@@ -554,7 +555,8 @@ AddonsReconciler.prototype = {
* @return Object on success on null on failure.
*/
getAddonStateFromSyncGUID: function getAddonStateFromSyncGUID(guid) {
- for each (let addon in this.addons) {
+ for (let id in this.addons) {
+ let addon = this.addons[id];
if (addon.guid == guid) {
return addon;
}
diff --git a/services/sync/modules/addonutils.js b/services/sync/modules/addonutils.js
index 54b441b9e..11b6b0397 100644
--- a/services/sync/modules/addonutils.js
+++ b/services/sync/modules/addonutils.js
@@ -6,7 +6,7 @@
this.EXPORTED_SYMBOLS = ["AddonUtils"];
-const {interfaces: Ci, utils: Cu} = Components;
+var {interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Log.jsm");
@@ -248,7 +248,7 @@ AddonUtilsInternal.prototype = {
}
let ids = [];
- for each (let addon in installs) {
+ for (let addon of installs) {
ids.push(addon.id);
}
@@ -298,7 +298,7 @@ AddonUtilsInternal.prototype = {
// server-side metrics aren't skewed (bug 708134). The server should
// ideally send proper URLs, but this solution was deemed too
// complicated at the time the functionality was implemented.
- for each (let addon in addons) {
+ for (let addon of addons) {
// sourceURI presence isn't enforced by AddonRepository. So, we skip
// add-ons without a sourceURI.
if (!addon.sourceURI) {
@@ -342,9 +342,9 @@ AddonUtilsInternal.prototype = {
// Start all the installs asynchronously. They will report back to us
// as they finish, eventually triggering the global callback.
- for each (let addon in toInstall) {
+ for (let addon of toInstall) {
let options = {};
- for each (let install in installs) {
+ for (let install of installs) {
if (install.id == addon.id) {
options = install;
break;
@@ -365,7 +365,7 @@ AddonUtilsInternal.prototype = {
/**
* Update the user disabled flag for an add-on.
*
- * The supplied callback will ba called when the operation is
+ * The supplied callback will be called when the operation is
* complete. If the new flag matches the existing or if the add-on
* isn't currently active, the function will fire the callback
* immediately. Else, the callback is invoked when the AddonManager
diff --git a/services/sync/modules/browserid_identity.js b/services/sync/modules/browserid_identity.js
index bc8ea6b30..9709b9196 100644
--- a/services/sync/modules/browserid_identity.js
+++ b/services/sync/modules/browserid_identity.js
@@ -6,7 +6,7 @@
this.EXPORTED_SYMBOLS = ["BrowserIDManager"];
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
+var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://services-common/async.js");
@@ -39,7 +39,7 @@ XPCOMUtils.defineLazyGetter(this, 'log', function() {
});
// FxAccountsCommon.js doesn't use a "namespace", so create one here.
-let fxAccountsCommon = {};
+var fxAccountsCommon = {};
Cu.import("resource://gre/modules/FxAccountsCommon.js", fxAccountsCommon);
const OBSERVER_TOPICS = [
@@ -144,7 +144,7 @@ this.BrowserIDManager.prototype = {
// re-entering of credentials by the user is necessary we don't take any
// further action - an observer will fire when the user does that.
if (Weave.Status.login == LOGIN_FAILED_LOGIN_REJECTED) {
- return Promise.reject();
+ return Promise.reject(new Error("User needs to re-authenticate"));
}
// So - we've a previous auth problem and aren't currently attempting to
diff --git a/services/sync/modules/engines.js b/services/sync/modules/engines.js
index eabddae2b..35e8d6954 100644
--- a/services/sync/modules/engines.js
+++ b/services/sync/modules/engines.js
@@ -10,7 +10,7 @@ this.EXPORTED_SYMBOLS = [
"Store"
];
-const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
+var {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
Cu.import("resource://services-common/async.js");
Cu.import("resource://gre/modules/Log.jsm");
@@ -104,7 +104,7 @@ Tracker.prototype = {
Utils.jsonLoad("changes/" + this.file, this, function(json) {
if (json && (typeof(json) == "object")) {
this.changedIDs = json;
- } else {
+ } else if (json !== null) {
this._log.warn("Changed IDs file " + this.file + " contains non-object value.");
json = null;
}
@@ -135,7 +135,7 @@ Tracker.prototype = {
return false;
}
- if (this.ignoreAll || (id in this._ignored)) {
+ if (this.ignoreAll || this._ignored.includes(id)) {
return false;
}
@@ -159,8 +159,9 @@ Tracker.prototype = {
this._log.warn("Attempted to remove undefined ID to tracker");
return false;
}
- if (this.ignoreAll || (id in this._ignored))
+ if (this.ignoreAll || this._ignored.includes(id)) {
return false;
+ }
if (this.changedIDs[id] != null) {
this._log.trace("Removing changed ID " + id);
delete this.changedIDs[id];
@@ -299,7 +300,7 @@ Store.prototype = {
*/
applyIncomingBatch: function (records) {
let failed = [];
- for each (let record in records) {
+ for (let record of records) {
try {
this.applyIncoming(record);
} catch (ex if (ex.code == Engine.prototype.eEngineAbortApplyIncoming)) {
@@ -483,7 +484,11 @@ EngineManager.prototype = {
},
getAll: function () {
- return [engine for ([name, engine] in Iterator(this._engines))];
+ let engines = [];
+ for (let [, engine] of Object.entries(this._engines)) {
+ engines.push(engine);
+ }
+ return engines;
},
/**
@@ -496,7 +501,7 @@ EngineManager.prototype = {
},
get enabledEngineNames() {
- return [e.name for each (e in this.getEnabled())];
+ return this.getEnabled().map(e => e.name);
},
persistDeclined: function () {
@@ -1245,7 +1250,7 @@ SyncEngine.prototype = {
// because some state may change during the course of this function and we
// need to operate on the original values.
let existsLocally = this._store.itemExists(item.id);
- let locallyModified = item.id in this._modified;
+ let locallyModified = this._modified.has(item.id);
// TODO Handle clock drift better. Tracked in bug 721181.
let remoteAge = AsyncResource.serverTime - item.modified;
@@ -1444,14 +1449,14 @@ SyncEngine.prototype = {
+ failed_ids.join(", "));
// Clear successfully uploaded objects.
- for each (let id in resp.obj.success) {
+ for (let id of resp.obj.success) {
delete this._modified[id];
}
up.clearRecords();
});
- for each (let id in modifiedIDs) {
+ for (let id of modifiedIDs) {
try {
let out = this._createRecord(id);
if (this._log.level <= Log.Level.Trace)
@@ -1489,7 +1494,7 @@ SyncEngine.prototype = {
coll.delete();
});
- for (let [key, val] in Iterator(this._delete)) {
+ for (let [key, val] of Object.entries(this._delete)) {
// Remove the key for future uses
delete this._delete[key];
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);
}
},
diff --git a/services/sync/modules/identity.js b/services/sync/modules/identity.js
index 2bee13b5b..cd28f5efe 100644
--- a/services/sync/modules/identity.js
+++ b/services/sync/modules/identity.js
@@ -6,7 +6,7 @@
this.EXPORTED_SYMBOLS = ["IdentityManager"];
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
+var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Promise.jsm");
@@ -206,7 +206,7 @@ IdentityManager.prototype = {
return null;
}
- for each (let login in this._getLogins(PWDMGR_PASSWORD_REALM)) {
+ for (let login of this._getLogins(PWDMGR_PASSWORD_REALM)) {
if (login.username.toLowerCase() == username) {
// It should already be UTF-8 encoded, but we don't take any chances.
this._basicPassword = Utils.encodeUTF8(login.password);
@@ -260,7 +260,7 @@ IdentityManager.prototype = {
return null;
}
- for each (let login in this._getLogins(PWDMGR_PASSPHRASE_REALM)) {
+ for (let login of this._getLogins(PWDMGR_PASSPHRASE_REALM)) {
if (login.username.toLowerCase() == username) {
this._syncKey = login.password;
}
@@ -411,7 +411,7 @@ IdentityManager.prototype = {
this._setLogin(PWDMGR_PASSWORD_REALM, this.username,
this._basicPassword);
} else {
- for each (let login in this._getLogins(PWDMGR_PASSWORD_REALM)) {
+ for (let login of this._getLogins(PWDMGR_PASSWORD_REALM)) {
Services.logins.removeLogin(login);
}
}
@@ -423,7 +423,7 @@ IdentityManager.prototype = {
if (this._syncKey) {
this._setLogin(PWDMGR_PASSPHRASE_REALM, this.username, this._syncKey);
} else {
- for each (let login in this._getLogins(PWDMGR_PASSPHRASE_REALM)) {
+ for (let login of this._getLogins(PWDMGR_PASSPHRASE_REALM)) {
Services.logins.removeLogin(login);
}
}
@@ -477,7 +477,7 @@ IdentityManager.prototype = {
*/
_setLogin: function _setLogin(realm, username, password) {
let exists = false;
- for each (let login in this._getLogins(realm)) {
+ for (let login of this._getLogins(realm)) {
if (login.username == username && login.password == password) {
exists = true;
} else {
@@ -513,7 +513,7 @@ IdentityManager.prototype = {
deleteSyncCredentials: function deleteSyncCredentials() {
for (let host of this._getSyncCredentialsHosts()) {
let logins = Services.logins.findLogins({}, host, "", "");
- for each (let login in logins) {
+ for (let login of logins) {
Services.logins.removeLogin(login);
}
}
diff --git a/services/sync/modules/jpakeclient.js b/services/sync/modules/jpakeclient.js
index 10f405371..625dc91b6 100644
--- a/services/sync/modules/jpakeclient.js
+++ b/services/sync/modules/jpakeclient.js
@@ -4,7 +4,7 @@
this.EXPORTED_SYMBOLS = ["JPAKEClient", "SendCredentialsController"];
-const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
+var {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://services-common/rest.js");
@@ -281,8 +281,7 @@ JPAKEClient.prototype = {
let rng = Cc["@mozilla.org/security/random-generator;1"]
.createInstance(Ci.nsIRandomGenerator);
let bytes = rng.generateRandomBytes(JPAKE_LENGTH_CLIENTID / 2);
- this._clientID = [("0" + byte.toString(16)).slice(-2)
- for each (byte in bytes)].join("");
+ this._clientID = bytes.map(byte => ("0" + byte.toString(16)).slice(-2)).join("");
},
_createSecret: function _createSecret() {
@@ -291,8 +290,7 @@ JPAKEClient.prototype = {
let rng = Cc["@mozilla.org/security/random-generator;1"]
.createInstance(Ci.nsIRandomGenerator);
let bytes = rng.generateRandomBytes(JPAKE_LENGTH_SECRET);
- return [key[Math.floor(byte * key.length / 256)]
- for each (byte in bytes)].join("");
+ return bytes.map(byte => key[Math.floor(byte * key.length / 256)]).join("");
},
_newRequest: function _newRequest(uri) {
diff --git a/services/sync/modules/keys.js b/services/sync/modules/keys.js
index bf909bdc2..b93de7f31 100644
--- a/services/sync/modules/keys.js
+++ b/services/sync/modules/keys.js
@@ -9,7 +9,7 @@ this.EXPORTED_SYMBOLS = [
"SyncKeyBundle"
];
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
+var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://services-sync/constants.js");
Cu.import("resource://gre/modules/Log.jsm");
diff --git a/services/sync/modules/main.js b/services/sync/modules/main.js
index 488a2594b..e8e705e72 100644
--- a/services/sync/modules/main.js
+++ b/services/sync/modules/main.js
@@ -6,7 +6,7 @@ this.EXPORTED_SYMBOLS = ['Weave'];
this.Weave = {};
Components.utils.import("resource://services-sync/constants.js", Weave);
-let lazies = {
+var lazies = {
"jpakeclient.js": ["JPAKEClient", "SendCredentialsController"],
"notifications.js": ["Notifications", "Notification", "NotificationButton"],
"service.js": ["Service"],
@@ -15,12 +15,14 @@ let lazies = {
};
function lazyImport(module, dest, props) {
- function getter(prop) function() {
- let ns = {};
- Components.utils.import(module, ns);
- delete dest[prop];
- return dest[prop] = ns[prop];
- };
+ function getter(prop) {
+ return function() {
+ let ns = {};
+ Components.utils.import(module, ns);
+ delete dest[prop];
+ return dest[prop] = ns[prop];
+ };
+ }
props.forEach(function (prop) { dest.__defineGetter__(prop, getter(prop)); });
}
diff --git a/services/sync/modules/notifications.js b/services/sync/modules/notifications.js
index 1ee24f2cd..72187a4ce 100644
--- a/services/sync/modules/notifications.js
+++ b/services/sync/modules/notifications.js
@@ -4,10 +4,10 @@
this.EXPORTED_SYMBOLS = ["Notifications", "Notification", "NotificationButton"];
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cr = Components.results;
-const Cu = Components.utils;
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cr = Components.results;
+var Cu = Components.utils;
Cu.import("resource://services-common/observers.js");
Cu.import("resource://gre/modules/Log.jsm");
diff --git a/services/sync/modules/policies.js b/services/sync/modules/policies.js
index d799cb235..38f118d3f 100644
--- a/services/sync/modules/policies.js
+++ b/services/sync/modules/policies.js
@@ -7,7 +7,7 @@ this.EXPORTED_SYMBOLS = [
"SyncScheduler",
];
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
+var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://services-sync/constants.js");
diff --git a/services/sync/modules/record.js b/services/sync/modules/record.js
index 04ccd2dd2..e609ad1bc 100644
--- a/services/sync/modules/record.js
+++ b/services/sync/modules/record.js
@@ -10,10 +10,10 @@ this.EXPORTED_SYMBOLS = [
"Collection",
];
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cr = Components.results;
-const Cu = Components.utils;
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cr = Components.results;
+var Cu = Components.utils;
const CRYPTO_COLLECTION = "crypto";
const KEYS_WBO = "keys";
@@ -85,7 +85,7 @@ WBORecord.prototype = {
toJSON: function toJSON() {
// Copy fields from data to be stringified, making sure payload is a string
let obj = {};
- for (let [key, val] in Iterator(this.data))
+ for (let [key, val] of Object.entries(this.data))
obj[key] = key == "payload" ? JSON.stringify(val) : val;
if (this.ttl)
obj.ttl = this.ttl;
@@ -309,7 +309,7 @@ CollectionKeyManager.prototype = {
// Return a sorted, unique array.
changed.sort();
let last;
- changed = [x for each (x in changed) if ((x != last) && (last = x))];
+ changed = changed.filter(x => (x != last) && (last = x));
return {same: changed.length == 0,
changed: changed};
},
diff --git a/services/sync/modules/resource.js b/services/sync/modules/resource.js
index 1c2a67b90..b31d129a5 100644
--- a/services/sync/modules/resource.js
+++ b/services/sync/modules/resource.js
@@ -7,10 +7,10 @@ this.EXPORTED_SYMBOLS = [
"Resource"
];
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cr = Components.results;
-const Cu = Components.utils;
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cr = Components.results;
+var Cu = Components.utils;
Cu.import("resource://gre/modules/Preferences.jsm");
Cu.import("resource://services-common/async.js");
@@ -174,7 +174,7 @@ AsyncResource.prototype = {
if (this.authenticator) {
let result = this.authenticator(this, method);
if (result && result.headers) {
- for (let [k, v] in Iterator(result.headers)) {
+ for (let [k, v] of Object.entries(result.headers)) {
headers[k.toLowerCase()] = v;
}
}
@@ -182,7 +182,7 @@ AsyncResource.prototype = {
this._log.debug("No authenticator found.");
}
- for (let [key, value] in Iterator(headers)) {
+ for (let [key, value] of Object.entries(headers)) {
if (key == 'authorization')
this._log.trace("HTTP Header " + key + ": ***** (suppressed)");
else
diff --git a/services/sync/modules/rest.js b/services/sync/modules/rest.js
index 34382eed5..106ece222 100644
--- a/services/sync/modules/rest.js
+++ b/services/sync/modules/rest.js
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
+var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://services-common/rest.js");
diff --git a/services/sync/modules/service.js b/services/sync/modules/service.js
index 637760b8f..f3837a949 100644
--- a/services/sync/modules/service.js
+++ b/services/sync/modules/service.js
@@ -4,10 +4,10 @@
this.EXPORTED_SYMBOLS = ["Service"];
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cr = Components.results;
-const Cu = Components.utils;
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cr = Components.results;
+var Cu = Components.utils;
// How long before refreshing the cluster
const CLUSTER_BACKOFF = 5 * 60 * 1000; // 5 minutes
@@ -432,7 +432,7 @@ Sync11Service.prototype = {
// Map each old pref to the current pref branch
let oldPref = new Preferences(oldPrefBranch);
- for each (let pref in oldPrefNames)
+ for (let pref of oldPrefNames)
Svc.Prefs.set(pref, oldPref.get(pref));
// Remove all the old prefs and remember that we've migrated
@@ -890,7 +890,7 @@ Sync11Service.prototype = {
// Deletion doesn't make sense if we aren't set up yet!
if (this.clusterURL != "") {
// Clear client-specific data from the server, including disabled engines.
- for each (let engine in [this.clientsEngine].concat(this.engineManager.getAll())) {
+ for (let engine of [this.clientsEngine].concat(this.engineManager.getAll())) {
try {
engine.removeClientData();
} catch(ex) {
@@ -1497,7 +1497,7 @@ Sync11Service.prototype = {
// Wipe everything we know about except meta because we just uploaded it
let engines = [this.clientsEngine].concat(this.engineManager.getAll());
- let collections = [engine.name for each (engine in engines)];
+ let collections = engines.map(engine => engine.name);
// TODO: there's a bug here. We should be calling resetClient, no?
// Generate, upload, and download new keys. Do this last so we don't wipe
@@ -1657,7 +1657,7 @@ Sync11Service.prototype = {
}
// Have each engine drop any temporary meta data
- for each (let engine in engines) {
+ for (let engine of engines) {
engine.resetClient();
}
})();
diff --git a/services/sync/modules/stages/cluster.js b/services/sync/modules/stages/cluster.js
index dd358bf98..41afe61d8 100644
--- a/services/sync/modules/stages/cluster.js
+++ b/services/sync/modules/stages/cluster.js
@@ -4,7 +4,7 @@
this.EXPORTED_SYMBOLS = ["ClusterManager"];
-const {utils: Cu} = Components;
+var {utils: Cu} = Components;
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://services-sync/constants.js");
diff --git a/services/sync/modules/stages/declined.js b/services/sync/modules/stages/declined.js
index b0877e929..ff8a14181 100644
--- a/services/sync/modules/stages/declined.js
+++ b/services/sync/modules/stages/declined.js
@@ -11,7 +11,7 @@
this.EXPORTED_SYMBOLS = ["DeclinedEngines"];
-const {utils: Cu} = Components;
+var {utils: Cu} = Components;
Cu.import("resource://services-sync/constants.js");
Cu.import("resource://gre/modules/Log.jsm");
@@ -29,8 +29,8 @@ this.DeclinedEngines = function (service) {
}
this.DeclinedEngines.prototype = {
updateDeclined: function (meta, engineManager=this.service.engineManager) {
- let enabled = new Set([e.name for each (e in engineManager.getEnabled())]);
- let known = new Set([e.name for each (e in engineManager.getAll())]);
+ let enabled = new Set(engineManager.getEnabled().map(e => e.name));
+ let known = new Set(engineManager.getAll().map(e => e.name));
let remoteDeclined = new Set(meta.payload.declined || []);
let localDeclined = new Set(engineManager.getDeclined());
diff --git a/services/sync/modules/stages/enginesync.js b/services/sync/modules/stages/enginesync.js
index ed91adddb..ce7fce94d 100644
--- a/services/sync/modules/stages/enginesync.js
+++ b/services/sync/modules/stages/enginesync.js
@@ -8,7 +8,7 @@
this.EXPORTED_SYMBOLS = ["EngineSynchronizer"];
-const {utils: Cu} = Components;
+var {utils: Cu} = Components;
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://services-sync/constants.js");
@@ -224,8 +224,15 @@ EngineSynchronizer.prototype = {
// If we're the only client, and no engines are marked as enabled,
// thumb our noses at the server data: it can't be right.
// Belt-and-suspenders approach to Bug 615926.
- if ((numClients <= 1) &&
- ([e for (e in meta.payload.engines) if (e != "clients")].length == 0)) {
+ let hasEnabledEngines = false;
+ for (let e in meta.payload.engines) {
+ if (e != "clients") {
+ hasEnabledEngines = true;
+ break;
+ }
+ }
+
+ if ((numClients <= 1) && !hasEnabledEngines) {
this._log.info("One client and no enabled engines: not touching local engine status.");
return;
}
@@ -289,7 +296,7 @@ EngineSynchronizer.prototype = {
}
// Any remaining engines were either enabled locally or disabled remotely.
- for each (let engineName in enabled) {
+ for (let engineName of enabled) {
let engine = engineManager.get(engineName);
if (Svc.Prefs.get("engineStatusChanged." + engine.prefName, false)) {
this._log.trace("The " + engineName + " engine was enabled locally.");
diff --git a/services/sync/modules/status.js b/services/sync/modules/status.js
index 19dff9712..4b26f62bd 100644
--- a/services/sync/modules/status.js
+++ b/services/sync/modules/status.js
@@ -4,10 +4,10 @@
this.EXPORTED_SYMBOLS = ["Status"];
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cr = Components.results;
-const Cu = Components.utils;
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cr = Components.results;
+var Cu = Components.utils;
Cu.import("resource://services-sync/constants.js");
Cu.import("resource://gre/modules/Log.jsm");
diff --git a/services/sync/modules/userapi.js b/services/sync/modules/userapi.js
index ec77d63e2..e906440bd 100644
--- a/services/sync/modules/userapi.js
+++ b/services/sync/modules/userapi.js
@@ -8,7 +8,7 @@ this.EXPORTED_SYMBOLS = [
"UserAPI10Client",
];
-const {utils: Cu} = Components;
+var {utils: Cu} = Components;
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://services-common/rest.js");
diff --git a/services/sync/modules/util.js b/services/sync/modules/util.js
index 67cc3f063..b063a29ac 100644
--- a/services/sync/modules/util.js
+++ b/services/sync/modules/util.js
@@ -4,7 +4,7 @@
this.EXPORTED_SYMBOLS = ["XPCOMUtils", "Services", "Utils", "Async", "Svc", "Str"];
-const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
+var {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://services-common/observers.js");
@@ -338,12 +338,14 @@ this.Utils = {
try {
json = yield CommonUtils.readJSON(path);
- } catch (e if e instanceof OS.File.Error && e.becauseNoSuchFile) {
- // Ignore non-existent files.
} catch (e) {
- if (that._log) {
- that._log.debug("Failed to load json: " +
- CommonUtils.exceptionStr(e));
+ if (e instanceof OS.File.Error && e.becauseNoSuchFile) {
+ // Ignore non-existent files, but explicitly return null.
+ json = null;
+ } else {
+ if (that._log) {
+ that._log.debug("Failed to load json", e);
+ }
}
}
@@ -690,7 +692,7 @@ Svc.Prefs = new Preferences(PREFS_BRANCH);
Svc.DefaultPrefs = new Preferences({branch: PREFS_BRANCH, defaultBranch: true});
Svc.Obs = Observers;
-let _sessionCID = Services.appinfo.ID == SEAMONKEY_ID ?
+var _sessionCID = Services.appinfo.ID == SEAMONKEY_ID ?
"@mozilla.org/suite/sessionstore;1" :
"@mozilla.org/browser/sessionstore;1";
diff --git a/services/sync/services-sync.js b/services/sync/services-sync.js
index d5d153436..640fb4abc 100644
--- a/services/sync/services-sync.js
+++ b/services/sync/services-sync.js
@@ -35,7 +35,7 @@ pref("services.sync.engine.history", true);
pref("services.sync.engine.passwords", true);
pref("services.sync.engine.prefs", true);
pref("services.sync.engine.tabs", true);
-pref("services.sync.engine.tabs.filteredUrls", "^(about:.*|chrome://weave/.*|wyciwyg:.*|file:.*)$");
+pref("services.sync.engine.tabs.filteredUrls", "^(about:.*|chrome://weave/.*|wyciwyg:.*|file:.*|blob:.*)$");
pref("services.sync.jpake.serverURL", "https://keyserver.palemoon.org/");
pref("services.sync.jpake.pollInterval", 1000);
diff --git a/services/sync/tps/extensions/mozmill/resource/driver/controller.js b/services/sync/tps/extensions/mozmill/resource/driver/controller.js
index d5948598e..1a4e6f3b6 100644
--- a/services/sync/tps/extensions/mozmill/resource/driver/controller.js
+++ b/services/sync/tps/extensions/mozmill/resource/driver/controller.js
@@ -5,9 +5,9 @@
var EXPORTED_SYMBOLS = ["MozMillController", "globalEventRegistry",
"sleep", "windowMap"];
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cu = Components.utils;
var EventUtils = {}; Cu.import('resource://mozmill/stdlib/EventUtils.js', EventUtils);
@@ -44,7 +44,11 @@ waitForEvents.prototype = {
node.firedEvents = {};
this.registry = {};
- for each (var e in events) {
+ if (!events) {
+ return;
+ }
+ for (var key in events) {
+ var e = events[key];
var listener = function (event) {
this.firedEvents[event.type] = true;
}
@@ -973,7 +977,10 @@ function browserAdditions (controller) {
return windows.map.hasPageLoaded(utils.getWindowId(win));
}, "Timeout", timeout, aInterval);
}
- catch (ex if ex instanceof errors.TimeoutError) {
+ catch (ex) {
+ if (!(ex instanceof errors.TimeoutError)) {
+ throw ex;
+ }
timed_out = true;
}
finally {
diff --git a/services/sync/tps/extensions/mozmill/resource/driver/elementslib.js b/services/sync/tps/extensions/mozmill/resource/driver/elementslib.js
index f08cf42f3..4bf35a384 100644
--- a/services/sync/tps/extensions/mozmill/resource/driver/elementslib.js
+++ b/services/sync/tps/extensions/mozmill/resource/driver/elementslib.js
@@ -6,9 +6,9 @@ var EXPORTED_SYMBOLS = ["ID", "Link", "XPath", "Selector", "Name", "Anon", "Anon
"Lookup", "_byID", "_byName", "_byAttrib", "_byAnonAttrib",
];
-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/Services.jsm");
@@ -304,7 +304,7 @@ var _returnResult = function (results) {
var _forChildren = function (element, name, value) {
var results = [];
- var nodes = [e for each (e in element.childNodes) if (e)]
+ var nodes = Array.from(element.childNodes).filter(e => e);
for (var i in nodes) {
var n = nodes[i];
@@ -318,7 +318,7 @@ var _forChildren = function (element, name, value) {
var _forAnonChildren = function (_document, element, name, value) {
var results = [];
- var nodes = [e for each (e in _document.getAnoymousNodes(element)) if (e)];
+ var nodes = Array.from(_document.getAnoymousNodes(element)).filter(e => e);
for (var i in nodes ) {
var n = nodes[i];
@@ -381,7 +381,7 @@ var _byAnonAttrib = function (_document, parent, attributes) {
}
}
- var nodes = [n for each (n in _document.getAnonymousNodes(parent)) if (n.getAttribute)];
+ var nodes = Array.from(_document.getAnonymousNodes(parent)).filter(n => n.getAttribute);
function resultsForNodes (nodes) {
for (var i in nodes) {
@@ -404,7 +404,7 @@ var _byAnonAttrib = function (_document, parent, attributes) {
resultsForNodes(nodes);
if (results.length == 0) {
- resultsForNodes([n for each (n in parent.childNodes) if (n != undefined && n.getAttribute)])
+ resultsForNodes(Array.from(parent.childNodes).filter(n => n != undefined && n.getAttribute));
}
return _returnResult(results)
@@ -440,7 +440,7 @@ function Lookup(_document, expression) {
throw new Error('Lookup constructor did not recieve enough arguments.');
}
- var expSplit = [e for each (e in smartSplit(expression) ) if (e != '')];
+ var expSplit = smartSplit(expression).filter(e => e != '');
expSplit.unshift(_document);
var nCases = {'id':_byID, 'name':_byName, 'attrib':_byAttrib, 'index':_byIndex};
diff --git a/services/sync/tps/extensions/mozmill/resource/driver/mozelement.js b/services/sync/tps/extensions/mozmill/resource/driver/mozelement.js
index 0af204794..ae55cb0ce 100644
--- a/services/sync/tps/extensions/mozmill/resource/driver/mozelement.js
+++ b/services/sync/tps/extensions/mozmill/resource/driver/mozelement.js
@@ -9,9 +9,9 @@ var EXPORTED_SYMBOLS = ["Elem", "Selector", "ID", "Link", "XPath", "Name", "Look
const NAMESPACE_XUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cu = Components.utils;
var EventUtils = {}; Cu.import('resource://mozmill/stdlib/EventUtils.js', EventUtils);
diff --git a/services/sync/tps/extensions/mozmill/resource/driver/mozmill.js b/services/sync/tps/extensions/mozmill/resource/driver/mozmill.js
index 283c9bfb4..1e422591f 100644
--- a/services/sync/tps/extensions/mozmill/resource/driver/mozmill.js
+++ b/services/sync/tps/extensions/mozmill/resource/driver/mozmill.js
@@ -13,9 +13,9 @@ var EXPORTED_SYMBOLS = ["controller", "utils", "elementslib", "os",
"firePythonCallback", "getAddons"
];
-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/AddonManager.jsm");
diff --git a/services/sync/tps/extensions/mozmill/resource/modules/assertions.js b/services/sync/tps/extensions/mozmill/resource/modules/assertions.js
index b49502057..c76f95747 100644
--- a/services/sync/tps/extensions/mozmill/resource/modules/assertions.js
+++ b/services/sync/tps/extensions/mozmill/resource/modules/assertions.js
@@ -4,7 +4,7 @@
var EXPORTED_SYMBOLS = ['Assert', 'Expect'];
-const Cu = Components.utils;
+var Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
@@ -658,7 +658,10 @@ Expect.prototype.waitFor = function Expect_waitFor(aCallback, aMessage, aTimeout
try {
Assert.prototype.waitFor.apply(this, arguments);
}
- catch (ex if ex instanceof errors.AssertionError) {
+ catch (ex) {
+ if (!(ex instanceof errors.AssertionError)) {
+ throw ex;
+ }
message = ex.message;
condition = false;
}
diff --git a/services/sync/tps/extensions/mozmill/resource/modules/frame.js b/services/sync/tps/extensions/mozmill/resource/modules/frame.js
index 799e81d55..dae8276b6 100644
--- a/services/sync/tps/extensions/mozmill/resource/modules/frame.js
+++ b/services/sync/tps/extensions/mozmill/resource/modules/frame.js
@@ -5,9 +5,9 @@
var EXPORTED_SYMBOLS = ['Collector','Runner','events', 'runTestFile', 'log',
'timers', 'persisted', 'shutdownApplication'];
-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 TIMEOUT_SHUTDOWN_HTTPD = 15000;
@@ -256,7 +256,7 @@ events.pass = function (obj) {
events.currentTest.__passes__.push(obj);
}
- for each (var timer in timers) {
+ for (var timer of timers) {
timer.actions.push(
{"currentTest": events.currentModule.__file__ + "::" + events.currentTest.__name__,
"obj": obj,
@@ -286,7 +286,7 @@ events.fail = function (obj) {
events.currentTest.__fails__.push(obj);
}
- for each (var time in timers) {
+ for (var time of timers) {
timer.actions.push(
{"currentTest": events.currentModule.__file__ + "::" + events.currentTest.__name__,
"obj": obj,
@@ -325,7 +325,7 @@ events.fireEvent = function (name, obj) {
}
}
- for each(var listener in this.globalListeners) {
+ for (var listener of this.globalListeners) {
listener(name, obj);
}
}
diff --git a/services/sync/tps/extensions/mozmill/resource/modules/windows.js b/services/sync/tps/extensions/mozmill/resource/modules/windows.js
index fe9cfaa01..1c75a2d3d 100644
--- a/services/sync/tps/extensions/mozmill/resource/modules/windows.js
+++ b/services/sync/tps/extensions/mozmill/resource/modules/windows.js
@@ -4,9 +4,9 @@
var EXPORTED_SYMBOLS = ["init", "map"];
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cu = Components.utils;
// imports
var utils = {}; Cu.import('resource://mozmill/stdlib/utils.js', utils);
diff --git a/services/sync/tps/extensions/mozmill/resource/stdlib/EventUtils.js b/services/sync/tps/extensions/mozmill/resource/stdlib/EventUtils.js
index a821ab2e0..7f08469f0 100644
--- a/services/sync/tps/extensions/mozmill/resource/stdlib/EventUtils.js
+++ b/services/sync/tps/extensions/mozmill/resource/stdlib/EventUtils.js
@@ -8,8 +8,8 @@ var EXPORTED_SYMBOLS = ["disableNonTestMouseEvents","sendMouseEvent", "sendChar"
"synthesizeText",
"synthesizeComposition", "synthesizeQuerySelectedText"];
-const Ci = Components.interfaces;
-const Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cc = Components.classes;
var window = Cc["@mozilla.org/appshell/appShellService;1"]
.getService(Ci.nsIAppShellService).hiddenDOMWindow;
diff --git a/services/sync/tps/extensions/mozmill/resource/stdlib/os.js b/services/sync/tps/extensions/mozmill/resource/stdlib/os.js
index fcda30572..ce88bea8a 100644
--- a/services/sync/tps/extensions/mozmill/resource/stdlib/os.js
+++ b/services/sync/tps/extensions/mozmill/resource/stdlib/os.js
@@ -4,9 +4,9 @@
var EXPORTED_SYMBOLS = ['listDirectory', 'getFileForPath', 'abspath', 'getPlatform'];
-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/Services.jsm");
@@ -37,7 +37,7 @@ function abspath(rel, file) {
file = file.parent;
}
- for each(var p in relSplit) {
+ for (var p of relSplit) {
if (p == '..') {
file = file.parent;
} else if (p == '.') {
diff --git a/services/sync/tps/extensions/mozmill/resource/stdlib/securable-module.js b/services/sync/tps/extensions/mozmill/resource/stdlib/securable-module.js
index 794c3e2c2..bfa7ef5a9 100644
--- a/services/sync/tps/extensions/mozmill/resource/stdlib/securable-module.js
+++ b/services/sync/tps/extensions/mozmill/resource/stdlib/securable-module.js
@@ -168,8 +168,7 @@
if (rootPaths) {
if (rootPaths.constructor.name != "Array")
rootPaths = [rootPaths];
- var fses = [new exports.LocalFileSystem(path)
- for each (path in rootPaths)];
+ var fses = rootPaths.map(path => new exports.LocalFileSystem(path));
options.fs = new exports.CompositeFileSystem(fses);
} else
options.fs = new exports.LocalFileSystem();
diff --git a/services/sync/tps/extensions/mozmill/resource/stdlib/utils.js b/services/sync/tps/extensions/mozmill/resource/stdlib/utils.js
index 3dcca76e0..f27bbaaf7 100644
--- a/services/sync/tps/extensions/mozmill/resource/stdlib/utils.js
+++ b/services/sync/tps/extensions/mozmill/resource/stdlib/utils.js
@@ -10,9 +10,9 @@ var EXPORTED_SYMBOLS = ["applicationName", "assert", "Copy", "getBrowserObject",
"unwrapNode", "waitFor"
];
-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/NetUtil.jsm");
@@ -83,7 +83,7 @@ function getWindows(type) {
}
function getMethodInWindows(methodName) {
- for each (var w in getWindows()) {
+ for (var w of getWindows()) {
if (w[methodName] != undefined) {
return w[methodName];
}
@@ -93,7 +93,7 @@ function getMethodInWindows(methodName) {
}
function getWindowByTitle(title) {
- for each (var w in getWindows()) {
+ for (var w of getWindows()) {
if (w.document.title && w.document.title == title) {
return w;
}
diff --git a/services/sync/tps/extensions/tps/resource/modules/addons.jsm b/services/sync/tps/extensions/tps/resource/modules/addons.jsm
index 5c308b5c2..8dae75ede 100644
--- a/services/sync/tps/extensions/tps/resource/modules/addons.jsm
+++ b/services/sync/tps/extensions/tps/resource/modules/addons.jsm
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
-let EXPORTED_SYMBOLS = ["Addon", "STATE_ENABLED", "STATE_DISABLED"];
+var EXPORTED_SYMBOLS = ["Addon", "STATE_ENABLED", "STATE_DISABLED"];
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
diff --git a/services/sync/tps/extensions/tps/resource/modules/history.jsm b/services/sync/tps/extensions/tps/resource/modules/history.jsm
index ab0514bcc..3e750a5f0 100644
--- a/services/sync/tps/extensions/tps/resource/modules/history.jsm
+++ b/services/sync/tps/extensions/tps/resource/modules/history.jsm
@@ -33,7 +33,7 @@ var DumpHistory = function TPS_History__DumpHistory() {
let node = root.getChild(i);
let uri = node.uri;
let curvisits = HistoryEntry._getVisits(uri);
- for each (var visit in curvisits) {
+ for (var visit of curvisits) {
Logger.logInfo("URI: " + uri + ", type=" + visit.type + ", date=" + visit.date, true);
}
}
@@ -110,7 +110,7 @@ var HistoryEntry = {
uri: uri,
visits: []
};
- for each (visit in item.visits) {
+ for (let visit of item.visits) {
place.visits.push({
visitDate: usSinceEpoch + (visit.date * 60 * 60 * 1000 * 1000),
transitionType: visit.type
@@ -150,8 +150,8 @@ var HistoryEntry = {
"History entry in test file must have both 'visits' " +
"and 'uri' properties");
let curvisits = this._getVisits(item.uri);
- for each (visit in curvisits) {
- for each (itemvisit in item.visits) {
+ for (let visit of curvisits) {
+ for (let itemvisit of item.visits) {
let expectedDate = itemvisit.date * 60 * 60 * 1000 * 1000
+ usSinceEpoch;
if (visit.type == itemvisit.type && visit.date == expectedDate) {
@@ -161,7 +161,7 @@ var HistoryEntry = {
}
let all_items_found = true;
- for each (itemvisit in item.visits) {
+ for (let itemvisit of item.visits) {
all_items_found = all_items_found && "found" in itemvisit;
Logger.logInfo("History entry for " + item.uri + ", type:" +
itemvisit.type + ", date:" + itemvisit.date +
diff --git a/services/sync/tps/extensions/tps/resource/modules/passwords.jsm b/services/sync/tps/extensions/tps/resource/modules/passwords.jsm
index f7221224a..a84800bab 100644
--- a/services/sync/tps/extensions/tps/resource/modules/passwords.jsm
+++ b/services/sync/tps/extensions/tps/resource/modules/passwords.jsm
@@ -14,7 +14,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://tps/logger.jsm");
-let nsLoginInfo = new Components.Constructor(
+var nsLoginInfo = new Components.Constructor(
"@mozilla.org/login-manager/loginInfo;1",
Ci.nsILoginInfo,
"init");
diff --git a/services/sync/tps/extensions/tps/resource/modules/prefs.jsm b/services/sync/tps/extensions/tps/resource/modules/prefs.jsm
index 18a6e32ee..286c5a6b5 100644
--- a/services/sync/tps/extensions/tps/resource/modules/prefs.jsm
+++ b/services/sync/tps/extensions/tps/resource/modules/prefs.jsm
@@ -13,7 +13,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
const WEAVE_PREF_PREFIX = "services.sync.prefs.sync.";
-let prefs = Cc["@mozilla.org/preferences-service;1"]
+var prefs = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch);
Cu.import("resource://tps/logger.jsm");
diff --git a/services/sync/tps/extensions/tps/resource/modules/tabs.jsm b/services/sync/tps/extensions/tps/resource/modules/tabs.jsm
index a2ce1afc1..af983573f 100644
--- a/services/sync/tps/extensions/tps/resource/modules/tabs.jsm
+++ b/services/sync/tps/extensions/tps/resource/modules/tabs.jsm
@@ -13,7 +13,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://services-sync/main.js");
-let BrowserTabs = {
+var BrowserTabs = {
/**
* Add
*
@@ -49,8 +49,12 @@ let BrowserTabs = {
Find: function(uri, title, profile) {
// Find the uri in Weave's list of tabs for the given profile.
let engine = Weave.Service.engineManager.get("tabs");
- for (let [guid, client] in Iterator(engine.getAllClients())) {
- for each (tab in client.tabs) {
+ for (let [guid, client] of Object.entries(engine.getAllClients())) {
+ if (!client.tabs) {
+ continue;
+ }
+ for (let key in client.tabs) {
+ let tab = client.tabs[key];
let weaveTabUrl = tab.urlHistory[0];
if (uri == weaveTabUrl && profile == client.clientName)
if (title == undefined || title == tab.title)
diff --git a/services/sync/tps/extensions/tps/resource/modules/windows.jsm b/services/sync/tps/extensions/tps/resource/modules/windows.jsm
index 62cc80d2c..d892aea56 100644
--- a/services/sync/tps/extensions/tps/resource/modules/windows.jsm
+++ b/services/sync/tps/extensions/tps/resource/modules/windows.jsm
@@ -14,7 +14,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://services-sync/main.js");
-let BrowserWindows = {
+var BrowserWindows = {
/**
* Add
*
diff --git a/services/sync/tps/extensions/tps/resource/tps.jsm b/services/sync/tps/extensions/tps/resource/tps.jsm
index d3a8b0b7d..db191def7 100644
--- a/services/sync/tps/extensions/tps/resource/tps.jsm
+++ b/services/sync/tps/extensions/tps/resource/tps.jsm
@@ -7,11 +7,11 @@
* listed symbols will exposed on import, and only when and where imported.
*/
-let EXPORTED_SYMBOLS = ["ACTIONS", "TPS"];
+var EXPORTED_SYMBOLS = ["ACTIONS", "TPS"];
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-let module = this;
+var module = this;
// Global modules
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
@@ -89,7 +89,7 @@ const OBSERVER_TOPICS = ["fxaccounts:onlogin",
"weave:service:sync:start"
];
-let TPS = {
+var TPS = {
_currentAction: -1,
_currentPhase: -1,
_enabledEngines: null,
@@ -285,7 +285,7 @@ let TPS = {
HandleTabs: function (tabs, action) {
this._tabsAdded = tabs.length;
this._tabsFinished = 0;
- for each (let tab in tabs) {
+ for (let tab of tabs) {
Logger.logInfo("executing action " + action.toUpperCase() +
" on tab " + JSON.stringify(tab));
switch(action) {
@@ -330,7 +330,7 @@ let TPS = {
},
HandlePrefs: function (prefs, action) {
- for each (pref in prefs) {
+ for (let pref of prefs) {
Logger.logInfo("executing action " + action.toUpperCase() +
" on pref " + JSON.stringify(pref));
let preference = new Preference(pref);
@@ -349,7 +349,7 @@ let TPS = {
},
HandleForms: function (data, action) {
- for each (datum in data) {
+ for (let datum of data) {
Logger.logInfo("executing action " + action.toUpperCase() +
" on form entry " + JSON.stringify(datum));
let formdata = new FormData(datum, this._usSinceEpoch);
@@ -377,7 +377,7 @@ let TPS = {
HandleHistory: function (entries, action) {
try {
- for each (entry in entries) {
+ for (let entry of entries) {
Logger.logInfo("executing action " + action.toUpperCase() +
" on history entry " + JSON.stringify(entry));
switch(action) {
@@ -410,7 +410,7 @@ let TPS = {
HandlePasswords: function (passwords, action) {
try {
- for each (password in passwords) {
+ for (let password of passwords) {
let password_id = -1;
Logger.logInfo("executing action " + action.toUpperCase() +
" on password " + JSON.stringify(password));
@@ -450,7 +450,7 @@ let TPS = {
},
HandleAddons: function (addons, action, state) {
- for each (let entry in addons) {
+ for (let entry of addons) {
Logger.logInfo("executing action " + action.toUpperCase() +
" on addon " + JSON.stringify(entry));
let addon = new Addon(this, entry);
@@ -483,7 +483,7 @@ let TPS = {
let items = [];
for (folder in bookmarks) {
let last_item_pos = -1;
- for each (bookmark in bookmarks[folder]) {
+ for (let bookmark of bookmarks[folder]) {
Logger.clearPotentialError();
let placesItem;
bookmark['location'] = folder;
@@ -525,7 +525,7 @@ let TPS = {
}
if (action == ACTION_DELETE || action == ACTION_MODIFY) {
- for each (item in items) {
+ for (let item of items) {
Logger.logInfo("executing action " + action.toUpperCase() +
" on bookmark " + JSON.stringify(item));
switch(action) {
@@ -689,7 +689,7 @@ let TPS = {
// care about.
if (settings.ignoreUnusedEngines && Array.isArray(this._enabledEngines)) {
let names = {};
- for each (let name in this._enabledEngines) {
+ for (let name of this._enabledEngines) {
names[name] = true;
}