Usage counter for add/removeEventListener third argument.
Check to see if the third argument on the add/removeEventListener is
a boolean; if it isn't log a UMA metric.
BUG=543685
Review URL: https://codereview.chromium.org/1414533002
Cr-Commit-Position: refs/heads/master@{#354908}
diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8EventTargetCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8EventTargetCustom.cpp
index 97ae719..8903ee9 100644
--- a/third_party/WebKit/Source/bindings/core/v8/custom/V8EventTargetCustom.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8EventTargetCustom.cpp
@@ -42,6 +42,10 @@
UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionContext(info.GetIsolate()),
info.Length() == 0 ? UseCounter::AddEventListenerNoArguments : UseCounter::AddEventListenerOneArgument);
}
+ if (info.Length() >= 3 && info[2]->IsObject()) {
+ UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionContext(info.GetIsolate()),
+ UseCounter::AddEventListenerThirdArgumentIsObject);
+ }
}
void V8EventTarget::addEventListenerMethodEpilogueCustom(const v8::FunctionCallbackInfo<v8::Value>& info, EventTarget* impl)
@@ -56,6 +60,10 @@
UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionContext(info.GetIsolate()),
info.Length() == 0 ? UseCounter::RemoveEventListenerNoArguments : UseCounter::RemoveEventListenerOneArgument);
}
+ if (info.Length() >= 3 && info[2]->IsObject()) {
+ UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionContext(info.GetIsolate()),
+ UseCounter::RemoveEventListenerThirdArgumentIsObject);
+ }
}
void V8EventTarget::removeEventListenerMethodEpilogueCustom(const v8::FunctionCallbackInfo<v8::Value>& info, EventTarget* impl)
diff --git a/third_party/WebKit/Source/core/frame/UseCounter.h b/third_party/WebKit/Source/core/frame/UseCounter.h
index 392f2cd6..da6dfda53 100644
--- a/third_party/WebKit/Source/core/frame/UseCounter.h
+++ b/third_party/WebKit/Source/core/frame/UseCounter.h
@@ -844,6 +844,8 @@
RequestAutocomplete = 965,
BlockableMixedContentInSubframeBlocked = 966,
+ AddEventListenerThirdArgumentIsObject = 967,
+ RemoveEventListenerThirdArgumentIsObject = 968,
// Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots.
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index b96ffab..d091505 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -60511,6 +60511,8 @@
<int value="964" label="CredentialManagerRequireUserMediation"/>
<int value="965" label="RequestAutocomplete"/>
<int value="966" label="BlockableMixedContentInSubframeBlocked"/>
+ <int value="967" label="AddEventListenerThirdArgumentIsObject"/>
+ <int value="968" label="RemoveEventListenerThirdArgumentIsObject"/>
</enum>
<enum name="FetchRequestMode" type="int">