diff --git a/services/.eslintrc.js b/services/.eslintrc.js deleted file mode 100644 index 0c441ce41635..000000000000 --- a/services/.eslintrc.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; - -module.exports = { - extends: [ - "plugin:mozilla/recommended" - ], - - plugins: [ - "mozilla" - ] -} diff --git a/services/crypto/modules/utils.js b/services/crypto/modules/utils.js index 3f8f0062ebfd..f14f0f33d125 100644 --- a/services/crypto/modules/utils.js +++ b/services/crypto/modules/utils.js @@ -511,7 +511,7 @@ this.CryptoUtils = { artifacts.hash = hash_b64; } - let requestString = ("hawk.1.header\n" + + let requestString = ("hawk.1.header" + "\n" + artifacts.ts.toString(10) + "\n" + artifacts.nonce + "\n" + artifacts.method + "\n" + diff --git a/services/fxaccounts/FxAccountsManager.jsm b/services/fxaccounts/FxAccountsManager.jsm index c2eee55fe383..cd00a9da26bc 100644 --- a/services/fxaccounts/FxAccountsManager.jsm +++ b/services/fxaccounts/FxAccountsManager.jsm @@ -465,7 +465,7 @@ this.FxAccountsManager = { let client = this._getFxAccountsClient(); return client.accountExists(aEmail).then( result => { - log.debug("Account " + (result ? "" : "does not ") + "exists"); + log.debug("Account " + result ? "" : "does not" + " exists"); let error = this._getError(result); if (error) { return this._error(error, result); diff --git a/services/fxaccounts/tests/mochitest/test_invalidEmailCase.html b/services/fxaccounts/tests/mochitest/test_invalidEmailCase.html index 4a9f9e6677f3..241fc4bc9ff6 100644 --- a/services/fxaccounts/tests/mochitest/test_invalidEmailCase.html +++ b/services/fxaccounts/tests/mochitest/test_invalidEmailCase.html @@ -38,11 +38,11 @@ let MockStorage = function() { this.data = null; }; MockStorage.prototype = Object.freeze({ - set(contents) { + set: function (contents) { this.data = contents; return Promise.resolve(null); }, - get() { + get: function () { return Promise.resolve(this.data); }, getOAuthTokens() { @@ -57,7 +57,7 @@ function MockFxAccounts() { return new FxAccounts({ _now_is: new Date(), - now() { + now: function() { return this._now_is; }, @@ -113,17 +113,18 @@ function runTest() { ok(false, JSON.stringify(signInError)); } ); -} +}; SpecialPowers.pushPrefEnv({"set": [ ["identity.fxaccounts.enabled", true], // fx accounts ["identity.fxaccounts.auth.uri", TEST_SERVER], // our sjs server ["browser.dom.window.dump.enabled", true], ]}, - function() { runTest(); } + function () { runTest(); } ); + diff --git a/services/sync/modules/bookmark_repair.js b/services/sync/modules/bookmark_repair.js index 0a5a25a54a55..737b66b1a333 100644 --- a/services/sync/modules/bookmark_repair.js +++ b/services/sync/modules/bookmark_repair.js @@ -381,7 +381,7 @@ class BookmarkRepairRequestor extends CollectionRepairRequestor { case STATE.FINISHED: break; - case STATE.NOT_REPAIRING: + case NOT_REPAIRING: // No repair is in progress. This is a common case, so only log trace. log.trace("continue repairs called but no repair in progress."); break; @@ -667,16 +667,18 @@ class BookmarkRepairResponder extends CollectionRepairResponder { log.debug(`repair request to upload item '${id}' but it isn't under a syncable root; writing a tombstone`); toDelete.add(id); } - // The item wasn't explicitly requested - only upload if it is syncable - // and doesn't exist on the server. - } else if (syncable && !existRemotely.has(id)) { - log.debug(`repair request found related item '${id}' which isn't on the server; uploading`); - toUpload.add(id); - } else if (!syncable && existRemotely.has(id)) { - log.debug(`repair request found non-syncable related item '${id}' on the server; writing a tombstone`); - toDelete.add(id); } else { - log.debug(`repair request found related item '${id}' which we will not upload; ignoring`); + // The item wasn't explicitly requested - only upload if it is syncable + // and doesn't exist on the server. + if (syncable && !existRemotely.has(id)) { + log.debug(`repair request found related item '${id}' which isn't on the server; uploading`); + toUpload.add(id); + } else if (!syncable && existRemotely.has(id)) { + log.debug(`repair request found non-syncable related item '${id}' on the server; writing a tombstone`); + toDelete.add(id); + } else { + log.debug(`repair request found related item '${id}' which we will not upload; ignoring`); + } } } return { toUpload, toDelete }; diff --git a/services/sync/modules/bookmark_validator.js b/services/sync/modules/bookmark_validator.js index db63bec7ab11..3d0279ce06ee 100644 --- a/services/sync/modules/bookmark_validator.js +++ b/services/sync/modules/bookmark_validator.js @@ -386,8 +386,6 @@ class BookmarkValidator { * the fields describing client/server relationship will not have been filled * out yet. */ - // XXX This should be split up and the complexity reduced. - // eslint-disable-next-line complexity async inspectServerRecords(serverRecords) { let deletedItemIds = new Set(); let idToRecord = new Map(); @@ -681,8 +679,6 @@ class BookmarkValidator { * - problemData is the same as for inspectServerRecords, except all properties * will be filled out. */ - // XXX This should be split up and the complexity reduced. - // eslint-disable-next-line complexity async compareServerWithClient(serverRecords, clientTree) { let clientRecords = await this.createClientRecordsFromTree(clientTree); diff --git a/services/sync/modules/telemetry.js b/services/sync/modules/telemetry.js index e0640254d5ff..ef1fa835c26e 100644 --- a/services/sync/modules/telemetry.js +++ b/services/sync/modules/telemetry.js @@ -697,5 +697,4 @@ class SyncTelemetryImpl { } -/* global SyncTelemetry */ this.SyncTelemetry = new SyncTelemetryImpl(ENGINES); diff --git a/services/sync/tests/unit/head_helpers.js b/services/sync/tests/unit/head_helpers.js index 364fbbdc16f3..ec404b190cf6 100644 --- a/services/sync/tests/unit/head_helpers.js +++ b/services/sync/tests/unit/head_helpers.js @@ -485,8 +485,6 @@ Utils.getDefaultDeviceName = function() { }; function registerRotaryEngine() { - let {RotaryEngine} = - Cu.import("resource://testing-common/services/sync/rotaryengine.js", {}); Service.engineManager.clear(); Service.engineManager.register(RotaryEngine); diff --git a/services/sync/tests/unit/test_bookmark_repair.js b/services/sync/tests/unit/test_bookmark_repair.js index 14fc98b534f9..a65164d6802e 100644 --- a/services/sync/tests/unit/test_bookmark_repair.js +++ b/services/sync/tests/unit/test_bookmark_repair.js @@ -313,6 +313,9 @@ add_task(async function test_repair_client_missing() { let server = serverForFoo(bookmarksEngine); await SyncTestingInfrastructure(server); + let user = server.user("foo"); + + let initialID = Service.clientsEngine.localID; let remoteID = Utils.makeGUID(); try { @@ -384,6 +387,7 @@ add_task(async function test_repair_server_missing() { let user = server.user("foo"); + let initialID = Service.clientsEngine.localID; let remoteID = Utils.makeGUID(); try { @@ -446,6 +450,9 @@ add_task(async function test_repair_server_deleted() { let server = serverForFoo(bookmarksEngine); await SyncTestingInfrastructure(server); + let user = server.user("foo"); + + let initialID = Service.clientsEngine.localID; let remoteID = Utils.makeGUID(); try { diff --git a/services/sync/tests/unit/test_clients_engine.js b/services/sync/tests/unit/test_clients_engine.js index 1e0d8f00e6c4..0dd209b6f536 100644 --- a/services/sync/tests/unit/test_clients_engine.js +++ b/services/sync/tests/unit/test_clients_engine.js @@ -791,6 +791,7 @@ add_task(async function test_clients_not_in_fxa_list() { let server = serverForFoo(engine); await SyncTestingInfrastructure(server); + let user = server.user("foo"); let remoteId = Utils.makeGUID(); let remoteId2 = Utils.makeGUID(); diff --git a/services/sync/tests/unit/test_errorhandler_filelog.js b/services/sync/tests/unit/test_errorhandler_filelog.js index 9a22f393e56c..af6428e80401 100644 --- a/services/sync/tests/unit/test_errorhandler_filelog.js +++ b/services/sync/tests/unit/test_errorhandler_filelog.js @@ -273,6 +273,7 @@ add_test(function test_noNewFailed_noErrorLog() { Svc.Prefs.set("log.appender.file.logOnError", true); Svc.Prefs.set("log.appender.file.logOnSuccess", false); + let log = Log.repository.getLogger("Sync.Test.FileLog"); Svc.Obs.add("weave:service:reset-file-log", function onResetFileLog() { Svc.Obs.remove("weave:service:reset-file-log", onResetFileLog); // No log file was written. diff --git a/tools/lint/eslint/modules.json b/tools/lint/eslint/modules.json index 838869018b46..6591b558ce49 100644 --- a/tools/lint/eslint/modules.json +++ b/tools/lint/eslint/modules.json @@ -38,7 +38,7 @@ "collection_repair.js": ["getRepairRequestor", "getAllRepairRequestors", "CollectionRepairRequestor", "getRepairResponder", "CollectionRepairResponder"], "collection_validator.js": ["CollectionValidator", "CollectionProblemData"], "Console.jsm": ["console", "ConsoleAPI"], - "constants.js": ["WEAVE_VERSION", "SYNC_API_VERSION", "USER_API_VERSION", "MISC_API_VERSION", "STORAGE_VERSION", "PREFS_BRANCH", "PWDMGR_HOST", "PWDMGR_PASSWORD_REALM", "PWDMGR_PASSPHRASE_REALM", "PWDMGR_KEYBUNDLE_REALM", "DEFAULT_KEYBUNDLE_NAME", "HMAC_INPUT", "SYNC_KEY_ENCODED_LENGTH", "SYNC_KEY_DECODED_LENGTH", "SYNC_KEY_HYPHENATED_LENGTH", "NO_SYNC_NODE_INTERVAL", "MAX_ERROR_COUNT_BEFORE_BACKOFF", "MAX_IGNORE_ERROR_COUNT", "MINIMUM_BACKOFF_INTERVAL", "MAXIMUM_BACKOFF_INTERVAL", "HMAC_EVENT_INTERVAL", "MASTER_PASSWORD_LOCKED_RETRY_INTERVAL", "DEFAULT_BLOCK_PERIOD", "MOBILE_BATCH_SIZE", "DEFAULT_GUID_FETCH_BATCH_SIZE", "DEFAULT_MOBILE_GUID_FETCH_BATCH_SIZE", "DEFAULT_STORE_BATCH_SIZE", "HISTORY_STORE_BATCH_SIZE", "FORMS_STORE_BATCH_SIZE", "PASSWORDS_STORE_BATCH_SIZE", "ADDONS_STORE_BATCH_SIZE", "APPS_STORE_BATCH_SIZE", "DEFAULT_DOWNLOAD_BATCH_SIZE", "DEFAULT_MAX_RECORD_PAYLOAD_BYTES", "SINGLE_USER_THRESHOLD", "MULTI_DEVICE_THRESHOLD", "SCORE_INCREMENT_SMALL", "SCORE_INCREMENT_MEDIUM", "SCORE_INCREMENT_XLARGE", "SCORE_UPDATE_DELAY", "IDLE_OBSERVER_BACK_DELAY", "MAX_UPLOAD_RECORDS", "MAX_UPLOAD_BYTES", "MAX_HISTORY_UPLOAD", "MAX_HISTORY_DOWNLOAD", "NOTIFY_TAB_SENT_TTL_SECS", "STATUS_OK", "SYNC_FAILED", "LOGIN_FAILED", "SYNC_FAILED_PARTIAL", "CLIENT_NOT_CONFIGURED", "STATUS_DISABLED", "MASTER_PASSWORD_LOCKED", "LOGIN_SUCCEEDED", "SYNC_SUCCEEDED", "ENGINE_SUCCEEDED", "LOGIN_FAILED_NO_USERNAME", "LOGIN_FAILED_NO_PASSWORD", "LOGIN_FAILED_NO_PASSPHRASE", "LOGIN_FAILED_NETWORK_ERROR", "LOGIN_FAILED_SERVER_ERROR", "LOGIN_FAILED_INVALID_PASSPHRASE", "LOGIN_FAILED_LOGIN_REJECTED", "METARECORD_DOWNLOAD_FAIL", "VERSION_OUT_OF_DATE", "DESKTOP_VERSION_OUT_OF_DATE", "SETUP_FAILED_NO_PASSPHRASE", "CREDENTIALS_CHANGED", "ABORT_SYNC_COMMAND", "NO_SYNC_NODE_FOUND", "OVER_QUOTA", "PROLONGED_SYNC_FAILURE", "SERVER_MAINTENANCE", "RESPONSE_OVER_QUOTA", "ENGINE_UPLOAD_FAIL", "ENGINE_DOWNLOAD_FAIL", "ENGINE_UNKNOWN_FAIL", "ENGINE_APPLY_FAIL", "ENGINE_METARECORD_DOWNLOAD_FAIL", "ENGINE_METARECORD_UPLOAD_FAIL", "ENGINE_BATCH_INTERRUPTED", "JPAKE_ERROR_CHANNEL", "JPAKE_ERROR_NETWORK", "JPAKE_ERROR_SERVER", "JPAKE_ERROR_TIMEOUT", "JPAKE_ERROR_INTERNAL", "JPAKE_ERROR_INVALID", "JPAKE_ERROR_NODATA", "JPAKE_ERROR_KEYMISMATCH", "JPAKE_ERROR_WRONGMESSAGE", "JPAKE_ERROR_USERABORT", "JPAKE_ERROR_DELAYUNSUPPORTED", "INFO_COLLECTIONS", "INFO_COLLECTION_USAGE", "INFO_COLLECTION_COUNTS", "INFO_QUOTA", "kSyncMasterPasswordLocked", "kSyncWeaveDisabled", "kSyncNetworkOffline", "kSyncBackoffNotMet", "kFirstSyncChoiceNotMade", "FIREFOX_ID", "FENNEC_ID", "SEAMONKEY_ID", "TEST_HARNESS_ID", "MIN_PP_LENGTH", "MIN_PASS_LENGTH", "DEVICE_TYPE_DESKTOP", "DEVICE_TYPE_MOBILE", "SQLITE_MAX_VARIABLE_NUMBER"], + "constants.js": ["WEAVE_VERSION", "SYNC_API_VERSION", "USER_API_VERSION", "MISC_API_VERSION", "STORAGE_VERSION", "PREFS_BRANCH", "PWDMGR_HOST", "PWDMGR_PASSWORD_REALM", "PWDMGR_PASSPHRASE_REALM", "PWDMGR_KEYBUNDLE_REALM", "DEFAULT_KEYBUNDLE_NAME", "HMAC_INPUT", "SYNC_KEY_ENCODED_LENGTH", "SYNC_KEY_DECODED_LENGTH", "SYNC_KEY_HYPHENATED_LENGTH", "NO_SYNC_NODE_INTERVAL", "MAX_ERROR_COUNT_BEFORE_BACKOFF", "MAX_IGNORE_ERROR_COUNT", "MINIMUM_BACKOFF_INTERVAL", "MAXIMUM_BACKOFF_INTERVAL", "HMAC_EVENT_INTERVAL", "MASTER_PASSWORD_LOCKED_RETRY_INTERVAL", "DEFAULT_BLOCK_PERIOD", "MOBILE_BATCH_SIZE", "DEFAULT_GUID_FETCH_BATCH_SIZE", "DEFAULT_MOBILE_GUID_FETCH_BATCH_SIZE", "DEFAULT_STORE_BATCH_SIZE", "HISTORY_STORE_BATCH_SIZE", "FORMS_STORE_BATCH_SIZE", "PASSWORDS_STORE_BATCH_SIZE", "ADDONS_STORE_BATCH_SIZE", "APPS_STORE_BATCH_SIZE", "DEFAULT_DOWNLOAD_BATCH_SIZE", "SINGLE_USER_THRESHOLD", "MULTI_DEVICE_THRESHOLD", "SCORE_INCREMENT_SMALL", "SCORE_INCREMENT_MEDIUM", "SCORE_INCREMENT_XLARGE", "SCORE_UPDATE_DELAY", "IDLE_OBSERVER_BACK_DELAY", "MAX_UPLOAD_RECORDS", "MAX_UPLOAD_BYTES", "MAX_HISTORY_UPLOAD", "MAX_HISTORY_DOWNLOAD", "NOTIFY_TAB_SENT_TTL_SECS", "STATUS_OK", "SYNC_FAILED", "LOGIN_FAILED", "SYNC_FAILED_PARTIAL", "CLIENT_NOT_CONFIGURED", "STATUS_DISABLED", "MASTER_PASSWORD_LOCKED", "LOGIN_SUCCEEDED", "SYNC_SUCCEEDED", "ENGINE_SUCCEEDED", "LOGIN_FAILED_NO_USERNAME", "LOGIN_FAILED_NO_PASSWORD", "LOGIN_FAILED_NO_PASSPHRASE", "LOGIN_FAILED_NETWORK_ERROR", "LOGIN_FAILED_SERVER_ERROR", "LOGIN_FAILED_INVALID_PASSPHRASE", "LOGIN_FAILED_LOGIN_REJECTED", "METARECORD_DOWNLOAD_FAIL", "VERSION_OUT_OF_DATE", "DESKTOP_VERSION_OUT_OF_DATE", "SETUP_FAILED_NO_PASSPHRASE", "CREDENTIALS_CHANGED", "ABORT_SYNC_COMMAND", "NO_SYNC_NODE_FOUND", "OVER_QUOTA", "PROLONGED_SYNC_FAILURE", "SERVER_MAINTENANCE", "RESPONSE_OVER_QUOTA", "ENGINE_UPLOAD_FAIL", "ENGINE_DOWNLOAD_FAIL", "ENGINE_UNKNOWN_FAIL", "ENGINE_APPLY_FAIL", "ENGINE_METARECORD_DOWNLOAD_FAIL", "ENGINE_METARECORD_UPLOAD_FAIL", "ENGINE_BATCH_INTERRUPTED", "JPAKE_ERROR_CHANNEL", "JPAKE_ERROR_NETWORK", "JPAKE_ERROR_SERVER", "JPAKE_ERROR_TIMEOUT", "JPAKE_ERROR_INTERNAL", "JPAKE_ERROR_INVALID", "JPAKE_ERROR_NODATA", "JPAKE_ERROR_KEYMISMATCH", "JPAKE_ERROR_WRONGMESSAGE", "JPAKE_ERROR_USERABORT", "JPAKE_ERROR_DELAYUNSUPPORTED", "INFO_COLLECTIONS", "INFO_COLLECTION_USAGE", "INFO_COLLECTION_COUNTS", "INFO_QUOTA", "kSyncMasterPasswordLocked", "kSyncWeaveDisabled", "kSyncNetworkOffline", "kSyncBackoffNotMet", "kFirstSyncChoiceNotMade", "FIREFOX_ID", "FENNEC_ID", "SEAMONKEY_ID", "TEST_HARNESS_ID", "MIN_PP_LENGTH", "MIN_PASS_LENGTH", "DEVICE_TYPE_DESKTOP", "DEVICE_TYPE_MOBILE", "SQLITE_MAX_VARIABLE_NUMBER"], "Constants.jsm": ["Roles", "Events", "Relations", "Filters", "States", "Prefilters"], "ContactDB.jsm": ["ContactDB", "DB_NAME", "STORE_NAME", "SAVED_GETALL_STORE_NAME", "REVISION_STORE", "DB_VERSION"], "content-server.jsm": ["init"],