Bug 1189195 - Fix PContentPermissionRequest shutdown r=fabrice

This commit is contained in:
Sotaro Ikeda 2015-11-05 16:41:13 -08:00
Родитель 9d11e85ed9
Коммит 7c26aaa947
4 изменённых файлов: 19 добавлений и 10 удалений

Просмотреть файл

@ -127,6 +127,7 @@ class ContentPermissionRequestParent : public PContentPermissionRequestParent
private: private:
virtual bool Recvprompt(); virtual bool Recvprompt();
virtual bool RecvNotifyVisibility(const bool& aIsVisible); virtual bool RecvNotifyVisibility(const bool& aIsVisible);
virtual bool RecvDestroy();
virtual void ActorDestroy(ActorDestroyReason why); virtual void ActorDestroy(ActorDestroyReason why);
}; };
@ -167,6 +168,13 @@ ContentPermissionRequestParent::RecvNotifyVisibility(const bool& aIsVisible)
return true; return true;
} }
bool
ContentPermissionRequestParent::RecvDestroy()
{
Unused << PContentPermissionRequestParent::Send__delete__(this);
return true;
}
void void
ContentPermissionRequestParent::ActorDestroy(ActorDestroyReason why) ContentPermissionRequestParent::ActorDestroy(ActorDestroyReason why)
{ {
@ -609,7 +617,7 @@ nsContentPermissionRequestProxy::Cancel()
nsTArray<PermissionChoice> emptyChoices; nsTArray<PermissionChoice> emptyChoices;
Unused << ContentPermissionRequestParent::Send__delete__(mParent, false, emptyChoices); Unused << mParent->SendNotifyResult(false, emptyChoices);
mParent = nullptr; mParent = nullptr;
return NS_OK; return NS_OK;
} }
@ -678,7 +686,7 @@ nsContentPermissionRequestProxy::Allow(JS::HandleValue aChoices)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
Unused << ContentPermissionRequestParent::Send__delete__(mParent, true, choices); Unused << mParent->SendNotifyResult(true, choices);
mParent = nullptr; mParent = nullptr;
return NS_OK; return NS_OK;
} }
@ -732,9 +740,10 @@ RemotePermissionRequest::DoAllow(JS::HandleValue aChoices)
// PContentPermissionRequestChild // PContentPermissionRequestChild
bool bool
RemotePermissionRequest::Recv__delete__(const bool& aAllow, RemotePermissionRequest::RecvNotifyResult(const bool& aAllow,
InfallibleTArray<PermissionChoice>&& aChoices) InfallibleTArray<PermissionChoice>&& aChoices)
{ {
Unused << this->SendDestroy();
mListener->RemoveListener(); mListener->RemoveListener();
mListener = nullptr; mListener = nullptr;

Просмотреть файл

@ -188,8 +188,8 @@ public:
nsPIDOMWindow* aWindow); nsPIDOMWindow* aWindow);
// It will be called when prompt dismissed. // It will be called when prompt dismissed.
virtual bool Recv__delete__(const bool &aAllow, virtual bool RecvNotifyResult(const bool &aAllow,
InfallibleTArray<PermissionChoice>&& aChoices) override; InfallibleTArray<PermissionChoice>&& aChoices) override;
virtual bool RecvGetVisibility() override; virtual bool RecvGetVisibility() override;

Просмотреть файл

@ -2246,9 +2246,7 @@ ContentParent::NotifyTabDestroyed(const TabId& aTabId,
// Need to close undeleted ContentPermissionRequestParents before tab is closed. // Need to close undeleted ContentPermissionRequestParents before tab is closed.
for (auto& permissionRequestParent : parentArray) { for (auto& permissionRequestParent : parentArray) {
nsTArray<PermissionChoice> emptyChoices; nsTArray<PermissionChoice> emptyChoices;
Unused << PContentPermissionRequestParent::Send__delete__(permissionRequestParent, Unused << PContentPermissionRequestParent::Send__delete__(permissionRequestParent);
false,
emptyChoices);
} }
// There can be more than one PBrowser for a given app process // There can be more than one PBrowser for a given app process

Просмотреть файл

@ -15,10 +15,12 @@ protocol PContentPermissionRequest
parent: parent:
prompt(); prompt();
NotifyVisibility(bool visibility); NotifyVisibility(bool visibility);
Destroy();
child: child:
GetVisibility(); GetVisibility();
__delete__(bool allow, PermissionChoice[] choices); NotifyResult(bool allow, PermissionChoice[] choices);
__delete__();
}; };