merge fx-team to mozilla-central
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Tue, 22 Apr 2014 12:27:12 +0200
changeset 197987 4aa53ede977df6409a9829b57d531772d4bde5b4
parent 197985 312fe098b44c8d43bb448c1c78d233d023d8f647 (current diff)
parent 197986 d6cf23c13dde5fe7c605035b16a97345a0e1ea97 (diff)
child 197996 1d0496e30feba58f93036ca8f02b4e681f0681f4
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone31.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
merge fx-team to mozilla-central
--- a/mobile/android/modules/HomeProvider.jsm
+++ b/mobile/android/modules/HomeProvider.jsm
@@ -84,20 +84,16 @@ function getLastSyncPrefName(datasetId) 
 }
 
 // Whether or not we've registered an update timer.
 var gTimerRegistered = false;
 
 // Map of datasetId -> { interval: <integer>, callback: <function> }
 var gSyncCallbacks = {};
 
-// Whether or not writes to the provider are expected.
-// e.g. save() and deleteAll()
-var gWritesAreExpected = false;
-
 /**
  * nsITimerCallback implementation. Checks to see if it's time to sync any registered datasets.
  *
  * @param timer The timer which has expired.
  */
 function syncTimerCallback(timer) {
   for (let datasetId in gSyncCallbacks) {
     let lastSyncTime = 0;
@@ -153,20 +149,17 @@ this.HomeProvider = Object.freeze({
    */
   requestSync: function(datasetId, callback) {
     // Make sure it's a good time to sync.
     if ((Services.prefs.getIntPref(PREF_SYNC_UPDATE_MODE) === 1) && !isUsingWifi()) {
       Cu.reportError("HomeProvider: Failed to sync because device is not on a local network");
       return false;
     }
 
-    gWritesAreExpected = true;
     callback(datasetId);
-    gWritesAreExpected = false;
-
     return true;
   },
 
   /**
    * Specifies that a sync should be requested for the given dataset and update interval.
    *
    * @param datasetId Unique identifier for the dataset to sync.
    * @param interval Update interval in seconds. By default, this is throttled to 3600 seconds (1 hour).
@@ -294,20 +287,16 @@ HomeStorage.prototype = {
    *
    * @param data
    *        (array) JSON array of row items
    *
    * @return Promise
    * @resolves When the operation has completed.
    */
   save: function(data) {
-    if (!gWritesAreExpected) {
-      Cu.reportError("HomeStorage: save() called outside of sync window");
-    }
-
     return Task.spawn(function save_task() {
       let db = yield getDatabaseConnection();
       try {
         yield db.executeTransaction(function save_transaction() {
           // Insert data into DB.
           for (let item of data) {
             validateItem(this.datasetId, item);
 
@@ -337,20 +326,16 @@ HomeStorage.prototype = {
 
   /**
    * Deletes all rows associated with this storage.
    *
    * @return Promise
    * @resolves When the operation has completed.
    */
   deleteAll: function() {
-    if (!gWritesAreExpected) {
-      Cu.reportError("HomeStorage: deleteAll() called outside of sync window");
-    }
-
     return Task.spawn(function delete_all_task() {
       let db = yield getDatabaseConnection();
       try {
         let params = { dataset_id: this.datasetId };
         yield db.executeCached(SQL.deleteFromDataset, params);
       } finally {
         yield db.close();
       }