tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 700d0fee4007a11c9284a6b57d96eb782332e3da
parent d7650f6a2e680f3c50051fd0863690837023c99b
Author: Kagami Sascha Rosylight <krosylight@proton.me>
Date:   Thu, 27 Nov 2025 16:11:17 +0000

Bug 2002346 - Add Notification option use counters r=webidl,smaug

Differential Revision: https://phabricator.services.mozilla.com/D274134

Diffstat:
Mdom/base/UseCounters.conf | 11+++++++++++
Mdom/base/UseCountersWorker.conf | 9+++++++++
Mdom/base/use_counter_metrics.yaml | 718++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
Mdom/notification/Notification.cpp | 19+++++++++++++++++++
Mdom/webidl/Notification.webidl | 17+++++++++++++++--
5 files changed, 753 insertions(+), 21 deletions(-)

diff --git a/dom/base/UseCounters.conf b/dom/base/UseCounters.conf @@ -463,6 +463,17 @@ custom TextDirectiveNotCreated has not succeeded in creating a text fragment custom MathMLUsed has used MathML +// Dictionary members for Notifications API +// Those are not methods but it doesn't matter for the generated Glean entries. +method NotificationOptions.navigate +method NotificationOptions.image +method NotificationOptions.badge +method NotificationOptions.vibrate +method NotificationOptions.timestamp +method NotificationOptions.renotify +method NotificationOptions.requireInteraction +method NotificationOptions.actions + // NOTE: You might need a data collection review if you are adding // a custom use counter. And for WebIDL methods or attributes, // deprecated operations, or CSS properties: you almost certainly diff --git a/dom/base/UseCountersWorker.conf b/dom/base/UseCountersWorker.conf @@ -102,3 +102,12 @@ method Scheduler.postTask // WebGPU custom WebgpuRequestAdapter requests a WebGPU adapter + +method NotificationOptions.navigate +method NotificationOptions.image +method NotificationOptions.badge +method NotificationOptions.vibrate +method NotificationOptions.timestamp +method NotificationOptions.renotify +method NotificationOptions.requireInteraction +method NotificationOptions.actions diff --git a/dom/base/use_counter_metrics.yaml b/dom/base/use_counter_metrics.yaml @@ -108,8 +108,8 @@ use.counter: send_in_pings: - use-counters -# Total of 2380 use counter metrics (excludes denominators). -# Total of 356 'page' use counters. +# Total of 2420 use counter metrics (excludes denominators). +# Total of 364 'page' use counters. use.counter.page: svgsvgelement_getelementbyid: type: counter @@ -6163,7 +6163,143 @@ use.counter.page: send_in_pings: - use-counters -# Total of 356 'document' use counters. + notificationoptions_navigate: + type: counter + description: > + Whether a page called called NotificationOptions.navigate. + Compare against `use.counter.top_level_content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_image: + type: counter + description: > + Whether a page called called NotificationOptions.image. + Compare against `use.counter.top_level_content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_badge: + type: counter + description: > + Whether a page called called NotificationOptions.badge. + Compare against `use.counter.top_level_content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_vibrate: + type: counter + description: > + Whether a page called called NotificationOptions.vibrate. + Compare against `use.counter.top_level_content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_timestamp: + type: counter + description: > + Whether a page called called NotificationOptions.timestamp. + Compare against `use.counter.top_level_content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_renotify: + type: counter + description: > + Whether a page called called NotificationOptions.renotify. + Compare against `use.counter.top_level_content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_requireinteraction: + type: counter + description: > + Whether a page called called NotificationOptions.requireInteraction. + Compare against `use.counter.top_level_content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_actions: + type: counter + description: > + Whether a page called called NotificationOptions.actions. + Compare against `use.counter.top_level_content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + +# Total of 364 'document' use counters. use.counter.doc: svgsvgelement_getelementbyid: type: counter @@ -12217,7 +12353,143 @@ use.counter.doc: send_in_pings: - use-counters -# Total of 54 'dedicated worker' use counters. + notificationoptions_navigate: + type: counter + description: > + Whether a document called called NotificationOptions.navigate. + Compare against `use.counter.content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_image: + type: counter + description: > + Whether a document called called NotificationOptions.image. + Compare against `use.counter.content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_badge: + type: counter + description: > + Whether a document called called NotificationOptions.badge. + Compare against `use.counter.content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_vibrate: + type: counter + description: > + Whether a document called called NotificationOptions.vibrate. + Compare against `use.counter.content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_timestamp: + type: counter + description: > + Whether a document called called NotificationOptions.timestamp. + Compare against `use.counter.content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_renotify: + type: counter + description: > + Whether a document called called NotificationOptions.renotify. + Compare against `use.counter.content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_requireinteraction: + type: counter + description: > + Whether a document called called NotificationOptions.requireInteraction. + Compare against `use.counter.content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_actions: + type: counter + description: > + Whether a document called called NotificationOptions.actions. + Compare against `use.counter.content_documents_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + +# Total of 62 'dedicated worker' use counters. use.counter.worker.dedicated: pushmanager_subscribe: type: counter @@ -13137,13 +13409,11 @@ use.counter.worker.dedicated: send_in_pings: - use-counters -# Total of 54 'shared worker' use counters. -use.counter.worker.shared: - pushmanager_subscribe: + notificationoptions_navigate: type: counter description: > - Whether a shared worker called called PushManager.subscribe. - Compare against `use.counter.shared_workers_destroyed` + Whether a dedicated worker called called NotificationOptions.navigate. + Compare against `use.counter.dedicated_workers_destroyed` to calculate the rate. bugs: - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 @@ -13156,11 +13426,11 @@ use.counter.worker.shared: send_in_pings: - use-counters - pushsubscription_unsubscribe: + notificationoptions_image: type: counter description: > - Whether a shared worker called called PushSubscription.unsubscribe. - Compare against `use.counter.shared_workers_destroyed` + Whether a dedicated worker called called NotificationOptions.image. + Compare against `use.counter.dedicated_workers_destroyed` to calculate the rate. bugs: - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 @@ -13173,11 +13443,11 @@ use.counter.worker.shared: send_in_pings: - use-counters - console_assert: + notificationoptions_badge: type: counter description: > - Whether a shared worker called called console.assert. - Compare against `use.counter.shared_workers_destroyed` + Whether a dedicated worker called called NotificationOptions.badge. + Compare against `use.counter.dedicated_workers_destroyed` to calculate the rate. bugs: - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 @@ -13190,11 +13460,149 @@ use.counter.worker.shared: send_in_pings: - use-counters - console_clear: + notificationoptions_vibrate: type: counter description: > - Whether a shared worker called called console.clear. - Compare against `use.counter.shared_workers_destroyed` + Whether a dedicated worker called called NotificationOptions.vibrate. + Compare against `use.counter.dedicated_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_timestamp: + type: counter + description: > + Whether a dedicated worker called called NotificationOptions.timestamp. + Compare against `use.counter.dedicated_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_renotify: + type: counter + description: > + Whether a dedicated worker called called NotificationOptions.renotify. + Compare against `use.counter.dedicated_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_requireinteraction: + type: counter + description: > + Whether a dedicated worker called called NotificationOptions.requireInteraction. + Compare against `use.counter.dedicated_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_actions: + type: counter + description: > + Whether a dedicated worker called called NotificationOptions.actions. + Compare against `use.counter.dedicated_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + +# Total of 62 'shared worker' use counters. +use.counter.worker.shared: + pushmanager_subscribe: + type: counter + description: > + Whether a shared worker called called PushManager.subscribe. + Compare against `use.counter.shared_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + pushsubscription_unsubscribe: + type: counter + description: > + Whether a shared worker called called PushSubscription.unsubscribe. + Compare against `use.counter.shared_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + console_assert: + type: counter + description: > + Whether a shared worker called called console.assert. + Compare against `use.counter.shared_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + console_clear: + type: counter + description: > + Whether a shared worker called called console.clear. + Compare against `use.counter.shared_workers_destroyed` to calculate the rate. bugs: - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 @@ -14057,7 +14465,143 @@ use.counter.worker.shared: send_in_pings: - use-counters -# Total of 54 'service worker' use counters. + notificationoptions_navigate: + type: counter + description: > + Whether a shared worker called called NotificationOptions.navigate. + Compare against `use.counter.shared_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_image: + type: counter + description: > + Whether a shared worker called called NotificationOptions.image. + Compare against `use.counter.shared_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_badge: + type: counter + description: > + Whether a shared worker called called NotificationOptions.badge. + Compare against `use.counter.shared_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_vibrate: + type: counter + description: > + Whether a shared worker called called NotificationOptions.vibrate. + Compare against `use.counter.shared_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_timestamp: + type: counter + description: > + Whether a shared worker called called NotificationOptions.timestamp. + Compare against `use.counter.shared_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_renotify: + type: counter + description: > + Whether a shared worker called called NotificationOptions.renotify. + Compare against `use.counter.shared_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_requireinteraction: + type: counter + description: > + Whether a shared worker called called NotificationOptions.requireInteraction. + Compare against `use.counter.shared_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_actions: + type: counter + description: > + Whether a shared worker called called NotificationOptions.actions. + Compare against `use.counter.shared_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + +# Total of 62 'service worker' use counters. use.counter.worker.service: pushmanager_subscribe: type: counter @@ -14977,6 +15521,142 @@ use.counter.worker.service: send_in_pings: - use-counters + notificationoptions_navigate: + type: counter + description: > + Whether a service worker called called NotificationOptions.navigate. + Compare against `use.counter.service_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_image: + type: counter + description: > + Whether a service worker called called NotificationOptions.image. + Compare against `use.counter.service_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_badge: + type: counter + description: > + Whether a service worker called called NotificationOptions.badge. + Compare against `use.counter.service_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_vibrate: + type: counter + description: > + Whether a service worker called called NotificationOptions.vibrate. + Compare against `use.counter.service_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_timestamp: + type: counter + description: > + Whether a service worker called called NotificationOptions.timestamp. + Compare against `use.counter.service_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_renotify: + type: counter + description: > + Whether a service worker called called NotificationOptions.renotify. + Compare against `use.counter.service_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_requireinteraction: + type: counter + description: > + Whether a service worker called called NotificationOptions.requireInteraction. + Compare against `use.counter.service_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + + notificationoptions_actions: + type: counter + description: > + Whether a service worker called called NotificationOptions.actions. + Compare against `use.counter.service_workers_destroyed` + to calculate the rate. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 + notification_emails: + - dom-core@mozilla.com + - emilio@mozilla.com + expires: never + send_in_pings: + - use-counters + # Total of 49 'deprecated operations (page)' use counters. use.counter.deprecated_ops.page: components: diff --git a/dom/notification/Notification.cpp b/dom/notification/Notification.cpp @@ -13,6 +13,7 @@ #include "mozilla/HoldDropJSObjects.h" #include "mozilla/OwningNonNull.h" #include "mozilla/StaticPrefs_dom.h" +#include "mozilla/UseCounter.h" #include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/Document.h" #include "mozilla/dom/Promise-inl.h" @@ -345,6 +346,16 @@ static Result<nsString, nsresult> SerializeDataAsBase64( return result; } +#define SetUseCounterIf(wasUsed, memberName) \ + if (wasUsed) { \ + if (NS_IsMainThread()) { \ + SetUseCounter(aGlobal->GetGlobalJSObject(), \ + eUseCounter_NotificationOptions_##memberName); \ + } else { \ + SetUseCounter(UseCounterWorker::NotificationOptions_##memberName); \ + } \ + } + /* static */ // https://notifications.spec.whatwg.org/#create-a-notification already_AddRefed<Notification> Notification::ValidateAndCreate( @@ -353,6 +364,14 @@ already_AddRefed<Notification> Notification::ValidateAndCreate( ErrorResult& aRv) { MOZ_ASSERT(aGlobal); + SetUseCounterIf(aOptions.mNavigate.WasPassed(), navigate); + SetUseCounterIf(aOptions.mBadge.WasPassed(), badge); + SetUseCounterIf(aOptions.mVibrate.WasPassed(), vibrate); + SetUseCounterIf(aOptions.mTimestamp.WasPassed(), timestamp); + SetUseCounterIf(aOptions.mRenotify, renotify); + SetUseCounterIf(aOptions.mRequireInteraction, requireInteraction); + SetUseCounterIf(!aOptions.mActions.IsEmpty(), actions); + // Step 4: Set notification’s data to // StructuredSerializeForStorage(options["data"]). JS::Rooted<JS::Value> data(aCx, aOptions.mData); diff --git a/dom/webidl/Notification.webidl b/dom/webidl/Notification.webidl @@ -78,12 +78,25 @@ dictionary NotificationOptions { NotificationDirection dir = "auto"; DOMString lang = ""; DOMString body = ""; + // [UseCounter], bug 1976515 + UTF8String navigate; DOMString tag = ""; + // [UseCounter], bug 1976515 + UTF8String image; UTF8String icon = ""; - boolean requireInteraction = false; - boolean silent = false; + // [UseCounter], bug 1976515 + UTF8String badge; + // [UseCounter], bug 1976515 VibratePattern vibrate; + // [UseCounter], bug 1976515 + EpochTimeStamp timestamp; + // [UseCounter], bug 1976515 + boolean renotify = false; + boolean silent = false; + // [UseCounter], bug 1976515 + boolean requireInteraction = false; any data = null; + // [UseCounter], bug 1976515 [Pref="dom.webnotifications.actions.enabled"] sequence<NotificationAction> actions = []; };