Bug 735357: Fix Contacts API to use new IndexedDB constants. r=gwagner
authorJonas Sicking <jonas@sicking.cc>
Tue, 13 Mar 2012 13:25:05 -0700
changeset 92287 342d9abc7213f2a755b69d53175f2807384f1d49
parent 92286 9b09f6e06408162bc2be6aa958c7019178f4c0f6
child 92288 0511f0c490160cdbfcf0ddf71d58d3272bb32d57
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgwagner
bugs735357
milestone13.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 735357: Fix Contacts API to use new IndexedDB constants. r=gwagner
dom/contacts/fallback/ContactDB.jsm
dom/indexedDB/IDBCursor.cpp
dom/indexedDB/IDBTransaction.cpp
--- a/dom/contacts/fallback/ContactDB.jsm
+++ b/dom/contacts/fallback/ContactDB.jsm
@@ -118,17 +118,17 @@ ContactDB.prototype = {
 
     debug("Created object stores and indexes");
   },
 
   /**
    * Start a new transaction.
    * 
    * @param txn_type
-   *        Type of transaction (e.g. IDBTransaction.READ_WRITE)
+   *        Type of transaction (e.g. "readwrite")
    * @param callback
    *        Function to call when the transaction is available. It will
    *        be invoked with the transaction and the 'contacts' object store.
    * @param successCb [optional]
    *        Success callback to call on a successful transaction commit.
    * @param failureCb [optional]
    *        Error callback to call when an error is encountered.
    */
@@ -229,17 +229,17 @@ ContactDB.prototype = {
     if (!record.published) {
       record.published = new Date();
     }
     record.updated = new Date();
   },
 
   saveContact: function saveContact(aContact, successCb, errorCb) {
     let contact = this.makeImport(aContact);
-    this.newTxn(Ci.nsIIDBTransaction.READ_WRITE, function (txn, store) {
+    this.newTxn("readwrite", function (txn, store) {
       debug("Going to update" + JSON.stringify(contact));
 
       // Look up the existing record and compare the update timestamp.
       // If no record exists, just add the new entry.
       let newRequest = store.get(contact.id);
       newRequest.onsuccess = function (event) {
         if (!event.target.result) {
           debug("new record!")
@@ -258,24 +258,24 @@ ContactDB.prototype = {
             store.put(contact);
           }
         }
       }.bind(this);
     }.bind(this), successCb, errorCb);
   },
 
   removeContact: function removeContact(aId, aSuccessCb, aErrorCb) {
-    this.newTxn(Ci.nsIIDBTransaction.READ_WRITE, function (txn, store) {
+    this.newTxn("readwrite", function (txn, store) {
       debug("Going to delete" + aId);
       store.delete(aId);
     }, aSuccessCb, aErrorCb);
   },
 
   clear: function clear(aSuccessCb, aErrorCb) {
-    this.newTxn(Ci.nsIIDBTransaction.READ_WRITE, function (txn, store) {
+    this.newTxn("readwrite", function (txn, store) {
       debug("Going to clear all!");
       store.clear();
     }, aSuccessCb, aErrorCb);
   },
 
   /**
    * @param successCb
    *        Callback function to invoke with result array.
@@ -292,17 +292,17 @@ ContactDB.prototype = {
    *        - sortBy
    *        - sortOrder
    *        - startIndex
    */
   find: function find(aSuccessCb, aFailureCb, aOptions) {
     debug("ContactDB:find val:" + aOptions.filterValue + " by: " + aOptions.filterBy + " op: " + aOptions.filterOp + "\n");
 
     let self = this;
-    this.newTxn(Ci.nsIIDBTransaction.READ_ONLY, function (txn, store) {
+    this.newTxn("readonly", function (txn, store) {
       if (aOptions && aOptions.filterOp == "equals") {
         self._findWithIndex(txn, store, aOptions);
       } else if (aOptions && aOptions.filterBy) {
         self._findWithSearch(txn, store, aOptions);
       } else {
         self._findAll(txn, store, aOptions);
       }
     }, aSuccessCb, aFailureCb);
--- a/dom/indexedDB/IDBCursor.cpp
+++ b/dom/indexedDB/IDBCursor.cpp
@@ -458,17 +458,17 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(IDBCurs
 DOMCI_DATA(IDBCursor, IDBCursor)
 DOMCI_DATA(IDBCursorWithValue, IDBCursor)
 
 NS_IMETHODIMP
 IDBCursor::GetDirection(nsAString& aDirection)
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 
-  switch(mDirection) {
+  switch (mDirection) {
     case NEXT:
       aDirection.AssignLiteral("next");
       break;
     case NEXT_UNIQUE:
       aDirection.AssignLiteral("nextunique");
       break;
     case PREV:
       aDirection.AssignLiteral("prev");
--- a/dom/indexedDB/IDBTransaction.cpp
+++ b/dom/indexedDB/IDBTransaction.cpp
@@ -527,17 +527,17 @@ IDBTransaction::GetDb(nsIIDBDatabase** a
   return NS_OK;
 }
 
 NS_IMETHODIMP
 IDBTransaction::GetMode(nsAString& aMode)
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 
-  switch(mMode) {
+  switch (mMode) {
     case READ_ONLY:
       aMode.AssignLiteral("readonly");
       break;
     case READ_WRITE:
       aMode.AssignLiteral("readwrite");
       break;
     case VERSION_CHANGE:
       aMode.AssignLiteral("versionchange");