Bug 1450448 - Correctly handle non-initialized appCache in site data preferences. r=Gijs draft
authorJohann Hofmann <jhofmann@mozilla.com>
Tue, 15 May 2018 22:02:33 +0200
changeset 795451 9b367bafb01537eaebcdc877eb5744d7fe86b391
parent 795256 cf3ee14023483cbbb57129479537c713e22c1980
push id109975
push userjhofmann@mozilla.com
push dateTue, 15 May 2018 20:03:27 +0000
reviewersGijs
bugs1450448
milestone62.0a1
Bug 1450448 - Correctly handle non-initialized appCache in site data preferences. r=Gijs 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;