зеркало из https://github.com/mozilla/gecko-dev.git
Resolve lastChannel removal and 0.5 api changes. r=thunder
This commit is contained in:
Родитель
9be9fdd6c3
Коммит
7c9ca97a64
|
@ -468,24 +468,15 @@ SyncEngine.prototype = {
|
|||
// Upload what we've got so far in the collection
|
||||
let doUpload = Utils.bind2(this, function(desc) {
|
||||
this._log.info("Uploading " + desc + " of " + outnum + " records");
|
||||
<<<<<<< local
|
||||
up.post();
|
||||
=======
|
||||
let resp = up.post();
|
||||
if (!resp.success)
|
||||
throw resp;
|
||||
>>>>>>> other
|
||||
|
||||
<<<<<<< local
|
||||
// Record the modified time of the upload
|
||||
let modified = up._lastChannel.getResponseHeader("X-Weave-Timestamp");
|
||||
let modified = resp.headers["X-Weave-Timestamp"];
|
||||
if (modified > this.lastSync)
|
||||
this.lastSync = modified;
|
||||
|
||||
=======
|
||||
if (up.data.modified > this.lastSync)
|
||||
this.lastSync = up.data.modified;
|
||||
>>>>>>> other
|
||||
up.clearRecords();
|
||||
});
|
||||
|
||||
|
|
|
@ -459,30 +459,14 @@ WeaveSvc.prototype = {
|
|||
|
||||
let res = new Resource(this.baseURL + "1/" + username + "/node/weave");
|
||||
try {
|
||||
<<<<<<< local
|
||||
res.get();
|
||||
} catch(ex) {}
|
||||
|
||||
try {
|
||||
switch (res.lastChannel.responseStatus) {
|
||||
=======
|
||||
let node = res.get();
|
||||
switch (node.status) {
|
||||
>>>>>>> other
|
||||
case 404:
|
||||
this._log.debug("Using serverURL as data cluster (multi-cluster support disabled)");
|
||||
<<<<<<< local
|
||||
return this.baseURL;
|
||||
=======
|
||||
return Svc.Prefs.get("serverURL");
|
||||
case 0:
|
||||
>>>>>>> other
|
||||
case 200:
|
||||
<<<<<<< local
|
||||
return res.data;
|
||||
=======
|
||||
return "https://" + node + "/";
|
||||
>>>>>>> other
|
||||
return node;
|
||||
default:
|
||||
this._log.debug("Unexpected response code: " + node.status);
|
||||
break;
|
||||
|
@ -616,13 +600,8 @@ WeaveSvc.prototype = {
|
|||
let res = new Weave.Resource(url);
|
||||
res.authenticator = new Weave.NoOpAuthenticator();
|
||||
|
||||
<<<<<<< local
|
||||
let resp = res.post(newpass);
|
||||
if (res.lastChannel.responseStatus != 200) {
|
||||
=======
|
||||
let resp = res.post(message);
|
||||
if (resp.status != 200) {
|
||||
>>>>>>> other
|
||||
this._log.info("Password change failed: " + resp);
|
||||
throw "Could not change password";
|
||||
}
|
||||
|
@ -813,23 +792,12 @@ WeaveSvc.prototype = {
|
|||
|
||||
let error = "generic-server-error";
|
||||
try {
|
||||
<<<<<<< local
|
||||
ret.response = res.put(payload);
|
||||
ret.status = res.lastChannel.responseStatus;
|
||||
=======
|
||||
let register = res.post(message);
|
||||
let register = res.put(payload);
|
||||
if (register.success) {
|
||||
this._log.info("Account created: " + register);
|
||||
return;
|
||||
}
|
||||
>>>>>>> other
|
||||
|
||||
<<<<<<< local
|
||||
// No exceptions must have meant it was successful
|
||||
this._log.info("Account created: " + ret.response);
|
||||
return ret;
|
||||
} catch(ex) {
|
||||
=======
|
||||
// Must have failed, so figure out the reason
|
||||
switch (register.status) {
|
||||
case 400:
|
||||
|
@ -841,7 +809,6 @@ WeaveSvc.prototype = {
|
|||
}
|
||||
}
|
||||
catch(ex) {
|
||||
>>>>>>> other
|
||||
this._log.warn("Failed to create account: " + ex);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче