Bug 1467919 - Don't try to clear PushService data if Push disabled r=baku a=lizzard
authorJames Willcox <snorp@snorp.net>
Fri, 29 Jun 2018 13:26:53 -0500
changeset 477845 3c8ab5a011e3e53fe125693ce8922314ffcf7a8b
parent 477844 2d9b44bd2d74fbb8f64d86b666e05bb08fa04a6b
child 477846 83d54bf1905f4c71190b5438eeedb9fef3c55c4b
push id9444
push userarchaeopteryx@coole-files.de
push dateSat, 07 Jul 2018 21:01:06 +0000
treeherdermozilla-beta@3c8ab5a011e3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku, lizzard
bugs1467919
milestone62.0
Bug 1467919 - Don't try to clear PushService data if Push disabled r=baku a=lizzard MozReview-Commit-ID: IkImtSkmUAI
toolkit/components/cleardata/ClearDataService.js
--- a/toolkit/components/cleardata/ClearDataService.js
+++ b/toolkit/components/cleardata/ClearDataService.js
@@ -410,30 +410,38 @@ const PredictorNetworkCleaner = {
              getService(Ci.nsINetworkPredictor);
     np.reset();
     return Promise.resolve();
   },
 };
 
 const PushNotificationsCleaner = {
   deleteByHost(aHost, aOriginAttributes) {
+    if (!Services.prefs.getBoolPref("dom.push.enabled", false)) {
+      return Promise.resolve();
+    }
+
     return new Promise((aResolve, aReject) => {
       let push = Cc["@mozilla.org/push/Service;1"]
                    .getService(Ci.nsIPushService);
       push.clearForDomain(aHost, aStatus => {
         if (!Components.isSuccessCode(aStatus)) {
           aReject();
         } else {
           aResolve();
         }
       });
     });
   },
 
   deleteAll() {
+    if (!Services.prefs.getBoolPref("dom.push.enabled", false)) {
+      return Promise.resolve();
+    }
+
     return new Promise((aResolve, aReject) => {
       let push = Cc["@mozilla.org/push/Service;1"]
                    .getService(Ci.nsIPushService);
       push.clearForDomain("*", aStatus => {
         if (!Components.isSuccessCode(aStatus)) {
           aReject();
         } else {
           aResolve();