diff --git a/dom/base/nsContentPermissionHelper.cpp b/dom/base/nsContentPermissionHelper.cpp index 650f85e3cc2a..be7372eed895 100644 --- a/dom/base/nsContentPermissionHelper.cpp +++ b/dom/base/nsContentPermissionHelper.cpp @@ -127,6 +127,7 @@ class ContentPermissionRequestParent : public PContentPermissionRequestParent private: virtual bool Recvprompt(); virtual bool RecvNotifyVisibility(const bool& aIsVisible); + virtual bool RecvDestroy(); virtual void ActorDestroy(ActorDestroyReason why); }; @@ -167,6 +168,13 @@ ContentPermissionRequestParent::RecvNotifyVisibility(const bool& aIsVisible) return true; } +bool +ContentPermissionRequestParent::RecvDestroy() +{ + Unused << PContentPermissionRequestParent::Send__delete__(this); + return true; +} + void ContentPermissionRequestParent::ActorDestroy(ActorDestroyReason why) { @@ -609,7 +617,7 @@ nsContentPermissionRequestProxy::Cancel() nsTArray emptyChoices; - Unused << ContentPermissionRequestParent::Send__delete__(mParent, false, emptyChoices); + Unused << mParent->SendNotifyResult(false, emptyChoices); mParent = nullptr; return NS_OK; } @@ -678,7 +686,7 @@ nsContentPermissionRequestProxy::Allow(JS::HandleValue aChoices) return NS_ERROR_FAILURE; } - Unused << ContentPermissionRequestParent::Send__delete__(mParent, true, choices); + Unused << mParent->SendNotifyResult(true, choices); mParent = nullptr; return NS_OK; } @@ -732,9 +740,10 @@ RemotePermissionRequest::DoAllow(JS::HandleValue aChoices) // PContentPermissionRequestChild bool -RemotePermissionRequest::Recv__delete__(const bool& aAllow, - InfallibleTArray&& aChoices) +RemotePermissionRequest::RecvNotifyResult(const bool& aAllow, + InfallibleTArray&& aChoices) { + Unused << this->SendDestroy(); mListener->RemoveListener(); mListener = nullptr; diff --git a/dom/base/nsContentPermissionHelper.h b/dom/base/nsContentPermissionHelper.h index 3b030d9ad3a8..d9c531bc1a88 100644 --- a/dom/base/nsContentPermissionHelper.h +++ b/dom/base/nsContentPermissionHelper.h @@ -188,8 +188,8 @@ public: nsPIDOMWindow* aWindow); // It will be called when prompt dismissed. - virtual bool Recv__delete__(const bool &aAllow, - InfallibleTArray&& aChoices) override; + virtual bool RecvNotifyResult(const bool &aAllow, + InfallibleTArray&& aChoices) override; virtual bool RecvGetVisibility() override; diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 0560dc5fe44b..b6f7da553c04 100755 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -2246,9 +2246,7 @@ ContentParent::NotifyTabDestroyed(const TabId& aTabId, // Need to close undeleted ContentPermissionRequestParents before tab is closed. for (auto& permissionRequestParent : parentArray) { nsTArray emptyChoices; - Unused << PContentPermissionRequestParent::Send__delete__(permissionRequestParent, - false, - emptyChoices); + Unused << PContentPermissionRequestParent::Send__delete__(permissionRequestParent); } // There can be more than one PBrowser for a given app process diff --git a/dom/ipc/PContentPermissionRequest.ipdl b/dom/ipc/PContentPermissionRequest.ipdl index 05f9d5e8e688..0afe70928438 100644 --- a/dom/ipc/PContentPermissionRequest.ipdl +++ b/dom/ipc/PContentPermissionRequest.ipdl @@ -15,10 +15,12 @@ protocol PContentPermissionRequest parent: prompt(); NotifyVisibility(bool visibility); + Destroy(); child: GetVisibility(); - __delete__(bool allow, PermissionChoice[] choices); + NotifyResult(bool allow, PermissionChoice[] choices); + __delete__(); };