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 478372 adfbbc7a8f60
parent 478371 d645f9af7e16
child 478373 3a49b45d3428
push id9639
push userryanvm@gmail.com
push dateFri, 10 Aug 2018 20:54:33 +0000
treeherdermozilla-beta@4471d22def67 [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();