1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/services/sync/modules/constants.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,182 @@ 1.4 +#filter substitution 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +// Process each item in the "constants hash" to add to "global" and give a name 1.10 +this.EXPORTED_SYMBOLS = [((this[key] = val), key) for ([key, val] in Iterator({ 1.11 + 1.12 +WEAVE_VERSION: "@weave_version@", 1.13 + 1.14 +// Sync Server API version that the client supports. 1.15 +SYNC_API_VERSION: "1.1", 1.16 +USER_API_VERSION: "1.0", 1.17 +MISC_API_VERSION: "1.0", 1.18 + 1.19 +// Version of the data format this client supports. The data format describes 1.20 +// how records are packaged; this is separate from the Server API version and 1.21 +// the per-engine cleartext formats. 1.22 +STORAGE_VERSION: 5, 1.23 +PREFS_BRANCH: "services.sync.", 1.24 + 1.25 +// Host "key" to access Weave Identity in the password manager 1.26 +PWDMGR_HOST: "chrome://weave", 1.27 +PWDMGR_PASSWORD_REALM: "Mozilla Services Password", 1.28 +PWDMGR_PASSPHRASE_REALM: "Mozilla Services Encryption Passphrase", 1.29 +PWDMGR_KEYBUNDLE_REALM: "Mozilla Services Key Bundles", 1.30 + 1.31 +// Put in [] because those aren't allowed in a collection name. 1.32 +DEFAULT_KEYBUNDLE_NAME: "[default]", 1.33 + 1.34 +// Our extra input to SHA256-HMAC in generateEntry. 1.35 +// This includes the full crypto spec; change this when our algo changes. 1.36 +HMAC_INPUT: "Sync-AES_256_CBC-HMAC256", 1.37 + 1.38 +// Key dimensions. 1.39 +SYNC_KEY_ENCODED_LENGTH: 26, 1.40 +SYNC_KEY_DECODED_LENGTH: 16, 1.41 +SYNC_KEY_HYPHENATED_LENGTH: 31, // 26 chars, 5 hyphens. 1.42 + 1.43 +NO_SYNC_NODE_INTERVAL: 10 * 60 * 1000, // 10 minutes 1.44 + 1.45 +MAX_ERROR_COUNT_BEFORE_BACKOFF: 3, 1.46 +MAX_IGNORE_ERROR_COUNT: 5, 1.47 + 1.48 +// Backoff intervals 1.49 +MINIMUM_BACKOFF_INTERVAL: 15 * 60 * 1000, // 15 minutes 1.50 +MAXIMUM_BACKOFF_INTERVAL: 8 * 60 * 60 * 1000, // 8 hours 1.51 + 1.52 +// HMAC event handling timeout. 1.53 +// 10 minutes: a compromise between the multi-desktop sync interval 1.54 +// and the mobile sync interval. 1.55 +HMAC_EVENT_INTERVAL: 600000, 1.56 + 1.57 +// How long to wait between sync attempts if the Master Password is locked. 1.58 +MASTER_PASSWORD_LOCKED_RETRY_INTERVAL: 15 * 60 * 1000, // 15 minutes 1.59 + 1.60 +// Separate from the ID fetch batch size to allow tuning for mobile. 1.61 +MOBILE_BATCH_SIZE: 50, 1.62 + 1.63 +// 50 is hardcoded here because of URL length restrictions. 1.64 +// (GUIDs can be up to 64 chars long.) 1.65 +// Individual engines can set different values for their limit if their 1.66 +// identifiers are shorter. 1.67 +DEFAULT_GUID_FETCH_BATCH_SIZE: 50, 1.68 +DEFAULT_MOBILE_GUID_FETCH_BATCH_SIZE: 50, 1.69 + 1.70 +// Default batch size for applying incoming records. 1.71 +DEFAULT_STORE_BATCH_SIZE: 1, 1.72 +HISTORY_STORE_BATCH_SIZE: 50, // same as MOBILE_BATCH_SIZE 1.73 +FORMS_STORE_BATCH_SIZE: 50, // same as MOBILE_BATCH_SIZE 1.74 +PASSWORDS_STORE_BATCH_SIZE: 50, // same as MOBILE_BATCH_SIZE 1.75 +ADDONS_STORE_BATCH_SIZE: 1000000, // process all addons at once 1.76 +APPS_STORE_BATCH_SIZE: 50, // same as MOBILE_BATCH_SIZE 1.77 + 1.78 +// score thresholds for early syncs 1.79 +SINGLE_USER_THRESHOLD: 1000, 1.80 +MULTI_DEVICE_THRESHOLD: 300, 1.81 + 1.82 +// Other score increment constants 1.83 +SCORE_INCREMENT_SMALL: 1, 1.84 +SCORE_INCREMENT_MEDIUM: 10, 1.85 + 1.86 +// Instant sync score increment 1.87 +SCORE_INCREMENT_XLARGE: 300 + 1, //MULTI_DEVICE_THRESHOLD + 1 1.88 + 1.89 +// Delay before incrementing global score 1.90 +SCORE_UPDATE_DELAY: 100, 1.91 + 1.92 +// Delay for the back observer debouncer. This is chosen to be longer than any 1.93 +// observed spurious idle/back events and short enough to pre-empt user activity. 1.94 +IDLE_OBSERVER_BACK_DELAY: 100, 1.95 + 1.96 +// Number of records to upload in a single POST (multiple POSTS if exceeded) 1.97 +// FIXME: Record size limit is 256k (new cluster), so this can be quite large! 1.98 +// (Bug 569295) 1.99 +MAX_UPLOAD_RECORDS: 100, 1.100 +MAX_HISTORY_UPLOAD: 5000, 1.101 +MAX_HISTORY_DOWNLOAD: 5000, 1.102 + 1.103 +// Top-level statuses: 1.104 +STATUS_OK: "success.status_ok", 1.105 +SYNC_FAILED: "error.sync.failed", 1.106 +LOGIN_FAILED: "error.login.failed", 1.107 +SYNC_FAILED_PARTIAL: "error.sync.failed_partial", 1.108 +CLIENT_NOT_CONFIGURED: "service.client_not_configured", 1.109 +STATUS_DISABLED: "service.disabled", 1.110 +MASTER_PASSWORD_LOCKED: "service.master_password_locked", 1.111 + 1.112 +// success states 1.113 +LOGIN_SUCCEEDED: "success.login", 1.114 +SYNC_SUCCEEDED: "success.sync", 1.115 +ENGINE_SUCCEEDED: "success.engine", 1.116 + 1.117 +// login failure status codes: 1.118 +LOGIN_FAILED_NO_USERNAME: "error.login.reason.no_username", 1.119 +LOGIN_FAILED_NO_PASSWORD: "error.login.reason.no_password2", 1.120 +LOGIN_FAILED_NO_PASSPHRASE: "error.login.reason.no_recoverykey", 1.121 +LOGIN_FAILED_NETWORK_ERROR: "error.login.reason.network", 1.122 +LOGIN_FAILED_SERVER_ERROR: "error.login.reason.server", 1.123 +LOGIN_FAILED_INVALID_PASSPHRASE: "error.login.reason.recoverykey", 1.124 +LOGIN_FAILED_LOGIN_REJECTED: "error.login.reason.account", 1.125 +LOGIN_FAILED_NOT_READY: "error.login.reason.initializing", 1.126 + 1.127 +// sync failure status codes 1.128 +METARECORD_DOWNLOAD_FAIL: "error.sync.reason.metarecord_download_fail", 1.129 +VERSION_OUT_OF_DATE: "error.sync.reason.version_out_of_date", 1.130 +DESKTOP_VERSION_OUT_OF_DATE: "error.sync.reason.desktop_version_out_of_date", 1.131 +SETUP_FAILED_NO_PASSPHRASE: "error.sync.reason.setup_failed_no_passphrase", 1.132 +CREDENTIALS_CHANGED: "error.sync.reason.credentials_changed", 1.133 +ABORT_SYNC_COMMAND: "aborting sync, process commands said so", 1.134 +NO_SYNC_NODE_FOUND: "error.sync.reason.no_node_found", 1.135 +OVER_QUOTA: "error.sync.reason.over_quota", 1.136 +PROLONGED_SYNC_FAILURE: "error.sync.prolonged_failure", 1.137 +SERVER_MAINTENANCE: "error.sync.reason.serverMaintenance", 1.138 + 1.139 +RESPONSE_OVER_QUOTA: "14", 1.140 + 1.141 +// engine failure status codes 1.142 +ENGINE_UPLOAD_FAIL: "error.engine.reason.record_upload_fail", 1.143 +ENGINE_DOWNLOAD_FAIL: "error.engine.reason.record_download_fail", 1.144 +ENGINE_UNKNOWN_FAIL: "error.engine.reason.unknown_fail", 1.145 +ENGINE_APPLY_FAIL: "error.engine.reason.apply_fail", 1.146 +ENGINE_METARECORD_DOWNLOAD_FAIL: "error.engine.reason.metarecord_download_fail", 1.147 +ENGINE_METARECORD_UPLOAD_FAIL: "error.engine.reason.metarecord_upload_fail", 1.148 + 1.149 +JPAKE_ERROR_CHANNEL: "jpake.error.channel", 1.150 +JPAKE_ERROR_NETWORK: "jpake.error.network", 1.151 +JPAKE_ERROR_SERVER: "jpake.error.server", 1.152 +JPAKE_ERROR_TIMEOUT: "jpake.error.timeout", 1.153 +JPAKE_ERROR_INTERNAL: "jpake.error.internal", 1.154 +JPAKE_ERROR_INVALID: "jpake.error.invalid", 1.155 +JPAKE_ERROR_NODATA: "jpake.error.nodata", 1.156 +JPAKE_ERROR_KEYMISMATCH: "jpake.error.keymismatch", 1.157 +JPAKE_ERROR_WRONGMESSAGE: "jpake.error.wrongmessage", 1.158 +JPAKE_ERROR_USERABORT: "jpake.error.userabort", 1.159 +JPAKE_ERROR_DELAYUNSUPPORTED: "jpake.error.delayunsupported", 1.160 + 1.161 +// info types for Service.getStorageInfo 1.162 +INFO_COLLECTIONS: "collections", 1.163 +INFO_COLLECTION_USAGE: "collection_usage", 1.164 +INFO_COLLECTION_COUNTS: "collection_counts", 1.165 +INFO_QUOTA: "quota", 1.166 + 1.167 +// Ways that a sync can be disabled (messages only to be printed in debug log) 1.168 +kSyncMasterPasswordLocked: "User elected to leave Master Password locked", 1.169 +kSyncWeaveDisabled: "Weave is disabled", 1.170 +kSyncNetworkOffline: "Network is offline", 1.171 +kSyncBackoffNotMet: "Trying to sync before the server said it's okay", 1.172 +kFirstSyncChoiceNotMade: "User has not selected an action for first sync", 1.173 + 1.174 +// Application IDs 1.175 +FIREFOX_ID: "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}", 1.176 +FENNEC_ID: "{a23983c0-fd0e-11dc-95ff-0800200c9a66}", 1.177 +SEAMONKEY_ID: "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}", 1.178 +TEST_HARNESS_ID: "xuth@mozilla.org", 1.179 + 1.180 +MIN_PP_LENGTH: 12, 1.181 +MIN_PASS_LENGTH: 8, 1.182 + 1.183 +LOG_DATE_FORMAT: "%Y-%m-%d %H:%M:%S", 1.184 + 1.185 +}))];