diff --git a/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom b/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom
index 18b386524eb966..01712ec9e9a98a 100644
--- a/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom
+++ b/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom
@@ -3792,6 +3792,8 @@ enum WebFeature {
kContentDispositionInSvgUse = 4451,
kSameDocumentCrossOriginInitiator = 4452,
kServiceWorkerFetchHandlerModifiedAfterInitialization = 4453,
+ kServiceWorkerAddHandlerAfterInitialization = 4468,
+ kServiceWorkerSetAttributeHandlerAfterInitialization = 4469,
// Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots.
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc
index 0dc366b235dc9d..1db08bf3dbc6ad 100644
--- a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc
+++ b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc
@@ -695,6 +695,8 @@ bool ServiceWorkerGlobalScope::AddEventListenerInternal(
this,
WebFeature::kServiceWorkerFetchHandlerUpdateAfterInitialization);
}
+ UseCounter::Count(this,
+ WebFeature::kServiceWorkerAddHandlerAfterInitialization);
}
return WorkerGlobalScope::AddEventListenerInternal(event_type, listener,
options);
@@ -2645,10 +2647,14 @@ bool ServiceWorkerGlobalScope::SetAttributeEventListener(
const AtomicString& event_type,
EventListener* listener) {
// Count the modification of fetch handlers after the initial evaluation.
- if (did_evaluate_script_ && event_type == event_type_names::kFetch) {
+ if (did_evaluate_script_) {
+ if (event_type == event_type_names::kFetch) {
+ UseCounter::Count(
+ this,
+ WebFeature::kServiceWorkerFetchHandlerModifiedAfterInitialization);
+ }
UseCounter::Count(
- this,
- WebFeature::kServiceWorkerFetchHandlerModifiedAfterInitialization);
+ this, WebFeature::kServiceWorkerSetAttributeHandlerAfterInitialization);
}
return WorkerGlobalScope::SetAttributeEventListener(event_type, listener);
}
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml
index e1621de677fbb2..b9dc5462fc816e 100644
--- a/tools/metrics/histograms/enums.xml
+++ b/tools/metrics/histograms/enums.xml
@@ -41969,6 +41969,9 @@ Called by update_use_counter_feature_enum.py.-->
+
+