home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 10868 / 10868.xpi / modules / constants.js < prev    next >
Encoding:
Text File  |  2010-02-11  |  6.3 KB  |  137 lines

  1. /* ***** BEGIN LICENSE BLOCK *****
  2.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  3.  *
  4.  * The contents of this file are subject to the Mozilla Public License Version
  5.  * 1.1 (the "License"); you may not use this file except in compliance with
  6.  * the License. You may obtain a copy of the License at
  7.  * http://www.mozilla.org/MPL/
  8.  *
  9.  * Software distributed under the License is distributed on an "AS IS" basis,
  10.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11.  * for the specific language governing rights and limitations under the
  12.  * License.
  13.  *
  14.  * The Original Code is Bookmarks Sync.
  15.  *
  16.  * The Initial Developer of the Original Code is Mozilla.
  17.  * Portions created by the Initial Developer are Copyright (C) 2007
  18.  * the Initial Developer. All Rights Reserved.
  19.  *
  20.  * Contributor(s):
  21.  *  Dan Mills <thunder@mozilla.com>
  22.  *
  23.  * Alternatively, the contents of this file may be used under the terms of
  24.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  25.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  26.  * in which case the provisions of the GPL or the LGPL are applicable instead
  27.  * of those above. If you wish to allow use of your version of this file only
  28.  * under the terms of either the GPL or the LGPL, and not to allow others to
  29.  * use your version of this file under the terms of the MPL, indicate your
  30.  * decision by deleting the provisions above and replace them with the notice
  31.  * and other provisions required by the GPL or the LGPL. If you do not delete
  32.  * the provisions above, a recipient may use your version of this file under
  33.  * the terms of any one of the MPL, the GPL or the LGPL.
  34.  *
  35.  * ***** END LICENSE BLOCK ***** */
  36.  
  37. // Process each item in the "constants hash" to add to "global" and give a name
  38. let EXPORTED_SYMBOLS = [((this[key] = val), key) for ([key, val] in Iterator({
  39.  
  40. WEAVE_VERSION:                         "1.0.1",
  41. WEAVE_ID:                              "{340c2bbc-ce74-4362-90b5-7c26312808ef}",
  42.  
  43. // Last client version this client can read. If the server contains an older
  44. // version, this client will wipe the data on the server first.
  45. COMPATIBLE_VERSION:                    "1.0rc4",
  46.  
  47. DEFAULT_SERVER:                        "https://auth.services.mozilla.com/",
  48.  
  49. PREFS_BRANCH:                          "extensions.weave.",
  50.  
  51. // Host "key" to access Weave Identity in the password manager
  52. PWDMGR_HOST:                           "chrome://weave",
  53.  
  54. // Sync intervals for various clients configurations
  55. SINGLE_USER_SYNC:                      24 * 60 * 60 * 1000, // 1 day
  56. MULTI_DESKTOP_SYNC:                    60 * 60 * 1000, // 1 hour
  57. MULTI_MOBILE_SYNC:                     5 * 60 * 1000, // 5 minutes
  58. PARTIAL_DATA_SYNC:                     60 * 1000, // 1 minute
  59.  
  60. // score thresholds for early syncs
  61. SINGLE_USER_THRESHOLD:                 1000,
  62. MULTI_DESKTOP_THRESHOLD:               500,
  63. MULTI_MOBILE_THRESHOLD:                100,
  64.  
  65. // File IO Flags
  66. MODE_RDONLY:                           0x01,
  67. MODE_WRONLY:                           0x02,
  68. MODE_CREATE:                           0x08,
  69. MODE_APPEND:                           0x10,
  70. MODE_TRUNCATE:                         0x20,
  71.  
  72. // File Permission flags
  73. PERMS_FILE:                            0644,
  74. PERMS_PASSFILE:                        0600,
  75. PERMS_DIRECTORY:                       0755,
  76.  
  77. // Number of records to upload in a single POST (multiple POSTS if exceeded)
  78. // Record size limit is currently 10K, so 100 is a bit over 1MB
  79. MAX_UPLOAD_RECORDS:                    100,
  80.  
  81. // Top-level statuses:
  82. STATUS_OK:                             "success.status_ok",
  83. SYNC_FAILED:                           "error.sync.failed",
  84. LOGIN_FAILED:                          "error.login.failed",
  85. SYNC_FAILED_PARTIAL:                   "error.sync.failed_partial",
  86. STATUS_DISABLED:                       "service.disabled",
  87. STATUS_DELAYED:                        "service.startup.delayed",
  88.  
  89. // success states
  90. LOGIN_SUCCEEDED:                       "success.login",
  91. SYNC_SUCCEEDED:                        "success.sync",
  92. ENGINE_SUCCEEDED:                      "success.engine",
  93.  
  94. // login failure status codes:
  95. LOGIN_FAILED_NO_USERNAME:              "error.login.reason.no_username",
  96. LOGIN_FAILED_NO_PASSWORD:              "error.login.reason.no_password",
  97. LOGIN_FAILED_NETWORK_ERROR:            "error.login.reason.network",
  98. LOGIN_FAILED_SERVER_ERROR:             "error.login.reason.server",
  99. LOGIN_FAILED_INVALID_PASSPHRASE:       "error.login.reason.passphrase",
  100. LOGIN_FAILED_LOGIN_REJECTED:           "error.login.reason.password",
  101.  
  102. // sync failure status codes
  103. METARECORD_DOWNLOAD_FAIL:              "error.sync.reason.metarecord_download_fail",
  104. VERSION_OUT_OF_DATE:                   "error.sync.reason.version_out_of_date",
  105. DESKTOP_VERSION_OUT_OF_DATE:           "error.sync.reason.desktop_version_out_of_date",
  106. KEYS_DOWNLOAD_FAIL:                    "error.sync.reason.keys_download_fail",
  107. NO_KEYS_NO_KEYGEN:                     "error.sync.reason.no_keys_no_keygen",
  108. KEYS_UPLOAD_FAIL:                      "error.sync.reason.keys_upload_fail",
  109. SETUP_FAILED_NO_PASSPHRASE:            "error.sync.reason.setup_failed_no_passphrase",
  110. ABORT_SYNC_COMMAND:                    "aborting sync, process commands said so",
  111. NO_SYNC_NODE_FOUND:                    "error.sync.reason.no_node_found",
  112.  
  113. // engine failure status codes
  114. ENGINE_UPLOAD_FAIL:                    "error.engine.reason.record_upload_fail",
  115. ENGINE_DOWNLOAD_FAIL:                  "error.engine.reason.record_download_fail",
  116. ENGINE_UNKNOWN_FAIL:                   "error.engine.reason.unknown_fail",
  117. ENGINE_METARECORD_UPLOAD_FAIL:         "error.engine.reason.metarecord_upload_fail",
  118.  
  119. // Ways that a sync can be disabled (messages only to be printed in debug log)
  120. kSyncWeaveDisabled:                    "Weave is disabled",
  121. kSyncNotLoggedIn:                      "User is not logged in",
  122. kSyncNetworkOffline:                   "Network is offline",
  123. kSyncInPrivateBrowsing:                "Private browsing is enabled",
  124. kSyncBackoffNotMet:                    "Trying to sync before the server said it's okay",
  125.  
  126. // Application IDs
  127. FIREFOX_ID:                            "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
  128. FENNEC_ID:                             "{a23983c0-fd0e-11dc-95ff-0800200c9a66}",
  129. SEAMONKEY_ID:                          "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}",
  130.  
  131. // UI constants
  132.  
  133. // How many data types (bookmarks, history, etc) to display per row
  134. UI_DATA_TYPES_PER_ROW:                 3,
  135.  
  136. }))];
  137.