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

This commit is contained in:
Richard Newman 2011-10-15 15:29:11 -07:00
parent 31440a22b7
commit 31b5110792
2 changed files with 34 additions and 1 deletions

View File

@ -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);

View File

@ -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,