1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:17:46 +00:00

Everywhere: Use unqualified AK::URL

Now possible in LibWeb now that there is no longer a Web::URL.
This commit is contained in:
Shannon Booth 2024-02-11 20:15:39 +13:00 committed by Andreas Kling
parent f9e5b43b7a
commit 9ce8189f21
156 changed files with 471 additions and 471 deletions

View file

@ -19,7 +19,7 @@ ContentFilter::ContentFilter() = default;
ContentFilter::~ContentFilter() = default;
bool ContentFilter::is_filtered(const AK::URL& url) const
bool ContentFilter::is_filtered(const URL& url) const
{
if (url.scheme() == "data")
return false;

View file

@ -16,7 +16,7 @@ class ContentFilter {
public:
static ContentFilter& the();
bool is_filtered(const AK::URL&) const;
bool is_filtered(const URL&) const;
ErrorOr<void> set_patterns(ReadonlySpan<String>);
private:

View file

@ -26,7 +26,7 @@ void set_chrome_process_executable_path(StringView executable_path)
s_chrome_process_executable_path = MUST(String::from_utf8(executable_path));
}
ErrorOr<String> load_error_page(AK::URL const& url)
ErrorOr<String> load_error_page(URL const& url)
{
// Generate HTML error page from error template file
// FIXME: Use an actual templating engine (our own one when it's built, preferably with a way to check these usages at compile time)
@ -38,7 +38,7 @@ ErrorOr<String> load_error_page(AK::URL const& url)
return TRY(String::from_utf8(generator.as_string_view()));
}
ErrorOr<String> load_file_directory_page(AK::URL const& url)
ErrorOr<String> load_file_directory_page(URL const& url)
{
// Generate HTML contents entries table
auto lexical_path = LexicalPath(url.serialize_path());

View file

@ -17,9 +17,9 @@ static String s_chrome_process_executable_path {};
void set_chrome_process_command_line(StringView command_line);
void set_chrome_process_executable_path(StringView executable_path);
ErrorOr<String> load_error_page(AK::URL const&);
ErrorOr<String> load_error_page(URL const&);
ErrorOr<String> load_file_directory_page(AK::URL const&);
ErrorOr<String> load_file_directory_page(URL const&);
ErrorOr<String> load_about_version_page();

View file

@ -10,7 +10,7 @@
namespace Web {
LoadRequest LoadRequest::create_for_url_on_page(const AK::URL& url, Page* page)
LoadRequest LoadRequest::create_for_url_on_page(const URL& url, Page* page)
{
LoadRequest request;
request.set_url(url);

View file

@ -22,7 +22,7 @@ public:
{
}
static LoadRequest create_for_url_on_page(const AK::URL& url, Page* page);
static LoadRequest create_for_url_on_page(const URL& url, Page* page);
// The main resource is the file being displayed in a frame (unlike subresources like images, scripts, etc.)
// If a main resource fails with an HTTP error, we may still display its content if non-empty, e.g a custom 404 page.
@ -31,8 +31,8 @@ public:
bool is_valid() const { return m_url.is_valid(); }
const AK::URL& url() const { return m_url; }
void set_url(const AK::URL& url) { m_url = url; }
const URL& url() const { return m_url; }
void set_url(const URL& url) { m_url = url; }
ByteString const& method() const { return m_method; }
void set_method(ByteString const& method) { m_method = method; }
@ -74,7 +74,7 @@ public:
HashMap<ByteString, ByteString, CaseInsensitiveStringTraits> const& headers() const { return m_headers; }
private:
AK::URL m_url;
URL m_url;
ByteString m_method { "GET" };
HashMap<ByteString, ByteString, CaseInsensitiveStringTraits> m_headers;
ByteBuffer m_body;

View file

@ -12,7 +12,7 @@ Web::ProxyMappings& Web::ProxyMappings::the()
return instance;
}
Core::ProxyData Web::ProxyMappings::proxy_for_url(AK::URL const& url) const
Core::ProxyData Web::ProxyMappings::proxy_for_url(URL const& url) const
{
auto url_string = url.to_byte_string();
for (auto& it : m_mappings) {

View file

@ -17,7 +17,7 @@ class ProxyMappings {
public:
static ProxyMappings& the();
Core::ProxyData proxy_for_url(AK::URL const&) const;
Core::ProxyData proxy_for_url(URL const&) const;
void set_mappings(Vector<ByteString> proxies, OrderedHashMap<ByteString, size_t> mappings);
private:

View file

@ -50,7 +50,7 @@ public:
bool has_encoded_data() const { return !m_encoded_data.is_empty(); }
const AK::URL& url() const { return m_request.url(); }
const URL& url() const { return m_request.url(); }
ByteBuffer const& encoded_data() const { return m_encoded_data; }
HashMap<ByteString, ByteString, CaseInsensitiveStringTraits> const& response_headers() const { return m_response_headers; }

View file

@ -65,7 +65,7 @@ ResourceLoader::ResourceLoader(NonnullRefPtr<ResourceLoaderConnector> connector)
{
}
void ResourceLoader::prefetch_dns(AK::URL const& url)
void ResourceLoader::prefetch_dns(URL const& url)
{
if (ContentFilter::the().is_filtered(url)) {
dbgln("ResourceLoader: Refusing to prefetch DNS for '{}': \033[31;1mURL was filtered\033[0m", url);
@ -75,7 +75,7 @@ void ResourceLoader::prefetch_dns(AK::URL const& url)
m_connector->prefetch_dns(url);
}
void ResourceLoader::preconnect(AK::URL const& url)
void ResourceLoader::preconnect(URL const& url)
{
if (url.scheme().is_one_of("file"sv, "data"sv))
return;
@ -126,7 +126,7 @@ RefPtr<Resource> ResourceLoader::load_resource(Resource::Type type, LoadRequest&
return resource;
}
static ByteString sanitized_url_for_logging(AK::URL const& url)
static ByteString sanitized_url_for_logging(URL const& url)
{
if (url.scheme() == "data"sv)
return "[data URL]"sv;
@ -144,7 +144,7 @@ static void emit_signpost(ByteString const& message, int id)
#endif
}
static void store_response_cookies(Page& page, AK::URL const& url, ByteString const& cookies)
static void store_response_cookies(Page& page, URL const& url, ByteString const& cookies)
{
auto set_cookie_json_value = MUST(JsonValue::from_string(cookies));
VERIFY(set_cookie_json_value.type() == JsonValue::Type::Array);
@ -196,7 +196,7 @@ void ResourceLoader::load(LoadRequest& request, SuccessCallback success_callback
dbgln("ResourceLoader: Failed load of: \"{}\", \033[31;1mError: {}\033[0m, Duration: {}ms", url_for_logging, error_message, load_time_ms);
};
auto respond_directory_page = [log_success, log_failure](LoadRequest const& request, AK::URL const& url, SuccessCallback const& success_callback, ErrorCallback const& error_callback) {
auto respond_directory_page = [log_success, log_failure](LoadRequest const& request, URL const& url, SuccessCallback const& success_callback, ErrorCallback const& error_callback) {
auto maybe_response = load_file_directory_page(url);
if (maybe_response.is_error()) {
log_failure(request, maybe_response.error());

View file

@ -91,10 +91,10 @@ class ResourceLoaderConnector : public RefCounted<ResourceLoaderConnector> {
public:
virtual ~ResourceLoaderConnector();
virtual void prefetch_dns(AK::URL const&) = 0;
virtual void preconnect(AK::URL const&) = 0;
virtual void prefetch_dns(URL const&) = 0;
virtual void preconnect(URL const&) = 0;
virtual RefPtr<ResourceLoaderConnectorRequest> start_request(ByteString const& method, AK::URL const&, HashMap<ByteString, ByteString> const& request_headers = {}, ReadonlyBytes request_body = {}, Core::ProxyData const& = {}) = 0;
virtual RefPtr<ResourceLoaderConnectorRequest> start_request(ByteString const& method, URL const&, HashMap<ByteString, ByteString> const& request_headers = {}, ReadonlyBytes request_body = {}, Core::ProxyData const& = {}) = 0;
protected:
explicit ResourceLoaderConnector();
@ -116,8 +116,8 @@ public:
ResourceLoaderConnector& connector() { return *m_connector; }
void prefetch_dns(AK::URL const&);
void preconnect(AK::URL const&);
void prefetch_dns(URL const&);
void preconnect(URL const&);
Function<void()> on_load_counter_change;