Merge mozilla-central to mozilla-inbound

This commit is contained in:
Ed Morley 2012-08-13 19:20:38 +01:00
Родитель df0aae5734 94d1e10bd0
Коммит 64209eb4d9
8 изменённых файлов: 133 добавлений и 102 удалений

Просмотреть файл

@ -9,6 +9,14 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk include $(DEPTH)/config/autoconf.mk
aitc_modules := \
browserid.js \
client.js \
main.js \
manager.js \
storage.js \
$(NULL)
EXTRA_COMPONENTS = \ EXTRA_COMPONENTS = \
AitcComponents.manifest \ AitcComponents.manifest \
Aitc.js \ Aitc.js \
@ -16,8 +24,9 @@ EXTRA_COMPONENTS = \
PREF_JS_EXPORTS = $(srcdir)/services-aitc.js PREF_JS_EXPORTS = $(srcdir)/services-aitc.js
libs:: AITC_MODULE_FILES := $(addprefix modules/,$(aitc_modules))
$(NSINSTALL) $(srcdir)/modules/* $(FINAL_TARGET)/modules/services-aitc AITC_MODULE_DEST = $(FINAL_TARGET)/modules/services-aitc
INSTALL_TARGETS += AITC_MODULE
TEST_DIRS += tests TEST_DIRS += tests

Просмотреть файл

@ -9,8 +9,6 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk include $(DEPTH)/config/autoconf.mk
PREF_JS_EXPORTS = $(srcdir)/services-common.js
modules := \ modules := \
async.js \ async.js \
log4moz.js \ log4moz.js \
@ -23,25 +21,25 @@ modules := \
utils.js \ utils.js \
$(NULL) $(NULL)
source_modules = $(foreach module,$(modules),$(srcdir)/$(module))
module_dir = $(FINAL_TARGET)/modules/services-common
libs::
$(NSINSTALL) -D $(module_dir)
$(NSINSTALL) $(source_modules) $(module_dir)
TEST_DIRS += tests
testing_modules := \ testing_modules := \
aitcserver.js \ aitcserver.js \
storageserver.js \ storageserver.js \
utils.js \ utils.js \
$(NULL) $(NULL)
TESTING_JS_MODULES := $(foreach file,$(testing_modules),modules-testing/$(file)) TEST_DIRS += tests
PREF_JS_EXPORTS = $(srcdir)/services-common.js
MODULES_FILES := $(modules)
MODULES_DEST = $(FINAL_TARGET)/modules/services-common
INSTALL_TARGETS += MODULES
TESTING_JS_MODULES := $(addprefix modules-testing/,$(testing_modules))
TESTING_JS_MODULE_DIR := services-common TESTING_JS_MODULE_DIR := services-common
include $(topsrcdir)/config/rules.mk
# What follows is a helper to launch a standalone storage server instance. # What follows is a helper to launch a standalone storage server instance.
# Most of the code lives in a Python script in the tests directory. If we # Most of the code lives in a Python script in the tests directory. If we
# ever consolidate our Python code, and/or have a supplemental driver for the # ever consolidate our Python code, and/or have a supplemental driver for the
@ -64,4 +62,3 @@ aitc-server:
$(PYTHON) $(srcdir)/tests/run_server.py $(topsrcdir) \ $(PYTHON) $(srcdir)/tests/run_server.py $(topsrcdir) \
$(MOZ_BUILD_ROOT) run_aitc_server.js --port $(aitc_server_port) $(MOZ_BUILD_ROOT) run_aitc_server.js --port $(aitc_server_port)
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -1,4 +1,3 @@
#
# This Source Code Form is subject to the terms of the Mozilla Public # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
@ -10,10 +9,16 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk include $(DEPTH)/config/autoconf.mk
modules := \
utils.js \
WeaveCrypto.js \
$(NULL)
MODULE = services-crypto MODULE = services-crypto
libs:: CRYPTO_MODULE_FILES := $(addprefix modules/,$(modules))
$(PYTHON) $(topsrcdir)/config/nsinstall.py $(srcdir)/modules/* $(FINAL_TARGET)/modules/services-crypto CRYPTO_MODULE_DEST = $(FINAL_TARGET)/modules/services-crypto
INSTALL_TARGETS += CRYPTO_MODULE
TEST_DIRS += tests TEST_DIRS += tests

Просмотреть файл

@ -1,4 +1,3 @@
#
# This Source Code Form is subject to the terms of the Mozilla Public # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
@ -12,21 +11,21 @@ include $(DEPTH)/config/autoconf.mk
FAIL_ON_WARNINGS := 1 FAIL_ON_WARNINGS := 1
MODULE = services-crypto MODULE := services-crypto
XPIDL_MODULE = services-crypto-component XPIDL_MODULE := services-crypto-component
XPIDLSRCS = \ XPIDLSRCS := \
nsISyncJPAKE.idl \ nsISyncJPAKE.idl \
$(NULL) $(NULL)
LIBRARY_NAME = services-crypto LIBRARY_NAME := services-crypto
EXPORT_LIBRARY = 1 EXPORT_LIBRARY := 1
IS_COMPONENT = 1 IS_COMPONENT := 1
MODULE_NAME = nsServicesCryptoModule MODULE_NAME := nsServicesCryptoModule
LIBXUL_LIBRARY = 1 LIBXUL_LIBRARY := 1
MOZILLA_INTERNAL_API = 1 MOZILLA_INTERNAL_API := 1
CPPSRCS = \ CPPSRCS := \
nsSyncJPAKE.cpp \ nsSyncJPAKE.cpp \
$(NULL) $(NULL)

Просмотреть файл

@ -2,30 +2,26 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this file, # License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/. # You can obtain one at http://mozilla.org/MPL/2.0/.
DEPTH = @DEPTH@ DEPTH := @DEPTH@
topsrcdir = @top_srcdir@ topsrcdir := @top_srcdir@
srcdir = @srcdir@ srcdir := @srcdir@
VPATH = @srcdir@ VPATH := @srcdir@
include $(DEPTH)/config/autoconf.mk include $(DEPTH)/config/autoconf.mk
EXTRA_COMPONENTS = \ EXTRA_COMPONENTS := \
NotificationsComponents.manifest \ NotificationsComponents.manifest \
$(NULL) $(NULL)
PREF_JS_EXPORTS = $(srcdir)/services-notifications.js PREF_JS_EXPORTS := $(srcdir)/services-notifications.js
modules := \ modules := \
service.js \ service.js \
$(NULL) $(NULL)
source_modules = $(foreach module,$(modules),$(srcdir)/$(module)) NOTIFICATION_MODULE_FILES := $(modules)
module_dir = $(FINAL_TARGET)/modules/services-notifications NOTIFICATION_MODULE_DEST = $(FINAL_TARGET)/modules/services-notifications
INSTALL_TARGETS += NOTIFICATION_MODULE
GENERATED_DIRS += $(module_dir)
libs::
$(NSINSTALL) $(source_modules) $(module_dir)
TEST_DIRS += tests TEST_DIRS += tests

Просмотреть файл

@ -14,12 +14,50 @@ weave_version := 1.19.0
weave_channel := rel weave_channel := rel
weave_id := {340c2bbc-ce74-4362-90b5-7c26312808ef} weave_id := {340c2bbc-ce74-4362-90b5-7c26312808ef}
sync_pp_defines := \ # Preprocess files.
SYNC_PP := modules/constants.js
SYNC_PP_FLAGS := \
-Dweave_version=$(weave_version) \ -Dweave_version=$(weave_version) \
-Dweave_channel=$(weave_channel) \ -Dweave_channel=$(weave_channel) \
-Dweave_id=$(weave_id) -Dweave_id=$(weave_id)
SYNC_PP_PATH = $(FINAL_TARGET)/modules/services-sync
PP_TARGETS += SYNC_PP
DIRS := locales # The set of core JavaScript modules for Sync. These are copied as-is.
sync_modules := \
addonsreconciler.js \
addonutils.js \
engines.js \
identity.js \
jpakeclient.js \
keys.js \
main.js \
notifications.js \
policies.js \
record.js \
resource.js \
rest.js \
service.js \
status.js \
util.js \
$(NULL)
# The set of JavaScript modules provide engines for Sync. These are
# copied as-is.
sync_engine_modules := \
addons.js \
apps.js \
bookmarks.js \
clients.js \
forms.js \
history.js \
passwords.js \
prefs.js \
tabs.js \
$(NULL)
DIRS += locales
TEST_DIRS += tests
EXTRA_COMPONENTS := \ EXTRA_COMPONENTS := \
SyncComponents.manifest \ SyncComponents.manifest \
@ -28,31 +66,13 @@ EXTRA_COMPONENTS := \
PREF_JS_EXPORTS := $(srcdir)/services-sync.js PREF_JS_EXPORTS := $(srcdir)/services-sync.js
# Preprocess constants (by preprocessing everything). # Install JS module files.
# The 'HERE' idiom avoids a dependency on pushd. We need to do this fiddling in SYNC_MAIN_FILES := $(addprefix modules/,$(sync_modules))
# order to get relative paths, so we can process services/sync/modules/* into SYNC_MAIN_DEST = $(FINAL_TARGET)/modules/services-sync
# modules/services-sync/*. INSTALL_TARGETS += SYNC_MAIN
#
# Note that we find candidates, make directories, then 'copy' files.
libs::
ifndef NO_DIST_INSTALL
$(EXIT_ON_ERROR) \
HERE=$(CURDIR); \
cd $(srcdir)/modules; \
dirs=`find * -type d`; \
files=`find * -type f`; \
cd $$HERE; \
for d in $$dirs; do \
$(PYTHON) $(topsrcdir)/config/nsinstall.py -D $(FINAL_TARGET)/modules/services-sync/$$d; \
done; \
for i in $$files; do \
src=$(srcdir)/modules/$$i; \
dest=$(FINAL_TARGET)/modules/services-sync/$$i; \
$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(sync_pp_defines) $$src > $$dest ; \
done
endif
SYNC_ENGINES_FILES := $(addprefix modules/engines/,$(sync_engine_modules))
TEST_DIRS += tests SYNC_ENGINES_DEST = $(FINAL_TARGET)/modules/services-sync/engines
INSTALL_TARGETS += SYNC_ENGINES
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -1,4 +1,3 @@
#
# This Source Code Form is subject to the terms of the Mozilla Public # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.

Просмотреть файл

@ -115,13 +115,13 @@ WeaveSvc.prototype = {
get isLoggedIn() { return this._loggedIn; }, get isLoggedIn() { return this._loggedIn; },
get locked() { return this._locked; }, get locked() { return this._locked; },
lock: function Svc_lock() { lock: function lock() {
if (this._locked) if (this._locked)
return false; return false;
this._locked = true; this._locked = true;
return true; return true;
}, },
unlock: function Svc_unlock() { unlock: function unlock() {
this._locked = false; this._locked = false;
}, },
@ -155,7 +155,7 @@ WeaveSvc.prototype = {
this.cryptoKeysURL = this.storageURL + CRYPTO_COLLECTION + "/" + KEYS_WBO; this.cryptoKeysURL = this.storageURL + CRYPTO_COLLECTION + "/" + KEYS_WBO;
}, },
_checkCrypto: function WeaveSvc__checkCrypto() { _checkCrypto: function _checkCrypto() {
let ok = false; let ok = false;
try { try {
@ -327,7 +327,7 @@ WeaveSvc.prototype = {
// Send an event now that Weave service is ready. We don't do this // Send an event now that Weave service is ready. We don't do this
// synchronously so that observers can import this module before // synchronously so that observers can import this module before
// registering an observer. // registering an observer.
Utils.nextTick(function() { Utils.nextTick(function onNextTick() {
Status.ready = true; Status.ready = true;
Svc.Obs.notify("weave:service:ready"); Svc.Obs.notify("weave:service:ready");
}); });
@ -376,7 +376,7 @@ WeaveSvc.prototype = {
/** /**
* Register the built-in engines for certain applications * Register the built-in engines for certain applications
*/ */
_registerEngines: function WeaveSvc__registerEngines() { _registerEngines: function _registerEngines() {
let engines = []; let engines = [];
// Applications can provide this preference (comma-separated list) // Applications can provide this preference (comma-separated list)
// to specify which engines should be registered on startup. // to specify which engines should be registered on startup.
@ -386,7 +386,9 @@ WeaveSvc.prototype = {
} }
// Grab the actual engines and register them // Grab the actual engines and register them
Engines.register(engines.map(function(name) Weave[name + "Engine"])); Engines.register(engines.map(function onItem(name) {
return Weave[name + "Engine"];
}));
}, },
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
@ -394,7 +396,7 @@ WeaveSvc.prototype = {
// nsIObserver // nsIObserver
observe: function WeaveSvc__observe(subject, topic, data) { observe: function observe(subject, topic, data) {
switch (topic) { switch (topic) {
case "weave:service:setup-complete": case "weave:service:setup-complete":
let status = this._checkSetup(); let status = this._checkSetup();
@ -629,7 +631,7 @@ WeaveSvc.prototype = {
}, },
verifyLogin: function verifyLogin() verifyLogin: function verifyLogin()
this._notify("verify-login", "", function() { this._notify("verify-login", "", function onNotify() {
if (!this._identity.username) { if (!this._identity.username) {
this._log.warn("No username in verifyLogin."); this._log.warn("No username in verifyLogin.");
Status.login = LOGIN_FAILED_NO_USERNAME; Status.login = LOGIN_FAILED_NO_USERNAME;
@ -717,8 +719,7 @@ WeaveSvc.prototype = {
} }
})(), })(),
generateNewSymmetricKeys: generateNewSymmetricKeys: function generateNewSymmetricKeys() {
function WeaveSvc_generateNewSymmetricKeys() {
this._log.info("Generating new keys WBO..."); this._log.info("Generating new keys WBO...");
let wbo = CollectionKeys.generateNewKeysWBO(); let wbo = CollectionKeys.generateNewKeysWBO();
this._log.info("Encrypting new key bundle."); this._log.info("Encrypting new key bundle.");
@ -775,8 +776,8 @@ WeaveSvc.prototype = {
} }
}, },
changePassword: function WeaveSvc_changePassword(newpass) changePassword: function changePassword(newpass) {
this._notify("changepwd", "", function() { return this._notify("changepwd", "", function onNotify() {
let url = this.userAPI + this._identity.username + "/password"; let url = this.userAPI + this._identity.username + "/password";
try { try {
let resp = new Resource(url).post(Utils.encodeUTF8(newpass)); let resp = new Resource(url).post(Utils.encodeUTF8(newpass));
@ -795,10 +796,11 @@ WeaveSvc.prototype = {
this._identity.basicPassword = newpass; this._identity.basicPassword = newpass;
this.persistLogin(); this.persistLogin();
return true; return true;
})(), })();
},
changePassphrase: function WeaveSvc_changePassphrase(newphrase) changePassphrase: function changePassphrase(newphrase) {
this._catch(this._notify("changepph", "", function() { return this._catch(this._notify("changepph", "", function onNotify() {
/* Wipe. */ /* Wipe. */
this.wipeServer(); this.wipeServer();
@ -815,7 +817,8 @@ WeaveSvc.prototype = {
/* Login and sync. This also generates new keys. */ /* Login and sync. This also generates new keys. */
this.sync(); this.sync();
return true; return true;
}))(), }))();
},
startOver: function startOver() { startOver: function startOver() {
this._log.trace("Invoking Service.startOver."); this._log.trace("Invoking Service.startOver.");
@ -868,9 +871,8 @@ WeaveSvc.prototype = {
} }
}, },
login: function login(username, password, passphrase) login: function login(username, password, passphrase) {
this._catch(this._lock("service.js: login", function onNotify() {
this._notify("login", "", function() {
this._loggedIn = false; this._loggedIn = false;
if (Services.io.offline) { if (Services.io.offline) {
Status.login = LOGIN_FAILED_NETWORK_ERROR; Status.login = LOGIN_FAILED_NETWORK_ERROR;
@ -910,7 +912,11 @@ WeaveSvc.prototype = {
this._loggedIn = true; this._loggedIn = true;
return true; return true;
})))(), }
let notifier = this._notify("login", "", onNotify.bind(this));
return this._catch(this._lock("service.js: login", notifier))();
},
logout: function logout() { logout: function logout() {
// No need to do anything if we're already logged out. // No need to do anything if we're already logged out.
@ -984,7 +990,7 @@ WeaveSvc.prototype = {
// Stuff we need to do after login, before we can really do // Stuff we need to do after login, before we can really do
// anything (e.g. key setup). // anything (e.g. key setup).
_remoteSetup: function WeaveSvc__remoteSetup(infoResponse) { _remoteSetup: function _remoteSetup(infoResponse) {
let reset = false; let reset = false;
this._log.debug("Fetching global metadata record"); this._log.debug("Fetching global metadata record");
@ -1138,7 +1144,7 @@ WeaveSvc.prototype = {
* *
* @return Reason for not syncing; not-truthy if sync should run * @return Reason for not syncing; not-truthy if sync should run
*/ */
_checkSync: function WeaveSvc__checkSync(ignore) { _checkSync: function _checkSync(ignore) {
let reason = ""; let reason = "";
if (!this.enabled) if (!this.enabled)
reason = kSyncWeaveDisabled; reason = kSyncWeaveDisabled;
@ -1183,7 +1189,7 @@ WeaveSvc.prototype = {
*/ */
_lockedSync: function _lockedSync() _lockedSync: function _lockedSync()
this._lock("service.js: sync", this._lock("service.js: sync",
this._notify("sync", "", function() { this._notify("sync", "", function onNotify() {
this._log.info("In sync()."); this._log.info("In sync().");
@ -1388,7 +1394,7 @@ WeaveSvc.prototype = {
// Returns true if sync should proceed. // Returns true if sync should proceed.
// false / no return value means sync should be aborted. // false / no return value means sync should be aborted.
_syncEngine: function WeaveSvc__syncEngine(engine) { _syncEngine: function _syncEngine(engine) {
try { try {
engine.sync(); engine.sync();
} }
@ -1447,7 +1453,7 @@ WeaveSvc.prototype = {
return true; return true;
}, },
_freshStart: function WeaveSvc__freshStart() { _freshStart: function _freshStart() {
this._log.info("Fresh start. Resetting client and considering key upgrade."); this._log.info("Fresh start. Resetting client and considering key upgrade.");
this.resetClient(); this.resetClient();
CollectionKeys.clear(); CollectionKeys.clear();
@ -1497,7 +1503,7 @@ WeaveSvc.prototype = {
* @return the server's timestamp of the (last) DELETE. * @return the server's timestamp of the (last) DELETE.
*/ */
wipeServer: function wipeServer(collections) wipeServer: function wipeServer(collections)
this._notify("wipe-server", "", function() { this._notify("wipe-server", "", function onNotify() {
let response; let response;
if (!collections) { if (!collections) {
// Strip the trailing slash. // Strip the trailing slash.
@ -1544,8 +1550,8 @@ WeaveSvc.prototype = {
* @param engines [optional] * @param engines [optional]
* Array of engine names to wipe. If not given, all engines are used. * Array of engine names to wipe. If not given, all engines are used.
*/ */
wipeClient: function WeaveSvc_wipeClient(engines) wipeClient: function wipeClient(engines)
this._notify("wipe-client", "", function() { this._notify("wipe-client", "", function onNotify() {
// If we don't have any engines, reset the service and wipe all engines // If we don't have any engines, reset the service and wipe all engines
if (!engines) { if (!engines) {
// Clear out any service data // Clear out any service data
@ -1601,8 +1607,8 @@ WeaveSvc.prototype = {
/** /**
* Reset local service information like logs, sync times, caches. * Reset local service information like logs, sync times, caches.
*/ */
resetService: function WeaveSvc_resetService() resetService: function resetService()
this._catch(this._notify("reset-service", "", function() { this._catch(this._notify("reset-service", "", function onNotify() {
this._log.info("Service reset."); this._log.info("Service reset.");
// Pretend we've never synced to the server and drop cached data // Pretend we've never synced to the server and drop cached data
@ -1616,8 +1622,8 @@ WeaveSvc.prototype = {
* @param engines [optional] * @param engines [optional]
* Array of engine names to reset. If not given, all engines are used. * Array of engine names to reset. If not given, all engines are used.
*/ */
resetClient: function WeaveSvc_resetClient(engines) resetClient: function resetClient(engines)
this._catch(this._notify("reset-client", "", function() { this._catch(this._notify("reset-client", "", function onNotify() {
// If we don't have any engines, reset everything including the service // If we don't have any engines, reset everything including the service
if (!engines) { if (!engines) {
// Clear out any service data // Clear out any service data