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 74c39b620d5c0..ae13f39de8e4b 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 @@ -3816,6 +3816,7 @@ enum WebFeature { kCreateNSResolverWithNonElements2 = 4475, kGetDisplayMediaWithPreferCurrentTabTrue = 4476, kFencedFrameConfigAttribute = 4477, + kURLSearchParams_Has_Delete_MultipleArguments = 4478, // 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/core/url/url_search_params.cc b/third_party/blink/renderer/core/url/url_search_params.cc index 67795cedce8d3..b556142e8f333 100644 --- a/third_party/blink/renderer/core/url/url_search_params.cc +++ b/third_party/blink/renderer/core/url/url_search_params.cc @@ -7,7 +7,9 @@ #include #include +#include "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom-shared.h" #include "third_party/blink/renderer/bindings/core/v8/v8_union_usvstring_usvstringsequencesequence_usvstringusvstringrecord.h" +#include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/url/dom_url.h" #include "third_party/blink/renderer/platform/bindings/exception_messages.h" #include "third_party/blink/renderer/platform/network/form_data_encoder.h" @@ -184,7 +186,7 @@ void URLSearchParams::append(const String& name, const String& value) { RunUpdateSteps(); } -void URLSearchParams::deleteAllWithName(const String& name) { +void URLSearchParams::deleteAllWithName(ExecutionContext*, const String& name) { for (wtf_size_t i = 0; i < params_.size();) { if (params_[i].first == name) params_.EraseAt(i); @@ -194,6 +196,14 @@ void URLSearchParams::deleteAllWithName(const String& name) { RunUpdateSteps(); } +void URLSearchParams::deleteAllWithName(ExecutionContext* execution_context, + const String& name, + const ScriptValue& ignored) { + UseCounter::Count(execution_context, + WebFeature::kURLSearchParams_Has_Delete_MultipleArguments); + deleteAllWithName(execution_context, name); +} + String URLSearchParams::get(const String& name) const { for (const auto& param : params_) { if (param.first == name) @@ -211,7 +221,7 @@ Vector URLSearchParams::getAll(const String& name) const { return result; } -bool URLSearchParams::has(const String& name) const { +bool URLSearchParams::has(ExecutionContext*, const String& name) const { for (const auto& param : params_) { if (param.first == name) return true; @@ -219,6 +229,14 @@ bool URLSearchParams::has(const String& name) const { return false; } +bool URLSearchParams::has(ExecutionContext* execution_context, + const String& name, + const ScriptValue& ignored) const { + UseCounter::Count(execution_context, + WebFeature::kURLSearchParams_Has_Delete_MultipleArguments); + return has(execution_context, name); +} + void URLSearchParams::set(const String& name, const String& value) { bool found_match = false; for (wtf_size_t i = 0; i < params_.size();) { diff --git a/third_party/blink/renderer/core/url/url_search_params.h b/third_party/blink/renderer/core/url/url_search_params.h index 97bda9727ad5c..5c64985afaa83 100644 --- a/third_party/blink/renderer/core/url/url_search_params.h +++ b/third_party/blink/renderer/core/url/url_search_params.h @@ -51,10 +51,14 @@ class CORE_EXPORT URLSearchParams final // URLSearchParams interface methods String toString() const; void append(const String& name, const String& value); - void deleteAllWithName(const String&); + void deleteAllWithName(ExecutionContext*, const String&); + void deleteAllWithName(ExecutionContext*, + const String&, + const ScriptValue& ignored); String get(const String&) const; Vector getAll(const String&) const; - bool has(const String&) const; + bool has(ExecutionContext*, const String&) const; + bool has(ExecutionContext*, const String&, const ScriptValue& ignored) const; void set(const String& name, const String& value); void sort(); void SetInputWithoutUpdate(const String&); diff --git a/third_party/blink/renderer/core/url/url_search_params.idl b/third_party/blink/renderer/core/url/url_search_params.idl index 12db678963972..e33da2a3ebef2 100644 --- a/third_party/blink/renderer/core/url/url_search_params.idl +++ b/third_party/blink/renderer/core/url/url_search_params.idl @@ -9,10 +9,10 @@ ] interface URLSearchParams { [RaisesException] constructor(optional (sequence> or record or USVString) init = ""); void append(USVString name, USVString value); - [ImplementedAs=deleteAllWithName] void delete(USVString name); + [ImplementedAs=deleteAllWithName, CallWith=ExecutionContext] void delete(USVString name, optional any ignored); USVString? get(USVString name); sequence getAll(USVString name); - boolean has(USVString name); + [CallWith=ExecutionContext] boolean has(USVString name, optional any ignored); void set(USVString name, USVString value); void sort(); diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 8c9479b1657b3..6a3b6cb5aacb2 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml @@ -42357,6 +42357,7 @@ Called by update_use_counter_feature_enum.py.--> +