Bug 1046026 - Part 3: Remove the redundant function name from the implementation of EventHandler. r=vyang

This commit is contained in:
Bevis Tseng 2014-08-04 14:38:03 +08:00
parent 91499576e8
commit 1314ae65cb

View File

@ -295,10 +295,10 @@ MobileMessageDB.prototype = {
let txn = db.transaction(storeNames, txn_type);
if (DEBUG) debug("Started transaction " + txn + " of type " + txn_type);
if (DEBUG) {
txn.oncomplete = function oncomplete(event) {
txn.oncomplete = function(event) {
debug("Transaction " + txn + " completed.");
};
txn.onerror = function onerror(event) {
txn.onerror = function(event) {
// TODO check event.target.error.name and show an appropiate error
// message according to it.
debug("Error occurred during transaction: " + event.target.error.name);
@ -353,7 +353,7 @@ MobileMessageDB.prototype = {
// In order to get the highest key value, we open a key cursor in reverse
// order and get only the first pointed value.
let request = messageStore.openCursor(null, PREV);
request.onsuccess = function onsuccess(event) {
request.onsuccess = function(event) {
let cursor = event.target.result;
if (!cursor) {
if (DEBUG) {
@ -365,7 +365,7 @@ MobileMessageDB.prototype = {
self.lastMessageId = cursor.key || 0;
if (DEBUG) debug("Last assigned message ID was " + self.lastMessageId);
};
request.onerror = function onerror(event) {
request.onerror = function(event) {
if (DEBUG) {
debug("Could not get the last key from mobile message database " +
event.target.error.name);
@ -831,7 +831,7 @@ MobileMessageDB.prototype = {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
let request = messageStore.mozGetAll(lastMessageId);
request.onsuccess = function onsuccess() {
request.onsuccess = function() {
let messageRecord = request.result[0];
if (!messageRecord) {
if (DEBUG) debug("Message ID " + lastMessageId + " not found");
@ -849,7 +849,7 @@ MobileMessageDB.prototype = {
cursor.continue();
};
request.onerror = function onerror(event) {
request.onerror = function(event) {
if (DEBUG) {
if (event.target) {
debug("Caught error on transaction", event.target.error.name);
@ -2088,14 +2088,14 @@ MobileMessageDB.prototype = {
let deletedInfo = { messageIds: [], threadIds: [] };
txn.oncomplete = function oncomplete(event) {
txn.oncomplete = function(event) {
if (aMessageRecord.id > self.lastMessageId) {
self.lastMessageId = aMessageRecord.id;
}
notifyResult(Cr.NS_OK, aMessageRecord);
self.notifyDeletedInfo(deletedInfo);
};
txn.onabort = function onabort(event) {
txn.onabort = function(event) {
if (DEBUG) debug("transaction abort due to " + event.target.error.name);
let error = (event.target.error.name === 'QuotaExceededError')
? Cr.NS_ERROR_FILE_NO_DEVICE_SPACE
@ -2156,7 +2156,7 @@ MobileMessageDB.prototype = {
let participantId = participantRecord.id;
let range = IDBKeyRange.bound([participantId, 0], [participantId, ""]);
let request = aMessageStore.index("participantIds").openCursor(range);
request.onsuccess = function onsuccess(event) {
request.onsuccess = function(event) {
let cursor = event.target.result;
if (!cursor) {
self.realSaveRecord(aTransaction, aMessageStore, aParticipantStore,
@ -2355,7 +2355,7 @@ MobileMessageDB.prototype = {
getRequest = aMessageStore.index("envelopeId").get(id);
}
getRequest.onsuccess = function onsuccess(event) {
getRequest.onsuccess = function(event) {
let messageRecord = event.target.result;
if (!messageRecord) {
if (DEBUG) debug("type = " + id + " is not found");
@ -2726,7 +2726,7 @@ MobileMessageDB.prototype = {
let self = this;
this.newTxnWithCallback(aCallback, function(aCapture, aMessageStore) {
let getRequest = aMessageStore.index("envelopeId").get(aEnvelopeId);
getRequest.onsuccess = function onsuccess(event) {
getRequest.onsuccess = function(event) {
let messageRecord = event.target.result;
if (!messageRecord) {
if (DEBUG) debug("envelopeId '" + aEnvelopeId + "' not found");
@ -2777,7 +2777,7 @@ MobileMessageDB.prototype = {
}
let request = messageStore.index("transactionId").get(aTransactionId);
txn.oncomplete = function oncomplete(event) {
txn.oncomplete = function(event) {
if (DEBUG) debug("Transaction " + txn + " completed.");
let messageRecord = request.result;
if (!messageRecord) {
@ -2790,7 +2790,7 @@ MobileMessageDB.prototype = {
aCallback.notify(Cr.NS_OK, messageRecord, null);
};
txn.onerror = function onerror(event) {
txn.onerror = function(event) {
if (DEBUG) {
if (event.target) {
debug("Caught error on transaction", event.target.error.name);
@ -2812,7 +2812,7 @@ MobileMessageDB.prototype = {
}
let request = messageStore.mozGetAll(aMessageId);
txn.oncomplete = function oncomplete() {
txn.oncomplete = function() {
if (DEBUG) debug("Transaction " + txn + " completed.");
if (request.result.length > 1) {
if (DEBUG) debug("Got too many results for id " + aMessageId);
@ -2837,7 +2837,7 @@ MobileMessageDB.prototype = {
aCallback.notify(Cr.NS_OK, messageRecord, domMessage);
};
txn.onerror = function onerror(event) {
txn.onerror = function(event) {
if (DEBUG) {
if (event.target) {
debug("Caught error on transaction", event.target.error.name);
@ -2872,7 +2872,7 @@ MobileMessageDB.prototype = {
return;
}
txn.oncomplete = function oncomplete(event) {
txn.oncomplete = function(event) {
if (DEBUG) debug("Transaction " + txn + " completed.");
if (completeMessage) {
// Rebuild full body
@ -2904,7 +2904,7 @@ MobileMessageDB.prototype = {
aCallback.notify(Cr.NS_OK, completeMessage);
};
txn.onabort = function onabort(event) {
txn.onabort = function(event) {
if (DEBUG) debug("transaction abort due to " + event.target.error.name);
let error = (event.target.error.name === 'QuotaExceededError')
? Cr.NS_ERROR_FILE_NO_DEVICE_SPACE
@ -3022,7 +3022,7 @@ MobileMessageDB.prototype = {
let deletedInfo = { messageIds: [], threadIds: [] };
txn.onabort = function onabort(event) {
txn.onabort = function(event) {
if (DEBUG) debug("transaction abort due to " + event.target.error.name);
let error = (event.target.error.name === 'QuotaExceededError')
? Ci.nsIMobileMessageCallback.STORAGE_FULL_ERROR
@ -3033,7 +3033,7 @@ MobileMessageDB.prototype = {
const messageStore = stores[0];
const threadStore = stores[1];
txn.oncomplete = function oncomplete(event) {
txn.oncomplete = function(event) {
if (DEBUG) debug("Transaction " + txn + " completed.");
aRequest.notifyMessageDeleted(deleted, length);
self.notifyDeletedInfo(deletedInfo);
@ -3118,7 +3118,7 @@ MobileMessageDB.prototype = {
let messageStore = stores[0];
let threadStore = stores[1];
messageStore.get(messageId).onsuccess = function onsuccess(event) {
messageStore.get(messageId).onsuccess = function(event) {
let messageRecord = event.target.result;
if (!messageRecord) {
if (DEBUG) debug("Message ID " + messageId + " not found");
@ -3160,7 +3160,7 @@ MobileMessageDB.prototype = {
}
if (DEBUG) debug("Message.read set to: " + value);
messageStore.put(messageRecord).onsuccess = function onsuccess(event) {
messageStore.put(messageRecord).onsuccess = function(event) {
if (DEBUG) {
debug("Update successfully completed. Message: " +
JSON.stringify(event.target.result));
@ -3203,7 +3203,7 @@ MobileMessageDB.prototype = {
collector.collect(null, COLLECT_ID_ERROR, COLLECT_TIMESTAMP_UNUSED);
return;
}
txn.onerror = function onerror(event) {
txn.onerror = function(event) {
if (DEBUG) debug("Caught error on transaction ", event.target.error.name);
collector.collect(null, COLLECT_ID_ERROR, COLLECT_TIMESTAMP_UNUSED);
};
@ -3242,7 +3242,7 @@ let FilterSearcherHelper = {
filterIndex: function(index, range, direction, txn, collect) {
let messageStore = txn.objectStore(MESSAGE_STORE_NAME);
let request = messageStore.index(index).openKeyCursor(range, direction);
request.onsuccess = function onsuccess(event) {
request.onsuccess = function(event) {
let cursor = event.target.result;
// Once the cursor has retrieved all keys that matches its key range,
// the filter search is done.
@ -3255,7 +3255,7 @@ let FilterSearcherHelper = {
collect(txn, COLLECT_ID_END, COLLECT_TIMESTAMP_UNUSED);
}
};
request.onerror = function onerror(event) {
request.onerror = function(event) {
if (DEBUG && event) debug("IDBRequest error " + event.target.error.name);
collect(txn, COLLECT_ID_ERROR, COLLECT_TIMESTAMP_UNUSED);
};
@ -3747,7 +3747,7 @@ GetMessagesCursor.prototype = {
let getRequest = messageStore.get(messageId);
let self = this;
getRequest.onsuccess = function onsuccess(event) {
getRequest.onsuccess = function(event) {
if (DEBUG) {
debug("notifyNextMessageInListGot - messageId: " + messageId);
}
@ -3755,7 +3755,7 @@ GetMessagesCursor.prototype = {
self.mmdb.createDomMessageFromRecord(event.target.result);
self.callback.notifyCursorResult(domMessage);
};
getRequest.onerror = function onerror(event) {
getRequest.onerror = function(event) {
if (DEBUG) {
debug("notifyCursorError - messageId: " + messageId);
}
@ -3821,7 +3821,7 @@ GetThreadsCursor.prototype = {
let getRequest = threadStore.get(threadId);
let self = this;
getRequest.onsuccess = function onsuccess(event) {
getRequest.onsuccess = function(event) {
let threadRecord = event.target.result;
if (DEBUG) {
debug("notifyCursorResult: " + JSON.stringify(threadRecord));
@ -3836,7 +3836,7 @@ GetThreadsCursor.prototype = {
threadRecord.lastMessageType);
self.callback.notifyCursorResult(thread);
};
getRequest.onerror = function onerror(event) {
getRequest.onerror = function(event) {
if (DEBUG) {
debug("notifyCursorError - threadId: " + threadId);
}