mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 13:57:32 +00:00
Bug 1928702 - Part 4: Implement ActorDestroy r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D227689
This commit is contained in:
parent
c2fa7e3ebb
commit
baa2566f17
@ -6,6 +6,7 @@
|
||||
|
||||
#include "NotificationParent.h"
|
||||
|
||||
#include "NotificationUtils.h"
|
||||
#include "mozilla/ipc/Endpoint.h"
|
||||
|
||||
namespace mozilla::dom::notification {
|
||||
@ -40,4 +41,18 @@ nsresult NotificationParent::BindToMainThread(
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void NotificationParent::ActorDestroy(ActorDestroyReason aWhy) {
|
||||
nsAutoString alertName;
|
||||
GetAlertName(alertName);
|
||||
UnregisterNotification(mPrincipal, mId, alertName, CloseMode::InactiveGlobal);
|
||||
}
|
||||
|
||||
void NotificationParent::MaybeInitAlertName() {
|
||||
if (!mAlertName.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ComputeAlertName(mPrincipal, mOptions.tag(), mId, mAlertName);
|
||||
}
|
||||
|
||||
} // namespace mozilla::dom::notification
|
||||
|
@ -35,21 +35,32 @@ class NotificationParent final : public PNotificationParent,
|
||||
mOptions(aOptions) {};
|
||||
|
||||
IPCResult RecvShow(ShowResolver&& aResolver);
|
||||
IPCResult RecvClose();
|
||||
|
||||
nsresult BindToMainThread(
|
||||
Endpoint<PNotificationParent>&& aParentEndpoint,
|
||||
PBackgroundParent::CreateNotificationParentResolver&& aResolver);
|
||||
|
||||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
|
||||
private:
|
||||
~NotificationParent() = default;
|
||||
|
||||
void GetAlertName(nsAString& aRetval) {
|
||||
if (mAlertName.IsEmpty()) {
|
||||
MaybeInitAlertName();
|
||||
}
|
||||
aRetval = mAlertName;
|
||||
}
|
||||
void MaybeInitAlertName();
|
||||
|
||||
NotNull<nsCOMPtr<nsIPrincipal>> mPrincipal;
|
||||
NotNull<nsCOMPtr<nsIPrincipal>> mEffectiveStoragePrincipal;
|
||||
bool mIsSecureContext;
|
||||
nsString mId;
|
||||
nsString mScope;
|
||||
IPCNotificationOptions mOptions;
|
||||
|
||||
nsString mAlertName;
|
||||
};
|
||||
|
||||
} // namespace mozilla::dom::notification
|
||||
|
Loading…
x
Reference in New Issue
Block a user