diff options
Diffstat (limited to 'Userland/Libraries')
15 files changed, 24 insertions, 24 deletions
diff --git a/Userland/Libraries/LibVT/TerminalWidget.cpp b/Userland/Libraries/LibVT/TerminalWidget.cpp index b96829ec59..c7a8b1e272 100644 --- a/Userland/Libraries/LibVT/TerminalWidget.cpp +++ b/Userland/Libraries/LibVT/TerminalWidget.cpp @@ -1145,7 +1145,7 @@ void TerminalWidget::drop_event(GUI::DropEvent& event) if (!first) send_non_user_input(" "sv.bytes()); - if (url.protocol() == "file") + if (url.scheme() == "file") send_non_user_input(url.path().bytes()); else send_non_user_input(url.to_string().bytes()); diff --git a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp index 037b7775cc..86b7eca376 100644 --- a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp +++ b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp @@ -204,7 +204,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::protocol_getter) // FIXME: 1. If this's relevant Document is non-null and its origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException. // 2. Return this's url's scheme, followed by ":". - return JS::js_string(vm, String::formatted("{}:", location_object->url().protocol())); + return JS::js_string(vm, String::formatted("{}:", location_object->url().scheme())); } // https://html.spec.whatwg.org/multipage/history.html#dom-location-port diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index f1ac365edd..dcd3d6b8a4 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -1383,7 +1383,7 @@ void StyleComputer::load_fonts_from_sheet(CSSStyleSheet const& sheet) if (!source.url.is_valid()) continue; - if (source.url.protocol() != "data") { + if (source.url.scheme() != "data") { auto path = source.url.path(); if (!path.ends_with(".woff"sv, AK::CaseSensitivity::CaseInsensitive) && !path.ends_with(".ttf"sv, AK::CaseSensitivity::CaseInsensitive)) { diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp index d3c3af2ab2..18cbdbdcfd 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp +++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp @@ -56,7 +56,7 @@ static HTML::Origin url_origin(AK::URL const& url) if (url.scheme() == "file"sv) { // Unfortunate as it is, this is left as an exercise to the reader. When in doubt, return a new opaque origin. // Note: We must return an origin with the `file://' protocol for `file://' iframes to work from `file://' pages. - return HTML::Origin(url.protocol(), String(), 0); + return HTML::Origin(url.scheme(), String(), 0); } return HTML::Origin {}; diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.cpp index fecd1788c1..6ddbad68e9 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.cpp +++ b/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.cpp @@ -168,7 +168,7 @@ void BrowsingContextContainer::shared_attribute_processing_steps_for_iframe_and_ // FIXME: Set the referrer policy. // AD-HOC: - if (url.protocol() == "file" && document().origin().protocol() != "file") { + if (url.scheme() == "file" && document().origin().protocol() != "file") { dbgln("iframe failed to load URL: Security violation: {} may not load {}", document().url(), url); return; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp index 9599f9390f..3a16a49cae 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp @@ -96,8 +96,8 @@ void HTMLFormElement::submit_form(JS::GCPtr<HTMLElement> submitter, bool from_su return; } - if (url.protocol() == "file") { - if (document().url().protocol() != "file") { + if (url.scheme() == "file") { + if (document().url().scheme() != "file") { dbgln("Failed to submit form: Security violation: {} may not submit to {}", document().url(), url); return; } @@ -105,7 +105,7 @@ void HTMLFormElement::submit_form(JS::GCPtr<HTMLElement> submitter, bool from_su dbgln("Failed to submit form: Unsupported form method '{}' for URL: {}", method(), url); return; } - } else if (url.protocol() != "http" && url.protocol() != "https") { + } else if (url.scheme() != "http" && url.scheme() != "https") { dbgln("Failed to submit form: Unsupported protocol for URL: {}", url); return; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp index 34fda75a53..34ba6df919 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp @@ -117,7 +117,7 @@ void HTMLIFrameElement::load_src(String const& value) dbgln("iframe failed to load URL: Invalid URL: {}", value); return; } - if (url.protocol() == "file" && document().origin().protocol() != "file") { + if (url.scheme() == "file" && document().origin().protocol() != "file") { dbgln("iframe failed to load URL: Security violation: {} may not load {}", document().url(), url); return; } diff --git a/Userland/Libraries/LibWeb/Loader/ContentFilter.cpp b/Userland/Libraries/LibWeb/Loader/ContentFilter.cpp index adce6815a4..8a2c191773 100644 --- a/Userland/Libraries/LibWeb/Loader/ContentFilter.cpp +++ b/Userland/Libraries/LibWeb/Loader/ContentFilter.cpp @@ -21,7 +21,7 @@ ContentFilter::~ContentFilter() = default; bool ContentFilter::is_filtered(const AK::URL& url) const { - if (url.protocol() == "data") + if (url.scheme() == "data") return false; auto url_string = url.to_string(); diff --git a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp index d45e90a8eb..dd1f74a67e 100644 --- a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp +++ b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp @@ -242,9 +242,9 @@ bool FrameLoader::load(LoadRequest& request, Type type) if (document && document->has_active_favicon()) return true; - if (url.protocol() == "http" || url.protocol() == "https") { + if (url.scheme() == "http" || url.scheme() == "https") { AK::URL favicon_url; - favicon_url.set_protocol(url.protocol()); + favicon_url.set_scheme(url.scheme()); favicon_url.set_host(url.host()); favicon_url.set_port(url.port_or_default()); favicon_url.set_paths({ "favicon.ico" }); diff --git a/Userland/Libraries/LibWeb/Loader/Resource.cpp b/Userland/Libraries/LibWeb/Loader/Resource.cpp index 931c1327da..cc28cfae05 100644 --- a/Userland/Libraries/LibWeb/Loader/Resource.cpp +++ b/Userland/Libraries/LibWeb/Loader/Resource.cpp @@ -105,7 +105,7 @@ void Resource::did_load(Badge<ResourceLoader>, ReadonlyBytes data, HashMap<Strin // Let's use image/x-qoi for now, which is also what our Core::MimeData uses & would guess. if (m_mime_type == "application/octet-stream" && url().path().ends_with(".qoi"sv)) m_mime_type = "image/x-qoi"; - } else if (url().protocol() == "data" && !url().data_mime_type().is_empty()) { + } else if (url().scheme() == "data" && !url().data_mime_type().is_empty()) { dbgln_if(RESOURCE_DEBUG, "This is a data URL with mime-type _{}_", url().data_mime_type()); m_mime_type = url().data_mime_type(); } else { diff --git a/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp b/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp index d562506ac6..e5cf0a6d98 100644 --- a/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp +++ b/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp @@ -87,7 +87,7 @@ RefPtr<Resource> ResourceLoader::load_resource(Resource::Type type, LoadRequest& if (!request.is_valid()) return nullptr; - bool use_cache = request.url().protocol() != "file"; + bool use_cache = request.url().scheme() != "file"; if (use_cache) { auto it = s_resource_cache.find(request); @@ -120,7 +120,7 @@ RefPtr<Resource> ResourceLoader::load_resource(Resource::Type type, LoadRequest& static String sanitized_url_for_logging(AK::URL const& url) { - if (url.protocol() == "data"sv) + if (url.scheme() == "data"sv) return String::formatted("[data URL, mime-type={}, size={}]", url.data_mime_type(), url.data_payload().length()); return url.to_string(); } @@ -172,7 +172,7 @@ void ResourceLoader::load(LoadRequest& request, Function<void(ReadonlyBytes, Has return; } - if (url.protocol() == "about") { + if (url.scheme() == "about") { dbgln_if(SPAM_DEBUG, "Loading about: URL {}", url); log_success(request); @@ -185,7 +185,7 @@ void ResourceLoader::load(LoadRequest& request, Function<void(ReadonlyBytes, Has return; } - if (url.protocol() == "data") { + if (url.scheme() == "data") { dbgln_if(SPAM_DEBUG, "ResourceLoader loading a data URL with mime-type: '{}', base64={}, payload='{}'", url.data_mime_type(), url.data_payload_is_base64(), @@ -212,7 +212,7 @@ void ResourceLoader::load(LoadRequest& request, Function<void(ReadonlyBytes, Has return; } - if (url.protocol() == "file") { + if (url.scheme() == "file") { if (request.page().has_value()) m_page = request.page().value(); @@ -263,7 +263,7 @@ void ResourceLoader::load(LoadRequest& request, Function<void(ReadonlyBytes, Has return; } - if (url.protocol() == "http" || url.protocol() == "https" || url.protocol() == "gemini") { + if (url.scheme() == "http" || url.scheme() == "https" || url.scheme() == "gemini") { auto proxy = ProxyMappings::the().proxy_for_url(url); HashMap<String, String> headers; @@ -326,7 +326,7 @@ void ResourceLoader::load(LoadRequest& request, Function<void(ReadonlyBytes, Has return; } - auto not_implemented_error = String::formatted("Protocol not implemented: {}", url.protocol()); + auto not_implemented_error = String::formatted("Protocol not implemented: {}", url.scheme()); log_failure(request, not_implemented_error); if (error_callback) error_callback(not_implemented_error, {}); diff --git a/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp b/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp index 594a26bcce..39596604f4 100644 --- a/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp +++ b/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp @@ -52,7 +52,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<WebSocket>> WebSocket::create_with_global_o AK::URL url_record(url); if (!url_record.is_valid()) return WebIDL::SyntaxError::create(window, "Invalid URL"); - if (!url_record.protocol().is_one_of("ws", "wss")) + if (!url_record.scheme().is_one_of("ws", "wss")) return WebIDL::SyntaxError::create(window, "Invalid protocol"); if (!url_record.fragment().is_empty()) return WebIDL::SyntaxError::create(window, "Presence of URL fragment is invalid"); diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp index 20240d7e46..472b1802d4 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp @@ -416,7 +416,7 @@ WebIDL::ExceptionOr<void> XMLHttpRequest::send(Optional<Fetch::XMLHttpRequestBod dbgln("XHR send from {} to {}", m_window->associated_document().url(), request_url); // TODO: Add support for preflight requests to support CORS requests - auto request_url_origin = HTML::Origin(request_url.protocol(), request_url.host(), request_url.port_or_default()); + auto request_url_origin = HTML::Origin(request_url.scheme(), request_url.host(), request_url.port_or_default()); bool should_enforce_same_origin_policy = true; if (auto* page = m_window->page()) diff --git a/Userland/Libraries/LibWebSocket/ConnectionInfo.cpp b/Userland/Libraries/LibWebSocket/ConnectionInfo.cpp index 5bd7864fcd..b95633d4eb 100644 --- a/Userland/Libraries/LibWebSocket/ConnectionInfo.cpp +++ b/Userland/Libraries/LibWebSocket/ConnectionInfo.cpp @@ -17,7 +17,7 @@ bool ConnectionInfo::is_secure() const { // RFC 6455 Section 3 : // The URI is called "secure" if the scheme component matches "wss" case-insensitively. - return m_url.protocol().equals_ignoring_case("wss"sv); + return m_url.scheme().equals_ignoring_case("wss"sv); } String ConnectionInfo::resource_name() const diff --git a/Userland/Libraries/LibWebView/DumpLayoutTree/main.cpp b/Userland/Libraries/LibWebView/DumpLayoutTree/main.cpp index 577c8b144b..5f28191dbf 100644 --- a/Userland/Libraries/LibWebView/DumpLayoutTree/main.cpp +++ b/Userland/Libraries/LibWebView/DumpLayoutTree/main.cpp @@ -17,7 +17,7 @@ int main(int argc, char** argv) window->resize(800, 600); window->show(); auto& web_view = window->set_main_widget<WebView::OutOfProcessWebView>(); - web_view.load(URL::create_with_file_protocol(argv[1])); + web_view.load(URL::create_with_file_scheme(argv[1])); web_view.on_load_finish = [&](auto&) { auto dump = web_view.dump_layout_tree(); write(STDOUT_FILENO, dump.characters(), dump.length() + 1); |