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 470837 ab893afd788e
parent 470836 5d7d7ee1bbd1
child 470838 c3d8e5732769
push id9239
push userryanvm@gmail.com
push date2018-05-18 15:23 +0000
treeherdermozilla-beta@617990cee57d [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;