Bug 1317587 - don't start scheduled sync after shutdown. r?rnewman draft
authorMark Hammond <mhammond@skippinet.com.au>
Tue, 15 Nov 2016 15:28:52 +1100
changeset 439386 7bb9038dbee47fe9275de09c3cb9b9ff08d504f2
parent 439149 f8ba9c9b401f57b0047ddd6932cb830190865b38
child 439387 6916134db0cf59d56916e945e1d91ee2ac1473cd
child 439460 d07e727d5e7d3d7a06d34d4f9a408835d126576e
push id35999
push userbmo:markh@mozilla.com
push dateWed, 16 Nov 2016 01:21:11 +0000
reviewersrnewman
bugs1317587
milestone53.0a1
Bug 1317587 - don't start scheduled sync after shutdown. r?rnewman MozReview-Commit-ID: GSyWAUa1qyr
services/sync/modules/policies.js
--- a/services/sync/modules/policies.js
+++ b/services/sync/modules/policies.js
@@ -396,16 +396,25 @@ SyncScheduler.prototype = {
       this._log.debug("Not initiating sync: Login status is " + Status.login);
 
       // If we're not syncing now, we need to schedule the next one.
       this._log.trace("Scheduling a sync at MASTER_PASSWORD_LOCKED_RETRY_INTERVAL");
       this.scheduleAtInterval(MASTER_PASSWORD_LOCKED_RETRY_INTERVAL);
       return;
     }
 
+    try {
+      Async.checkAppReady()
+    } catch (ex) {
+      if (Async.isShutdownException(ex)) {
+        this._log.debug("Not initiating sync: app is shutting down");
+        return;
+      }
+      throw ex;
+    }
     Utils.nextTick(this.service.sync, this.service);
   },
 
   /**
    * Set a timer for the next sync
    */
   scheduleNextSync: function scheduleNextSync(interval) {
     // If no interval was specified, use the current sync interval.