diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
commit | 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch) | |
tree | a4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /dom/notification/Notification.cpp | |
parent | Adding debian version 124.0.1-1. (diff) | |
download | firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/notification/Notification.cpp')
-rw-r--r-- | dom/notification/Notification.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/dom/notification/Notification.cpp b/dom/notification/Notification.cpp index 39ba7b23ff..fb5b0ea9a3 100644 --- a/dom/notification/Notification.cpp +++ b/dom/notification/Notification.cpp @@ -714,7 +714,12 @@ Notification::Notification(nsIGlobalObject* aGlobal, const nsAString& aID, } } -nsresult Notification::Init() { +nsresult Notification::MaybeObserveWindowFrozenOrDestroyed() { + // NOTE: Non-persistent notifications can also be opened from workers, but we + // don't care and nobody else cares. And it's not clear whether we even should + // do this for window at all, see + // https://github.com/whatwg/notifications/issues/204. + // TODO: Somehow extend GlobalTeardownObserver to deal with FROZEN_TOPIC? if (!mWorkerPrivate) { nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService(); NS_ENSURE_TRUE(obs, NS_ERROR_FAILURE); @@ -776,6 +781,10 @@ already_AddRefed<Notification> Notification::Constructor( if (NS_WARN_IF(aRv.Failed())) { return nullptr; } + if (NS_WARN_IF( + NS_FAILED(notification->MaybeObserveWindowFrozenOrDestroyed()))) { + return nullptr; + } // This is be ok since we are on the worker thread where this function will // run to completion before the Notification has a chance to go away. @@ -915,8 +924,6 @@ already_AddRefed<Notification> Notification::CreateInternal( aGlobal, id, aTitle, aOptions.mBody, aOptions.mDir, aOptions.mLang, aOptions.mTag, aOptions.mIcon, aOptions.mRequireInteraction, silent, std::move(vibrate), aOptions.mMozbehavior); - rv = notification->Init(); - NS_ENSURE_SUCCESS(rv, nullptr); return notification.forget(); } |