2007-12-10 21:38:53 -08:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is Bookmarks Sync.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Mozilla.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2007
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Dan Mills <thunder@mozilla.com>
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
2009-09-15 19:07:23 -07:00
|
|
|
// Process each item in the "constants hash" to add to "global" and give a name
|
|
|
|
let EXPORTED_SYMBOLS = [((this[key] = val), key) for ([key, val] in Iterator({
|
2007-12-10 21:38:53 -08:00
|
|
|
|
2009-09-15 19:07:23 -07:00
|
|
|
WEAVE_VERSION: "@weave_version@",
|
2009-02-11 23:52:44 -08:00
|
|
|
|
2009-09-15 19:07:23 -07:00
|
|
|
// Last client version this client can read. If the server contains an older
|
|
|
|
// version, this client will wipe the data on the server first.
|
|
|
|
COMPATIBLE_VERSION: "@compatible_version@",
|
2007-12-20 14:46:12 -08:00
|
|
|
|
2009-09-25 09:11:19 -07:00
|
|
|
DEFAULT_SERVER: "@server_url@",
|
|
|
|
|
2009-09-15 19:07:23 -07:00
|
|
|
PREFS_BRANCH: "extensions.weave.",
|
2007-12-20 14:46:12 -08:00
|
|
|
|
2009-09-03 21:11:32 -07:00
|
|
|
// Host "key" to access Weave Identity in the password manager
|
2009-09-15 19:07:23 -07:00
|
|
|
PWDMGR_HOST: "chrome://weave",
|
2009-09-03 21:11:32 -07:00
|
|
|
|
2009-09-25 15:05:09 -07:00
|
|
|
// Sync intervals for various clients configurations
|
|
|
|
SINGLE_USER_SYNC: 24 * 60 * 60 * 1000, // 1 day
|
|
|
|
MULTI_DESKTOP_SYNC: 60 * 60 * 1000, // 1 hour
|
|
|
|
MULTI_MOBILE_SYNC: 5 * 60 * 1000, // 5 minutes
|
2009-10-13 11:56:46 -07:00
|
|
|
PARTIAL_DATA_SYNC: 60 * 1000, // 1 minute
|
2009-09-25 15:05:09 -07:00
|
|
|
|
2009-11-09 09:57:58 -08:00
|
|
|
// score thresholds for early syncs
|
|
|
|
SINGLE_USER_THRESHOLD: 100,
|
|
|
|
MULTI_DESKTOP_THRESHOLD: 500,
|
|
|
|
MULTI_MOBILE_THRESHOLD: 1000,
|
|
|
|
|
2009-09-15 19:07:23 -07:00
|
|
|
// File IO Flags
|
|
|
|
MODE_RDONLY: 0x01,
|
|
|
|
MODE_WRONLY: 0x02,
|
|
|
|
MODE_CREATE: 0x08,
|
|
|
|
MODE_APPEND: 0x10,
|
|
|
|
MODE_TRUNCATE: 0x20,
|
2007-12-10 21:38:53 -08:00
|
|
|
|
2009-09-15 19:07:23 -07:00
|
|
|
// File Permission flags
|
|
|
|
PERMS_FILE: 0644,
|
|
|
|
PERMS_PASSFILE: 0600,
|
|
|
|
PERMS_DIRECTORY: 0755,
|
2007-12-10 21:38:53 -08:00
|
|
|
|
2009-09-15 19:07:23 -07:00
|
|
|
// Number of records to upload in a single POST (multiple POSTS if exceeded)
|
2009-07-22 16:21:33 -07:00
|
|
|
// Record size limit is currently 10K, so 100 is a bit over 1MB
|
2009-09-15 19:07:23 -07:00
|
|
|
MAX_UPLOAD_RECORDS: 100,
|
2009-03-25 23:43:14 -07:00
|
|
|
|
|
|
|
// Top-level statuses:
|
2009-09-15 19:07:23 -07:00
|
|
|
STATUS_OK: "success.status_ok",
|
|
|
|
SYNC_FAILED: "error.sync.failed",
|
|
|
|
LOGIN_FAILED: "error.login.failed",
|
|
|
|
SYNC_FAILED_PARTIAL: "error.sync.failed_partial",
|
|
|
|
STATUS_DISABLED: "service.disabled",
|
2009-09-24 23:16:27 -07:00
|
|
|
STATUS_DELAYED: "service.startup.delayed",
|
2009-09-15 18:38:52 -07:00
|
|
|
|
|
|
|
// success states
|
2009-09-15 19:07:23 -07:00
|
|
|
LOGIN_SUCCEEDED: "success.login",
|
|
|
|
SYNC_SUCCEEDED: "success.sync",
|
|
|
|
ENGINE_SUCCEEDED: "success.engine",
|
2009-09-15 18:38:52 -07:00
|
|
|
|
|
|
|
// login failure status codes:
|
2009-09-15 19:07:23 -07:00
|
|
|
LOGIN_FAILED_NO_USERNAME: "error.login.reason.no_username",
|
|
|
|
LOGIN_FAILED_NO_PASSWORD: "error.login.reason.no_password",
|
|
|
|
LOGIN_FAILED_NETWORK_ERROR: "error.login.reason.network",
|
2009-09-28 16:13:42 -07:00
|
|
|
LOGIN_FAILED_SERVER_ERROR: "error.login.reason.server",
|
2009-09-16 19:15:46 -07:00
|
|
|
LOGIN_FAILED_INVALID_PASSPHRASE: "error.login.reason.passphrase",
|
2009-09-15 19:07:23 -07:00
|
|
|
LOGIN_FAILED_LOGIN_REJECTED: "error.login.reason.password",
|
2009-09-15 18:38:52 -07:00
|
|
|
|
|
|
|
// sync failure status codes
|
2009-09-15 19:07:23 -07:00
|
|
|
METARECORD_DOWNLOAD_FAIL: "error.sync.reason.metarecord_download_fail",
|
|
|
|
VERSION_OUT_OF_DATE: "error.sync.reason.version_out_of_date",
|
|
|
|
DESKTOP_VERSION_OUT_OF_DATE: "error.sync.reason.desktop_version_out_of_date",
|
|
|
|
KEYS_DOWNLOAD_FAIL: "error.sync.reason.keys_download_fail",
|
|
|
|
NO_KEYS_NO_KEYGEN: "error.sync.reason.no_keys_no_keygen",
|
|
|
|
KEYS_UPLOAD_FAIL: "error.sync.reason.keys_upload_fail",
|
|
|
|
SETUP_FAILED_NO_PASSPHRASE: "error.sync.reason.setup_failed_no_passphrase",
|
2009-11-12 12:44:33 -08:00
|
|
|
ABORT_SYNC_COMMAND: "aborting sync, process commands said so",
|
2009-09-29 18:33:41 -07:00
|
|
|
NO_SYNC_NODE_FOUND: "error.sync.reason.no_node_found",
|
2009-09-15 18:38:52 -07:00
|
|
|
|
|
|
|
// engine failure status codes
|
2009-09-15 19:07:23 -07:00
|
|
|
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_METARECORD_UPLOAD_FAIL: "error.engine.reason.metarecord_upload_fail",
|
|
|
|
|
|
|
|
// Ways that a sync can be disabled (messages only to be printed in debug log)
|
|
|
|
kSyncWeaveDisabled: "Weave is disabled",
|
|
|
|
kSyncNotLoggedIn: "User is not logged in",
|
|
|
|
kSyncNetworkOffline: "Network is offline",
|
|
|
|
kSyncInPrivateBrowsing: "Private browsing is enabled",
|
|
|
|
kSyncBackoffNotMet: "Trying to sync before the server said it's okay",
|
2009-03-25 23:43:14 -07:00
|
|
|
|
2009-05-18 11:11:07 -07:00
|
|
|
// Application IDs
|
2009-09-15 19:07:23 -07:00
|
|
|
FIREFOX_ID: "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
|
|
|
|
THUNDERBIRD_ID: "{3550f703-e582-4d05-9a08-453d09bdfdc6}",
|
|
|
|
FENNEC_ID: "{a23983c0-fd0e-11dc-95ff-0800200c9a66}",
|
|
|
|
SEAMONKEY_ID: "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}",
|
2009-09-16 13:56:37 -07:00
|
|
|
|
2009-09-16 13:45:08 -07:00
|
|
|
// UI constants
|
2009-09-16 13:36:11 -07:00
|
|
|
|
|
|
|
// How many data types (bookmarks, history, etc) to display per row
|
2009-09-16 13:45:08 -07:00
|
|
|
UI_DATA_TYPES_PER_ROW: 3,
|
|
|
|
|
2009-09-15 19:07:23 -07:00
|
|
|
}))];
|