String NavigatorContentUtils::isProtocolHandlerRegistered(Navigator& navigator, const String& scheme, const String& url, ExceptionCode& ec) { static NeverDestroyed<String> declined(ASCIILiteral("declined")); if (!navigator.frame()) return declined; URL baseURL = navigator.frame()->document()->baseURL(); if (!verifyCustomHandlerURL(baseURL, url, ec)) return declined; if (!verifyProtocolHandlerScheme(scheme, ec)) return declined; return customHandlersStateString(NavigatorContentUtils::from(navigator.frame()->page())->client()->isProtocolHandlerRegistered(scheme, baseURL, URL(ParsedURLString, url))); }
ExceptionOr<String> NavigatorContentUtils::isProtocolHandlerRegistered(Navigator& navigator, const String& scheme, const String& url) { static NeverDestroyed<String> declined(MAKE_STATIC_STRING_IMPL("declined")); if (!navigator.frame()) return String { declined }; URL baseURL = navigator.frame()->document()->baseURL(); if (!verifyCustomHandlerURL(baseURL, url)) return Exception { SyntaxError }; if (!verifyProtocolHandlerScheme(scheme)) return Exception { SecurityError }; return customHandlersStateString(NavigatorContentUtils::from(navigator.frame()->page())->client()->isProtocolHandlerRegistered(scheme, baseURL, URL({ }, url))); }
String NavigatorContentUtils::isProtocolHandlerRegistered(Navigator* navigator, const String& scheme, const String& url, ExceptionCode& ec) { DEFINE_STATIC_LOCAL(const String, declined, ("declined")); if (!navigator->frame()) return declined; Document* document = navigator->frame()->document(); String baseURL = document->baseURL().baseAsString(); if (!verifyCustomHandlerURL(baseURL, url, ec)) return declined; if (!verifyProtocolHandlerScheme(scheme, ec)) return declined; return customHandlersStateString(NavigatorContentUtils::from(navigator->frame()->page())->client()->isProtocolHandlerRegistered(scheme, baseURL, url)); }