Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | #filter substitution |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | // Process each item in the "constants hash" to add to "global" and give a name |
michael@0 | 7 | this.EXPORTED_SYMBOLS = [((this[key] = val), key) for ([key, val] in Iterator({ |
michael@0 | 8 | |
michael@0 | 9 | WEAVE_VERSION: "@weave_version@", |
michael@0 | 10 | |
michael@0 | 11 | // Sync Server API version that the client supports. |
michael@0 | 12 | SYNC_API_VERSION: "1.1", |
michael@0 | 13 | USER_API_VERSION: "1.0", |
michael@0 | 14 | MISC_API_VERSION: "1.0", |
michael@0 | 15 | |
michael@0 | 16 | // Version of the data format this client supports. The data format describes |
michael@0 | 17 | // how records are packaged; this is separate from the Server API version and |
michael@0 | 18 | // the per-engine cleartext formats. |
michael@0 | 19 | STORAGE_VERSION: 5, |
michael@0 | 20 | PREFS_BRANCH: "services.sync.", |
michael@0 | 21 | |
michael@0 | 22 | // Host "key" to access Weave Identity in the password manager |
michael@0 | 23 | PWDMGR_HOST: "chrome://weave", |
michael@0 | 24 | PWDMGR_PASSWORD_REALM: "Mozilla Services Password", |
michael@0 | 25 | PWDMGR_PASSPHRASE_REALM: "Mozilla Services Encryption Passphrase", |
michael@0 | 26 | PWDMGR_KEYBUNDLE_REALM: "Mozilla Services Key Bundles", |
michael@0 | 27 | |
michael@0 | 28 | // Put in [] because those aren't allowed in a collection name. |
michael@0 | 29 | DEFAULT_KEYBUNDLE_NAME: "[default]", |
michael@0 | 30 | |
michael@0 | 31 | // Our extra input to SHA256-HMAC in generateEntry. |
michael@0 | 32 | // This includes the full crypto spec; change this when our algo changes. |
michael@0 | 33 | HMAC_INPUT: "Sync-AES_256_CBC-HMAC256", |
michael@0 | 34 | |
michael@0 | 35 | // Key dimensions. |
michael@0 | 36 | SYNC_KEY_ENCODED_LENGTH: 26, |
michael@0 | 37 | SYNC_KEY_DECODED_LENGTH: 16, |
michael@0 | 38 | SYNC_KEY_HYPHENATED_LENGTH: 31, // 26 chars, 5 hyphens. |
michael@0 | 39 | |
michael@0 | 40 | NO_SYNC_NODE_INTERVAL: 10 * 60 * 1000, // 10 minutes |
michael@0 | 41 | |
michael@0 | 42 | MAX_ERROR_COUNT_BEFORE_BACKOFF: 3, |
michael@0 | 43 | MAX_IGNORE_ERROR_COUNT: 5, |
michael@0 | 44 | |
michael@0 | 45 | // Backoff intervals |
michael@0 | 46 | MINIMUM_BACKOFF_INTERVAL: 15 * 60 * 1000, // 15 minutes |
michael@0 | 47 | MAXIMUM_BACKOFF_INTERVAL: 8 * 60 * 60 * 1000, // 8 hours |
michael@0 | 48 | |
michael@0 | 49 | // HMAC event handling timeout. |
michael@0 | 50 | // 10 minutes: a compromise between the multi-desktop sync interval |
michael@0 | 51 | // and the mobile sync interval. |
michael@0 | 52 | HMAC_EVENT_INTERVAL: 600000, |
michael@0 | 53 | |
michael@0 | 54 | // How long to wait between sync attempts if the Master Password is locked. |
michael@0 | 55 | MASTER_PASSWORD_LOCKED_RETRY_INTERVAL: 15 * 60 * 1000, // 15 minutes |
michael@0 | 56 | |
michael@0 | 57 | // Separate from the ID fetch batch size to allow tuning for mobile. |
michael@0 | 58 | MOBILE_BATCH_SIZE: 50, |
michael@0 | 59 | |
michael@0 | 60 | // 50 is hardcoded here because of URL length restrictions. |
michael@0 | 61 | // (GUIDs can be up to 64 chars long.) |
michael@0 | 62 | // Individual engines can set different values for their limit if their |
michael@0 | 63 | // identifiers are shorter. |
michael@0 | 64 | DEFAULT_GUID_FETCH_BATCH_SIZE: 50, |
michael@0 | 65 | DEFAULT_MOBILE_GUID_FETCH_BATCH_SIZE: 50, |
michael@0 | 66 | |
michael@0 | 67 | // Default batch size for applying incoming records. |
michael@0 | 68 | DEFAULT_STORE_BATCH_SIZE: 1, |
michael@0 | 69 | HISTORY_STORE_BATCH_SIZE: 50, // same as MOBILE_BATCH_SIZE |
michael@0 | 70 | FORMS_STORE_BATCH_SIZE: 50, // same as MOBILE_BATCH_SIZE |
michael@0 | 71 | PASSWORDS_STORE_BATCH_SIZE: 50, // same as MOBILE_BATCH_SIZE |
michael@0 | 72 | ADDONS_STORE_BATCH_SIZE: 1000000, // process all addons at once |
michael@0 | 73 | APPS_STORE_BATCH_SIZE: 50, // same as MOBILE_BATCH_SIZE |
michael@0 | 74 | |
michael@0 | 75 | // score thresholds for early syncs |
michael@0 | 76 | SINGLE_USER_THRESHOLD: 1000, |
michael@0 | 77 | MULTI_DEVICE_THRESHOLD: 300, |
michael@0 | 78 | |
michael@0 | 79 | // Other score increment constants |
michael@0 | 80 | SCORE_INCREMENT_SMALL: 1, |
michael@0 | 81 | SCORE_INCREMENT_MEDIUM: 10, |
michael@0 | 82 | |
michael@0 | 83 | // Instant sync score increment |
michael@0 | 84 | SCORE_INCREMENT_XLARGE: 300 + 1, //MULTI_DEVICE_THRESHOLD + 1 |
michael@0 | 85 | |
michael@0 | 86 | // Delay before incrementing global score |
michael@0 | 87 | SCORE_UPDATE_DELAY: 100, |
michael@0 | 88 | |
michael@0 | 89 | // Delay for the back observer debouncer. This is chosen to be longer than any |
michael@0 | 90 | // observed spurious idle/back events and short enough to pre-empt user activity. |
michael@0 | 91 | IDLE_OBSERVER_BACK_DELAY: 100, |
michael@0 | 92 | |
michael@0 | 93 | // Number of records to upload in a single POST (multiple POSTS if exceeded) |
michael@0 | 94 | // FIXME: Record size limit is 256k (new cluster), so this can be quite large! |
michael@0 | 95 | // (Bug 569295) |
michael@0 | 96 | MAX_UPLOAD_RECORDS: 100, |
michael@0 | 97 | MAX_HISTORY_UPLOAD: 5000, |
michael@0 | 98 | MAX_HISTORY_DOWNLOAD: 5000, |
michael@0 | 99 | |
michael@0 | 100 | // Top-level statuses: |
michael@0 | 101 | STATUS_OK: "success.status_ok", |
michael@0 | 102 | SYNC_FAILED: "error.sync.failed", |
michael@0 | 103 | LOGIN_FAILED: "error.login.failed", |
michael@0 | 104 | SYNC_FAILED_PARTIAL: "error.sync.failed_partial", |
michael@0 | 105 | CLIENT_NOT_CONFIGURED: "service.client_not_configured", |
michael@0 | 106 | STATUS_DISABLED: "service.disabled", |
michael@0 | 107 | MASTER_PASSWORD_LOCKED: "service.master_password_locked", |
michael@0 | 108 | |
michael@0 | 109 | // success states |
michael@0 | 110 | LOGIN_SUCCEEDED: "success.login", |
michael@0 | 111 | SYNC_SUCCEEDED: "success.sync", |
michael@0 | 112 | ENGINE_SUCCEEDED: "success.engine", |
michael@0 | 113 | |
michael@0 | 114 | // login failure status codes: |
michael@0 | 115 | LOGIN_FAILED_NO_USERNAME: "error.login.reason.no_username", |
michael@0 | 116 | LOGIN_FAILED_NO_PASSWORD: "error.login.reason.no_password2", |
michael@0 | 117 | LOGIN_FAILED_NO_PASSPHRASE: "error.login.reason.no_recoverykey", |
michael@0 | 118 | LOGIN_FAILED_NETWORK_ERROR: "error.login.reason.network", |
michael@0 | 119 | LOGIN_FAILED_SERVER_ERROR: "error.login.reason.server", |
michael@0 | 120 | LOGIN_FAILED_INVALID_PASSPHRASE: "error.login.reason.recoverykey", |
michael@0 | 121 | LOGIN_FAILED_LOGIN_REJECTED: "error.login.reason.account", |
michael@0 | 122 | LOGIN_FAILED_NOT_READY: "error.login.reason.initializing", |
michael@0 | 123 | |
michael@0 | 124 | // sync failure status codes |
michael@0 | 125 | METARECORD_DOWNLOAD_FAIL: "error.sync.reason.metarecord_download_fail", |
michael@0 | 126 | VERSION_OUT_OF_DATE: "error.sync.reason.version_out_of_date", |
michael@0 | 127 | DESKTOP_VERSION_OUT_OF_DATE: "error.sync.reason.desktop_version_out_of_date", |
michael@0 | 128 | SETUP_FAILED_NO_PASSPHRASE: "error.sync.reason.setup_failed_no_passphrase", |
michael@0 | 129 | CREDENTIALS_CHANGED: "error.sync.reason.credentials_changed", |
michael@0 | 130 | ABORT_SYNC_COMMAND: "aborting sync, process commands said so", |
michael@0 | 131 | NO_SYNC_NODE_FOUND: "error.sync.reason.no_node_found", |
michael@0 | 132 | OVER_QUOTA: "error.sync.reason.over_quota", |
michael@0 | 133 | PROLONGED_SYNC_FAILURE: "error.sync.prolonged_failure", |
michael@0 | 134 | SERVER_MAINTENANCE: "error.sync.reason.serverMaintenance", |
michael@0 | 135 | |
michael@0 | 136 | RESPONSE_OVER_QUOTA: "14", |
michael@0 | 137 | |
michael@0 | 138 | // engine failure status codes |
michael@0 | 139 | ENGINE_UPLOAD_FAIL: "error.engine.reason.record_upload_fail", |
michael@0 | 140 | ENGINE_DOWNLOAD_FAIL: "error.engine.reason.record_download_fail", |
michael@0 | 141 | ENGINE_UNKNOWN_FAIL: "error.engine.reason.unknown_fail", |
michael@0 | 142 | ENGINE_APPLY_FAIL: "error.engine.reason.apply_fail", |
michael@0 | 143 | ENGINE_METARECORD_DOWNLOAD_FAIL: "error.engine.reason.metarecord_download_fail", |
michael@0 | 144 | ENGINE_METARECORD_UPLOAD_FAIL: "error.engine.reason.metarecord_upload_fail", |
michael@0 | 145 | |
michael@0 | 146 | JPAKE_ERROR_CHANNEL: "jpake.error.channel", |
michael@0 | 147 | JPAKE_ERROR_NETWORK: "jpake.error.network", |
michael@0 | 148 | JPAKE_ERROR_SERVER: "jpake.error.server", |
michael@0 | 149 | JPAKE_ERROR_TIMEOUT: "jpake.error.timeout", |
michael@0 | 150 | JPAKE_ERROR_INTERNAL: "jpake.error.internal", |
michael@0 | 151 | JPAKE_ERROR_INVALID: "jpake.error.invalid", |
michael@0 | 152 | JPAKE_ERROR_NODATA: "jpake.error.nodata", |
michael@0 | 153 | JPAKE_ERROR_KEYMISMATCH: "jpake.error.keymismatch", |
michael@0 | 154 | JPAKE_ERROR_WRONGMESSAGE: "jpake.error.wrongmessage", |
michael@0 | 155 | JPAKE_ERROR_USERABORT: "jpake.error.userabort", |
michael@0 | 156 | JPAKE_ERROR_DELAYUNSUPPORTED: "jpake.error.delayunsupported", |
michael@0 | 157 | |
michael@0 | 158 | // info types for Service.getStorageInfo |
michael@0 | 159 | INFO_COLLECTIONS: "collections", |
michael@0 | 160 | INFO_COLLECTION_USAGE: "collection_usage", |
michael@0 | 161 | INFO_COLLECTION_COUNTS: "collection_counts", |
michael@0 | 162 | INFO_QUOTA: "quota", |
michael@0 | 163 | |
michael@0 | 164 | // Ways that a sync can be disabled (messages only to be printed in debug log) |
michael@0 | 165 | kSyncMasterPasswordLocked: "User elected to leave Master Password locked", |
michael@0 | 166 | kSyncWeaveDisabled: "Weave is disabled", |
michael@0 | 167 | kSyncNetworkOffline: "Network is offline", |
michael@0 | 168 | kSyncBackoffNotMet: "Trying to sync before the server said it's okay", |
michael@0 | 169 | kFirstSyncChoiceNotMade: "User has not selected an action for first sync", |
michael@0 | 170 | |
michael@0 | 171 | // Application IDs |
michael@0 | 172 | FIREFOX_ID: "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}", |
michael@0 | 173 | FENNEC_ID: "{a23983c0-fd0e-11dc-95ff-0800200c9a66}", |
michael@0 | 174 | SEAMONKEY_ID: "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}", |
michael@0 | 175 | TEST_HARNESS_ID: "xuth@mozilla.org", |
michael@0 | 176 | |
michael@0 | 177 | MIN_PP_LENGTH: 12, |
michael@0 | 178 | MIN_PASS_LENGTH: 8, |
michael@0 | 179 | |
michael@0 | 180 | LOG_DATE_FORMAT: "%Y-%m-%d %H:%M:%S", |
michael@0 | 181 | |
michael@0 | 182 | }))]; |