Bug 1046026 - Part 1: Deprecate the Optional Property |isDiskFull| in MobileMessageDB. r=vyang
authorBevis Tseng <btseng@mozilla.com>
Mon, 04 Aug 2014 14:22:33 +0800
changeset 198281 3deaa74ba2aba2c47d73de76edf26ddf0a1c4025
parent 198280 6985f4896a10463d4c9d1df367fc592048e934c2
child 198282 b21936aad355f2dd1bad28d9df1478d1845ea51b
push id9522
push userryanvm@gmail.com
push dateThu, 07 Aug 2014 12:43:25 +0000
treeherderb2g-inbound@83bc4242fd1c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvyang
bugs1046026
milestone34.0a1
Bug 1046026 - Part 1: Deprecate the Optional Property |isDiskFull| in MobileMessageDB. r=vyang
dom/mobilemessage/src/gonk/MobileMessageDB.jsm
dom/mobilemessage/src/gonk/MobileMessageDatabaseService.js
--- a/dom/mobilemessage/src/gonk/MobileMessageDB.jsm
+++ b/dom/mobilemessage/src/gonk/MobileMessageDB.jsm
@@ -93,23 +93,16 @@ MobileMessageDB.prototype = {
   db: null,
 
   /**
    * Last sms/mms object store key value in the database.
    */
   lastMessageId: 0,
 
   /**
-   * An optional hook to check if device storage is full.
-   *
-   * @return true if full.
-   */
-  isDiskFull: null,
-
-  /**
    * Prepare the database. This may include opening the database and upgrading
    * it to the latest schema version.
    *
    * @param callback
    *        Function that takes an error and db argument. It is called when
    *        the database is ready to use or if an error occurs while preparing
    *        the database.
    *
@@ -289,21 +282,16 @@ MobileMessageDB.prototype = {
    */
   newTxn: function(txn_type, callback, storeNames) {
     if (!storeNames) {
       storeNames = [MESSAGE_STORE_NAME];
     }
     if (DEBUG) debug("Opening transaction for object stores: " + storeNames);
     let self = this;
     this.ensureDB(function(error, db) {
-      if (!error &&
-          txn_type === READ_WRITE &&
-          self.isDiskFull && self.isDiskFull()) {
-        error = Cr.NS_ERROR_FILE_NO_DEVICE_SPACE;
-      }
       if (error) {
         if (DEBUG) debug("Could not open database: " + error);
         callback(error);
         return;
       }
       let txn = db.transaction(storeNames, txn_type);
       if (DEBUG) debug("Started transaction " + txn + " of type " + txn_type);
       if (DEBUG) {
--- a/dom/mobilemessage/src/gonk/MobileMessageDatabaseService.js
+++ b/dom/mobilemessage/src/gonk/MobileMessageDatabaseService.js
@@ -12,35 +12,28 @@ Cu.import("resource://gre/modules/Servic
 let MMDB = {};
 Cu.import("resource://gre/modules/MobileMessageDB.jsm", MMDB);
 
 const RIL_MOBILEMESSAGEDATABASESERVICE_CONTRACTID =
   "@mozilla.org/mobilemessage/rilmobilemessagedatabaseservice;1";
 const RIL_MOBILEMESSAGEDATABASESERVICE_CID =
   Components.ID("{29785f90-6b5b-11e2-9201-3b280170b2ec}");
 
-XPCOMUtils.defineLazyServiceGetter(this, "gDiskSpaceWatcher",
-                                   "@mozilla.org/toolkit/disk-space-watcher;1",
-                                   "nsIDiskSpaceWatcher");
-
 const DB_NAME = "sms";
 
 /**
  * MobileMessageDatabaseService
  */
 function MobileMessageDatabaseService() {
   // Prime the directory service's cache to ensure that the ProfD entry exists
   // by the time IndexedDB queries for it off the main thread. (See bug 743635.)
   Services.dirsvc.get("ProfD", Ci.nsIFile);
 
   let mmdb = new MMDB.MobileMessageDB();
   mmdb.init(DB_NAME, 0, mmdb.updatePendingTransactionToError.bind(mmdb));
-  mmdb.isDiskFull = function() {
-    return gDiskSpaceWatcher.isDiskFull;
-  };
   this.mmdb = mmdb;
 }
 MobileMessageDatabaseService.prototype = {
 
   classID: RIL_MOBILEMESSAGEDATABASESERVICE_CID,
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIRilMobileMessageDatabaseService,
                                          Ci.nsIMobileMessageDatabaseService,
                                          Ci.nsIObserver]),