Bug 1226443 P4 Cleanup ServiceWorkerScriptCache objects when initialization fails. r=ehsan
☠☠ backed out by c873567c2898 ☠ ☠
authorBen Kelly <ben@wanderview.com>
Thu, 10 Dec 2015 18:08:14 -0500
changeset 276142 a7def186c1d3f25cf8c8fb150487849af0a2b6ae
parent 276141 e2f21ee1cd4cb118ec1c2794d48a2c1296c53ec2
child 276143 d518261eb3b17f3e6b11fdb6d55ec1b7d4b11901
push id69058
push userbkelly@mozilla.com
push dateThu, 10 Dec 2015 23:08:27 +0000
treeherdermozilla-inbound@d518261eb3b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1226443
milestone45.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 1226443 P4 Cleanup ServiceWorkerScriptCache objects when initialization fails. r=ehsan
dom/workers/ServiceWorkerScriptCache.cpp
--- a/dom/workers/ServiceWorkerScriptCache.cpp
+++ b/dom/workers/ServiceWorkerScriptCache.cpp
@@ -258,30 +258,33 @@ public:
     // the cache even if there isn't an existing one.
     AutoJSAPI jsapi;
     jsapi.Init();
     ErrorResult result;
     mSandbox.init(jsapi.cx());
     mCacheStorage = CreateCacheStorage(jsapi.cx(), aPrincipal, result, &mSandbox);
     if (NS_WARN_IF(result.Failed())) {
       MOZ_ASSERT(!result.IsErrorWithMessage());
+      Cleanup();
       return result.StealNSResult();
     }
 
     mCN = new CompareNetwork(this);
     nsresult rv = mCN->Initialize(aPrincipal, aURL, aLoadGroup);
     if (NS_WARN_IF(NS_FAILED(rv))) {
+      Cleanup();
       return rv;
     }
 
     if (!aCacheName.IsEmpty()) {
       mCC = new CompareCache(this);
       rv = mCC->Initialize(aPrincipal, aURL, aCacheName);
       if (NS_WARN_IF(NS_FAILED(rv))) {
         mCN->Abort();
+        Cleanup();
         return rv;
       }
     }
 
     return NS_OK;
   }
 
   const nsAString&