Bug 1450448 - Correctly handle non-initialized appCache in site data preferences. r=Gijs
MozReview-Commit-ID: IhQGAWNQtR0
--- 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;