diff --git a/services/.eslintrc.js b/services/.eslintrc.js index a42f4047f8c2..c11de0d4b01e 100644 --- a/services/.eslintrc.js +++ b/services/.eslintrc.js @@ -21,7 +21,6 @@ module.exports = { "no-redeclare": "warn", "no-unreachable": "warn", "no-unsafe-finally": "warn", - "no-unused-vars": "warn", "no-useless-call": "warn" } }; diff --git a/services/cloudsync/CloudSyncBookmarks.jsm b/services/cloudsync/CloudSyncBookmarks.jsm index fb4438f4d5ee..4cb0bc7a7f60 100644 --- a/services/cloudsync/CloudSyncBookmarks.jsm +++ b/services/cloudsync/CloudSyncBookmarks.jsm @@ -144,7 +144,6 @@ var Bookmarks = function() { let getRootFolder = function(name) { let ROOT_FOLDER_ANNO = "cloudsync/rootFolder/" + name; - let ROOT_SHORTCUT_ANNO = "cloudsync/rootShortcut/" + name; let deferred = Promise.defer(); function checkRootFolder(folderIds) { @@ -171,7 +170,6 @@ var Bookmarks = function() { let ROOT_SHORTCUT_ANNO = "cloudsync/rootShortcut/" + name; let deferred = Promise.defer(); - let placesRootId = PlacesUtils.placesRootId; function getRootShortcutId() { return PlacesWrapper.getLocalIdsWithAnnotation(ROOT_SHORTCUT_ANNO); diff --git a/services/cloudsync/CloudSyncTabs.jsm b/services/cloudsync/CloudSyncTabs.jsm index 0b35c21932bb..74e98187a175 100644 --- a/services/cloudsync/CloudSyncTabs.jsm +++ b/services/cloudsync/CloudSyncTabs.jsm @@ -220,19 +220,6 @@ this.Tabs = function() { let tabCache = new TabCache(); - let getWindowEnumerator = function() { - return Services.wm.getEnumerator("navigator:browser"); - }; - - let shouldSkipWindow = function(win) { - return win.closed || - PrivateBrowsingUtils.isWindowPrivate(win); - }; - - let getTabState = function(tab) { - return JSON.parse(Session.getTabState(tab)); - }; - let getLocalTabs = function(filter) { let deferred = Promise.defer(); diff --git a/services/common/modules-testing/storageserver.js b/services/common/modules-testing/storageserver.js index cf5a8618788a..a3c0f0541b16 100644 --- a/services/common/modules-testing/storageserver.js +++ b/services/common/modules-testing/storageserver.js @@ -345,7 +345,7 @@ StorageServerCollection.prototype = { */ bsos: function bsos(filter) { let os = []; - for (let [id, bso] of Object.entries(this._bsos)) { + for (let bso of Object.values(this._bsos)) { if (!bso.deleted) { os.push(bso); } @@ -440,7 +440,7 @@ StorageServerCollection.prototype = { count: function count(options) { options = options || {}; let c = 0; - for (let [id, bso] of Object.entries(this._bsos)) { + for (let bso of Object.values(this._bsos)) { if (bso.modified && this._inResultSet(bso, options)) { c++; } @@ -598,7 +598,7 @@ StorageServerCollection.prototype = { } let deleted = []; - for (let [id, bso] of Object.entries(this._bsos)) { + for (let bso of Object.values(this._bsos)) { if (this._inResultSet(bso, options)) { this._log.debug("Deleting " + JSON.stringify(bso)); deleted.push(bso.id); @@ -730,8 +730,6 @@ StorageServerCollection.prototype = { }, postHandler: function postHandler(request, response) { - let options = this.parseOptions(request); - if (!request.hasHeader("content-type")) { this._log.info("No Content-Type request header!"); throw HTTP_400; @@ -1319,7 +1317,7 @@ StorageServer.prototype = { throw HTTP_404; } - let [all, version, userPath, first, rest] = parts; + let [, version, userPath, first, rest] = parts; if (version != STORAGE_API_VERSION) { this._log.debug("StorageServer: Unknown version."); throw HTTP_404; @@ -1427,7 +1425,7 @@ StorageServer.prototype = { this._log.warn("StorageServer: Unknown storage operation " + rest); throw HTTP_404; } - let [all, collection, bsoID] = match; + let [, collection, bsoID] = match; let coll = this.getCollection(username, collection); let collectionExisted = !!coll; diff --git a/services/common/tests/unit/test_async_querySpinningly.js b/services/common/tests/unit/test_async_querySpinningly.js index 76d4ffbbb135..50808e86ce3f 100644 --- a/services/common/tests/unit/test_async_querySpinningly.js +++ b/services/common/tests/unit/test_async_querySpinningly.js @@ -85,9 +85,9 @@ function run_test() { _("Generate an execution error"); let query = "INSERT INTO moz_formhistory (fieldname, value) VALUES ('one', NULL)"; let stmt = Svc.Form.DBConnection.createStatement(query); - let r11, except; + let except; try { - r11 = Async.querySpinningly(stmt); + Async.querySpinningly(stmt); } catch (e) { except = e; } diff --git a/services/common/tests/unit/test_blocklist_certificates.js b/services/common/tests/unit/test_blocklist_certificates.js index 5da16f613e56..cf5ee9d03889 100644 --- a/services/common/tests/unit/test_blocklist_certificates.js +++ b/services/common/tests/unit/test_blocklist_certificates.js @@ -64,7 +64,7 @@ add_task(function* test_something() { server.registerPathHandler(recordsPath, handleResponse); // Test an empty db populates - let result = yield OneCRLBlocklistClient.maybeSync(2000, Date.now()); + yield OneCRLBlocklistClient.maybeSync(2000, Date.now()); // Open the collection, verify it's been populated: // Our test data has a single record; it should be in the local collection diff --git a/services/common/tests/unit/test_blocklist_clients.js b/services/common/tests/unit/test_blocklist_clients.js index ca5aa5eaeecb..997b590f7863 100644 --- a/services/common/tests/unit/test_blocklist_clients.js +++ b/services/common/tests/unit/test_blocklist_clients.js @@ -121,7 +121,7 @@ function run_test() { add_task(function* test_records_obtained_from_server_are_stored_in_db() { for (let {client} of gBlocklistClients) { // Test an empty db populates - let result = yield client.maybeSync(2000, Date.now()); + yield client.maybeSync(2000, Date.now()); // Open the collection, verify it's been populated: // Our test data has a single record; it should be in the local collection @@ -139,7 +139,7 @@ add_task(function* test_list_is_written_to_file_in_profile() { const profFile = FileUtils.getFile(KEY_PROFILEDIR, [filename]); strictEqual(profFile.exists(), false); - let result = yield client.maybeSync(2000, Date.now()); + yield client.maybeSync(2000, Date.now()); strictEqual(profFile.exists(), true); const content = yield readJSON(profFile.path); @@ -150,7 +150,6 @@ add_task(clear_state); add_task(function* test_current_server_time_is_saved_in_pref() { for (let {client} of gBlocklistClients) { - const before = Services.prefs.getIntPref(client.lastCheckTimePref); const serverTime = Date.now(); yield client.maybeSync(2000, serverTime); const after = Services.prefs.getIntPref(client.lastCheckTimePref); @@ -162,7 +161,6 @@ add_task(clear_state); add_task(function* test_update_json_file_when_addons_has_changes() { for (let {client, filename, testData} of gBlocklistClients) { yield client.maybeSync(2000, Date.now() - 1000); - const before = Services.prefs.getIntPref(client.lastCheckTimePref); const profFile = FileUtils.getFile(KEY_PROFILEDIR, [filename]); const fileLastModified = profFile.lastModifiedTime = profFile.lastModifiedTime - 1000; const serverTime = Date.now(); @@ -198,7 +196,6 @@ add_task(clear_state); add_task(function* test_do_nothing_when_blocklist_is_up_to_date() { for (let {client, filename} of gBlocklistClients) { yield client.maybeSync(2000, Date.now() - 1000); - const before = Services.prefs.getIntPref(client.lastCheckTimePref); const profFile = FileUtils.getFile(KEY_PROFILEDIR, [filename]); const fileLastModified = profFile.lastModifiedTime = profFile.lastModifiedTime - 1000; const serverTime = Date.now(); diff --git a/services/common/tests/unit/test_blocklist_pinning.js b/services/common/tests/unit/test_blocklist_pinning.js index 54229f5e4870..a270eddc82a1 100644 --- a/services/common/tests/unit/test_blocklist_pinning.js +++ b/services/common/tests/unit/test_blocklist_pinning.js @@ -98,7 +98,7 @@ add_task(function* test_something() { ok(!sss.isSecureHost(sss.HEADER_HSTS, "five.example.com", 0)); // Test an empty db populates - let result = yield PinningPreloadClient.maybeSync(2000, Date.now()); + yield PinningPreloadClient.maybeSync(2000, Date.now()); let connection = yield FirefoxAdapter.openConnection({path: KINTO_STORAGE_PATH}); diff --git a/services/common/tests/unit/test_blocklist_signatures.js b/services/common/tests/unit/test_blocklist_signatures.js index 5a08761aeebf..ca1f46306a11 100644 --- a/services/common/tests/unit/test_blocklist_signatures.js +++ b/services/common/tests/unit/test_blocklist_signatures.js @@ -143,7 +143,6 @@ add_task(function* test_check_signatures() { for (let key of Object.keys(responses)) { const keyParts = key.split(":"); - const method = keyParts[0]; const valueParts = keyParts[1].split("?"); const path = valueParts[0]; diff --git a/services/common/tests/unit/test_hawkclient.js b/services/common/tests/unit/test_hawkclient.js index 9d24db0205e1..1a91cc6a2484 100644 --- a/services/common/tests/unit/test_hawkclient.js +++ b/services/common/tests/unit/test_hawkclient.js @@ -202,7 +202,7 @@ add_task(function* test_offset_after_request() { do_check_eq(client.localtimeOffsetMsec, 0); - let response = yield client.request("/foo", method, TEST_CREDS); + yield client.request("/foo", method, TEST_CREDS); // Should be about an hour off do_check_true(Math.abs(client.localtimeOffsetMsec + HOUR_MS) < SECOND_MS); @@ -236,9 +236,6 @@ add_task(function* test_offset_in_hawk_header() { }); let client = new HawkClient(server.baseURI); - function getOffset() { - return client.localtimeOffsetMsec; - } client.now = () => { return Date.now() + 12 * HOUR_MS; @@ -316,9 +313,6 @@ add_task(function* test_retry_request_on_fail() { }); let client = new HawkClient(server.baseURI); - function getOffset() { - return client.localtimeOffsetMsec; - } client.now = () => { return Date.now() + 12 * HOUR_MS; @@ -360,9 +354,6 @@ add_task(function* test_multiple_401_retry_once() { }); let client = new HawkClient(server.baseURI); - function getOffset() { - return client.localtimeOffsetMsec; - } client.now = () => { return Date.now() - 12 * HOUR_MS; @@ -402,9 +393,6 @@ add_task(function* test_500_no_retry() { }); let client = new HawkClient(server.baseURI); - function getOffset() { - return client.localtimeOffsetMsec; - } // Throw off the clock so the HawkClient would want to retry the request if // it could @@ -464,9 +452,6 @@ add_task(function* test_401_then_500() { }); let client = new HawkClient(server.baseURI); - function getOffset() { - return client.localtimeOffsetMsec; - } client.now = () => { return Date.now() - 12 * HOUR_MS; diff --git a/services/common/tests/unit/test_hawkrequest.js b/services/common/tests/unit/test_hawkrequest.js index 1f0e9ec8d0f3..a88bc946b83d 100644 --- a/services/common/tests/unit/test_hawkrequest.js +++ b/services/common/tests/unit/test_hawkrequest.js @@ -57,7 +57,6 @@ add_test(function test_intl_accept_language() { setLanguagePref(languages[testCount]); function checkLanguagePref() { - var _done = false; CommonUtils.nextTick(function() { // Ensure we're only called for the number of entries in languages[]. do_check_true(testCount < languages.length); @@ -186,7 +185,6 @@ add_test(function test_hawk_language_pref_changed() { }); let url = server.baseURI + "/foo"; - let postData = {}; let request; setLanguage(languages[0]); diff --git a/services/common/tests/unit/test_logmanager.js b/services/common/tests/unit/test_logmanager.js index 13e5caa0a655..27d4a76668d5 100644 --- a/services/common/tests/unit/test_logmanager.js +++ b/services/common/tests/unit/test_logmanager.js @@ -83,7 +83,7 @@ add_task(function* test_SharedLogs() { let lm2 = new LogManager("log-manager-2.test.", ["TestLog3"], "test"); let log = Log.repository.getLogger("TestLog3"); - let [capp, dapp, fapps] = getAppenders(log); + let [capp, dapp, ] = getAppenders(log); // console and dump appenders should be "trace" as it is more verbose than // "debug" diff --git a/services/common/tests/unit/test_storage_adapter.js b/services/common/tests/unit/test_storage_adapter.js index 5c23d257475c..066b05f68398 100644 --- a/services/common/tests/unit/test_storage_adapter.js +++ b/services/common/tests/unit/test_storage_adapter.js @@ -248,7 +248,6 @@ add_test(function test_creation_from_empty_db() { add_test(function test_create_from_empty_db() { // place an empty kinto db file in the profile let profile = do_get_profile(); - let kintoDB = do_get_kinto_db(); let emptyDB = do_get_file("test_storage_adapter/empty.sqlite"); emptyDB.copyTo(profile, kintoFilename); diff --git a/services/common/tests/unit/test_storage_server.js b/services/common/tests/unit/test_storage_server.js index 8609a0fa50c5..ae1099911eac 100644 --- a/services/common/tests/unit/test_storage_server.js +++ b/services/common/tests/unit/test_storage_server.js @@ -173,8 +173,8 @@ add_test(function test_url_parsing() { do_check_eq(rest, undefined); parts = server.storageRE.exec("storage"); - let storage, collection, id; - [all, storage, collection, id] = parts; + let collection; + [all, , collection, ] = parts; do_check_eq(all, "storage"); do_check_eq(collection, undefined); @@ -414,7 +414,7 @@ add_test(function test_bso_delete_exists() { server.startSynchronous(); let coll = server.user("123").createCollection("test"); - let bso = coll.insert("myid", {foo: "bar"}); + coll.insert("myid", {foo: "bar"}); let timestamp = coll.timestamp; server.callback.onItemDeleted = function onDeleted(username, collection, id) { diff --git a/services/common/utils.js b/services/common/utils.js index d1ab244d331a..953b79b33bd5 100644 --- a/services/common/utils.js +++ b/services/common/utils.js @@ -237,7 +237,6 @@ this.CommonUtils = { */ encodeBase32: function encodeBase32(bytes) { const key = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; - let quanta = Math.floor(bytes.length / 5); let leftover = bytes.length % 5; // Pad the last quantum with zeros so the length is a multiple of 5. diff --git a/services/crypto/modules/utils.js b/services/crypto/modules/utils.js index dca1d3b8381c..edf0794dedf0 100644 --- a/services/crypto/modules/utils.js +++ b/services/crypto/modules/utils.js @@ -134,7 +134,6 @@ this.CryptoUtils = { * HMAC-based Key Derivation (RFC 5869). */ hkdf: function hkdf(ikm, xts, info, len) { - const BLOCKSIZE = 256 / 8; if (typeof xts === undefined) xts = String.fromCharCode(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/services/fxaccounts/FxAccounts.jsm b/services/fxaccounts/FxAccounts.jsm index 0682d6baa379..cfe84f74bcc9 100644 --- a/services/fxaccounts/FxAccounts.jsm +++ b/services/fxaccounts/FxAccounts.jsm @@ -742,7 +742,7 @@ FxAccountsInternal.prototype = { _destroyAllOAuthTokens(tokenInfos) { // let's just destroy them all in parallel... let promises = []; - for (let [key, tokenInfo] of Object.entries(tokenInfos || {})) { + for (let tokenInfo of Object.values(tokenInfos || {})) { promises.push(this._destroyOAuthToken(tokenInfo)); } return Promise.all(promises); @@ -953,7 +953,6 @@ FxAccountsInternal.prototype = { getAssertionFromCert(data, keyPair, cert, audience) { log.debug("getAssertionFromCert"); - let payload = {}; let d = Promise.defer(); let options = { duration: ASSERTION_LIFETIME, diff --git a/services/fxaccounts/FxAccountsManager.jsm b/services/fxaccounts/FxAccountsManager.jsm index f3044833b24f..5b9aaef109fa 100644 --- a/services/fxaccounts/FxAccountsManager.jsm +++ b/services/fxaccounts/FxAccountsManager.jsm @@ -458,8 +458,6 @@ this.FxAccountsManager = { return this._error(ERROR_OFFLINE); } - let deferred = Promise.defer(); - if (!aEmail) { return this._error(ERROR_INVALID_EMAIL); } diff --git a/services/fxaccounts/tests/xpcshell/test_accounts.js b/services/fxaccounts/tests/xpcshell/test_accounts.js index 1a321c558d47..505623fc6264 100644 --- a/services/fxaccounts/tests/xpcshell/test_accounts.js +++ b/services/fxaccounts/tests/xpcshell/test_accounts.js @@ -1004,7 +1004,7 @@ add_task(function* test_sign_out_without_device() { delete credentials.deviceId; yield fxa.internal.setSignedInUser(credentials); - const user = yield fxa.internal.getUserAccountData(); + yield fxa.internal.getUserAccountData(); const spy = { signOut: { count: 0, args: [] }, diff --git a/services/fxaccounts/tests/xpcshell/test_accounts_device_registration.js b/services/fxaccounts/tests/xpcshell/test_accounts_device_registration.js index 11c845188892..15c7caf284fe 100644 --- a/services/fxaccounts/tests/xpcshell/test_accounts_device_registration.js +++ b/services/fxaccounts/tests/xpcshell/test_accounts_device_registration.js @@ -182,7 +182,6 @@ add_task(function* test_updateDeviceRegistration_with_new_device() { add_task(function* test_updateDeviceRegistration_with_existing_device() { const deviceName = "phil's device"; - const deviceType = "desktop"; const credentials = getTestUser("pb"); const fxa = new MockFxAccounts({ name: deviceName }); @@ -363,7 +362,6 @@ add_task(function* test_updateDeviceRegistration_with_device_session_conflict_er add_task(function* test_updateDeviceRegistration_with_unrecoverable_error() { const deviceName = "foo"; - const deviceType = "bar"; const credentials = getTestUser("baz"); delete credentials.deviceId; diff --git a/services/fxaccounts/tests/xpcshell/test_client.js b/services/fxaccounts/tests/xpcshell/test_client.js index 224276851725..61eba826183c 100644 --- a/services/fxaccounts/tests/xpcshell/test_client.js +++ b/services/fxaccounts/tests/xpcshell/test_client.js @@ -586,7 +586,6 @@ add_task(function* test_signCertificate() { }); add_task(function* test_accountExists() { - let sessionMessage = JSON.stringify({sessionToken: FAKE_SESSION_TOKEN}); let existsMessage = JSON.stringify({error: "wrong password", code: 400, errno: 103}); let doesntExistMessage = JSON.stringify({error: "no such account", code: 400, errno: 102}); let emptyMessage = "{}"; diff --git a/services/fxaccounts/tests/xpcshell/test_credentials.js b/services/fxaccounts/tests/xpcshell/test_credentials.js index 06314bb57a37..0e9ac57bf19a 100644 --- a/services/fxaccounts/tests/xpcshell/test_credentials.js +++ b/services/fxaccounts/tests/xpcshell/test_credentials.js @@ -67,8 +67,6 @@ add_task(function* test_onepw_setup_credentials() { }); add_task(function* test_client_stretch_kdf() { - let pbkdf2 = CryptoUtils.pbkdf2Generate; - let hkdf = CryptoUtils.hkdf; let expected = vectors["client stretch-KDF"]; let email = h2s(expected.email); diff --git a/services/fxaccounts/tests/xpcshell/test_profile.js b/services/fxaccounts/tests/xpcshell/test_profile.js index 179b13c450a8..ff008cc8f530 100644 --- a/services/fxaccounts/tests/xpcshell/test_profile.js +++ b/services/fxaccounts/tests/xpcshell/test_profile.js @@ -184,7 +184,7 @@ add_task(function* fetchAndCacheProfileOnce() { let profile = CreateFxAccountsProfile(null, client); let request1 = profile._fetchAndCacheProfile(); - let request2 = profile._fetchAndCacheProfile(); + profile._fetchAndCacheProfile(); // should be one request made to fetch the profile (but the promise returned // by it remains unresolved) diff --git a/services/sync/modules/SyncedTabs.jsm b/services/sync/modules/SyncedTabs.jsm index 8c8d461a7a3e..a8340dfe7363 100644 --- a/services/sync/modules/SyncedTabs.jsm +++ b/services/sync/modules/SyncedTabs.jsm @@ -110,10 +110,9 @@ let SyncedTabsInternal = { let engine = Weave.Service.engineManager.get("tabs"); let seenURLs = new Set(); - let parentIndex = 0; let ntabs = 0; - for (let [guid, client] of Object.entries(engine.getAllClients())) { + for (let client of Object.values(engine.getAllClients())) { if (!Weave.Service.clientsEngine.remoteClientExists(client.id)) { continue; } diff --git a/services/sync/modules/bookmark_validator.js b/services/sync/modules/bookmark_validator.js index 56f733c35419..7897fa608e17 100644 --- a/services/sync/modules/bookmark_validator.js +++ b/services/sync/modules/bookmark_validator.js @@ -324,7 +324,6 @@ class BookmarkValidator { let deletedRecords = []; let folders = []; - let problems = []; let problemData = new BookmarkProblemData(); @@ -620,8 +619,6 @@ class BookmarkValidator { this._validateClient(problemData, clientRecords); - let matches = []; - let allRecords = new Map(); let serverDeletedLookup = new Set(inspectionInfo.deletedRecords.map(r => r.id)); diff --git a/services/sync/modules/collection_validator.js b/services/sync/modules/collection_validator.js index d8daa6ed0d29..f9dacca5e604 100644 --- a/services/sync/modules/collection_validator.js +++ b/services/sync/modules/collection_validator.js @@ -153,7 +153,6 @@ class CollectionValidator { } } - let recordPairs = []; let seenClient = new Map(); for (let record of clientItems) { let id = record[this.idProp]; diff --git a/services/sync/modules/engines/bookmarks.js b/services/sync/modules/engines/bookmarks.js index f9c201a02aaa..e85ac360e513 100644 --- a/services/sync/modules/engines/bookmarks.js +++ b/services/sync/modules/engines/bookmarks.js @@ -336,7 +336,7 @@ BookmarksEngine.prototype = { } for (let [node, parent] of walkBookmarksRoots(tree)) { - let {guid, id, type: placeType} = node; + let {guid, type: placeType} = node; guid = PlacesSyncUtils.bookmarks.guidToSyncId(guid); let key; switch (placeType) { diff --git a/services/sync/modules/identity.js b/services/sync/modules/identity.js index e6760ba9b1cd..dab6baf04806 100644 --- a/services/sync/modules/identity.js +++ b/services/sync/modules/identity.js @@ -295,7 +295,6 @@ IdentityManager.prototype = { // Clear any cached Sync Key Bundle and regenerate it. this._syncKeyBundle = null; - let bundle = this.syncKeyBundle; this._syncKeyUpdated = true; }, diff --git a/services/sync/modules/resource.js b/services/sync/modules/resource.js index 933669eb802d..19c63c89c407 100644 --- a/services/sync/modules/resource.js +++ b/services/sync/modules/resource.js @@ -163,7 +163,7 @@ AsyncResource.prototype = { this._log.debug("No authenticator found."); } - for (let [key, value] of Object.entries(headers)) { + for (let key of Object.values(headers)) { if (key == "authorization") this._log.trace("HTTP Header " + key + ": ***** (suppressed)"); else diff --git a/services/sync/modules/service.js b/services/sync/modules/service.js index 82cfef68b77f..0829441c11e3 100644 --- a/services/sync/modules/service.js +++ b/services/sync/modules/service.js @@ -616,7 +616,7 @@ Sync11Service.prototype = { let cryptoResp = cryptoKeys.fetch(this.resource(this.cryptoKeysURL)).response; if (cryptoResp.success) { - let keysChanged = this.handleFetchedKeys(syncKeyBundle, cryptoKeys); + this.handleFetchedKeys(syncKeyBundle, cryptoKeys); return true; } else if (cryptoResp.status == 404) { // On failure, ask to generate new keys and upload them. @@ -1092,8 +1092,6 @@ Sync11Service.prototype = { // Stuff we need to do after login, before we can really do // anything (e.g. key setup). _remoteSetup: function _remoteSetup(infoResponse) { - let reset = false; - if (!this._fetchServerConfiguration()) { return false; } @@ -1317,7 +1315,7 @@ Sync11Service.prototype = { synchronizer.sync(engineNamesToSync); // wait() throws if the first argument is truthy, which is exactly what // we want. - let result = cb.wait(); + cb.wait(); histogram = Services.telemetry.getHistogramById("WEAVE_COMPLETE_SUCCESS_COUNT"); histogram.add(1); @@ -1505,7 +1503,7 @@ Sync11Service.prototype = { this.upgradeSyncKey(this.syncID); // Wipe the server. - let wipeTimestamp = this.wipeServer(); + this.wipeServer(); // Upload a new meta/global record. let meta = new WBORecord("meta", "global"); @@ -1521,8 +1519,6 @@ Sync11Service.prototype = { this.uploadMetaGlobal(meta); // Wipe everything we know about except meta because we just uploaded it - let engines = [this.clientsEngine].concat(this.engineManager.getAll()); - 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 diff --git a/services/sync/tests/unit/head_http_server.js b/services/sync/tests/unit/head_http_server.js index 95df42a0aed8..01678a67f855 100644 --- a/services/sync/tests/unit/head_http_server.js +++ b/services/sync/tests/unit/head_http_server.js @@ -199,7 +199,7 @@ ServerCollection.prototype = { */ wbos: function wbos(filter) { let os = []; - for (let [id, wbo] of Object.entries(this._wbos)) { + for (let wbo of Object.values(this._wbos)) { if (wbo.payload) { os.push(wbo); } @@ -276,7 +276,7 @@ ServerCollection.prototype = { count(options) { options = options || {}; let c = 0; - for (let [id, wbo] of Object.entries(this._wbos)) { + for (let wbo of Object.values(this._wbos)) { if (wbo.modified && this._inResultSet(wbo, options)) { c++; } @@ -288,7 +288,7 @@ ServerCollection.prototype = { let result; if (options.full) { let data = []; - for (let [id, wbo] of Object.entries(this._wbos)) { + for (let wbo of Object.values(this._wbos)) { // Drop deleted. if (wbo.modified && this._inResultSet(wbo, options)) { data.push(wbo.get()); @@ -361,7 +361,7 @@ ServerCollection.prototype = { delete(options) { let deleted = []; - for (let [id, wbo] of Object.entries(this._wbos)) { + for (let wbo of Object.values(this._wbos)) { if (this._inResultSet(wbo, options)) { this._log.debug("Deleting " + JSON.stringify(wbo)); deleted.push(wbo.id); @@ -848,7 +848,7 @@ SyncServer.prototype = { throw HTTP_404; } - let [all, version, username, first, rest] = parts; + let [, version, username, first, rest] = parts; // Doing a float compare of the version allows for us to pretend there was // a node-reassignment - eg, we could re-assign from "1.1/user/" to // "1.10/user" - this server will then still accept requests with the new @@ -916,7 +916,7 @@ SyncServer.prototype = { this._log.warn("SyncServer: Unknown storage operation " + rest); throw HTTP_404; } - let [all, collection, wboID] = match; + let [, collection, wboID] = match; let coll = this.getCollection(username, collection); switch (req.method) { case "GET": diff --git a/services/sync/tests/unit/test_addon_utils.js b/services/sync/tests/unit/test_addon_utils.js index a048e10ae32f..ccdce1fb3f80 100644 --- a/services/sync/tests/unit/test_addon_utils.js +++ b/services/sync/tests/unit/test_addon_utils.js @@ -23,8 +23,6 @@ function createAndStartHTTPServer(port = HTTP_PORT) { try { let server = new HttpServer(); - let bootstrap1XPI = ExtensionsTestPath("/addons/test_bootstrap1_1.xpi"); - server.registerFile("/search/guid:missing-sourceuri%40tests.mozilla.org", do_get_file("missing-sourceuri.xml")); diff --git a/services/sync/tests/unit/test_addons_reconciler.js b/services/sync/tests/unit/test_addons_reconciler.js index d93bdfc0380d..d6d278ff3016 100644 --- a/services/sync/tests/unit/test_addons_reconciler.js +++ b/services/sync/tests/unit/test_addons_reconciler.js @@ -106,7 +106,6 @@ add_test(function test_uninstall_detection() { let addon = installAddon("test_bootstrap1_1"); let id = addon.id; - let guid = addon.syncGUID; reconciler._changes = []; uninstallAddon(addon); diff --git a/services/sync/tests/unit/test_addons_store.js b/services/sync/tests/unit/test_addons_store.js index 2af7e12ed4fc..f0e009c898b1 100644 --- a/services/sync/tests/unit/test_addons_store.js +++ b/services/sync/tests/unit/test_addons_store.js @@ -174,7 +174,7 @@ add_test(function test_ignore_different_appid() { do_check_eq(0, failed.length); let newAddon = getAddonFromAddonManagerByID(addon.id); - do_check_false(addon.userDisabled); + do_check_false(newAddon.userDisabled); uninstallAddon(addon); @@ -193,7 +193,7 @@ add_test(function test_ignore_unknown_source() { do_check_eq(0, failed.length); let newAddon = getAddonFromAddonManagerByID(addon.id); - do_check_false(addon.userDisabled); + do_check_false(newAddon.userDisabled); uninstallAddon(addon); @@ -431,7 +431,7 @@ add_test(function test_create_bad_install() { let guid = Utils.makeGUID(); let record = createRecordForThisApp(guid, id, true, false); - let failed = store.applyIncomingBatch([record]); + /* let failed = */ store.applyIncomingBatch([record]); // This addon had no source URI so was skipped - but it's not treated as // failure. // XXX - this test isn't testing what we thought it was. Previously the addon diff --git a/services/sync/tests/unit/test_bookmark_duping.js b/services/sync/tests/unit/test_bookmark_duping.js index cea77c59755c..66a8134555ba 100644 --- a/services/sync/tests/unit/test_bookmark_duping.js +++ b/services/sync/tests/unit/test_bookmark_duping.js @@ -141,7 +141,7 @@ add_task(async function test_dupe_bookmark() { try { // The parent folder and one bookmark in it. let {id: folder1_id, guid: folder1_guid } = createFolder(bms.toolbarFolder, "Folder 1"); - let {id: bmk1_id, guid: bmk1_guid} = createBookmark(folder1_id, "http://getfirefox.com/", "Get Firefox!"); + let {guid: bmk1_guid} = createBookmark(folder1_id, "http://getfirefox.com/", "Get Firefox!"); engine.sync(); @@ -192,7 +192,7 @@ add_task(async function test_dupe_reparented_bookmark() { try { // The parent folder and one bookmark in it. let {id: folder1_id, guid: folder1_guid } = createFolder(bms.toolbarFolder, "Folder 1"); - let {id: bmk1_id, guid: bmk1_guid} = createBookmark(folder1_id, "http://getfirefox.com/", "Get Firefox!"); + let {guid: bmk1_guid} = createBookmark(folder1_id, "http://getfirefox.com/", "Get Firefox!"); // Another parent folder *with the same name* let {id: folder2_id, guid: folder2_guid } = createFolder(bms.toolbarFolder, "Folder 1"); @@ -258,7 +258,7 @@ add_task(async function test_dupe_reparented_locally_changed_bookmark() { try { // The parent folder and one bookmark in it. let {id: folder1_id, guid: folder1_guid } = createFolder(bms.toolbarFolder, "Folder 1"); - let {id: bmk1_id, guid: bmk1_guid} = createBookmark(folder1_id, "http://getfirefox.com/", "Get Firefox!"); + let {guid: bmk1_guid} = createBookmark(folder1_id, "http://getfirefox.com/", "Get Firefox!"); // Another parent folder *with the same name* let {id: folder2_id, guid: folder2_guid } = createFolder(bms.toolbarFolder, "Folder 1"); @@ -335,9 +335,9 @@ add_task(async function test_dupe_reparented_to_earlier_appearing_parent_bookmar try { // The parent folder and one bookmark in it. let {id: folder1_id, guid: folder1_guid } = createFolder(bms.toolbarFolder, "Folder 1"); - let {id: bmk1_id, guid: bmk1_guid} = createBookmark(folder1_id, "http://getfirefox.com/", "Get Firefox!"); + let {guid: bmk1_guid} = createBookmark(folder1_id, "http://getfirefox.com/", "Get Firefox!"); // One more folder we'll use later. - let {id: folder2_id, guid: folder2_guid} = createFolder(bms.toolbarFolder, "A second folder"); + let {guid: folder2_guid} = createFolder(bms.toolbarFolder, "A second folder"); do_print(`folder1=${folder1_guid}, bmk1=${bmk1_guid} folder2=${folder2_guid}`); @@ -412,9 +412,9 @@ add_task(async function test_dupe_reparented_to_later_appearing_parent_bookmark( try { // The parent folder and one bookmark in it. let {id: folder1_id, guid: folder1_guid } = createFolder(bms.toolbarFolder, "Folder 1"); - let {id: bmk1_id, guid: bmk1_guid} = createBookmark(folder1_id, "http://getfirefox.com/", "Get Firefox!"); + let {guid: bmk1_guid} = createBookmark(folder1_id, "http://getfirefox.com/", "Get Firefox!"); // One more folder we'll use later. - let {id: folder2_id, guid: folder2_guid} = createFolder(bms.toolbarFolder, "A second folder"); + let {guid: folder2_guid} = createFolder(bms.toolbarFolder, "A second folder"); do_print(`folder1=${folder1_guid}, bmk1=${bmk1_guid} folder2=${folder2_guid}`); @@ -489,9 +489,9 @@ add_task(async function test_dupe_reparented_to_future_arriving_parent_bookmark( try { // The parent folder and one bookmark in it. let {id: folder1_id, guid: folder1_guid } = createFolder(bms.toolbarFolder, "Folder 1"); - let {id: bmk1_id, guid: bmk1_guid} = createBookmark(folder1_id, "http://getfirefox.com/", "Get Firefox!"); + let {guid: bmk1_guid} = createBookmark(folder1_id, "http://getfirefox.com/", "Get Firefox!"); // One more folder we'll use later. - let {id: folder2_id, guid: folder2_guid} = createFolder(bms.toolbarFolder, "A second folder"); + let {guid: folder2_guid} = createFolder(bms.toolbarFolder, "A second folder"); do_print(`folder1=${folder1_guid}, bmk1=${bmk1_guid} folder2=${folder2_guid}`); @@ -608,7 +608,7 @@ add_task(async function test_dupe_empty_folder() { try { // The folder we will end up duping away. - let {id: folder1_id, guid: folder1_guid } = createFolder(bms.toolbarFolder, "Folder 1"); + let {guid: folder1_guid } = createFolder(bms.toolbarFolder, "Folder 1"); engine.sync(); diff --git a/services/sync/tests/unit/test_bookmark_engine.js b/services/sync/tests/unit/test_bookmark_engine.js index 7cf8a463b17d..e71b28c8a678 100644 --- a/services/sync/tests/unit/test_bookmark_engine.js +++ b/services/sync/tests/unit/test_bookmark_engine.js @@ -49,7 +49,6 @@ add_task(async function test_delete_invalid_roots_from_server() { let engine = new BookmarksEngine(Service); let store = engine._store; - let tracker = engine._tracker; let server = serverForFoo(engine); await SyncTestingInfrastructure(server); @@ -106,7 +105,6 @@ add_task(async function test_change_during_sync() { let engine = new BookmarksEngine(Service); let store = engine._store; - let tracker = engine._tracker; let server = serverForFoo(engine); await SyncTestingInfrastructure(server); @@ -256,11 +254,9 @@ add_task(async function test_change_during_sync() { add_task(async function bad_record_allIDs() { let server = new SyncServer(); server.start(); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); _("Ensure that bad Places queries don't cause an error in getAllIDs."); - let engine = new BookmarksEngine(Service); - let store = engine._store; let badRecordID = PlacesUtils.bookmarks.insertBookmark( PlacesUtils.bookmarks.toolbarFolder, Utils.makeURI("place:folder=1138"), @@ -319,10 +315,8 @@ add_task(async function test_processIncoming_error_orderChildren() { let bmk1_id = PlacesUtils.bookmarks.insertBookmark( folder1_id, fxuri, PlacesUtils.bookmarks.DEFAULT_INDEX, "Get Firefox!"); - let bmk1_guid = store.GUIDForId(bmk1_id); let bmk2_id = PlacesUtils.bookmarks.insertBookmark( folder1_id, tburi, PlacesUtils.bookmarks.DEFAULT_INDEX, "Get Thunderbird!"); - let bmk2_guid = store.GUIDForId(bmk2_id); // Create a server record for folder1 where we flip the order of // the children. diff --git a/services/sync/tests/unit/test_bookmark_record.js b/services/sync/tests/unit/test_bookmark_record.js index f559f3e4f8e7..1444522c8deb 100644 --- a/services/sync/tests/unit/test_bookmark_record.js +++ b/services/sync/tests/unit/test_bookmark_record.js @@ -26,7 +26,6 @@ add_task(async function test_bookmark_record() { log.info("Creating a record"); - let u = "http://localhost:8080/storage/bookmarks/foo"; let placesItem = new PlacesItem("bookmarks", "foo", "bookmark"); let bookmarkItem = prepareBookmarkItem("bookmarks", "foo"); diff --git a/services/sync/tests/unit/test_bookmark_smart_bookmarks.js b/services/sync/tests/unit/test_bookmark_smart_bookmarks.js index 43796f7fa957..c369b59c43ae 100644 --- a/services/sync/tests/unit/test_bookmark_smart_bookmarks.js +++ b/services/sync/tests/unit/test_bookmark_smart_bookmarks.js @@ -188,8 +188,6 @@ add_task(async function test_smart_bookmarks_duped() { let record = store.createRecord(mostVisitedGUID); _("Prepare sync."); - let collection = server.user("foo").collection("bookmarks"); - try { engine._syncStartup(); diff --git a/services/sync/tests/unit/test_bookmark_tracker.js b/services/sync/tests/unit/test_bookmark_tracker.js index 696d0688ef37..c39417f60c5f 100644 --- a/services/sync/tests/unit/test_bookmark_tracker.js +++ b/services/sync/tests/unit/test_bookmark_tracker.js @@ -129,7 +129,7 @@ var populateTree = async function populate(parentId, ...items) { } async function insertBookmarksToMigrate() { - let mozBmk = await PlacesUtils.bookmarks.insert({ + await PlacesUtils.bookmarks.insert({ guid: "0gtWTOgYcoJD", parentGuid: PlacesUtils.bookmarks.menuGuid, url: "https://mozilla.org", @@ -144,7 +144,7 @@ async function insertBookmarksToMigrate() { parentGuid: PlacesUtils.bookmarks.menuGuid, url: "http://getthunderbird.com", }); - let bzBmk = await PlacesUtils.bookmarks.insert({ + await PlacesUtils.bookmarks.insert({ guid: "YK5Bdq5MIqL6", parentGuid: PlacesUtils.bookmarks.menuGuid, url: "https://bugzilla.mozilla.org", @@ -217,7 +217,7 @@ add_task(async function test_batch_tracking() { PlacesUtils.bookmarks.runInBatchMode({ runBatched() { - let folder = PlacesUtils.bookmarks.createFolder( + PlacesUtils.bookmarks.createFolder( PlacesUtils.bookmarks.bookmarksMenuFolder, "Test Folder", PlacesUtils.bookmarks.DEFAULT_INDEX); // We should be tracking the new folder and its parent (and need to jump @@ -244,7 +244,7 @@ add_task(async function test_nested_batch_tracking() { PlacesUtils.bookmarks.runInBatchMode({ runBatched() { - let folder = PlacesUtils.bookmarks.createFolder( + PlacesUtils.bookmarks.createFolder( PlacesUtils.bookmarks.bookmarksMenuFolder, "Test Folder", PlacesUtils.bookmarks.DEFAULT_INDEX); // We should be tracking the new folder and its parent (and need to jump @@ -667,7 +667,6 @@ add_task(async function test_onItemKeywordChanged() { let folder = PlacesUtils.bookmarks.createFolder( PlacesUtils.bookmarks.bookmarksMenuFolder, "Parent", PlacesUtils.bookmarks.DEFAULT_INDEX); - let folderGUID = engine._store.GUIDForId(folder); _("Track changes to keywords"); let uri = Utils.makeURI("http://getfirefox.com"); let b = PlacesUtils.bookmarks.insertBookmark( @@ -803,7 +802,6 @@ add_task(async function test_onItemAnnoChanged() { let folder = PlacesUtils.bookmarks.createFolder( PlacesUtils.bookmarks.bookmarksMenuFolder, "Parent", PlacesUtils.bookmarks.DEFAULT_INDEX); - let folderGUID = engine._store.GUIDForId(folder); _("Track changes to annos."); let b = PlacesUtils.bookmarks.insertBookmark( folder, Utils.makeURI("http://getfirefox.com"), @@ -1074,7 +1072,7 @@ add_task(async function test_async_onItemMoved_update() { try { await stopTracking(); - let fxBmk = await PlacesUtils.bookmarks.insert({ + await PlacesUtils.bookmarks.insert({ type: PlacesUtils.bookmarks.TYPE_BOOKMARK, parentGuid: PlacesUtils.bookmarks.menuGuid, url: "http://getfirefox.com", @@ -1301,18 +1299,16 @@ add_task(async function test_treeMoved() { let folder2_guid = engine._store.GUIDForId(folder2_id); // Create a couple of bookmarks in the second folder. - let fx_id = PlacesUtils.bookmarks.insertBookmark( + PlacesUtils.bookmarks.insertBookmark( folder2_id, Utils.makeURI("http://getfirefox.com"), PlacesUtils.bookmarks.DEFAULT_INDEX, "Get Firefox!"); - let fx_guid = engine._store.GUIDForId(fx_id); - let tb_id = PlacesUtils.bookmarks.insertBookmark( + PlacesUtils.bookmarks.insertBookmark( folder2_id, Utils.makeURI("http://getthunderbird.com"), PlacesUtils.bookmarks.DEFAULT_INDEX, "Get Thunderbird!"); - let tb_guid = engine._store.GUIDForId(tb_id); await startTracking(); @@ -1332,12 +1328,11 @@ add_task(async function test_onItemDeleted() { _("Bookmarks deleted via the synchronous API should be tracked"); try { - let fx_id = PlacesUtils.bookmarks.insertBookmark( + PlacesUtils.bookmarks.insertBookmark( PlacesUtils.bookmarks.bookmarksMenuFolder, Utils.makeURI("http://getfirefox.com"), PlacesUtils.bookmarks.DEFAULT_INDEX, "Get Firefox!"); - let fx_guid = engine._store.GUIDForId(fx_id); let tb_id = PlacesUtils.bookmarks.insertBookmark( PlacesUtils.bookmarks.bookmarksMenuFolder, Utils.makeURI("http://getthunderbird.com"), @@ -1370,7 +1365,7 @@ add_task(async function test_async_onItemDeleted() { url: "http://getfirefox.com", title: "Get Firefox!", }); - let tbBmk = await PlacesUtils.bookmarks.insert({ + await PlacesUtils.bookmarks.insert({ type: PlacesUtils.bookmarks.TYPE_BOOKMARK, parentGuid: PlacesUtils.bookmarks.menuGuid, url: "http://getthunderbird.com", diff --git a/services/sync/tests/unit/test_browserid_identity.js b/services/sync/tests/unit/test_browserid_identity.js index fd6ab141167d..b7a9eedcb201 100644 --- a/services/sync/tests/unit/test_browserid_identity.js +++ b/services/sync/tests/unit/test_browserid_identity.js @@ -748,7 +748,7 @@ add_task(async function test_signedInUserMissing() { _("BrowserIDManager detects getSignedInUser returning incomplete account data"); let browseridManager = new BrowserIDManager(); - let config = makeIdentityConfig(); + makeIdentityConfig(); // Delete stored keys and the key fetch token. delete identityConfig.fxaccount.user.kA; delete identityConfig.fxaccount.user.kB; diff --git a/services/sync/tests/unit/test_clients_engine.js b/services/sync/tests/unit/test_clients_engine.js index 8a95b93e5c1a..ca10fad61fda 100644 --- a/services/sync/tests/unit/test_clients_engine.js +++ b/services/sync/tests/unit/test_clients_engine.js @@ -336,7 +336,6 @@ add_test(function test_client_name_change() { let tracker = engine._tracker; - let localID = engine.localID; let initialName = engine.localName; Svc.Obs.notify("weave:engine:start-tracking"); @@ -373,7 +372,7 @@ add_test(function test_send_command() { let rec = new ClientsRec("clients", remoteId); store.create(rec); - let remoteRecord = store.createRecord(remoteId, "clients"); + store.createRecord(remoteId, "clients"); let action = "testCommand"; let args = ["foo", "bar"]; @@ -469,7 +468,6 @@ add_test(function test_command_duplication() { engine.sendCommand(action, args, remoteId); engine.sendCommand(action, args, remoteId); - let newRecord = store._remoteClients[remoteId]; let clientCommands = engine._readCommands()[remoteId]; equal(clientCommands.length, 1); @@ -776,7 +774,7 @@ add_test(function test_send_uri_to_client_for_display() { let rec = new ClientsRec("clients", remoteId); rec.name = "remote"; store.create(rec); - let remoteRecord = store.createRecord(remoteId, "clients"); + store.createRecord(remoteId, "clients"); tracker.clearChangedIDs(); let initialScore = tracker.score; @@ -902,7 +900,6 @@ add_task(async function test_merge_commands() { crypto: {} }; let server = serverForUsers({"foo": "password"}, contents); - let user = server.user("foo"); await SyncTestingInfrastructure(server); generateNewKeys(Service.collectionKeys); @@ -936,8 +933,6 @@ add_task(async function test_merge_commands() { }), now - 10)); try { - let store = engine._store; - _("First sync. 2 records downloaded."); strictEqual(engine.lastRecordUpload, 0); engine._sync(); @@ -983,7 +978,6 @@ add_task(async function test_duplicate_remote_commands() { crypto: {} }; let server = serverForUsers({"foo": "password"}, contents); - let user = server.user("foo"); await SyncTestingInfrastructure(server); generateNewKeys(Service.collectionKeys); @@ -999,8 +993,6 @@ add_task(async function test_duplicate_remote_commands() { }), now - 10)); try { - let store = engine._store; - _("First sync. 1 record downloaded."); strictEqual(engine.lastRecordUpload, 0); engine._sync(); @@ -1053,7 +1045,6 @@ add_task(async function test_upload_after_reboot() { crypto: {} }; let server = serverForUsers({"foo": "password"}, contents); - let user = server.user("foo"); await SyncTestingInfrastructure(server); generateNewKeys(Service.collectionKeys); @@ -1082,8 +1073,6 @@ add_task(async function test_upload_after_reboot() { }), now - 10)); try { - let store = engine._store; - _("First sync. 2 records downloaded."); strictEqual(engine.lastRecordUpload, 0); engine._sync(); @@ -1146,7 +1135,6 @@ add_task(async function test_keep_cleared_commands_after_reboot() { crypto: {} }; let server = serverForUsers({"foo": "password"}, contents); - let user = server.user("foo"); await SyncTestingInfrastructure(server); generateNewKeys(Service.collectionKeys); @@ -1188,8 +1176,6 @@ add_task(async function test_keep_cleared_commands_after_reboot() { }), now - 10)); try { - let store = engine._store; - _("First sync. Download remote and our record."); strictEqual(engine.lastRecordUpload, 0); @@ -1274,7 +1260,6 @@ add_task(async function test_deleted_commands() { crypto: {} }; let server = serverForUsers({"foo": "password"}, contents); - let user = server.user("foo"); await SyncTestingInfrastructure(server); generateNewKeys(Service.collectionKeys); @@ -1300,8 +1285,6 @@ add_task(async function test_deleted_commands() { }), now - 10)); try { - let store = engine._store; - _("First sync. 2 records downloaded."); engine._sync(); @@ -1343,7 +1326,6 @@ add_task(async function test_send_uri_ack() { crypto: {} }; let server = serverForUsers({"foo": "password"}, contents); - let user = server.user("foo"); await SyncTestingInfrastructure(server); generateNewKeys(Service.collectionKeys); @@ -1411,15 +1393,10 @@ add_task(async function test_command_sync() { let server = serverForUsers({"foo": "password"}, contents); await SyncTestingInfrastructure(server); - let user = server.user("foo"); let collection = server.getCollection("foo", "clients"); let remoteId = Utils.makeGUID(); let remoteId2 = Utils.makeGUID(); - function clientWBO(id) { - return user.collection("clients").wbo(id); - } - _("Create remote client record 1"); server.insertWBO("foo", "clients", new ServerWBO(remoteId, encryptPayload({ id: remoteId, diff --git a/services/sync/tests/unit/test_clients_escape.js b/services/sync/tests/unit/test_clients_escape.js index 837afc7a49a5..d755364a14dc 100644 --- a/services/sync/tests/unit/test_clients_escape.js +++ b/services/sync/tests/unit/test_clients_escape.js @@ -11,10 +11,6 @@ add_task(async function test_clients_escape() { _("Set up test fixtures."); await configureIdentity(); - let baseUri = "http://fakebase/1.1/foo/storage/"; - let pubUri = baseUri + "keys/pubkey"; - let privUri = baseUri + "keys/privkey"; - let keyBundle = Service.identity.syncKeyBundle; let engine = Service.clientsEngine; diff --git a/services/sync/tests/unit/test_collection_getBatched.js b/services/sync/tests/unit/test_collection_getBatched.js index c6523d497a15..aa92b6f07629 100644 --- a/services/sync/tests/unit/test_collection_getBatched.js +++ b/services/sync/tests/unit/test_collection_getBatched.js @@ -126,13 +126,13 @@ add_test(function test_total_limit() { const recordLimit = 11; const batchSize = 2; const lastModified = "111111"; - let { records, responses, requests, coll } = get_test_collection_info({ + let { records, requests, coll } = get_test_collection_info({ totalRecords, batchSize, lastModified, }); coll.limit = recordLimit; - let response = coll.getBatched(batchSize); + coll.getBatched(batchSize); equal(requests.length, Math.ceil(recordLimit / batchSize)); equal(records.length, recordLimit); @@ -180,7 +180,7 @@ add_test(function test_get_throws() { const totalRecords = 11; const batchSize = 2; const lastModified = "111111"; - let { records, responses, requests, coll } = get_test_collection_info({ + let { records, requests, coll } = get_test_collection_info({ totalRecords, batchSize, lastModified, diff --git a/services/sync/tests/unit/test_corrupt_keys.js b/services/sync/tests/unit/test_corrupt_keys.js index 0dbb07bed119..f3ddc56f9ea5 100644 --- a/services/sync/tests/unit/test_corrupt_keys.js +++ b/services/sync/tests/unit/test_corrupt_keys.js @@ -90,8 +90,6 @@ add_task(async function test_locally_changed_keys() { _("Tabs modified: " + johndoe.modified("tabs")); do_check_true(johndoe.modified("tabs") > 0); - let coll_modified = Service.collectionKeys.lastModified; - // Let's create some server side history records. let liveKeys = Service.collectionKeys.keyForCollection("history"); _("Keys now: " + liveKeys.keyPair); @@ -144,7 +142,6 @@ add_task(async function test_locally_changed_keys() { _("Keys now: " + Service.collectionKeys.keyForCollection("history").keyPair); // And look! We downloaded history! - let store = Service.engineManager.get("history")._store; do_check_true(await promiseIsURIVisited("http://foo/bar?record-no--0")); do_check_true(await promiseIsURIVisited("http://foo/bar?record-no--1")); do_check_true(await promiseIsURIVisited("http://foo/bar?record-no--2")); @@ -202,7 +199,6 @@ add_task(async function test_locally_changed_keys() { }); function run_test() { - let logger = Log.repository.rootLogger; Log.repository.rootLogger.addAppender(new Log.DumpAppender()); validate_all_future_pings(); diff --git a/services/sync/tests/unit/test_errorhandler_2.js b/services/sync/tests/unit/test_errorhandler_2.js index d9bc285c7c77..8275fc6d7b6b 100644 --- a/services/sync/tests/unit/test_errorhandler_2.js +++ b/services/sync/tests/unit/test_errorhandler_2.js @@ -900,7 +900,6 @@ add_task(async function test_engine_applyFailed() { Svc.Obs.notify("weave:engine:sync:applied", {newFailed:1}, "catapult"); }; - let log = Log.repository.getLogger("Sync.ErrorHandler"); Svc.Prefs.set("log.appender.file.logOnError", true); let promiseObserved = promiseOneObserver("weave:service:reset-file-log"); diff --git a/services/sync/tests/unit/test_errorhandler_filelog.js b/services/sync/tests/unit/test_errorhandler_filelog.js index 76fdf7b5baf6..8e2a405bf5c8 100644 --- a/services/sync/tests/unit/test_errorhandler_filelog.js +++ b/services/sync/tests/unit/test_errorhandler_filelog.js @@ -273,8 +273,6 @@ add_test(function test_login_error_logOnError_true() { add_test(function test_errorLog_dumpAddons() { Svc.Prefs.set("log.appender.file.logOnError", true); - let log = Log.repository.getLogger("Sync.Test.FileLog"); - // We need to wait until the log cleanup started by this test is complete // or the next test will fail as it is ongoing. Svc.Obs.add("services-tests:common:log-manager:cleanup-logs", function onCleanupLogs() { diff --git a/services/sync/tests/unit/test_errorhandler_sync_checkServerError.js b/services/sync/tests/unit/test_errorhandler_sync_checkServerError.js index 561c55f4b82a..1840f1bdf8ee 100644 --- a/services/sync/tests/unit/test_errorhandler_sync_checkServerError.js +++ b/services/sync/tests/unit/test_errorhandler_sync_checkServerError.js @@ -30,7 +30,6 @@ CatapultEngine.prototype = { function sync_httpd_setup() { let collectionsHelper = track_collections_helper(); let upd = collectionsHelper.with_updated_collection; - let collections = collectionsHelper.collections; let catapultEngine = engineManager.get("catapult"); let engines = {catapult: {version: catapultEngine.version, diff --git a/services/sync/tests/unit/test_forms_store.js b/services/sync/tests/unit/test_forms_store.js index 6963df1c0b00..78fa6755661c 100644 --- a/services/sync/tests/unit/test_forms_store.js +++ b/services/sync/tests/unit/test_forms_store.js @@ -8,7 +8,6 @@ Cu.import("resource://services-sync/util.js"); Cu.import("resource://gre/modules/Services.jsm"); function run_test() { - let baseuri = "http://fake/uri/"; let engine = new FormEngine(Service); let store = engine._store; @@ -18,7 +17,7 @@ function run_test() { _("Remove any existing entries"); store.wipe(); - for (let id in store.getAllIDs()) { + if (store.getAllIDs().length) { do_throw("Shouldn't get any ids!"); } @@ -55,7 +54,7 @@ function run_test() { _("Remove all entries"); store.wipe(); - for (let id in store.getAllIDs()) { + if (store.getAllIDs().length) { do_throw("Shouldn't get any ids!"); } @@ -83,7 +82,7 @@ function run_test() { store.remove({ id: "newid" }); - for (let id in store.getAllIDs()) { + if (store.getAllIDs().length) { do_throw("Shouldn't get any ids!"); } @@ -91,7 +90,7 @@ function run_test() { store.remove({ id: "newid" }); - for (let id in store.getAllIDs()) { + if (store.getAllIDs().length) { do_throw("Shouldn't get any ids!"); } @@ -114,7 +113,7 @@ function run_test() { toDelete.id = id; toDelete.deleted = true; applyEnsureNoFailures([toDelete]); - for (let id in store.getAllIDs()) { + if (store.getAllIDs().length) { do_throw("Shouldn't get any ids!"); } @@ -127,7 +126,7 @@ function run_test() { store.wipe(); - for (let id in store.getAllIDs()) { + if (store.getAllIDs().length) { do_throw("Shouldn't get any ids!"); } @@ -135,7 +134,7 @@ function run_test() { Services.prefs.setBoolPref("browser.formfill.enable", false); try { // a search - for (let id in store.getAllIDs()) { + if (store.getAllIDs().length) { do_throw("Shouldn't get any ids!"); } // an update. diff --git a/services/sync/tests/unit/test_fxa_migration.js b/services/sync/tests/unit/test_fxa_migration.js index 606cdf51edd3..991d0e891c5b 100644 --- a/services/sync/tests/unit/test_fxa_migration.js +++ b/services/sync/tests/unit/test_fxa_migration.js @@ -72,7 +72,7 @@ add_task(async function testMigrationUnlinks() { }); // Arrange for a legacy sync user. - let [engine, server] = configureLegacySync(); + configureLegacySync(); // Start a sync - this will cause an EOL notification which the migrator's // observer will notice. diff --git a/services/sync/tests/unit/test_history_tracker.js b/services/sync/tests/unit/test_history_tracker.js index fb5fe5eb2f43..5948586fa02f 100644 --- a/services/sync/tests/unit/test_history_tracker.js +++ b/services/sync/tests/unit/test_history_tracker.js @@ -209,8 +209,6 @@ add_task(async function test_track_delete() { add_task(async function test_dont_track_expiration() { _("Expirations are not tracked."); - let uriToExpire = await addVisit("to_expire"); - let guidToExpire = engine._store.GUIDForUri(uriToExpire); let uriToRemove = await addVisit("to_remove"); let guidToRemove = engine._store.GUIDForUri(uriToRemove); diff --git a/services/sync/tests/unit/test_hmac_error.js b/services/sync/tests/unit/test_hmac_error.js index 83c08db89032..6aa91d91576f 100644 --- a/services/sync/tests/unit/test_hmac_error.js +++ b/services/sync/tests/unit/test_hmac_error.js @@ -65,7 +65,6 @@ add_task(async function hmac_error_during_404() { let collectionsHelper = track_collections_helper(); let upd = collectionsHelper.with_updated_collection; - let collections = collectionsHelper.collections; let handlers = { "/1.1/foo/info/collections": collectionsHelper.handler, "/1.1/foo/storage/meta/global": upd("meta", global.handler()), diff --git a/services/sync/tests/unit/test_httpd_sync_server.js b/services/sync/tests/unit/test_httpd_sync_server.js index ba2893e65372..75e24c15f6b0 100644 --- a/services/sync/tests/unit/test_httpd_sync_server.js +++ b/services/sync/tests/unit/test_httpd_sync_server.js @@ -57,8 +57,8 @@ add_test(function test_url_parsing() { do_check_eq(rest, undefined); parts = server.storageRE.exec("storage"); - let storage, collection, id; - [all, storage, collection, id] = parts; + let collection; + [all, , collection, ] = parts; do_check_eq(all, "storage"); do_check_eq(collection, undefined); diff --git a/services/sync/tests/unit/test_keys.js b/services/sync/tests/unit/test_keys.js index c86e589676ca..f6ffc8a923fe 100644 --- a/services/sync/tests/unit/test_keys.js +++ b/services/sync/tests/unit/test_keys.js @@ -22,7 +22,6 @@ function do_check_keypair_eq(a, b) { } function test_time_keyFromString(iterations) { - let k; let o; let b = new BulkKeyBundle("dummy"); let d = Utils.decodeKeyBase32("ababcdefabcdefabcdefabcdef"); diff --git a/services/sync/tests/unit/test_password_store.js b/services/sync/tests/unit/test_password_store.js index f21fbb95f3ea..4cff7ddc08e1 100644 --- a/services/sync/tests/unit/test_password_store.js +++ b/services/sync/tests/unit/test_password_store.js @@ -119,7 +119,6 @@ function test_apply_same_record_with_different_times() { // The following record is going to be inserted multiple times in the store // and it needs to be found there. Then its timestamps are going to be // compared to the expected values. - var timePasswordChanged = 100; timePasswordChanged = changePassword("A", "http://a.tn", "password", 1, 100, 100, 100, timePasswordChanged, true); timePasswordChanged = changePassword("A", "http://a.tn", "password", 1, 100, diff --git a/services/sync/tests/unit/test_records_crypto.js b/services/sync/tests/unit/test_records_crypto.js index d4953d2a2cdf..96db8b63bf7a 100644 --- a/services/sync/tests/unit/test_records_crypto.js +++ b/services/sync/tests/unit/test_records_crypto.js @@ -43,7 +43,6 @@ add_task(async function test_records_crypto() { log.info("Creating a record"); - let cryptoUri = "http://localhost:8080/crypto/steam"; cryptoWrap = prepareCryptoWrap("steam", "resource"); log.info("cryptoWrap: " + cryptoWrap.toString()); @@ -107,7 +106,6 @@ add_task(async function test_records_crypto() { // Checking per-collection keys and default key handling. generateNewKeys(Service.collectionKeys); - let bu = "http://localhost:8080/storage/bookmarks/foo"; let bookmarkItem = prepareCryptoWrap("bookmarks", "foo"); bookmarkItem.encrypt(Service.collectionKeys.keyForCollection("bookmarks")); log.info("Ciphertext is " + bookmarkItem.ciphertext); diff --git a/services/sync/tests/unit/test_resource.js b/services/sync/tests/unit/test_resource.js index 607d7f4bf237..62231073ed28 100644 --- a/services/sync/tests/unit/test_resource.js +++ b/services/sync/tests/unit/test_resource.js @@ -429,7 +429,6 @@ function run_test() { Services.io.newURI("::::::::"); }; res18._onProgress = onProgress; - let oldWarn = res18._log.warn; let warnings = []; res18._log.warn = function(msg) { warnings.push(msg) }; error = undefined; diff --git a/services/sync/tests/unit/test_resource_async.js b/services/sync/tests/unit/test_resource_async.js index 25b87ce03df3..6dd3d9d09a1d 100644 --- a/services/sync/tests/unit/test_resource_async.js +++ b/services/sync/tests/unit/test_resource_async.js @@ -701,12 +701,6 @@ add_test(function test_uri_construction() { }); add_test(function test_not_sending_cookie() { - function handler(metadata, response) { - let body = "COOKIE!"; - response.setStatusLine(metadata.httpVersion, 200, "OK"); - response.bodyOutputStream.write(body, body.length); - do_check_false(metadata.hasHeader("Cookie")); - } let cookieSer = Cc["@mozilla.org/cookieService;1"] .getService(Ci.nsICookieService); let uri = CommonUtils.makeURI(server.baseURI); diff --git a/services/sync/tests/unit/test_service_detect_upgrade.js b/services/sync/tests/unit/test_service_detect_upgrade.js index 0fde13f198fc..916b6086cc9c 100644 --- a/services/sync/tests/unit/test_service_detect_upgrade.js +++ b/services/sync/tests/unit/test_service_detect_upgrade.js @@ -194,7 +194,6 @@ add_test(function v5_upgrade() { // Tracking info/collections. let collectionsHelper = track_collections_helper(); let upd = collectionsHelper.with_updated_collection; - let collections = collectionsHelper.collections; let keysWBO = new ServerWBO("keys"); let bulkWBO = new ServerWBO("bulk"); @@ -288,7 +287,6 @@ add_test(function v5_upgrade() { }); function run_test() { - let logger = Log.repository.rootLogger; Log.repository.rootLogger.addAppender(new Log.DumpAppender()); run_next_test(); diff --git a/services/sync/tests/unit/test_service_getStorageInfo.js b/services/sync/tests/unit/test_service_getStorageInfo.js index 56c0f4312201..a5e9d6c50d5f 100644 --- a/services/sync/tests/unit/test_service_getStorageInfo.js +++ b/services/sync/tests/unit/test_service_getStorageInfo.js @@ -73,7 +73,7 @@ add_test(function test_http_error() { Service.serverURL = server.baseURI + "/"; Service.clusterURL = server.baseURI + "/"; - let request = Service.getStorageInfo(INFO_COLLECTIONS, function(error, info) { + Service.getStorageInfo(INFO_COLLECTIONS, function(error, info) { do_check_eq(error.status, 500); do_check_eq(info, null); server.stop(run_next_test); @@ -86,7 +86,7 @@ add_test(function test_invalid_json() { Service.serverURL = server.baseURI + "/"; Service.clusterURL = server.baseURI + "/"; - let request = Service.getStorageInfo(INFO_COLLECTIONS, function(error, info) { + Service.getStorageInfo(INFO_COLLECTIONS, function(error, info) { do_check_eq(error.name, "SyntaxError"); do_check_eq(info, null); server.stop(run_next_test); diff --git a/services/sync/tests/unit/test_service_login.js b/services/sync/tests/unit/test_service_login.js index d42b45d5598b..4f228eaca711 100644 --- a/services/sync/tests/unit/test_service_login.js +++ b/services/sync/tests/unit/test_service_login.js @@ -23,7 +23,6 @@ function login_handling(handler) { } function run_test() { - let logger = Log.repository.rootLogger; Log.repository.rootLogger.addAppender(new Log.DumpAppender()); run_next_test(); @@ -45,10 +44,8 @@ add_test(function test_offline() { function setup() { let janeHelper = track_collections_helper(); let janeU = janeHelper.with_updated_collection; - let janeColls = janeHelper.collections; let johnHelper = track_collections_helper(); let johnU = johnHelper.with_updated_collection; - let johnColls = johnHelper.collections; let server = httpd_setup({ "/1.1/johndoe/info/collections": login_handling(johnHelper.handler), @@ -157,7 +154,6 @@ add_test(function test_login_on_sync() { Service.login = oldLogin; // Stub mpLocked. - let mpLockedF = Utils.mpLocked; let mpLocked = true; Utils.mpLocked = () => mpLocked; @@ -209,9 +205,6 @@ add_test(function test_login_on_sync() { throw "User canceled Master Password entry"; }); - let oldClearSyncTriggers = Service.scheduler.clearSyncTriggers; - let oldLockedSync = Service._lockedSync; - let cSTCalled = false; let lockedSyncCalled = false; diff --git a/services/sync/tests/unit/test_service_passwordUTF8.js b/services/sync/tests/unit/test_service_passwordUTF8.js index fc74b6b53401..a25020b4aeae 100644 --- a/services/sync/tests/unit/test_service_passwordUTF8.js +++ b/services/sync/tests/unit/test_service_passwordUTF8.js @@ -56,7 +56,6 @@ function run_test() { initTestLogging("Trace"); let collectionsHelper = track_collections_helper(); let upd = collectionsHelper.with_updated_collection; - let collections = collectionsHelper.collections; ensureLegacyIdentityManager(); diff --git a/services/sync/tests/unit/test_service_sync_401.js b/services/sync/tests/unit/test_service_sync_401.js index e83c001ba3e0..c383140197ac 100644 --- a/services/sync/tests/unit/test_service_sync_401.js +++ b/services/sync/tests/unit/test_service_sync_401.js @@ -21,12 +21,10 @@ function login_handling(handler) { } add_task(async function run_test() { - let logger = Log.repository.rootLogger; Log.repository.rootLogger.addAppender(new Log.DumpAppender()); let collectionsHelper = track_collections_helper(); let upd = collectionsHelper.with_updated_collection; - let collections = collectionsHelper.collections; let server = httpd_setup({ "/1.1/johndoe/storage/crypto/keys": upd("crypto", new ServerWBO("keys").handler()), diff --git a/services/sync/tests/unit/test_service_sync_remoteSetup.js b/services/sync/tests/unit/test_service_sync_remoteSetup.js index 75f3be2e6a04..ace57850b510 100644 --- a/services/sync/tests/unit/test_service_sync_remoteSetup.js +++ b/services/sync/tests/unit/test_service_sync_remoteSetup.js @@ -11,10 +11,8 @@ Cu.import("resource://testing-common/services/sync/utils.js"); function run_test() { validate_all_future_pings(); - let logger = Log.repository.rootLogger; Log.repository.rootLogger.addAppender(new Log.DumpAppender()); - let guidSvc = new FakeGUIDService(); let clients = new ServerCollection(); let meta_global = new ServerWBO("global"); @@ -55,7 +53,6 @@ function run_test() { } const GLOBAL_PATH = "/1.1/johndoe/storage/meta/global"; - const INFO_PATH = "/1.1/johndoe/info/collections"; let handlers = { "/1.1/johndoe/storage": storageHandler, @@ -160,7 +157,6 @@ function run_test() { metaColl.delete({}); _("Do an initial sync."); - let beforeSync = Date.now() / 1000; Service.sync(); _("Checking that remoteSetup returns true."); diff --git a/services/sync/tests/unit/test_service_sync_updateEnabledEngines.js b/services/sync/tests/unit/test_service_sync_updateEnabledEngines.js index bf90296e5c35..f5291aa55f0b 100644 --- a/services/sync/tests/unit/test_service_sync_updateEnabledEngines.js +++ b/services/sync/tests/unit/test_service_sync_updateEnabledEngines.js @@ -199,7 +199,6 @@ add_task(async function test_disabledLocally_wipe503() { engines: {steam: {syncID: engine.syncID, version: engine.version}} }); - let steamCollection = new ServerWBO("steam", PAYLOAD); function service_unavailable(request, response) { let body = "Service Unavailable"; diff --git a/services/sync/tests/unit/test_service_verifyLogin.js b/services/sync/tests/unit/test_service_verifyLogin.js index 307cd8442197..8f4a4e7766f2 100644 --- a/services/sync/tests/unit/test_service_verifyLogin.js +++ b/services/sync/tests/unit/test_service_verifyLogin.js @@ -27,7 +27,6 @@ function service_unavailable(request, response) { } function run_test() { - let logger = Log.repository.rootLogger; Log.repository.rootLogger.addAppender(new Log.DumpAppender()); ensureLegacyIdentityManager(); @@ -35,7 +34,6 @@ function run_test() { Services.logins.removeAllLogins(); let johnHelper = track_collections_helper(); let johnU = johnHelper.with_updated_collection; - let johnColls = johnHelper.collections; do_test_pending(); diff --git a/services/sync/tests/unit/test_service_wipeServer.js b/services/sync/tests/unit/test_service_wipeServer.js index 87f1b429f11a..781d2b900396 100644 --- a/services/sync/tests/unit/test_service_wipeServer.js +++ b/services/sync/tests/unit/test_service_wipeServer.js @@ -32,8 +32,6 @@ FakeCollection.prototype = { }; async function setUpTestFixtures(server) { - let cryptoService = new FakeCryptoService(); - Service.serverURL = server.baseURI + "/"; Service.clusterURL = server.baseURI + "/"; diff --git a/services/sync/tests/unit/test_status.js b/services/sync/tests/unit/test_status.js index ea6a099361bc..eb783bc51576 100644 --- a/services/sync/tests/unit/test_status.js +++ b/services/sync/tests/unit/test_status.js @@ -11,7 +11,7 @@ function run_test() { do_check_eq(Status.service, STATUS_OK); do_check_eq(Status.sync, SYNC_SUCCEEDED); do_check_eq(Status.login, LOGIN_SUCCEEDED); - for (let name in Status.engines) { + if (Status.engines.length) { do_throw("Status.engines should be empty."); } do_check_eq(Status.partial, false); diff --git a/services/sync/tests/unit/test_syncengine.js b/services/sync/tests/unit/test_syncengine.js index 86e0815d2adf..072620552806 100644 --- a/services/sync/tests/unit/test_syncengine.js +++ b/services/sync/tests/unit/test_syncengine.js @@ -15,7 +15,7 @@ var server = httpd_setup({}); add_task(async function test_url_attributes() { _("SyncEngine url attributes"); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); Service.clusterURL = "https://cluster/1.1/foo/"; let engine = makeSteamEngine(); try { @@ -29,7 +29,7 @@ add_task(async function test_url_attributes() { add_task(async function test_syncID() { _("SyncEngine.syncID corresponds to preference"); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); let engine = makeSteamEngine(); try { // Ensure pristine environment @@ -49,7 +49,7 @@ add_task(async function test_syncID() { add_task(async function test_lastSync() { _("SyncEngine.lastSync and SyncEngine.lastSyncLocal correspond to preferences"); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); let engine = makeSteamEngine(); try { // Ensure pristine environment @@ -139,7 +139,7 @@ add_task(async function test_previousFailed() { add_task(async function test_resetClient() { _("SyncEngine.resetClient resets lastSync and toFetch"); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); let engine = makeSteamEngine(); try { // Ensure pristine environment @@ -171,7 +171,7 @@ add_task(async function test_wipeServer() { let server = httpd_setup({ "/1.1/foo/storage/steam": steamCollection.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); do_test_pending(); try { diff --git a/services/sync/tests/unit/test_syncengine_sync.js b/services/sync/tests/unit/test_syncengine_sync.js index 96dfd2878e5b..a22cce2028a6 100644 --- a/services/sync/tests/unit/test_syncengine_sync.js +++ b/services/sync/tests/unit/test_syncengine_sync.js @@ -97,7 +97,7 @@ add_task(async function test_syncStartup_emptyOrOutdatedGlobalsResetsSync() { "/1.1/foo/storage/rotary": collection.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); Service.identity.username = "foo"; let engine = makeRotaryEngine(); @@ -141,7 +141,7 @@ add_task(async function test_syncStartup_serverHasNewerVersion() { "/1.1/foo/storage/meta/global": global.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); Service.identity.username = "foo"; let engine = makeRotaryEngine(); @@ -167,7 +167,7 @@ add_task(async function test_syncStartup_syncIDMismatchResetsClient() { _("SyncEngine._syncStartup resets sync if syncIDs don't match"); let server = sync_httpd_setup({}); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); Service.identity.username = "foo"; // global record with a different syncID than our engine has @@ -207,7 +207,7 @@ add_task(async function test_processIncoming_emptyServer() { "/1.1/foo/storage/rotary": collection.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); Service.identity.username = "foo"; let engine = makeRotaryEngine(); @@ -246,7 +246,7 @@ add_task(async function test_processIncoming_createFromServer() { "/1.1/foo/storage/rotary/scotsman": collection.wbo("scotsman").handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); Service.identity.username = "foo"; generateNewKeys(Service.collectionKeys); @@ -331,7 +331,7 @@ add_task(async function test_processIncoming_reconcile() { "/1.1/foo/storage/rotary": collection.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); Service.identity.username = "foo"; let engine = makeRotaryEngine(); @@ -633,7 +633,7 @@ add_task(async function test_processIncoming_mobile_batchSize() { "/1.1/foo/storage/rotary": collection.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); let engine = makeRotaryEngine(); let meta_global = Service.recordManager.set(engine.metaURL, @@ -708,7 +708,7 @@ add_task(async function test_processIncoming_store_toFetch() { "/1.1/foo/storage/rotary": collection.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); let meta_global = Service.recordManager.set(engine.metaURL, new WBORecord(engine.metaURL)); @@ -720,11 +720,9 @@ add_task(async function test_processIncoming_store_toFetch() { do_check_eq(engine.lastSync, 0); do_check_empty(engine._store.items); - let error; try { await sync_engine_and_validate_telem(engine, true); } catch (ex) { - error = ex; } // Only the first two batches have been applied. @@ -781,7 +779,7 @@ add_task(async function test_processIncoming_resume_toFetch() { "/1.1/foo/storage/rotary": collection.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); let meta_global = Service.recordManager.set(engine.metaURL, new WBORecord(engine.metaURL)); @@ -839,7 +837,7 @@ add_task(async function test_processIncoming_applyIncomingBatchSize_smaller() { "/1.1/foo/storage/rotary": collection.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); let meta_global = Service.recordManager.set(engine.metaURL, new WBORecord(engine.metaURL)); @@ -895,7 +893,7 @@ add_task(async function test_processIncoming_applyIncomingBatchSize_multiple() { "/1.1/foo/storage/rotary": collection.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); let meta_global = Service.recordManager.set(engine.metaURL, new WBORecord(engine.metaURL)); @@ -947,7 +945,7 @@ add_task(async function test_processIncoming_notify_count() { "/1.1/foo/storage/rotary": collection.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); let meta_global = Service.recordManager.set(engine.metaURL, new WBORecord(engine.metaURL)); @@ -1037,7 +1035,7 @@ add_task(async function test_processIncoming_previousFailed() { "/1.1/foo/storage/rotary": collection.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); let meta_global = Service.recordManager.set(engine.metaURL, new WBORecord(engine.metaURL)); @@ -1153,7 +1151,7 @@ add_task(async function test_processIncoming_failed_records() { "/1.1/foo/storage/rotary": recording_handler(collection) }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); let meta_global = Service.recordManager.set(engine.metaURL, new WBORecord(engine.metaURL)); @@ -1266,7 +1264,7 @@ add_task(async function test_processIncoming_decrypt_failed() { "/1.1/foo/storage/rotary": collection.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); let meta_global = Service.recordManager.set(engine.metaURL, new WBORecord(engine.metaURL)); @@ -1323,7 +1321,7 @@ add_task(async function test_uploadOutgoing_toEmptyServer() { "/1.1/foo/storage/rotary/scotsman": collection.wbo("scotsman").handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); generateNewKeys(Service.collectionKeys); let engine = makeRotaryEngine(); @@ -1379,7 +1377,7 @@ add_task(async function test_uploadOutgoing_huge() { "/1.1/foo/storage/rotary/flying": collection.wbo("flying").handler(), }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); generateNewKeys(Service.collectionKeys); let engine = makeRotaryEngine(); @@ -1428,7 +1426,7 @@ add_task(async function test_uploadOutgoing_failed() { "/1.1/foo/storage/rotary": collection.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); let engine = makeRotaryEngine(); engine.lastSync = 123; // needs to be non-zero so that tracker is queried @@ -1523,8 +1521,7 @@ add_task(async function test_uploadOutgoing_MAX_UPLOAD_RECORDS() { "/1.1/foo/storage/rotary": collection.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); - + await SyncTestingInfrastructure(server); try { // Confirm initial environment. @@ -1568,7 +1565,7 @@ add_task(async function test_uploadOutgoing_largeRecords() { "/1.1/foo/storage/rotary": collection.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); try { engine._syncStartup(); @@ -1590,7 +1587,7 @@ add_task(async function test_syncFinish_noDelete() { let server = httpd_setup({}); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); let engine = makeRotaryEngine(); engine._delete = {}; // Nothing to delete engine._tracker.score = 100; @@ -1620,7 +1617,7 @@ add_task(async function test_syncFinish_deleteByIds() { let server = httpd_setup({ "/1.1/foo/storage/rotary": collection.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); let engine = makeRotaryEngine(); try { @@ -1671,7 +1668,7 @@ add_task(async function test_syncFinish_deleteLotsInBatches() { "/1.1/foo/storage/rotary": collection.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); let engine = makeRotaryEngine(); try { @@ -1722,7 +1719,7 @@ add_task(async function test_sync_partialUpload() { let server = sync_httpd_setup({ "/1.1/foo/storage/rotary": collection.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); generateNewKeys(Service.collectionKeys); let engine = makeRotaryEngine(); @@ -1804,7 +1801,7 @@ add_task(async function test_canDecrypt_noCryptoKeys() { "/1.1/foo/storage/rotary": collection.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); let engine = makeRotaryEngine(); try { @@ -1830,7 +1827,7 @@ add_task(async function test_canDecrypt_true() { "/1.1/foo/storage/rotary": collection.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); let engine = makeRotaryEngine(); try { @@ -1861,7 +1858,7 @@ add_task(async function test_syncapplied_observer() { "/1.1/foo/storage/rotary": collection.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); let meta_global = Service.recordManager.set(engine.metaURL, new WBORecord(engine.metaURL)); diff --git a/services/sync/tests/unit/test_tab_engine.js b/services/sync/tests/unit/test_tab_engine.js index d9badd745a73..3218a272eeeb 100644 --- a/services/sync/tests/unit/test_tab_engine.js +++ b/services/sync/tests/unit/test_tab_engine.js @@ -78,7 +78,7 @@ add_task(async function test_tab_engine_skips_incoming_local_record() { "/1.1/foo/storage/tabs": collection.handler() }); - let syncTesting = await SyncTestingInfrastructure(server); + await SyncTestingInfrastructure(server); Service.identity.username = "foo"; let meta_global = Service.recordManager.set(engine.metaURL, @@ -105,7 +105,7 @@ add_task(async function test_tab_engine_skips_incoming_local_record() { }); add_test(function test_reconcile() { - let [engine, store] = getMocks(); + let [engine, ] = getMocks(); _("Setup engine for reconciling"); engine._syncStartup(); diff --git a/services/sync/tests/unit/test_tab_store.js b/services/sync/tests/unit/test_tab_store.js index 86844bd7aaa3..5ba1d281d5fc 100644 --- a/services/sync/tests/unit/test_tab_store.js +++ b/services/sync/tests/unit/test_tab_store.js @@ -93,8 +93,6 @@ function test_createRecord() { store.shouldSkipWindow = mockShouldSkipWindow; store.getWindowEnumerator = mockGetWindowEnumerator.bind(this, "http://foo.com", 1, 1); - let tabs = store.getAllTabs(); - let tabsize = JSON.stringify(tabs[0]).length; let numtabs = Math.ceil(20000. / 77.); store.getWindowEnumerator = mockGetWindowEnumerator.bind(this, "http://foo.com", 1, 1); diff --git a/services/sync/tests/unit/test_telemetry.js b/services/sync/tests/unit/test_telemetry.js index fa208f8c5c51..088a8ec6376d 100644 --- a/services/sync/tests/unit/test_telemetry.js +++ b/services/sync/tests/unit/test_telemetry.js @@ -160,15 +160,10 @@ add_task(async function test_uploading() { let parent = PlacesUtils.toolbarFolderId; let uri = Utils.makeURI("http://getfirefox.com/"); - let title = "Get Firefox"; let bmk_id = PlacesUtils.bookmarks.insertBookmark(parent, uri, PlacesUtils.bookmarks.DEFAULT_INDEX, "Get Firefox!"); - let guid = store.GUIDForId(bmk_id); - let record = store.createRecord(guid); - - let collection = server.user("foo").collection("bookmarks"); try { let ping = await sync_engine_and_validate_telem(engine, false); ok(!!ping); @@ -338,7 +333,6 @@ add_task(async function test_generic_engine_fail() { Service.engineManager.register(SteamEngine); let engine = Service.engineManager.get("steam"); engine.enabled = true; - let store = engine._store; let server = serverForUsers({"foo": "password"}, { meta: {global: {engines: {steam: {version: engine.version, syncID: engine.syncID}}}}, @@ -367,7 +361,6 @@ add_task(async function test_engine_fail_ioerror() { Service.engineManager.register(SteamEngine); let engine = Service.engineManager.get("steam"); engine.enabled = true; - let store = engine._store; let server = serverForUsers({"foo": "password"}, { meta: {global: {engines: {steam: {version: engine.version, syncID: engine.syncID}}}}, @@ -405,7 +398,6 @@ add_task(async function test_initial_sync_engines() { Service.engineManager.register(SteamEngine); let engine = Service.engineManager.get("steam"); engine.enabled = true; - let store = engine._store; let engines = {}; // These are the only ones who actually have things to sync at startup. let engineNames = ["clients", "bookmarks", "prefs", "tabs"]; @@ -444,7 +436,6 @@ add_task(async function test_nserror() { Service.engineManager.register(SteamEngine); let engine = Service.engineManager.get("steam"); engine.enabled = true; - let store = engine._store; let server = serverForUsers({"foo": "password"}, { meta: {global: {engines: {steam: {version: engine.version, syncID: engine.syncID}}}}, @@ -520,7 +511,6 @@ add_task(async function test_no_foreign_engines_in_error_ping() { Service.engineManager.register(BogusEngine); let engine = Service.engineManager.get("bogus"); engine.enabled = true; - let store = engine._store; let server = serverForUsers({"foo": "password"}, { meta: {global: {engines: {bogus: {version: engine.version, syncID: engine.syncID}}}}, steam: {} @@ -541,7 +531,6 @@ add_task(async function test_sql_error() { Service.engineManager.register(SteamEngine); let engine = Service.engineManager.get("steam"); engine.enabled = true; - let store = engine._store; let server = serverForUsers({"foo": "password"}, { meta: {global: {engines: {steam: {version: engine.version, syncID: engine.syncID}}}}, @@ -569,7 +558,6 @@ add_task(async function test_no_foreign_engines_in_success_ping() { Service.engineManager.register(BogusEngine); let engine = Service.engineManager.get("bogus"); engine.enabled = true; - let store = engine._store; let server = serverForUsers({"foo": "password"}, { meta: {global: {engines: {bogus: {version: engine.version, syncID: engine.syncID}}}}, steam: {} diff --git a/services/sync/tps/extensions/tps/resource/modules/bookmarks.jsm b/services/sync/tps/extensions/tps/resource/modules/bookmarks.jsm index 1a4111b869e5..15e773c3fd85 100644 --- a/services/sync/tps/extensions/tps/resource/modules/bookmarks.jsm +++ b/services/sync/tps/extensions/tps/resource/modules/bookmarks.jsm @@ -22,7 +22,7 @@ Cu.import("resource://tps/logger.jsm"); var DumpBookmarks = function TPS_Bookmarks__DumpBookmarks() { let cb = Async.makeSpinningCallback(); PlacesBackups.getBookmarksTree().then(result => { - let [bookmarks, count] = result; + let [bookmarks, ] = result; Logger.logInfo("Dumping Bookmarks...\n" + JSON.stringify(bookmarks) + "\n\n"); cb(null); }).then(null, error => { diff --git a/services/sync/tps/extensions/tps/resource/modules/history.jsm b/services/sync/tps/extensions/tps/resource/modules/history.jsm index c952aa8ee80c..320dc2225b62 100644 --- a/services/sync/tps/extensions/tps/resource/modules/history.jsm +++ b/services/sync/tps/extensions/tps/resource/modules/history.jsm @@ -17,13 +17,6 @@ Cu.import("resource://tps/logger.jsm"); Cu.import("resource://services-common/async.js"); var DumpHistory = function TPS_History__DumpHistory() { - let writer = { - value: "", - write: function PlacesItem__dump__write(aStr, aLen) { - this.value += aStr; - } - }; - let query = PlacesUtils.history.getNewQuery(); let options = PlacesUtils.history.getNewQueryOptions(); let root = PlacesUtils.history.executeQuery(query, options).root; diff --git a/services/sync/tps/extensions/tps/resource/modules/tabs.jsm b/services/sync/tps/extensions/tps/resource/modules/tabs.jsm index 670c0af1e7a1..797a939c09c6 100644 --- a/services/sync/tps/extensions/tps/resource/modules/tabs.jsm +++ b/services/sync/tps/extensions/tps/resource/modules/tabs.jsm @@ -49,7 +49,7 @@ var BrowserTabs = { Find(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] of Object.entries(engine.getAllClients())) { + for (let [, client] of Object.entries(engine.getAllClients())) { if (!client.tabs) { continue; } diff --git a/services/sync/tps/extensions/tps/resource/tps.jsm b/services/sync/tps/extensions/tps/resource/tps.jsm index cdaa0542e104..fd3f3a1ac00c 100644 --- a/services/sync/tps/extensions/tps/resource/tps.jsm +++ b/services/sync/tps/extensions/tps/resource/tps.jsm @@ -432,7 +432,6 @@ var TPS = { this.shouldValidatePasswords = true; try { for (let password of passwords) { - let password_id = -1; Logger.logInfo("executing action " + action.toUpperCase() + " on password " + JSON.stringify(password)); let passwordOb = new Password(password);