Bug 1609966 - Enable ESLint for services/sync/modules/constants.js. r=lina

Differential Revision: https://phabricator.services.mozilla.com/D60280

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mark Banner 2020-01-17 19:27:31 +00:00
parent 4fb4f2f900
commit 77a7218e90
2 changed files with 98 additions and 103 deletions

View file

@ -250,9 +250,6 @@ services/common/kinto-offline-client.js
# Webpack-bundled library # Webpack-bundled library
services/fxaccounts/FxAccountsPairingChannel.js services/fxaccounts/FxAccountsPairingChannel.js
# Uses `#filter substitution`
services/sync/modules/constants.js
# Servo is imported. # Servo is imported.
servo/ servo/

View file

@ -5,133 +5,131 @@
// Process each item in the "constants hash" to add to "global" and give a name // Process each item in the "constants hash" to add to "global" and give a name
var EXPORTED_SYMBOLS = []; var EXPORTED_SYMBOLS = [];
for (let [key, val] of Object.entries({ for (let [key, val] of Object.entries({
// Don't manually modify this line, as it is automatically replaced on merge day
// by the gecko_migration.py script.
WEAVE_VERSION: "1.76.0",
// Don't manually modify this line, as it is automatically replaced on merge day // Sync Server API version that the client supports.
// by the gecko_migration.py script. SYNC_API_VERSION: "1.5",
WEAVE_VERSION: "1.76.0",
// Sync Server API version that the client supports. // Version of the data format this client supports. The data format describes
SYNC_API_VERSION: "1.5", // how records are packaged; this is separate from the Server API version and
// the per-engine cleartext formats.
STORAGE_VERSION: 5,
PREFS_BRANCH: "services.sync.",
// Version of the data format this client supports. The data format describes // Put in [] because those aren't allowed in a collection name.
// how records are packaged; this is separate from the Server API version and DEFAULT_KEYBUNDLE_NAME: "[default]",
// the per-engine cleartext formats.
STORAGE_VERSION: 5,
PREFS_BRANCH: "services.sync.",
// Put in [] because those aren't allowed in a collection name. // Key dimensions.
DEFAULT_KEYBUNDLE_NAME: "[default]", SYNC_KEY_ENCODED_LENGTH: 26,
SYNC_KEY_DECODED_LENGTH: 16,
// Key dimensions. NO_SYNC_NODE_INTERVAL: 10 * 60 * 1000, // 10 minutes
SYNC_KEY_ENCODED_LENGTH: 26,
SYNC_KEY_DECODED_LENGTH: 16,
NO_SYNC_NODE_INTERVAL: 10 * 60 * 1000, // 10 minutes MAX_ERROR_COUNT_BEFORE_BACKOFF: 3,
MAX_ERROR_COUNT_BEFORE_BACKOFF: 3, // Backoff intervals
MINIMUM_BACKOFF_INTERVAL: 15 * 60 * 1000, // 15 minutes
MAXIMUM_BACKOFF_INTERVAL: 8 * 60 * 60 * 1000, // 8 hours
// Backoff intervals // HMAC event handling timeout.
MINIMUM_BACKOFF_INTERVAL: 15 * 60 * 1000, // 15 minutes // 10 minutes: a compromise between the multi-desktop sync interval
MAXIMUM_BACKOFF_INTERVAL: 8 * 60 * 60 * 1000, // 8 hours // and the mobile sync interval.
HMAC_EVENT_INTERVAL: 600000,
// HMAC event handling timeout. // How long to wait between sync attempts if the Master Password is locked.
// 10 minutes: a compromise between the multi-desktop sync interval MASTER_PASSWORD_LOCKED_RETRY_INTERVAL: 15 * 60 * 1000, // 15 minutes
// and the mobile sync interval.
HMAC_EVENT_INTERVAL: 600000,
// How long to wait between sync attempts if the Master Password is locked. // 50 is hardcoded here because of URL length restrictions.
MASTER_PASSWORD_LOCKED_RETRY_INTERVAL: 15 * 60 * 1000, // 15 minutes // (GUIDs can be up to 64 chars long.)
// Individual engines can set different values for their limit if their
// identifiers are shorter.
DEFAULT_GUID_FETCH_BATCH_SIZE: 50,
// 50 is hardcoded here because of URL length restrictions. // Default batch size for download batching
// (GUIDs can be up to 64 chars long.) // (how many records are fetched at a time from the server when batching is used).
// Individual engines can set different values for their limit if their DEFAULT_DOWNLOAD_BATCH_SIZE: 1000,
// identifiers are shorter.
DEFAULT_GUID_FETCH_BATCH_SIZE: 50,
// Default batch size for download batching // score thresholds for early syncs
// (how many records are fetched at a time from the server when batching is used). SINGLE_USER_THRESHOLD: 1000,
DEFAULT_DOWNLOAD_BATCH_SIZE: 1000, MULTI_DEVICE_THRESHOLD: 300,
// score thresholds for early syncs // Other score increment constants
SINGLE_USER_THRESHOLD: 1000, SCORE_INCREMENT_SMALL: 1,
MULTI_DEVICE_THRESHOLD: 300, SCORE_INCREMENT_MEDIUM: 10,
// Other score increment constants // Instant sync score increment
SCORE_INCREMENT_SMALL: 1, SCORE_INCREMENT_XLARGE: 300 + 1, //MULTI_DEVICE_THRESHOLD + 1
SCORE_INCREMENT_MEDIUM: 10,
// Instant sync score increment // Delay before incrementing global score
SCORE_INCREMENT_XLARGE: 300 + 1, //MULTI_DEVICE_THRESHOLD + 1 SCORE_UPDATE_DELAY: 100,
// Delay before incrementing global score // Delay for the back observer debouncer. This is chosen to be longer than any
SCORE_UPDATE_DELAY: 100, // observed spurious idle/back events and short enough to pre-empt user activity.
IDLE_OBSERVER_BACK_DELAY: 100,
// Delay for the back observer debouncer. This is chosen to be longer than any // Duplicate URI_LENGTH_MAX from Places (from nsNavHistory.h), used to discard
// observed spurious idle/back events and short enough to pre-empt user activity. // tabs with huge uris during tab sync.
IDLE_OBSERVER_BACK_DELAY: 100, URI_LENGTH_MAX: 65536,
// Duplicate URI_LENGTH_MAX from Places (from nsNavHistory.h), used to discard MAX_HISTORY_UPLOAD: 5000,
// tabs with huge uris during tab sync. MAX_HISTORY_DOWNLOAD: 5000,
URI_LENGTH_MAX: 65536,
MAX_HISTORY_UPLOAD: 5000, // Top-level statuses:
MAX_HISTORY_DOWNLOAD: 5000, STATUS_OK: "success.status_ok",
SYNC_FAILED: "error.sync.failed",
LOGIN_FAILED: "error.login.failed",
SYNC_FAILED_PARTIAL: "error.sync.failed_partial",
CLIENT_NOT_CONFIGURED: "service.client_not_configured",
STATUS_DISABLED: "service.disabled",
MASTER_PASSWORD_LOCKED: "service.master_password_locked",
// Top-level statuses: // success states
STATUS_OK: "success.status_ok", LOGIN_SUCCEEDED: "success.login",
SYNC_FAILED: "error.sync.failed", SYNC_SUCCEEDED: "success.sync",
LOGIN_FAILED: "error.login.failed", ENGINE_SUCCEEDED: "success.engine",
SYNC_FAILED_PARTIAL: "error.sync.failed_partial",
CLIENT_NOT_CONFIGURED: "service.client_not_configured",
STATUS_DISABLED: "service.disabled",
MASTER_PASSWORD_LOCKED: "service.master_password_locked",
// success states // login failure status codes:
LOGIN_SUCCEEDED: "success.login", LOGIN_FAILED_NO_USERNAME: "error.login.reason.no_username",
SYNC_SUCCEEDED: "success.sync", LOGIN_FAILED_NO_PASSPHRASE: "error.login.reason.no_recoverykey",
ENGINE_SUCCEEDED: "success.engine", LOGIN_FAILED_NETWORK_ERROR: "error.login.reason.network",
LOGIN_FAILED_SERVER_ERROR: "error.login.reason.server",
LOGIN_FAILED_INVALID_PASSPHRASE: "error.login.reason.recoverykey",
LOGIN_FAILED_LOGIN_REJECTED: "error.login.reason.account",
// login failure status codes: // sync failure status codes
LOGIN_FAILED_NO_USERNAME: "error.login.reason.no_username", METARECORD_DOWNLOAD_FAIL: "error.sync.reason.metarecord_download_fail",
LOGIN_FAILED_NO_PASSPHRASE: "error.login.reason.no_recoverykey", VERSION_OUT_OF_DATE: "error.sync.reason.version_out_of_date",
LOGIN_FAILED_NETWORK_ERROR: "error.login.reason.network", CREDENTIALS_CHANGED: "error.sync.reason.credentials_changed",
LOGIN_FAILED_SERVER_ERROR: "error.login.reason.server", ABORT_SYNC_COMMAND: "aborting sync, process commands said so",
LOGIN_FAILED_INVALID_PASSPHRASE: "error.login.reason.recoverykey", NO_SYNC_NODE_FOUND: "error.sync.reason.no_node_found",
LOGIN_FAILED_LOGIN_REJECTED: "error.login.reason.account", OVER_QUOTA: "error.sync.reason.over_quota",
SERVER_MAINTENANCE: "error.sync.reason.serverMaintenance",
// sync failure status codes RESPONSE_OVER_QUOTA: "14",
METARECORD_DOWNLOAD_FAIL: "error.sync.reason.metarecord_download_fail",
VERSION_OUT_OF_DATE: "error.sync.reason.version_out_of_date",
CREDENTIALS_CHANGED: "error.sync.reason.credentials_changed",
ABORT_SYNC_COMMAND: "aborting sync, process commands said so",
NO_SYNC_NODE_FOUND: "error.sync.reason.no_node_found",
OVER_QUOTA: "error.sync.reason.over_quota",
SERVER_MAINTENANCE: "error.sync.reason.serverMaintenance",
RESPONSE_OVER_QUOTA: "14", // engine failure status codes
ENGINE_UPLOAD_FAIL: "error.engine.reason.record_upload_fail",
ENGINE_DOWNLOAD_FAIL: "error.engine.reason.record_download_fail",
ENGINE_UNKNOWN_FAIL: "error.engine.reason.unknown_fail",
ENGINE_APPLY_FAIL: "error.engine.reason.apply_fail",
// an upload failure where the batch was interrupted with a 412
ENGINE_BATCH_INTERRUPTED: "error.engine.reason.batch_interrupted",
// engine failure status codes // Ways that a sync can be disabled (messages only to be printed in debug log)
ENGINE_UPLOAD_FAIL: "error.engine.reason.record_upload_fail", kSyncMasterPasswordLocked: "User elected to leave Master Password locked",
ENGINE_DOWNLOAD_FAIL: "error.engine.reason.record_download_fail", kSyncWeaveDisabled: "Weave is disabled",
ENGINE_UNKNOWN_FAIL: "error.engine.reason.unknown_fail", kSyncNetworkOffline: "Network is offline",
ENGINE_APPLY_FAIL: "error.engine.reason.apply_fail", kSyncBackoffNotMet: "Trying to sync before the server said it's okay",
// an upload failure where the batch was interrupted with a 412 kFirstSyncChoiceNotMade: "User has not selected an action for first sync",
ENGINE_BATCH_INTERRUPTED: "error.engine.reason.batch_interrupted", kSyncNotConfigured: "Sync is not configured",
kFirefoxShuttingDown: "Firefox is about to shut down",
// Ways that a sync can be disabled (messages only to be printed in debug log) DEVICE_TYPE_DESKTOP: "desktop",
kSyncMasterPasswordLocked: "User elected to leave Master Password locked", DEVICE_TYPE_MOBILE: "mobile",
kSyncWeaveDisabled: "Weave is disabled",
kSyncNetworkOffline: "Network is offline",
kSyncBackoffNotMet: "Trying to sync before the server said it's okay",
kFirstSyncChoiceNotMade: "User has not selected an action for first sync",
kSyncNotConfigured: "Sync is not configured",
kFirefoxShuttingDown: "Firefox is about to shut down",
DEVICE_TYPE_DESKTOP: "desktop",
DEVICE_TYPE_MOBILE: "mobile",
SQLITE_MAX_VARIABLE_NUMBER: 999,
SQLITE_MAX_VARIABLE_NUMBER: 999,
})) { })) {
this[key] = val; this[key] = val;
this.EXPORTED_SYMBOLS.push(key); this.EXPORTED_SYMBOLS.push(key);