Bug 694744 - Typo in JS Sync server. r=philikon

This commit is contained in:
Richard Newman 2011-10-15 15:29:11 -07:00
Родитель 554940d7ba
Коммит cc807466f0
2 изменённых файлов: 34 добавлений и 1 удалений

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

@ -906,9 +906,9 @@ SyncServer.prototype = {
let wbo = coll.wbo(wboID);
if (wbo) {
wbo.delete();
this.callback.onItemDeleted(username, collection, wboID);
}
respond(200, "OK", "{}");
this.callback.onItemDeleted(username, collectin, wboID);
return;
}
coll.collectionHandler(req, resp);

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

@ -180,6 +180,37 @@ add_test(function test_storage_request() {
Utils.nextTick(next);
});
}
function deleteWBONotExists(next) {
let req = localRequest(keysURL);
server.callback.onItemDeleted = function (username, collection, wboID) {
do_throw("onItemDeleted should not have been called.");
};
req.delete(function (err) {
_("Body is " + this.response.body);
_("Modified is " + this.response.newModified);
do_check_eq(this.response.status, 200);
delete server.callback.onItemDeleted;
Utils.nextTick(next);
});
}
function deleteWBOExists(next) {
let req = localRequest(foosURL);
server.callback.onItemDeleted = function (username, collection, wboID) {
_("onItemDeleted called for " + collection + "/" + wboID);
delete server.callback.onItemDeleted;
do_check_eq(username, "john");
do_check_eq(collection, "crypto");
do_check_eq(wboID, "foos");
Utils.nextTick(next);
};
req.delete(function (err) {
_("Body is " + this.response.body);
_("Modified is " + this.response.newModified);
do_check_eq(this.response.status, 200);
});
}
function deleteStorage(next) {
_("Testing DELETE on /storage.");
let now = server.timestamp();
@ -216,6 +247,8 @@ add_test(function test_storage_request() {
Async.chain(
retrieveWBONotExists,
retrieveWBOExists,
deleteWBOExists,
deleteWBONotExists,
getStorageFails,
getMissingCollectionWBO,
deleteStorage,