Bug 1470965 - Fix refcount sanity in nsIPrincipal.addonPolicy getter. r=mixedpuppy, a=lizzard
authorKris Maglione <maglione.k@gmail.com>
Tue, 26 Jun 2018 00:19:46 -0700
changeset 480877 adfbbc7a8f60df66e65681878875e8680cfe3d41
parent 480876 d645f9af7e169920167a298f6654b123f62e6730
child 480878 3a49b45d34288c6b6cebb18971fa7be93a4a21d7
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmixedpuppy, lizzard
bugs1470965
milestone62.0
Bug 1470965 - Fix refcount sanity in nsIPrincipal.addonPolicy getter. r=mixedpuppy, a=lizzard MozReview-Commit-ID: KuDN3joKi7S
caps/BasePrincipal.cpp
--- a/caps/BasePrincipal.cpp
+++ b/caps/BasePrincipal.cpp
@@ -331,17 +331,18 @@ BasePrincipal::GetIsInIsolatedMozBrowser
 {
   *aIsInIsolatedMozBrowserElement = IsInIsolatedMozBrowserElement();
   return NS_OK;
 }
 
 nsresult
 BasePrincipal::GetAddonPolicy(nsISupports** aResult)
 {
-  *aResult = AddonPolicy();
+  RefPtr<extensions::WebExtensionPolicy> policy(AddonPolicy());
+  policy.forget(aResult);
   return NS_OK;
 }
 
 extensions::WebExtensionPolicy*
 BasePrincipal::AddonPolicy()
 {
   if (Is<ContentPrincipal>()) {
     return As<ContentPrincipal>()->AddonPolicy();