Bug 1197008 - Stop assuming 0 is an invalid threadId. r=btseng r=hsinyi

This commit is contained in:
Reuben Morais 2015-09-02 09:37:17 -03:00
Родитель 98d994acf1
Коммит e0885aabed
10 изменённых файлов: 20 добавлений и 10 удалений

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

@ -463,8 +463,9 @@ MobileMessageManager::GetMessages(const MobileMessageFilter& aFilter,
read = aFilter.mRead.Value();
}
bool hasThreadId = !aFilter.mThreadId.IsNull();
uint64_t threadId = 0;
if (!aFilter.mThreadId.IsNull()) {
if (hasThreadId) {
threadId = aFilter.mThreadId.Value();
}
@ -476,7 +477,7 @@ MobileMessageManager::GetMessages(const MobileMessageFilter& aFilter,
ptrNumbers, numbersCount,
delivery,
hasRead, read,
threadId,
hasThreadId, threadId,
aReverse, cursorCallback,
getter_AddRefs(continueCallback));
if (NS_FAILED(rv)) {

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

@ -56,6 +56,7 @@ MobileMessageDatabaseService::CreateMessageCursor(bool aHasStartDate,
const nsAString& aDelivery,
bool aHasRead,
bool aRead,
bool aHasThreadId,
uint64_t aThreadId,
bool aReverse,
nsIMobileMessageCursorCallback* aCallback,

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

@ -4045,7 +4045,8 @@ MobileMessageDB.prototype = {
*/
createMessageCursor: function(aHasStartDate, aStartDate, aHasEndDate,
aEndDate, aNumbers, aNumbersCount, aDelivery,
aHasRead, aRead, aThreadId, aReverse, aCallback) {
aHasRead, aRead, aHasThreadId, aThreadId,
aReverse, aCallback) {
if (DEBUG) {
debug("Creating a message cursor. Filters:" +
" startDate: " + (aHasStartDate ? aStartDate : "(null)") +
@ -4053,7 +4054,7 @@ MobileMessageDB.prototype = {
" delivery: " + aDelivery +
" numbers: " + (aNumbersCount ? aNumbers : "(null)") +
" read: " + (aHasRead ? aRead : "(null)") +
" threadId: " + aThreadId +
" threadId: " + (aHasThreadId ? aThreadId : "(null)") +
" reverse: " + aReverse);
}
@ -4073,7 +4074,7 @@ MobileMessageDB.prototype = {
if (aHasRead) {
filter.read = aRead;
}
if (aThreadId) {
if (aHasThreadId) {
filter.threadId = aThreadId;
}

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

@ -110,11 +110,12 @@ MobileMessageDatabaseService.prototype = {
createMessageCursor: function(aHasStartDate, aStartDate, aHasEndDate,
aEndDate, aNumbers, aNumbersCount, aDelivery,
aHasRead, aRead, aThreadId, aReverse, aCallback) {
aHasRead, aRead, aHasThreadId, aThreadId,
aReverse, aCallback) {
return this.mmdb.createMessageCursor(aHasStartDate, aStartDate, aHasEndDate,
aEndDate, aNumbers, aNumbersCount,
aDelivery, aHasRead, aRead, aThreadId,
aReverse, aCallback);
aDelivery, aHasRead, aRead, aHasThreadId,
aThreadId, aReverse, aCallback);
},
markMessageRead: function(aMessageId, aValue, aSendReadReport, aRequest) {

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

@ -15,7 +15,7 @@ interface nsICursorContinueCallback;
interface nsIMobileMessageCallback;
interface nsIMobileMessageCursorCallback;
[scriptable, uuid(ead626bc-f5b4-47e1-921c-0b956c9298e0)]
[scriptable, uuid(18672be2-c185-4f9c-8af6-2e6ea004de73)]
interface nsIMobileMessageDatabaseService : nsISupports
{
[binaryname(GetMessageMoz)]
@ -35,6 +35,7 @@ interface nsIMobileMessageDatabaseService : nsISupports
[Null(Null), Undefined(Null)] in DOMString delivery,
in boolean hasRead,
in boolean read,
in boolean hasThreadId,
in unsigned long long threadId,
in boolean reverse,
in nsIMobileMessageCursorCallback callback);

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

@ -260,6 +260,7 @@ SmsIPCService::CreateMessageCursor(bool aHasStartDate,
const nsAString& aDelivery,
bool aHasRead,
bool aRead,
bool aHasThreadId,
uint64_t aThreadId,
bool aReverse,
nsIMobileMessageCursorCallback* aCursorCallback,
@ -284,6 +285,7 @@ SmsIPCService::CreateMessageCursor(bool aHasStartDate,
data.delivery() = aDelivery;
data.hasRead() = aHasRead;
data.read() = aRead;
data.hasThreadId() = aHasThreadId;
data.threadId() = aThreadId;
return SendCursorRequest(CreateMessageCursorRequest(data, aReverse),

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

@ -847,6 +847,7 @@ MobileMessageCursorParent::DoRequest(const CreateMessageCursorRequest& aRequest)
filter.delivery(),
filter.hasRead(),
filter.read(),
filter.hasThreadId(),
filter.threadId(),
aRequest.reverse(),
this,

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

@ -85,6 +85,7 @@ struct SmsFilterData
nsString delivery;
bool hasRead;
bool read;
bool hasThreadId;
uint64_t threadId;
};

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

@ -341,6 +341,7 @@ function createMessageCursor(aMmdb, aStartDate = null, aEndDate = null,
aDelivery || null,
aRead !== null,
aRead || false,
aThreadId !== null,
aThreadId || 0,
aReverse || false);
}

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

@ -72,7 +72,7 @@ dictionary MobileMessageFilter
boolean? read = null;
// Filtering by a message's threadId attribute.
[EnforceRange] unsigned long long? threadId = 0;
[EnforceRange] unsigned long long? threadId = null;
};
/**