Bug 1508758 - Ensure that nsContentPermissionRequestProxy getters can still work when the permission request object's Allow() or Cancel() methods are called r=baku
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 21 Nov 2018 11:29:12 +0000
changeset 506684 f340a2489f7366a1383ac842ac3191a19e26b500
parent 506683 12cd6bf51cdeafb596082068b7c925a844b37a83
child 506685 6ce32daf80793ae70f50cfdd421aad837e155435
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1508758
milestone65.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 1508758 - Ensure that nsContentPermissionRequestProxy getters can still work when the permission request object's Allow() or Cancel() methods are called r=baku Without this patch, getters such as GetElement(), GetPrincipal() and the like will start to throw as soon as either Cancel() or Allow() have been called. Differential Revision: https://phabricator.services.mozilla.com/D12465
dom/base/nsContentPermissionHelper.cpp
--- a/dom/base/nsContentPermissionHelper.cpp
+++ b/dom/base/nsContentPermissionHelper.cpp
@@ -889,17 +889,16 @@ nsContentPermissionRequestProxy::Cancel(
   // being destroyed and PContentPermissionRequest will soon be.
   if (mParent->IsBeingDestroyed()) {
     return NS_ERROR_FAILURE;
   }
 
   nsTArray<PermissionChoice> emptyChoices;
 
   Unused << mParent->SendNotifyResult(false, emptyChoices);
-  mParent = nullptr;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsContentPermissionRequestProxy::Allow(JS::HandleValue aChoices)
 {
   if (mParent == nullptr) {
     return NS_ERROR_FAILURE;
@@ -947,17 +946,16 @@ nsContentPermissionRequestProxy::Allow(J
       }
     }
   } else {
     MOZ_ASSERT(false, "SelectedChoices should be undefined or an JS object");
     return NS_ERROR_FAILURE;
   }
 
   Unused << mParent->SendNotifyResult(true, choices);
-  mParent = nullptr;
   return NS_OK;
 }
 
 void
 nsContentPermissionRequestProxy::NotifyVisibility(const bool& aIsVisible)
 {
   MOZ_ASSERT(mRequester);