Bug 963475 - Reverse the order of retrieval of message threads. r=gene
authorGabriele Svelto <gsvelto@mozilla.com>
Mon, 27 Jan 2014 19:52:11 +0100
changeset 181549 9441f9619749594ca288bc60f12f4664b0e33706
parent 181548 d8d208d749bd2a04106ddd8398ad6760e2c14116
child 181550 bcb7b4eed467ed05fdf8a1ba22ed31be2f0b7eb0
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgene
bugs963475
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 963475 - Reverse the order of retrieval of message threads. r=gene
dom/mobilemessage/src/gonk/MobileMessageDB.jsm
dom/mobilemessage/tests/marionette/test_getthreads.js
--- a/dom/mobilemessage/src/gonk/MobileMessageDB.jsm
+++ b/dom/mobilemessage/src/gonk/MobileMessageDB.jsm
@@ -2600,17 +2600,17 @@ MobileMessageDB.prototype = {
         if (DEBUG) debug(error);
         collector.collect(null, COLLECT_ID_ERROR, COLLECT_TIMESTAMP_UNUSED);
         return;
       }
       txn.onerror = function onerror(event) {
         if (DEBUG) debug("Caught error on transaction ", event.target.errorCode);
         collector.collect(null, COLLECT_ID_ERROR, COLLECT_TIMESTAMP_UNUSED);
       };
-      let request = threadStore.index("lastTimestamp").openKeyCursor();
+      let request = threadStore.index("lastTimestamp").openKeyCursor(null, PREV);
       request.onsuccess = function(event) {
         let cursor = event.target.result;
         if (cursor) {
           if (collector.collect(txn, cursor.primaryKey, cursor.key)) {
             cursor.continue();
           }
         } else {
           collector.collect(txn, COLLECT_ID_END, COLLECT_TIMESTAMP_UNUSED);
--- a/dom/mobilemessage/tests/marionette/test_getthreads.js
+++ b/dom/mobilemessage/tests/marionette/test_getthreads.js
@@ -371,16 +371,19 @@ tasks.push(sendMessage.bind(null, "55521
 tasks.push(sendMessage.bind(null, "+5511555211018", "thread 18-2"));
 checkFuncs.push(checkThread.bind(null, ["thread 18-1", "thread 18-2"],
                                  "thread 18-2", 0, ["555211018"]));
 
 // Check threads.
 tasks.push(getAllThreads.bind(null, function(threads) {
   is(threads.length, checkFuncs.length, "number of threads got");
 
+  // Reverse threads as we iterate over them in reverse order
+  threads.reverse();
+
   (function callback() {
     if (!threads.length) {
       tasks.next();
       return;
     }
 
     checkFuncs.shift()(threads.shift(), callback);
   })();