Bug 1346667: Fix error on extension shutdown when no local storage has been created. r=mixedpuppy
authorKris Maglione <maglione.k@gmail.com>
Sun, 12 Mar 2017 17:07:05 -0700
changeset 395517 4bc69004c3f66ea17dcc06e1c9e1a5659d27d82d
parent 395516 c01ab228256ba8e74a9449df309de4eb70f0fa46
child 395518 6b1862025a25525ce9ebcd044afa91269d1d4ee5
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmixedpuppy
bugs1346667
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1346667: Fix error on extension shutdown when no local storage has been created. r=mixedpuppy MozReview-Commit-ID: 899tYLjZSAq
toolkit/components/extensions/Extension.jsm
--- a/toolkit/components/extensions/Extension.jsm
+++ b/toolkit/components/extensions/Extension.jsm
@@ -194,17 +194,20 @@ var UninstallObserver = {
 
       // Clear any IndexedDB storage created by the extension
       let baseURI = NetUtil.newURI(`moz-extension://${uuid}/`);
       let principal = Services.scriptSecurityManager.createCodebasePrincipal(
         baseURI, {});
       Services.qms.clearStoragesForPrincipal(principal);
 
       // Clear localStorage created by the extension
-      Services.domStorageManager.getStorage(null, principal).clear();
+      let storage = Services.domStorageManager.getStorage(null, principal);
+      if (storage) {
+        storage.clear();
+      }
     }
 
     if (!this.leaveUuid) {
       // Clear the entry in the UUID map
       UUIDMap.remove(addon.id);
     }
   },
 };