#include "third_party/blink/renderer/core/url_pattern/url_pattern.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_util.h"
#include "third_party/blink/public/common/safe_url_pattern.h"
#include "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_urlpattern_urlpatterninit_usvstring.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_urlpatterninit_usvstring.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_url_pattern_component_result.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_url_pattern_init.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_url_pattern_options.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_url_pattern_result.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/web_feature.h"
#include "third_party/blink/renderer/core/url_pattern/url_pattern_canon.h"
#include "third_party/blink/renderer/core/url_pattern/url_pattern_component.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/script_regexp.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
#include "third_party/blink/renderer/platform/wtf/text/string_to_number.h"
#include "third_party/blink/renderer/platform/wtf/text/string_utf8_adaptor.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "third_party/liburlpattern/constructor_string_parser.h"
#include "third_party/liburlpattern/pattern.h"
#include "third_party/liburlpattern/tokenize.h"
#include "third_party/liburlpattern/utils.h"
namespace blink {
Component;
ValueType;
ComponentSet;
namespace {
bool IsAbsolutePathname(const String& pathname, ValueType type) { … }
bool IsProtocolDefaultPort(const String& protocol, const String& port) { … }
String EscapeBaseURLString(const String& input, ValueType type) { … }
void ApplyInit(const URLPatternInit* init,
ValueType type,
String& protocol,
String& username,
String& password,
String& hostname,
String& port,
String& pathname,
String& search,
String& hash,
ExceptionState& exception_state) { … }
URLPatternComponentResult* MakeURLPatternComponentResult(
ScriptState* script_state,
const String& input,
const Vector<std::pair<String, String>>& group_values) { … }
URLPatternInit* MakeURLPatternInit(
const liburlpattern::ConstructorStringParser::Result& result) { … }
ComponentSet ToURLPatternComponentSet(
const liburlpattern::ConstructorStringParser::ComponentSet&
present_components) { … }
}
URLPattern* URLPattern::From(v8::Isolate* isolate,
const V8URLPatternCompatible* compatible,
const KURL& base_url,
ExceptionState& exception_state) { … }
URLPattern* URLPattern::Create(v8::Isolate* isolate,
const V8URLPatternInput* input,
const String& base_url,
const URLPatternOptions* options,
ExceptionState& exception_state) { … }
URLPattern* URLPattern::Create(v8::Isolate* isolate,
const V8URLPatternInput* input,
const String& base_url,
ExceptionState& exception_state) { … }
URLPattern* URLPattern::Create(v8::Isolate* isolate,
const V8URLPatternInput* input,
const URLPatternOptions* options,
ExceptionState& exception_state) { … }
URLPattern* URLPattern::Create(v8::Isolate* isolate,
const V8URLPatternInput* input,
ExceptionState& exception_state) { … }
URLPattern* URLPattern::Create(v8::Isolate* isolate,
const URLPatternInit* init,
Component* precomputed_protocol_component,
const URLPatternOptions* options,
ExceptionState& exception_state) { … }
URLPattern::URLPattern(Component* protocol,
Component* username,
Component* password,
Component* hostname,
Component* port,
Component* pathname,
Component* search,
Component* hash,
Options options,
base::PassKey<URLPattern> key)
: … { … }
bool URLPattern::test(ScriptState* script_state,
const V8URLPatternInput* input,
const String& base_url,
ExceptionState& exception_state) const { … }
bool URLPattern::test(ScriptState* script_state,
const V8URLPatternInput* input,
ExceptionState& exception_state) const { … }
URLPatternResult* URLPattern::exec(ScriptState* script_state,
const V8URLPatternInput* input,
const String& base_url,
ExceptionState& exception_state) const { … }
URLPatternResult* URLPattern::exec(ScriptState* script_state,
const V8URLPatternInput* input,
ExceptionState& exception_state) const { … }
String URLPattern::protocol() const { … }
String URLPattern::username() const { … }
String URLPattern::password() const { … }
String URLPattern::hostname() const { … }
String URLPattern::port() const { … }
String URLPattern::pathname() const { … }
String URLPattern::search() const { … }
String URLPattern::hash() const { … }
bool URLPattern::hasRegExpGroups() const { … }
int URLPattern::compareComponent(const V8URLPatternComponent& component,
const URLPattern* left,
const URLPattern* right) { … }
std::optional<SafeUrlPattern> URLPattern::ToSafeUrlPattern(
ExceptionState& exception_state) const { … }
String URLPattern::ToString() const { … }
void URLPattern::Trace(Visitor* visitor) const { … }
bool URLPattern::Match(ScriptState* script_state,
const V8URLPatternInput* input,
const String& base_url,
URLPatternResult* result,
ExceptionState& exception_state) const { … }
}