зеркало из https://github.com/mozilla/gecko-dev.git
Prevent multiple lock requests from being executed (bug 441922, r=thunder)
This commit is contained in:
Родитель
19b2afb2b9
Коммит
b580a586dc
|
@ -192,6 +192,8 @@ Generator.prototype = {
|
|||
|
||||
this._exception = e;
|
||||
|
||||
} else if (e.message && e.message == 'Cannot acquire lock (internal lock)') {
|
||||
this._log.warn("Exception: " + Utils.exceptionStr(e));
|
||||
} else {
|
||||
this._log.error("Exception: " + Utils.exceptionStr(e));
|
||||
this._log.debug("Stack trace:\n" + Utils.stackTrace(e));
|
||||
|
|
|
@ -252,9 +252,6 @@ DAVCollection.prototype = {
|
|||
},
|
||||
|
||||
LOCK: function DC_LOCK(path, data, onComplete) {
|
||||
if (!this._lockAllowed)
|
||||
throw "Cannot acquire lock (internal lock)";
|
||||
|
||||
let headers = {'Content-type': 'text/xml; charset="utf-8"',
|
||||
'Depth': 'infinity',
|
||||
'Timeout': 'Second-600'};
|
||||
|
@ -364,6 +361,9 @@ DAVCollection.prototype = {
|
|||
let self = yield;
|
||||
|
||||
this._log.trace("Acquiring lock");
|
||||
if (!this._lockAllowed)
|
||||
throw {message: "Cannot acquire lock (internal lock)"};
|
||||
this._lockAllowed = false;
|
||||
|
||||
if (DAVLocks['default']) {
|
||||
this._log.debug("Lock called, but we already hold a token");
|
||||
|
@ -379,8 +379,10 @@ DAVCollection.prototype = {
|
|||
"</D:lockinfo>", self.cb);
|
||||
let resp = yield;
|
||||
|
||||
if (resp.status < 200 || resp.status >= 300)
|
||||
if (resp.status < 200 || resp.status >= 300) {
|
||||
this._lockAllowed = true;
|
||||
return;
|
||||
}
|
||||
|
||||
let tokens = Utils.xpath(resp.responseXML, '//D:locktoken/D:href');
|
||||
let token = tokens.iterateNext();
|
||||
|
@ -393,11 +395,14 @@ DAVCollection.prototype = {
|
|||
|
||||
if (!DAVLocks['default']) {
|
||||
this._log.warn("Could not acquire lock");
|
||||
this._lockAllowed = true;
|
||||
self.done();
|
||||
return;
|
||||
}
|
||||
|
||||
this._log.trace("Lock acquired");
|
||||
this._lockAllowed = true;
|
||||
|
||||
self.done(DAVLocks['default']);
|
||||
},
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ let Utils = {
|
|||
},
|
||||
|
||||
exceptionStr: function Weave_exceptionStr(e) {
|
||||
let message = e.message? e.message : e;
|
||||
let message = e.message ? e.message : e;
|
||||
let location = "";
|
||||
|
||||
if (e.location)
|
||||
|
|
Загрузка…
Ссылка в новой задаче