Bug 1450448 - Correctly handle non-initialized appCache in site data preferences. r=Gijs, a=RyanVM
authorJohann Hofmann <jhofmann@mozilla.com>
Tue, 15 May 2018 22:02:33 +0200
changeset 473369 ab893afd788e58e6b015548b3163fe3e70f2afbe
parent 473368 5d7d7ee1bbd1e6b563375c795f5bd1869f981d69
child 473370 c3d8e57327695aaa9c47c0ca6bb26b8434634303
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, RyanVM
bugs1450448
milestone61.0
Bug 1450448 - Correctly handle non-initialized appCache in site data preferences. r=Gijs, a=RyanVM MozReview-Commit-ID: IhQGAWNQtR0
browser/modules/SiteDataManager.jsm
--- a/browser/modules/SiteDataManager.jsm
+++ b/browser/modules/SiteDataManager.jsm
@@ -187,17 +187,29 @@ var SiteDataManager = {
   _cancelGetQuotaUsage() {
     if (this._quotaUsageRequest) {
       this._quotaUsageRequest.cancel();
       this._quotaUsageRequest = null;
     }
   },
 
   _updateAppCache() {
-    let groups = this._appCache.getGroups();
+    let groups;
+    try {
+      groups = this._appCache.getGroups();
+    } catch (e) {
+      // NS_ERROR_NOT_AVAILABLE means that appCache is not initialized,
+      // which probably means the user has disabled it. Otherwise, log an
+      // error. Either way, there's nothing we can do here.
+      if (e.result != Cr.NS_ERROR_NOT_AVAILABLE) {
+        Cu.reportError(e);
+      }
+      return;
+    }
+
     for (let group of groups) {
       let cache = this._appCache.getActiveCache(group);
       if (cache.usage <= 0) {
         // A site with 0 byte appcache usage is redundant for us so skip it.
         continue;
       }
       let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(group);
       let uri = principal.URI;