summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-09-13 00:33:23 +0300
committerAndreas Kling <kling@serenityos.org>2021-09-13 01:43:10 +0200
commit4629f2e4ad0640087d48e9e427e117620b09d7e8 (patch)
tree55f77b9b91c9dba677a7fd7e4b512fc75a49f27b /Userland/Libraries/LibWeb
parent2b78e227f2bba96ebdf10f5aa0a83e0c9fd022cb (diff)
downloadserenity-4629f2e4ad0640087d48e9e427e117620b09d7e8.zip
LibWeb: Add the Web::URL namespace and move URLEncoder to it
This namespace will be used for all interfaces defined in the URL specification, like URL and URLSearchParams. This has the unfortunate side-effect of requiring us to use the fully qualified AK::URL name whenever we want to refer to the AK class, so this commit also fixes all such references.
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/CMakeLists.txt2
-rw-r--r--Userland/Libraries/LibWeb/CSS/CSSImportRule.cpp2
-rw-r--r--Userland/Libraries/LibWeb/CSS/CSSImportRule.h8
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp8
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.h4
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleValue.cpp2
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleValue.h6
-rw-r--r--Userland/Libraries/LibWeb/DOM/Document.cpp4
-rw-r--r--Userland/Libraries/LibWeb/DOM/Document.h12
-rw-r--r--Userland/Libraries/LibWeb/DOM/Window.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOM/Window.h2
-rw-r--r--Userland/Libraries/LibWeb/Forward.h3
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp10
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp4
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp4
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.h4
-rw-r--r--Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp4
-rw-r--r--Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.h4
-rw-r--r--Userland/Libraries/LibWeb/HTML/Scripting/Script.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/Scripting/Script.h6
-rw-r--r--Userland/Libraries/LibWeb/HTML/WebSocket.cpp6
-rw-r--r--Userland/Libraries/LibWeb/HTML/WebSocket.h8
-rw-r--r--Userland/Libraries/LibWeb/InProcessWebView.cpp24
-rw-r--r--Userland/Libraries/LibWeb/InProcessWebView.h24
-rw-r--r--Userland/Libraries/LibWeb/Loader/CSSLoader.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Loader/CSSLoader.h2
-rw-r--r--Userland/Libraries/LibWeb/Loader/ContentFilter.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Loader/ContentFilter.h2
-rw-r--r--Userland/Libraries/LibWeb/Loader/FrameLoader.cpp8
-rw-r--r--Userland/Libraries/LibWeb/Loader/FrameLoader.h6
-rw-r--r--Userland/Libraries/LibWeb/Loader/ImageLoader.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Loader/ImageLoader.h2
-rw-r--r--Userland/Libraries/LibWeb/Loader/LoadRequest.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Loader/LoadRequest.h8
-rw-r--r--Userland/Libraries/LibWeb/Loader/Resource.h2
-rw-r--r--Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Loader/ResourceLoader.h2
-rw-r--r--Userland/Libraries/LibWeb/OutOfProcessWebView.cpp24
-rw-r--r--Userland/Libraries/LibWeb/OutOfProcessWebView.h28
-rw-r--r--Userland/Libraries/LibWeb/Page/BrowsingContext.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Page/BrowsingContext.h10
-rw-r--r--Userland/Libraries/LibWeb/Page/Page.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Page/Page.h22
-rw-r--r--Userland/Libraries/LibWeb/URL/URL.cpp27
-rw-r--r--Userland/Libraries/LibWeb/URL/URL.h21
-rw-r--r--Userland/Libraries/LibWeb/URLEncoder.cpp26
-rw-r--r--Userland/Libraries/LibWeb/URLEncoder.h21
-rw-r--r--Userland/Libraries/LibWeb/WebContentClient.cpp20
-rw-r--r--Userland/Libraries/LibWeb/WebContentClient.h20
-rw-r--r--Userland/Libraries/LibWeb/WebViewHooks.h22
-rw-r--r--Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp2
-rw-r--r--Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h2
53 files changed, 228 insertions, 224 deletions
diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt
index 3bd037fe22..117f81f447 100644
--- a/Userland/Libraries/LibWeb/CMakeLists.txt
+++ b/Userland/Libraries/LibWeb/CMakeLists.txt
@@ -230,7 +230,7 @@ set(SOURCES
StylePropertiesModel.cpp
UIEvents/EventNames.cpp
UIEvents/MouseEvent.cpp
- URLEncoder.cpp
+ URL/URL.cpp
WebAssembly/WebAssemblyInstanceConstructor.cpp
WebAssembly/WebAssemblyInstanceObject.cpp
WebAssembly/WebAssemblyInstanceObjectPrototype.cpp
diff --git a/Userland/Libraries/LibWeb/CSS/CSSImportRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSImportRule.cpp
index 0c75ed71ca..bb7a009425 100644
--- a/Userland/Libraries/LibWeb/CSS/CSSImportRule.cpp
+++ b/Userland/Libraries/LibWeb/CSS/CSSImportRule.cpp
@@ -10,7 +10,7 @@
namespace Web::CSS {
-CSSImportRule::CSSImportRule(URL url)
+CSSImportRule::CSSImportRule(AK::URL url)
: m_url(move(url))
{
}
diff --git a/Userland/Libraries/LibWeb/CSS/CSSImportRule.h b/Userland/Libraries/LibWeb/CSS/CSSImportRule.h
index cd3cc32b81..839555a5da 100644
--- a/Userland/Libraries/LibWeb/CSS/CSSImportRule.h
+++ b/Userland/Libraries/LibWeb/CSS/CSSImportRule.h
@@ -16,14 +16,14 @@ class CSSImportRule : public CSSRule {
AK_MAKE_NONMOVABLE(CSSImportRule);
public:
- static NonnullRefPtr<CSSImportRule> create(URL url)
+ static NonnullRefPtr<CSSImportRule> create(AK::URL url)
{
return adopt_ref(*new CSSImportRule(move(url)));
}
~CSSImportRule();
- const URL& url() const { return m_url; }
+ const AK::URL& url() const { return m_url; }
bool has_import_result() const { return !m_style_sheet.is_null(); }
RefPtr<CSSStyleSheet> loaded_style_sheet() { return m_style_sheet; }
@@ -34,9 +34,9 @@ public:
virtual Type type() const { return Type::Import; };
private:
- explicit CSSImportRule(URL);
+ explicit CSSImportRule(AK::URL);
- URL m_url;
+ AK::URL m_url;
RefPtr<CSSStyleSheet> m_style_sheet;
};
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
index a8bd5a767c..cd1372985f 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
@@ -50,9 +50,9 @@ bool ParsingContext::in_quirks_mode() const
return m_document ? m_document->in_quirks_mode() : false;
}
-URL ParsingContext::complete_url(String const& addr) const
+AK::URL ParsingContext::complete_url(String const& addr) const
{
- return m_document ? m_document->url().complete_url(addr) : URL::create_with_url_or_path(addr);
+ return m_document ? m_document->url().complete_url(addr) : AK::URL::create_with_url_or_path(addr);
}
template<typename T>
@@ -1159,7 +1159,7 @@ Vector<Vector<StyleComponentValueRule>> Parser::parse_a_comma_separated_list_of_
return lists;
}
-Optional<URL> Parser::parse_url_function(ParsingContext const& context, StyleComponentValueRule const& component_value)
+Optional<AK::URL> Parser::parse_url_function(ParsingContext const& context, StyleComponentValueRule const& component_value)
{
// FIXME: Handle list of media queries. https://www.w3.org/TR/css-cascade-3/#conditional-import
// FIXME: Handle data: urls (RFC2397)
@@ -1201,7 +1201,7 @@ RefPtr<CSSRule> Parser::convert_to_rule(NonnullRefPtr<StyleRule> rule)
return {};
} else if (rule->m_name.equals_ignoring_case("import"sv) && !rule->prelude().is_empty()) {
- Optional<URL> url;
+ Optional<AK::URL> url;
for (auto& token : rule->prelude()) {
if (token.is(Token::Type::Whitespace))
continue;
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h
index a343f5c711..3777251f48 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h
@@ -38,7 +38,7 @@ public:
bool in_quirks_mode() const;
DOM::Document* document() const { return m_document; }
- URL complete_url(String const&) const;
+ AK::URL complete_url(String const&) const;
PropertyID current_property_id() const { return m_current_property_id; }
void set_current_property_id(PropertyID property_id) { m_current_property_id = property_id; }
@@ -172,7 +172,7 @@ private:
static Optional<float> try_parse_float(StringView string);
static Optional<Color> parse_color(ParsingContext const&, StyleComponentValueRule const&);
static Optional<Length> parse_length(ParsingContext const&, StyleComponentValueRule const&);
- static Optional<URL> parse_url_function(ParsingContext const&, StyleComponentValueRule const&);
+ static Optional<AK::URL> parse_url_function(ParsingContext const&, StyleComponentValueRule const&);
Result<NonnullRefPtr<StyleValue>, ParsingResult> parse_css_value(PropertyID, TokenStream<StyleComponentValueRule>&);
static RefPtr<StyleValue> parse_css_value(ParsingContext const&, StyleComponentValueRule const&);
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp
index 8f462166ce..481de75603 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp
@@ -152,7 +152,7 @@ Color IdentifierStyleValue::to_color(const DOM::Document& document) const
}
}
-ImageStyleValue::ImageStyleValue(const URL& url, DOM::Document& document)
+ImageStyleValue::ImageStyleValue(const AK::URL& url, DOM::Document& document)
: StyleValue(Type::Image)
, m_url(url)
, m_document(document)
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValue.h
index b8a7219108..bba3b18f3d 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleValue.h
+++ b/Userland/Libraries/LibWeb/CSS/StyleValue.h
@@ -651,7 +651,7 @@ class ImageStyleValue final
: public StyleValue
, public ImageResourceClient {
public:
- static NonnullRefPtr<ImageStyleValue> create(const URL& url, DOM::Document& document) { return adopt_ref(*new ImageStyleValue(url, document)); }
+ static NonnullRefPtr<ImageStyleValue> create(const AK::URL& url, DOM::Document& document) { return adopt_ref(*new ImageStyleValue(url, document)); }
virtual ~ImageStyleValue() override { }
String to_string() const override { return String::formatted("Image({})", m_url.to_string()); }
@@ -659,12 +659,12 @@ public:
const Gfx::Bitmap* bitmap() const { return m_bitmap; }
private:
- ImageStyleValue(const URL&, DOM::Document&);
+ ImageStyleValue(const AK::URL&, DOM::Document&);
// ^ResourceClient
virtual void resource_did_load() override;
- URL m_url;
+ AK::URL m_url;
WeakPtr<DOM::Document> m_document;
RefPtr<Gfx::Bitmap> m_bitmap;
};
diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp
index a6b1c4c856..0a26a2f214 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Document.cpp
@@ -57,7 +57,7 @@
namespace Web::DOM {
-Document::Document(const URL& url)
+Document::Document(const AK::URL& url)
: ParentNode(*this, NodeType::DOCUMENT_NODE)
, m_style_resolver(make<CSS::StyleResolver>(*this))
, m_style_sheets(CSS::StyleSheetList::create(*this))
@@ -383,7 +383,7 @@ CSS::Repeat Document::background_repeat_y() const
}
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#parse-a-url
-URL Document::parse_url(String const& url) const
+AK::URL Document::parse_url(String const& url) const
{
// FIXME: Make sure we do this according to spec.
return m_url.complete_url(url);
diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h
index 91970e4e4c..099f199795 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.h
+++ b/Userland/Libraries/LibWeb/DOM/Document.h
@@ -45,7 +45,7 @@ class Document
public:
using WrapperType = Bindings::DocumentWrapper;
- static NonnullRefPtr<Document> create(const URL& url = "about:blank")
+ static NonnullRefPtr<Document> create(const AK::URL& url = "about:blank")
{
return adopt_ref(*new Document(url));
}
@@ -64,15 +64,15 @@ public:
bool should_invalidate_styles_on_attribute_changes() const { return m_should_invalidate_styles_on_attribute_changes; }
void set_should_invalidate_styles_on_attribute_changes(bool b) { m_should_invalidate_styles_on_attribute_changes = b; }
- void set_url(const URL& url) { m_url = url; }
- URL url() const { return m_url; }
+ void set_url(const AK::URL& url) { m_url = url; }
+ AK::URL url() const { return m_url; }
Origin origin() const;
void set_origin(const Origin& origin);
bool is_scripting_enabled() const { return true; }
- URL parse_url(String const&) const;
+ AK::URL parse_url(String const&) const;
CSS::StyleResolver& style_resolver() { return *m_style_resolver; }
const CSS::StyleResolver& style_resolver() const { return *m_style_resolver; }
@@ -282,7 +282,7 @@ public:
Bindings::LocationObject* location();
private:
- explicit Document(const URL&);
+ explicit Document(const AK::URL&);
// ^DOM::Node
virtual RefPtr<Layout::Node> create_layout_node() override;
@@ -316,7 +316,7 @@ private:
RefPtr<Node> m_hovered_node;
RefPtr<Node> m_inspected_node;
WeakPtr<BrowsingContext> m_browsing_context;
- URL m_url;
+ AK::URL m_url;
RefPtr<Window> m_window;
diff --git a/Userland/Libraries/LibWeb/DOM/Window.cpp b/Userland/Libraries/LibWeb/DOM/Window.cpp
index 8af72c6418..8202ed9825 100644
--- a/Userland/Libraries/LibWeb/DOM/Window.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Window.cpp
@@ -138,7 +138,7 @@ void Window::cancel_animation_frame(i32 id)
GUI::DisplayLink::unregister_callback(id);
}
-void Window::did_set_location_href(Badge<Bindings::LocationObject>, URL const& new_href)
+void Window::did_set_location_href(Badge<Bindings::LocationObject>, AK::URL const& new_href)
{
auto* frame = associated_document().browsing_context();
if (!frame)
diff --git a/Userland/Libraries/LibWeb/DOM/Window.h b/Userland/Libraries/LibWeb/DOM/Window.h
index fb646f541c..36f5fecb5c 100644
--- a/Userland/Libraries/LibWeb/DOM/Window.h
+++ b/Userland/Libraries/LibWeb/DOM/Window.h
@@ -54,7 +54,7 @@ public:
int inner_width() const;
int inner_height() const;
- void did_set_location_href(Badge<Bindings::LocationObject>, URL const& new_href);
+ void did_set_location_href(Badge<Bindings::LocationObject>, AK::URL const& new_href);
void did_call_location_reload(Badge<Bindings::LocationObject>);
Bindings::WindowObject* wrapper() { return m_wrapper; }
diff --git a/Userland/Libraries/LibWeb/Forward.h b/Userland/Libraries/LibWeb/Forward.h
index f99f71c7ed..1cdd5734b9 100644
--- a/Userland/Libraries/LibWeb/Forward.h
+++ b/Userland/Libraries/LibWeb/Forward.h
@@ -205,6 +205,9 @@ class XMLHttpRequest;
class XMLHttpRequestEventTarget;
}
+namespace Web::URL {
+}
+
namespace Web::Bindings {
class AbortControllerWrapper;
class AbortSignalWrapper;
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp
index 857887da64..cabbf54f75 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp
@@ -92,7 +92,7 @@ String HTMLCanvasElement::to_data_url(const String& type, [[maybe_unused]] Optio
if (type != "image/png")
return {};
auto encoded_bitmap = Gfx::PNGWriter::encode(*m_bitmap);
- return URL::create_with_data(type, encode_base64(encoded_bitmap), true).to_string();
+ return AK::URL::create_with_data(type, encode_base64(encoded_bitmap), true).to_string();
}
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp
index dbca33611c..5d9e3ef437 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp
@@ -12,7 +12,7 @@
#include <LibWeb/HTML/SubmitEvent.h>
#include <LibWeb/Page/BrowsingContext.h>
#include <LibWeb/Page/Page.h>
-#include <LibWeb/URLEncoder.h>
+#include <LibWeb/URL/URL.h>
namespace Web::HTML {
@@ -75,7 +75,7 @@ void HTMLFormElement::submit_form(RefPtr<HTMLElement> submitter, bool from_submi
return;
}
- URL url(document().parse_url(action()));
+ AK::URL url(document().parse_url(action()));
if (!url.is_valid()) {
dbgln("Failed to submit form: Invalid URL: {}", action());
@@ -96,7 +96,7 @@ void HTMLFormElement::submit_form(RefPtr<HTMLElement> submitter, bool from_submi
return;
}
- Vector<URLQueryParam> parameters;
+ Vector<URL::QueryParam> parameters;
for_each_in_inclusive_subtree_of_type<HTMLInputElement>([&](auto& input) {
if (!input.name().is_null() && (input.type() != "submit" || &input == submitter))
@@ -105,14 +105,14 @@ void HTMLFormElement::submit_form(RefPtr<HTMLElement> submitter, bool from_submi
});
if (effective_method == "get") {
- url.set_query(urlencode(parameters, URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded));
+ url.set_query(url_encode(parameters, AK::URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded));
}
LoadRequest request;
request.set_url(url);
if (effective_method == "post") {
- auto body = urlencode(parameters, URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded).to_byte_buffer();
+ auto body = url_encode(parameters, AK::URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded).to_byte_buffer();
request.set_method("POST");
request.set_header("Content-Type", "application/x-www-form-urlencoded");
request.set_header("Content-Length", String::number(body.size()));
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp
index 4aa8f5d205..57be9a6745 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp
@@ -304,7 +304,7 @@ void HTMLScriptElement::prepare_script()
document().interpreter();
// FIXME: This is all ad-hoc and needs work.
- auto script = ClassicScript::create(url.to_string(), data, document().interpreter().realm(), URL());
+ auto script = ClassicScript::create(url.to_string(), data, document().interpreter().realm(), AK::URL());
// When the chosen algorithm asynchronously completes, set the script's script to the result. At that time, the script is ready.
m_script = script;
@@ -331,7 +331,7 @@ void HTMLScriptElement::prepare_script()
document().interpreter();
// FIXME: Pass settings, base URL and options.
- auto script = ClassicScript::create(m_document->url().to_string(), source_text, document().interpreter().realm(), URL());
+ auto script = ClassicScript::create(m_document->url().to_string(), source_text, document().interpreter().realm(), AK::URL());
// 2. Set the script's script to script.
m_script = script;
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp
index 1d690dc92e..17324abc95 100644
--- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp
@@ -93,7 +93,7 @@ static Vector<FlyString> s_quirks_public_ids = {
"-//WebTechs//DTD Mozilla HTML//"
};
-RefPtr<DOM::Document> parse_html_document(const StringView& data, const URL& url, const String& encoding)
+RefPtr<DOM::Document> parse_html_document(const StringView& data, const AK::URL& url, const String& encoding)
{
auto document = DOM::Document::create(url);
HTMLDocumentParser parser(document, data, encoding);
@@ -116,7 +116,7 @@ HTMLDocumentParser::~HTMLDocumentParser()
m_document->set_should_invalidate_styles_on_attribute_changes(true);
}
-void HTMLDocumentParser::run(const URL& url)
+void HTMLDocumentParser::run(const AK::URL& url)
{
m_document->set_url(url);
m_document->set_source(m_tokenizer.source());
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.h b/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.h
index 3f56db98c1..5cefb17a43 100644
--- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.h
+++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.h
@@ -39,7 +39,7 @@ namespace Web::HTML {
__ENUMERATE_INSERTION_MODE(AfterAfterBody) \
__ENUMERATE_INSERTION_MODE(AfterAfterFrameset)
-RefPtr<DOM::Document> parse_html_document(const StringView&, const URL&, const String& encoding);
+RefPtr<DOM::Document> parse_html_document(const StringView&, const AK::URL&, const String& encoding);
class HTMLDocumentParser {
public:
@@ -48,7 +48,7 @@ public:
static NonnullOwnPtr<HTMLDocumentParser> create_with_uncertain_encoding(DOM::Document&, const ByteBuffer& input);
- void run(const URL&);
+ void run(const AK::URL&);
DOM::Document& document();
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp
index 4cb96d3532..da2022b2b8 100644
--- a/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp
@@ -11,7 +11,7 @@
namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/webappapis.html#creating-a-classic-script
-NonnullRefPtr<ClassicScript> ClassicScript::create(String filename, StringView source, JS::Realm& realm, URL base_url, MutedErrors muted_errors)
+NonnullRefPtr<ClassicScript> ClassicScript::create(String filename, StringView source, JS::Realm& realm, AK::URL base_url, MutedErrors muted_errors)
{
// 1. If muted errors was not provided, let it be false. (NOTE: This is taken care of by the default argument.)
@@ -65,7 +65,7 @@ JS::Value ClassicScript::run(RethrowErrors rethrow_errors)
return vm.last_value();
}
-ClassicScript::ClassicScript(URL base_url, String filename)
+ClassicScript::ClassicScript(AK::URL base_url, String filename)
: Script(move(base_url), move(filename))
{
}
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.h b/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.h
index 296b7caba5..34af98d50c 100644
--- a/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.h
+++ b/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.h
@@ -20,7 +20,7 @@ public:
No,
Yes,
};
- static NonnullRefPtr<ClassicScript> create(String filename, StringView source, JS::Realm&, URL base_url, MutedErrors = MutedErrors::No);
+ static NonnullRefPtr<ClassicScript> create(String filename, StringView source, JS::Realm&, AK::URL base_url, MutedErrors = MutedErrors::No);
JS::Script* script_record() { return m_script_record; }
JS::Script const* script_record() const { return m_script_record; }
@@ -32,7 +32,7 @@ public:
JS::Value run(RethrowErrors = RethrowErrors::No);
private:
- ClassicScript(URL base_url, String filename);
+ ClassicScript(AK::URL base_url, String filename);
RefPtr<JS::Script> m_script_record;
MutedErrors m_muted_errors { MutedErrors::No };
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/Script.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/Script.cpp
index d915e0b85a..8fcc9ddea7 100644
--- a/Userland/Libraries/LibWeb/HTML/Scripting/Script.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Scripting/Script.cpp
@@ -8,7 +8,7 @@
namespace Web::HTML {
-Script::Script(URL base_url, String filename)
+Script::Script(AK::URL base_url, String filename)
: m_base_url(move(base_url))
, m_filename(move(filename))
{
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/Script.h b/Userland/Libraries/LibWeb/HTML/Scripting/Script.h
index 10a189ccba..36f5885717 100644
--- a/Userland/Libraries/LibWeb/HTML/Scripting/Script.h
+++ b/Userland/Libraries/LibWeb/HTML/Scripting/Script.h
@@ -16,14 +16,14 @@ class Script : public RefCounted<Script> {
public:
virtual ~Script();
- URL const& base_url() const { return m_base_url; }
+ AK::URL const& base_url() const { return m_base_url; }
String const& filename() const { return m_filename; }
protected:
- Script(URL base_url, String filename);
+ Script(AK::URL base_url, String filename);
private:
- URL m_base_url;
+ AK::URL m_base_url;
String m_filename;
};
diff --git a/Userland/Libraries/LibWeb/HTML/WebSocket.cpp b/Userland/Libraries/LibWeb/HTML/WebSocket.cpp
index 59067e865a..5076ce9627 100644
--- a/Userland/Libraries/LibWeb/HTML/WebSocket.cpp
+++ b/Userland/Libraries/LibWeb/HTML/WebSocket.cpp
@@ -41,7 +41,7 @@ WebSocketClientManager::WebSocketClientManager()
{
}
-RefPtr<Protocol::WebSocket> WebSocketClientManager::connect(const URL& url)
+RefPtr<Protocol::WebSocket> WebSocketClientManager::connect(const AK::URL& url)
{
return m_websocket_client->connect(url);
}
@@ -49,7 +49,7 @@ RefPtr<Protocol::WebSocket> WebSocketClientManager::connect(const URL& url)
// https://html.spec.whatwg.org/multipage/web-sockets.html#the-websocket-interface
DOM::ExceptionOr<NonnullRefPtr<WebSocket>> WebSocket::create_with_global_object(Bindings::WindowObject& window, const String& url)
{
- URL url_record(url);
+ AK::URL url_record(url);
if (!url_record.is_valid())
return DOM::SyntaxError::create("Invalid URL");
if (!url_record.protocol().is_one_of("ws", "wss"))
@@ -61,7 +61,7 @@ DOM::ExceptionOr<NonnullRefPtr<WebSocket>> WebSocket::create_with_global_object(
return WebSocket::create(window.impl(), url_record);
}
-WebSocket::WebSocket(DOM::Window& window, URL& url)
+WebSocket::WebSocket(DOM::Window& window, AK::URL& url)
: EventTarget(static_cast<Bindings::ScriptExecutionContext&>(window.associated_document()))
, m_window(window)
{
diff --git a/Userland/Libraries/LibWeb/HTML/WebSocket.h b/Userland/Libraries/LibWeb/HTML/WebSocket.h
index 7f83d55285..d2f6e0b46f 100644
--- a/Userland/Libraries/LibWeb/HTML/WebSocket.h
+++ b/Userland/Libraries/LibWeb/HTML/WebSocket.h
@@ -35,7 +35,7 @@ class WebSocketClientManager : public Core::Object {
public:
static WebSocketClientManager& the();
- RefPtr<Protocol::WebSocket> connect(const URL&);
+ RefPtr<Protocol::WebSocket> connect(const AK::URL&);
private:
WebSocketClientManager();
@@ -57,7 +57,7 @@ public:
using WrapperType = Bindings::WebSocketWrapper;
- static NonnullRefPtr<WebSocket> create(DOM::Window& window, URL& url)
+ static NonnullRefPtr<WebSocket> create(DOM::Window& window, AK::URL& url)
{
return adopt_ref(*new WebSocket(window, url));
}
@@ -102,11 +102,11 @@ private:
void on_error();
void on_close(u16 code, String reason, bool was_clean);
- explicit WebSocket(DOM::Window&, URL&);
+ explicit WebSocket(DOM::Window&, AK::URL&);
NonnullRefPtr<DOM::Window> m_window;
- URL m_url;
+ AK::URL m_url;
String m_binary_type { "blob" };
RefPtr<Protocol::WebSocket> m_websocket;
};
diff --git a/Userland/Libraries/LibWeb/InProcessWebView.cpp b/Userland/Libraries/LibWeb/InProcessWebView.cpp
index f40e19a3e7..47b315606e 100644
--- a/Userland/Libraries/LibWeb/InProcessWebView.cpp
+++ b/Userland/Libraries/LibWeb/InProcessWebView.cpp
@@ -72,13 +72,13 @@ void InProcessWebView::page_did_set_document_in_top_level_browsing_context(DOM::
update();
}
-void InProcessWebView::page_did_start_loading(const URL& url)
+void InProcessWebView::page_did_start_loading(const AK::URL& url)
{
if (on_load_start)
on_load_start(url);
}
-void InProcessWebView::page_did_finish_loading(const URL& url)
+void InProcessWebView::page_did_finish_loading(const AK::URL& url)
{
if (on_load_finish)
on_load_finish(url);
@@ -100,13 +100,13 @@ void InProcessWebView::page_did_request_context_menu(const Gfx::IntPoint& conten
on_context_menu_request(screen_relative_rect().location().translated(to_widget_position(content_position)));
}
-void InProcessWebView::page_did_request_link_context_menu(const Gfx::IntPoint& content_position, const URL& url, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers)
+void InProcessWebView::page_did_request_link_context_menu(const Gfx::IntPoint& content_position, const AK::URL& url, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers)
{
if (on_link_context_menu_request)
on_link_context_menu_request(url, screen_relative_rect().location().translated(to_widget_position(content_position)));
}
-void InProcessWebView::page_did_request_image_context_menu(const Gfx::IntPoint& content_position, const URL& url, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers, const Gfx::Bitmap* bitmap)
+void InProcessWebView::page_did_request_image_context_menu(const Gfx::IntPoint& content_position, const AK::URL& url, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers, const Gfx::Bitmap* bitmap)
{
if (!on_image_context_menu_request)
return;
@@ -116,13 +116,13 @@ void InProcessWebView::page_did_request_image_context_menu(const Gfx::IntPoint&
on_image_context_menu_request(url, screen_relative_rect().location().translated(to_widget_position(content_position)), shareable_bitmap);
}
-void InProcessWebView::page_did_click_link(const URL& url, const String& target, unsigned modifiers)
+void InProcessWebView::page_did_click_link(const AK::URL& url, const String& target, unsigned modifiers)
{
if (on_link_click)
on_link_click(url, target, modifiers);
}
-void InProcessWebView::page_did_middle_click_link(const URL& url, const String& target, unsigned modifiers)
+void InProcessWebView::page_did_middle_click_link(const AK::URL& url, const String& target, unsigned modifiers)
{
if (on_link_middle_click)
on_link_middle_click(url, target, modifiers);
@@ -138,7 +138,7 @@ void InProcessWebView::page_did_leave_tooltip_area()
GUI::Application::the()->hide_tooltip();
}
-void InProcessWebView::page_did_hover_link(const URL& url)
+void InProcessWebView::page_did_hover_link(const AK::URL& url)
{
if (on_link_hover)
on_link_hover(url);
@@ -276,7 +276,7 @@ void InProcessWebView::keydown_event(GUI::KeyEvent& event)
event.accept();
}
-URL InProcessWebView::url() const
+AK::URL InProcessWebView::url() const
{
if (!page().top_level_browsing_context().active_document())
return {};
@@ -288,12 +288,12 @@ void InProcessWebView::reload()
load(url());
}
-void InProcessWebView::load_html(const StringView& html, const URL& url)
+void InProcessWebView::load_html(const StringView& html, const AK::URL& url)
{
page().top_level_browsing_context().loader().load_html(html, url);
}
-bool InProcessWebView::load(const URL& url)
+bool InProcessWebView::load(const AK::URL& url)
{
set_override_cursor(Gfx::StandardCursor::None);
return page().top_level_browsing_context().loader().load(url, FrameLoader::Type::Navigation);
@@ -372,14 +372,14 @@ String InProcessWebView::page_did_request_prompt(const String& message, const St
return {};
}
-String InProcessWebView::page_did_request_cookie(const URL& url, Cookie::Source source)
+String InProcessWebView::page_did_request_cookie(const AK::URL& url, Cookie::Source source)
{
if (on_get_cookie)
return on_get_cookie(url, source);
return {};
}
-void InProcessWebView::page_did_set_cookie(const URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source)
+void InProcessWebView::page_did_set_cookie(const AK::URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source)
{
if (on_set_cookie)
on_set_cookie(url, cookie, source);
diff --git a/Userland/Libraries/LibWeb/InProcessWebView.h b/Userland/Libraries/LibWeb/InProcessWebView.h
index 2d6717f37f..b858840625 100644
--- a/Userland/Libraries/LibWeb/InProcessWebView.h
+++ b/Userland/Libraries/LibWeb/InProcessWebView.h
@@ -24,7 +24,7 @@ class InProcessWebView final
public:
virtual ~InProcessWebView() override;
- void load_html(const StringView&, const URL&);
+ void load_html(const StringView&, const AK::URL&);
void load_empty_document();
DOM::Document* document();
@@ -36,9 +36,9 @@ public:
Layout::InitialContainingBlock* layout_root();
void reload();
- bool load(const URL&);
+ bool load(const AK::URL&);
- URL url() const;
+ AK::URL url() const;
void set_should_show_line_box_borders(bool value) { m_should_show_line_box_borders = value; }
@@ -67,18 +67,18 @@ private:
virtual Gfx::IntRect screen_rect() const override { return GUI::Desktop::the().rect(); }
virtual void page_did_change_title(const String&) override;
virtual void page_did_set_document_in_top_level_browsing_context(DOM::Document*) override;
- virtual void page_did_start_loading(const URL&) override;
- virtual void page_did_finish_loading(const URL&) override;
+ virtual void page_did_start_loading(const AK::URL&) override;
+ virtual void page_did_finish_loading(const AK::URL&) override;
virtual void page_did_change_selection() override;
virtual void page_did_request_cursor_change(Gfx::StandardCursor) override;
virtual void page_did_request_context_menu(const Gfx::IntPoint&) override;
- virtual void page_did_request_link_context_menu(const Gfx::IntPoint&, const URL&, const String& target, unsigned modifiers) override;
- virtual void page_did_request_image_context_menu(const Gfx::IntPoint&, const URL&, const String& target, unsigned modifiers, const Gfx::Bitmap*) override;
- virtual void page_did_click_link(const URL&, const String& target, unsigned modifiers) override;
- virtual void page_did_middle_click_link(const URL&, const String& target, unsigned modifiers) override;
+ virtual void page_did_request_link_context_menu(const Gfx::IntPoint&, const AK::URL&, const String& target, unsigned modifiers) override;
+ virtual void page_did_request_image_context_menu(const Gfx::IntPoint&, const AK::URL&, const String& target, unsigned modifiers, const Gfx::Bitmap*) override;
+ virtual void page_did_click_link(const AK::URL&, const String& target, unsigned modifiers) override;
+ virtual void page_did_middle_click_link(const AK::URL&, const String& target, unsigned modifiers) override;
virtual void page_did_enter_tooltip_area(const Gfx::IntPoint&, const String&) override;
virtual void page_did_leave_tooltip_area() override;
- virtual void page_did_hover_link(const URL&) override;
+ virtual void page_did_hover_link(const AK::URL&) override;
virtual void page_did_unhover_link() override;
virtual void page_did_invalidate(const Gfx::IntRect&) override;
virtual void page_did_change_favicon(const Gfx::Bitmap&) override;
@@ -87,8 +87,8 @@ private:
virtual void page_did_request_alert(const String&) override;
virtual bool page_did_request_confirm(const String&) override;
virtual String page_did_request_prompt(const String&, const String&) override;
- virtual String page_did_request_cookie(const URL&, Cookie::Source) override;
- virtual void page_did_set_cookie(const URL&, const Cookie::ParsedCookie&, Cookie::Source) override;
+ virtual String page_did_request_cookie(const AK::URL&, Cookie::Source) override;
+ virtual void page_did_set_cookie(const AK::URL&, const Cookie::ParsedCookie&, Cookie::Source) override;
void layout_and_sync_size();
diff --git a/Userland/Libraries/LibWeb/Loader/CSSLoader.cpp b/Userland/Libraries/LibWeb/Loader/CSSLoader.cpp
index 742d205676..df844b1c25 100644
--- a/Userland/Libraries/LibWeb/Loader/CSSLoader.cpp
+++ b/Userland/Libraries/LibWeb/Loader/CSSLoader.cpp
@@ -30,7 +30,7 @@ void CSSLoader::load_from_text(const String& text)
load_next_import_if_needed();
}
-void CSSLoader::load_from_url(const URL& url)
+void CSSLoader::load_from_url(const AK::URL& url)
{
m_style_sheet = CSS::CSSStyleSheet::create({});
m_style_sheet->set_owner_node(&m_owner_element);
diff --git a/Userland/Libraries/LibWeb/Loader/CSSLoader.h b/Userland/Libraries/LibWeb/Loader/CSSLoader.h
index b7ec77c4af..bed65b5ba4 100644
--- a/Userland/Libraries/LibWeb/Loader/CSSLoader.h
+++ b/Userland/Libraries/LibWeb/Loader/CSSLoader.h
@@ -17,7 +17,7 @@ public:
explicit CSSLoader(DOM::Element& owner_element);
void load_from_text(const String&);
- void load_from_url(const URL&);
+ void load_from_url(const AK::URL&);
void load_next_import_if_needed();
diff --git a/Userland/Libraries/LibWeb/Loader/ContentFilter.cpp b/Userland/Libraries/LibWeb/Loader/ContentFilter.cpp
index 39fa4a8669..5a33e09e24 100644
--- a/Userland/Libraries/LibWeb/Loader/ContentFilter.cpp
+++ b/Userland/Libraries/LibWeb/Loader/ContentFilter.cpp
@@ -23,7 +23,7 @@ ContentFilter::~ContentFilter()
{
}
-bool ContentFilter::is_filtered(const URL& url) const
+bool ContentFilter::is_filtered(const AK::URL& url) const
{
auto url_string = url.to_string();
diff --git a/Userland/Libraries/LibWeb/Loader/ContentFilter.h b/Userland/Libraries/LibWeb/Loader/ContentFilter.h
index 26fa8f7ab3..ac7c45d66b 100644
--- a/Userland/Libraries/LibWeb/Loader/ContentFilter.h
+++ b/Userland/Libraries/LibWeb/Loader/ContentFilter.h
@@ -15,7 +15,7 @@ class ContentFilter {
public:
static ContentFilter& the();
- bool is_filtered(const URL&) const;
+ bool is_filtered(const AK::URL&) const;
void add_pattern(const String&);
private:
diff --git a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp
index f56aff7918..2a984e157b 100644
--- a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp
+++ b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp
@@ -162,7 +162,7 @@ bool FrameLoader::load(LoadRequest& request, Type type)
return true;
if (url.protocol() == "http" || url.protocol() == "https") {
- URL favicon_url;
+ AK::URL favicon_url;
favicon_url.set_protocol(url.protocol());
favicon_url.set_host(url.host());
favicon_url.set_port(url.port());
@@ -195,7 +195,7 @@ bool FrameLoader::load(LoadRequest& request, Type type)
return true;
}
-bool FrameLoader::load(const URL& url, Type type)
+bool FrameLoader::load(const AK::URL& url, Type type)
{
dbgln_if(SPAM_DEBUG, "FrameLoader::load: {}", url);
@@ -208,7 +208,7 @@ bool FrameLoader::load(const URL& url, Type type)
return load(request, type);
}
-void FrameLoader::load_html(const StringView& html, const URL& url)
+void FrameLoader::load_html(const StringView& html, const AK::URL& url)
{
auto document = DOM::Document::create(url);
HTML::HTMLDocumentParser parser(document, html, "utf-8");
@@ -219,7 +219,7 @@ void FrameLoader::load_html(const StringView& html, const URL& url)
// FIXME: Use an actual templating engine (our own one when it's built, preferably
// with a way to check these usages at compile time)
-void FrameLoader::load_error_page(const URL& failed_url, const String& error)
+void FrameLoader::load_error_page(const AK::URL& failed_url, const String& error)
{
auto error_page_url = "file:///res/html/error.html";
ResourceLoader::the().load(
diff --git a/Userland/Libraries/LibWeb/Loader/FrameLoader.h b/Userland/Libraries/LibWeb/Loader/FrameLoader.h
index 95d3b5bbcc..7e87e93a81 100644
--- a/Userland/Libraries/LibWeb/Loader/FrameLoader.h
+++ b/Userland/Libraries/LibWeb/Loader/FrameLoader.h
@@ -26,10 +26,10 @@ public:
explicit FrameLoader(BrowsingContext&);
~FrameLoader();
- bool load(const URL&, Type);
+ bool load(const AK::URL&, Type);
bool load(LoadRequest&, Type);
- void load_html(const StringView&, const URL&);
+ void load_html(const StringView&, const AK::URL&);
BrowsingContext& browsing_context() { return m_browsing_context; }
const BrowsingContext& browsing_context() const { return m_browsing_context; }
@@ -39,7 +39,7 @@ private:
virtual void resource_did_load() override;
virtual void resource_did_fail() override;
- void load_error_page(const URL& failed_url, const String& error_message);
+ void load_error_page(const AK::URL& failed_url, const String& error_message);
void load_favicon(RefPtr<Gfx::Bitmap> bitmap = nullptr);
bool parse_document(DOM::Document&, const ByteBuffer& data);
diff --git a/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp b/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp
index 995098bc3e..aa60056331 100644
--- a/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp
+++ b/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp
@@ -20,7 +20,7 @@ ImageLoader::ImageLoader(DOM::Element& owner_element)
{
}
-void ImageLoader::load(const URL& url)
+void ImageLoader::load(const AK::URL& url)
{
m_loading_state = LoadingState::Loading;
diff --git a/Userland/Libraries/LibWeb/Loader/ImageLoader.h b/Userland/Libraries/LibWeb/Loader/ImageLoader.h
index 7c44b0d9cc..a5aa248ff8 100644
--- a/Userland/Libraries/LibWeb/Loader/ImageLoader.h
+++ b/Userland/Libraries/LibWeb/Loader/ImageLoader.h
@@ -16,7 +16,7 @@ class ImageLoader : public ImageResourceClient {
public:
ImageLoader(DOM::Element& owner_element);
- void load(const URL&);
+ void load(const AK::URL&);
const Gfx::Bitmap* bitmap(size_t index) const;
size_t current_frame_index() const { return m_current_frame_index; }
diff --git a/Userland/Libraries/LibWeb/Loader/LoadRequest.cpp b/Userland/Libraries/LibWeb/Loader/LoadRequest.cpp
index 343279f170..091eecd441 100644
--- a/Userland/Libraries/LibWeb/Loader/LoadRequest.cpp
+++ b/Userland/Libraries/LibWeb/Loader/LoadRequest.cpp
@@ -10,7 +10,7 @@
namespace Web {
-LoadRequest LoadRequest::create_for_url_on_page(const URL& url, Page* page)
+LoadRequest LoadRequest::create_for_url_on_page(const AK::URL& url, Page* page)
{
LoadRequest request;
request.set_url(url);
diff --git a/Userland/Libraries/LibWeb/Loader/LoadRequest.h b/Userland/Libraries/LibWeb/Loader/LoadRequest.h
index 314f974fe4..d220fddac9 100644
--- a/Userland/Libraries/LibWeb/Loader/LoadRequest.h
+++ b/Userland/Libraries/LibWeb/Loader/LoadRequest.h
@@ -21,12 +21,12 @@ public:
{
}
- static LoadRequest create_for_url_on_page(const URL& url, Page* page);
+ static LoadRequest create_for_url_on_page(const AK::URL& url, Page* page);
bool is_valid() const { return m_url.is_valid(); }
- const URL& url() const { return m_url; }
- void set_url(const URL& url) { m_url = url; }
+ const AK::URL& url() const { return m_url; }
+ void set_url(const AK::URL& url) { m_url = url; }
const String& method() const { return m_method; }
void set_method(const String& method) { m_method = method; }
@@ -65,7 +65,7 @@ public:
const HashMap<String, String>& headers() const { return m_headers; }
private:
- URL m_url;
+ AK::URL m_url;
String m_method { "GET" };
HashMap<String, String> m_headers;
ByteBuffer m_body;
diff --git a/Userland/Libraries/LibWeb/Loader/Resource.h b/Userland/Libraries/LibWeb/Loader/Resource.h
index 7a0b4c81f8..feb0c49956 100644
--- a/Userland/Libraries/LibWeb/Loader/Resource.h
+++ b/Userland/Libraries/LibWeb/Loader/Resource.h
@@ -44,7 +44,7 @@ public:
bool has_encoded_data() const { return !m_encoded_data.is_empty(); }
- const URL& url() const { return m_request.url(); }
+ const AK::URL& url() const { return m_request.url(); }
const ByteBuffer& encoded_data() const { return m_encoded_data; }
const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers() const { return m_response_headers; }
diff --git a/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp b/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp
index 04373f2778..45f33e9b8b 100644
--- a/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp
+++ b/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp
@@ -218,7 +218,7 @@ void ResourceLoader::load(LoadRequest& request, Function<void(ReadonlyBytes, con
error_callback(not_implemented_error, {});
}
-void ResourceLoader::load(const URL& url, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback)
+void ResourceLoader::load(const AK::URL& url, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback)
{
LoadRequest request;
request.set_url(url);
diff --git a/Userland/Libraries/LibWeb/Loader/ResourceLoader.h b/Userland/Libraries/LibWeb/Loader/ResourceLoader.h
index f3756700c1..062a7917dc 100644
--- a/Userland/Libraries/LibWeb/Loader/ResourceLoader.h
+++ b/Userland/Libraries/LibWeb/Loader/ResourceLoader.h
@@ -33,7 +33,7 @@ public:
RefPtr<Resource> load_resource(Resource::Type, LoadRequest&);
void load(LoadRequest&, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback = nullptr);
- void load(const URL&, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback = nullptr);
+ void load(const AK::URL&, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback = nullptr);
void load_sync(LoadRequest&, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback = nullptr);
Function<void()> on_load_counter_change;
diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp
index 6eec7399ca..e6585341b9 100644
--- a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp
+++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp
@@ -74,13 +74,13 @@ void OutOfProcessWebView::create_client()
client().async_update_screen_rects(GUI::Desktop::the().rects(), GUI::Desktop::the().main_screen_index());
}
-void OutOfProcessWebView::load(const URL& url)
+void OutOfProcessWebView::load(const AK::URL& url)
{
m_url = url;
client().async_load_url(url);
}
-void OutOfProcessWebView::load_html(const StringView& html, const URL& url)
+void OutOfProcessWebView::load_html(const StringView& html, const AK::URL& url)
{
m_url = url;
client().async_load_html(html, url);
@@ -262,7 +262,7 @@ void OutOfProcessWebView::notify_server_did_leave_tooltip_area(Badge<WebContentC
GUI::Application::the()->hide_tooltip();
}
-void OutOfProcessWebView::notify_server_did_hover_link(Badge<WebContentClient>, const URL& url)
+void OutOfProcessWebView::notify_server_did_hover_link(Badge<WebContentClient>, const AK::URL& url)
{
if (on_link_hover)
on_link_hover(url);
@@ -275,25 +275,25 @@ void OutOfProcessWebView::notify_server_did_unhover_link(Badge<WebContentClient>
on_link_hover({});
}
-void OutOfProcessWebView::notify_server_did_click_link(Badge<WebContentClient>, const URL& url, const String& target, unsigned int modifiers)
+void OutOfProcessWebView::notify_server_did_click_link(Badge<WebContentClient>, const AK::URL& url, const String& target, unsigned int modifiers)
{
if (on_link_click)
on_link_click(url, target, modifiers);
}
-void OutOfProcessWebView::notify_server_did_middle_click_link(Badge<WebContentClient>, const URL& url, const String& target, unsigned int modifiers)
+void OutOfProcessWebView::notify_server_did_middle_click_link(Badge<WebContentClient>, const AK::URL& url, const String& target, unsigned int modifiers)
{
if (on_link_middle_click)
on_link_middle_click(url, target, modifiers);
}
-void OutOfProcessWebView::notify_server_did_start_loading(Badge<WebContentClient>, const URL& url)
+void OutOfProcessWebView::notify_server_did_start_loading(Badge<WebContentClient>, const AK::URL& url)
{
if (on_load_start)
on_load_start(url);
}
-void OutOfProcessWebView::notify_server_did_finish_loading(Badge<WebContentClient>, const URL& url)
+void OutOfProcessWebView::notify_server_did_finish_loading(Badge<WebContentClient>, const AK::URL& url)
{
if (on_load_finish)
on_load_finish(url);
@@ -305,13 +305,13 @@ void OutOfProcessWebView::notify_server_did_request_context_menu(Badge<WebConten
on_context_menu_request(screen_relative_rect().location().translated(to_widget_position(content_position)));
}
-void OutOfProcessWebView::notify_server_did_request_link_context_menu(Badge<WebContentClient>, const Gfx::IntPoint& content_position, const URL& url, const String&, unsigned)
+void OutOfProcessWebView::notify_server_did_request_link_context_menu(Badge<WebContentClient>, const Gfx::IntPoint& content_position, const AK::URL& url, const String&, unsigned)
{
if (on_link_context_menu_request)
on_link_context_menu_request(url, screen_relative_rect().location().translated(to_widget_position(content_position)));
}
-void OutOfProcessWebView::notify_server_did_request_image_context_menu(Badge<WebContentClient>, const Gfx::IntPoint& content_position, const URL& url, const String&, unsigned, const Gfx::ShareableBitmap& bitmap)
+void OutOfProcessWebView::notify_server_did_request_image_context_menu(Badge<WebContentClient>, const Gfx::IntPoint& content_position, const AK::URL& url, const String&, unsigned, const Gfx::ShareableBitmap& bitmap)
{
if (on_image_context_menu_request)
on_image_context_menu_request(url, screen_relative_rect().location().translated(to_widget_position(content_position)), bitmap);
@@ -336,7 +336,7 @@ String OutOfProcessWebView::notify_server_did_request_prompt(Badge<WebContentCli
return {};
}
-void OutOfProcessWebView::notify_server_did_get_source(const URL& url, const String& source)
+void OutOfProcessWebView::notify_server_did_get_source(const AK::URL& url, const String& source)
{
if (on_get_source)
on_get_source(url, source);
@@ -372,14 +372,14 @@ void OutOfProcessWebView::notify_server_did_change_favicon(const Gfx::Bitmap& fa
on_favicon_change(favicon);
}
-String OutOfProcessWebView::notify_server_did_request_cookie(Badge<WebContentClient>, const URL& url, Cookie::Source source)
+String OutOfProcessWebView::notify_server_did_request_cookie(Badge<WebContentClient>, const AK::URL& url, Cookie::Source source)
{
if (on_get_cookie)
return on_get_cookie(url, source);
return {};
}
-void OutOfProcessWebView::notify_server_did_set_cookie(Badge<WebContentClient>, const URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source)
+void OutOfProcessWebView::notify_server_did_set_cookie(Badge<WebContentClient>, const AK::URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source)
{
if (on_set_cookie)
on_set_cookie(url, cookie, source);
diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.h b/Userland/Libraries/LibWeb/OutOfProcessWebView.h
index ed1a1d4576..bbb87b55d8 100644
--- a/Userland/Libraries/LibWeb/OutOfProcessWebView.h
+++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.h
@@ -23,10 +23,10 @@ class OutOfProcessWebView final
public:
virtual ~OutOfProcessWebView() override;
- URL url() const { return m_url; }
- void load(const URL&);
+ AK::URL url() const { return m_url; }
+ void load(const AK::URL&);
- void load_html(const StringView&, const URL&);
+ void load_html(const StringView&, const AK::URL&);
void load_empty_document();
void debug_request(const String& request, const String& argument = {});
@@ -62,26 +62,26 @@ public:
void notify_server_did_request_scroll_into_view(Badge<WebContentClient>, const Gfx::IntRect&);
void notify_server_did_enter_tooltip_area(Badge<WebContentClient>, const Gfx::IntPoint&, const String&);
void notify_server_did_leave_tooltip_area(Badge<WebContentClient>);
- void notify_server_did_hover_link(Badge<WebContentClient>, const URL&);
+ void notify_server_did_hover_link(Badge<WebContentClient>, const AK::URL&);
void notify_server_did_unhover_link(Badge<WebContentClient>);
- void notify_server_did_click_link(Badge<WebContentClient>, const URL&, const String& target, unsigned modifiers);
- void notify_server_did_middle_click_link(Badge<WebContentClient>, const URL&, const String& target, unsigned modifiers);
- void notify_server_did_start_loading(Badge<WebContentClient>, const URL&);
- void notify_server_did_finish_loading(Badge<WebContentClient>, const URL&);
+ void notify_server_did_click_link(Badge<WebContentClient>, const AK::URL&, const String& target, unsigned modifiers);
+ void notify_server_did_middle_click_link(Badge<WebContentClient>, const AK::URL&, const String& target, unsigned modifiers);
+ void notify_server_did_start_loading(Badge<WebContentClient>, const AK::URL&);
+ void notify_server_did_finish_loading(Badge<WebContentClient>, const AK::URL&);
void notify_server_did_request_context_menu(Badge<WebContentClient>, const Gfx::IntPoint&);
- void notify_server_did_request_link_context_menu(Badge<WebContentClient>, const Gfx::IntPoint&, const URL&, const String& target, unsigned modifiers);
- void notify_server_did_request_image_context_menu(Badge<WebContentClient>, const Gfx::IntPoint&, const URL&, const String& target, unsigned modifiers, const Gfx::ShareableBitmap&);
+ void notify_server_did_request_link_context_menu(Badge<WebContentClient>, const Gfx::IntPoint&, const AK::URL&, const String& target, unsigned modifiers);
+ void notify_server_did_request_image_context_menu(Badge<WebContentClient>, const Gfx::IntPoint&, const AK::URL&, const String& target, unsigned modifiers, const Gfx::ShareableBitmap&);
void notify_server_did_request_alert(Badge<WebContentClient>, const String& message);
bool notify_server_did_request_confirm(Badge<WebContentClient>, const String& message);
String notify_server_did_request_prompt(Badge<WebContentClient>, const String& message, const String& default_);
- void notify_server_did_get_source(const URL& url, const String& source);
+ void notify_server_did_get_source(const AK::URL& url, const String& source);
void notify_server_did_get_dom_tree(const String& dom_tree);
void notify_server_did_get_dom_node_properties(i32 node_id, String const& specified_style, String const& computed_style);
void notify_server_did_output_js_console_message(i32 message_index);
void notify_server_did_get_js_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages);
void notify_server_did_change_favicon(const Gfx::Bitmap& favicon);
- String notify_server_did_request_cookie(Badge<WebContentClient>, const URL& url, Cookie::Source source);
- void notify_server_did_set_cookie(Badge<WebContentClient>, const URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source);
+ String notify_server_did_request_cookie(Badge<WebContentClient>, const AK::URL& url, Cookie::Source source);
+ void notify_server_did_set_cookie(Badge<WebContentClient>, const AK::URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source);
private:
OutOfProcessWebView();
@@ -108,7 +108,7 @@ private:
void handle_web_content_process_crash();
- URL m_url;
+ AK::URL m_url;
struct ClientState {
RefPtr<WebContentClient> client;
diff --git a/Userland/Libraries/LibWeb/Page/BrowsingContext.cpp b/Userland/Libraries/LibWeb/Page/BrowsingContext.cpp
index 404cfbe24e..ea637cacd4 100644
--- a/Userland/Libraries/LibWeb/Page/BrowsingContext.cpp
+++ b/Userland/Libraries/LibWeb/Page/BrowsingContext.cpp
@@ -311,12 +311,12 @@ void BrowsingContext::unregister_viewport_client(ViewportClient& client)
VERIFY(was_removed);
}
-void BrowsingContext::register_frame_nesting(URL const& url)
+void BrowsingContext::register_frame_nesting(AK::URL const& url)
{
m_frame_nesting_levels.ensure(url)++;
}
-bool BrowsingContext::is_frame_nesting_allowed(URL const& url) const
+bool BrowsingContext::is_frame_nesting_allowed(AK::URL const& url) const
{
return m_frame_nesting_levels.get(url).value_or(0) < 3;
}
diff --git a/Userland/Libraries/LibWeb/Page/BrowsingContext.h b/Userland/Libraries/LibWeb/Page/BrowsingContext.h
index 80b10ac0bf..f0bb307ece 100644
--- a/Userland/Libraries/LibWeb/Page/BrowsingContext.h
+++ b/Userland/Libraries/LibWeb/Page/BrowsingContext.h
@@ -93,11 +93,11 @@ public:
void did_edit(Badge<EditEventHandler>);
- void register_frame_nesting(URL const&);
- bool is_frame_nesting_allowed(URL const&) const;
+ void register_frame_nesting(AK::URL const&);
+ bool is_frame_nesting_allowed(AK::URL const&) const;
- void set_frame_nesting_levels(HashMap<URL, size_t> frame_nesting_levels) { m_frame_nesting_levels = move(frame_nesting_levels); };
- HashMap<URL, size_t> const& frame_nesting_levels() const { return m_frame_nesting_levels; }
+ void set_frame_nesting_levels(HashMap<AK::URL, size_t> frame_nesting_levels) { m_frame_nesting_levels = move(frame_nesting_levels); };
+ HashMap<AK::URL, size_t> const& frame_nesting_levels() const { return m_frame_nesting_levels; }
DOM::Document* container_document();
DOM::Document const* container_document() const;
@@ -123,7 +123,7 @@ private:
HashTable<ViewportClient*> m_viewport_clients;
- HashMap<URL, size_t> m_frame_nesting_levels;
+ HashMap<AK::URL, size_t> m_frame_nesting_levels;
};
}
diff --git a/Userland/Libraries/LibWeb/Page/Page.cpp b/Userland/Libraries/LibWeb/Page/Page.cpp
index 065747768e..5c860bf81a 100644
--- a/Userland/Libraries/LibWeb/Page/Page.cpp
+++ b/Userland/Libraries/LibWeb/Page/Page.cpp
@@ -31,7 +31,7 @@ void Page::set_focused_browsing_context(Badge<EventHandler>, BrowsingContext& br
m_focused_context = browsing_context.make_weak_ptr();
}
-void Page::load(const URL& url)
+void Page::load(const AK::URL& url)
{
top_level_browsing_context().loader().load(url, FrameLoader::Type::Navigation);
}
@@ -41,7 +41,7 @@ void Page::load(LoadRequest& request)
top_level_browsing_context().loader().load(request, FrameLoader::Type::Navigation);
}
-void Page::load_html(const StringView& html, const URL& url)
+void Page::load_html(const StringView& html, const AK::URL& url)
{
top_level_browsing_context().loader().load_html(html, url);
}
diff --git a/Userland/Libraries/LibWeb/Page/Page.h b/Userland/Libraries/LibWeb/Page/Page.h
index d0f82a3a7c..077a605262 100644
--- a/Userland/Libraries/LibWeb/Page/Page.h
+++ b/Userland/Libraries/LibWeb/Page/Page.h
@@ -41,10 +41,10 @@ public:
void set_focused_browsing_context(Badge<EventHandler>, BrowsingContext&);
- void load(const URL&);
+ void load(const AK::URL&);
void load(LoadRequest&);
- void load_html(const StringView&, const URL&);
+ void load_html(const StringView&, const AK::URL&);
bool handle_mouseup(const Gfx::IntPoint&, unsigned button, unsigned modifiers);
bool handle_mousedown(const Gfx::IntPoint&, unsigned button, unsigned modifiers);
@@ -74,18 +74,18 @@ public:
virtual Gfx::IntRect screen_rect() const = 0;
virtual void page_did_set_document_in_top_level_browsing_context(DOM::Document*) { }
virtual void page_did_change_title(const String&) { }
- virtual void page_did_start_loading(const URL&) { }
- virtual void page_did_finish_loading(const URL&) { }
+ virtual void page_did_start_loading(const AK::URL&) { }
+ virtual void page_did_finish_loading(const AK::URL&) { }
virtual void page_did_change_selection() { }
virtual void page_did_request_cursor_change(Gfx::StandardCursor) { }
virtual void page_did_request_context_menu(const Gfx::IntPoint&) { }
- virtual void page_did_request_link_context_menu(const Gfx::IntPoint&, const URL&, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers) { }
- virtual void page_did_request_image_context_menu(const Gfx::IntPoint&, const URL&, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers, const Gfx::Bitmap*) { }
- virtual void page_did_click_link(const URL&, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers) { }
- virtual void page_did_middle_click_link(const URL&, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers) { }
+ virtual void page_did_request_link_context_menu(const Gfx::IntPoint&, const AK::URL&, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers) { }
+ virtual void page_did_request_image_context_menu(const Gfx::IntPoint&, const AK::URL&, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers, const Gfx::Bitmap*) { }
+ virtual void page_did_click_link(const AK::URL&, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers) { }
+ virtual void page_did_middle_click_link(const AK::URL&, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers) { }
virtual void page_did_enter_tooltip_area(const Gfx::IntPoint&, const String&) { }
virtual void page_did_leave_tooltip_area() { }
- virtual void page_did_hover_link(const URL&) { }
+ virtual void page_did_hover_link(const AK::URL&) { }
virtual void page_did_unhover_link() { }
virtual void page_did_invalidate(const Gfx::IntRect&) { }
virtual void page_did_change_favicon(const Gfx::Bitmap&) { }
@@ -96,8 +96,8 @@ public:
virtual void page_did_request_alert(const String&) { }
virtual bool page_did_request_confirm(const String&) { return false; }
virtual String page_did_request_prompt(const String&, const String&) { return {}; }
- virtual String page_did_request_cookie(const URL&, Cookie::Source) { return {}; }
- virtual void page_did_set_cookie(const URL&, const Cookie::ParsedCookie&, Cookie::Source) { }
+ virtual String page_did_request_cookie(const AK::URL&, Cookie::Source) { return {}; }
+ virtual void page_did_set_cookie(const AK::URL&, const Cookie::ParsedCookie&, Cookie::Source) { }
protected:
virtual ~PageClient() = default;
diff --git a/Userland/Libraries/LibWeb/URL/URL.cpp b/Userland/Libraries/LibWeb/URL/URL.cpp
new file mode 100644
index 0000000000..4bb41d92f1
--- /dev/null
+++ b/Userland/Libraries/LibWeb/URL/URL.cpp
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
+ * Copyright (c) 2021, the SerenityOS developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <AK/StringBuilder.h>
+#include <AK/URL.h>
+#include <LibWeb/URL/URL.h>
+
+namespace Web::URL {
+
+String url_encode(const Vector<QueryParam>& pairs, AK::URL::PercentEncodeSet percent_encode_set)
+{
+ StringBuilder builder;
+ for (size_t i = 0; i < pairs.size(); ++i) {
+ builder.append(AK::URL::percent_encode(pairs[i].name, percent_encode_set));
+ builder.append('=');
+ builder.append(AK::URL::percent_encode(pairs[i].value, percent_encode_set));
+ if (i != pairs.size() - 1)
+ builder.append('&');
+ }
+ return builder.to_string();
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/URL/URL.h b/Userland/Libraries/LibWeb/URL/URL.h
new file mode 100644
index 0000000000..a8c65aa5c2
--- /dev/null
+++ b/Userland/Libraries/LibWeb/URL/URL.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
+ * Copyright (c) 2021, the SerenityOS developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/String.h>
+#include <AK/Vector.h>
+
+namespace Web::URL {
+
+struct QueryParam {
+ String name;
+ String value;
+};
+String url_encode(const Vector<QueryParam>&, AK::URL::PercentEncodeSet);
+
+}
diff --git a/Userland/Libraries/LibWeb/URLEncoder.cpp b/Userland/Libraries/LibWeb/URLEncoder.cpp
deleted file mode 100644
index ed4ece6b79..0000000000
--- a/Userland/Libraries/LibWeb/URLEncoder.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2020, the SerenityOS developers.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include <AK/StringBuilder.h>
-#include <AK/URL.h>
-#include <LibWeb/URLEncoder.h>
-
-namespace Web {
-
-String urlencode(const Vector<URLQueryParam>& pairs, URL::PercentEncodeSet percent_encode_set)
-{
- StringBuilder builder;
- for (size_t i = 0; i < pairs.size(); ++i) {
- builder.append(URL::percent_encode(pairs[i].name, percent_encode_set));
- builder.append('=');
- builder.append(URL::percent_encode(pairs[i].value, percent_encode_set));
- if (i != pairs.size() - 1)
- builder.append('&');
- }
- return builder.to_string();
-}
-
-}
diff --git a/Userland/Libraries/LibWeb/URLEncoder.h b/Userland/Libraries/LibWeb/URLEncoder.h
deleted file mode 100644
index 5bd004f560..0000000000
--- a/Userland/Libraries/LibWeb/URLEncoder.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2020, the SerenityOS developers.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <AK/String.h>
-#include <AK/Vector.h>
-
-namespace Web {
-
-struct URLQueryParam {
- String name;
- String value;
-};
-
-String urlencode(const Vector<URLQueryParam>&, URL::PercentEncodeSet);
-
-}
diff --git a/Userland/Libraries/LibWeb/WebContentClient.cpp b/Userland/Libraries/LibWeb/WebContentClient.cpp
index 34a34487ac..1d0cb93871 100644
--- a/Userland/Libraries/LibWeb/WebContentClient.cpp
+++ b/Userland/Libraries/LibWeb/WebContentClient.cpp
@@ -28,7 +28,7 @@ void WebContentClient::did_paint(const Gfx::IntRect&, i32 bitmap_id)
m_view.notify_server_did_paint({}, bitmap_id);
}
-void WebContentClient::did_finish_loading(URL const& url)
+void WebContentClient::did_finish_loading(AK::URL const& url)
{
m_view.notify_server_did_finish_loading({}, url);
}
@@ -94,7 +94,7 @@ void WebContentClient::did_leave_tooltip_area()
m_view.notify_server_did_leave_tooltip_area({});
}
-void WebContentClient::did_hover_link(URL const& url)
+void WebContentClient::did_hover_link(AK::URL const& url)
{
dbgln_if(SPAM_DEBUG, "handle: WebContentClient::DidHoverLink! url={}", url);
m_view.notify_server_did_hover_link({}, url);
@@ -106,17 +106,17 @@ void WebContentClient::did_unhover_link()
m_view.notify_server_did_unhover_link({});
}
-void WebContentClient::did_click_link(URL const& url, String const& target, unsigned modifiers)
+void WebContentClient::did_click_link(AK::URL const& url, String const& target, unsigned modifiers)
{
m_view.notify_server_did_click_link({}, url, target, modifiers);
}
-void WebContentClient::did_middle_click_link(URL const& url, String const& target, unsigned modifiers)
+void WebContentClient::did_middle_click_link(AK::URL const& url, String const& target, unsigned modifiers)
{
m_view.notify_server_did_middle_click_link({}, url, target, modifiers);
}
-void WebContentClient::did_start_loading(URL const& url)
+void WebContentClient::did_start_loading(AK::URL const& url)
{
m_view.notify_server_did_start_loading({}, url);
}
@@ -126,17 +126,17 @@ void WebContentClient::did_request_context_menu(Gfx::IntPoint const& content_pos
m_view.notify_server_did_request_context_menu({}, content_position);
}
-void WebContentClient::did_request_link_context_menu(Gfx::IntPoint const& content_position, URL const& url, String const& target, unsigned modifiers)
+void WebContentClient::did_request_link_context_menu(Gfx::IntPoint const& content_position, AK::URL const& url, String const& target, unsigned modifiers)
{
m_view.notify_server_did_request_link_context_menu({}, content_position, url, target, modifiers);
}
-void WebContentClient::did_request_image_context_menu(Gfx::IntPoint const& content_position, URL const& url, String const& target, unsigned modifiers, Gfx::ShareableBitmap const& bitmap)
+void WebContentClient::did_request_image_context_menu(Gfx::IntPoint const& content_position, AK::URL const& url, String const& target, unsigned modifiers, Gfx::ShareableBitmap const& bitmap)
{
m_view.notify_server_did_request_image_context_menu({}, content_position, url, target, modifiers, bitmap);
}
-void WebContentClient::did_get_source(URL const& url, String const& source)
+void WebContentClient::did_get_source(AK::URL const& url, String const& source)
{
m_view.notify_server_did_get_source(url, source);
}
@@ -185,12 +185,12 @@ void WebContentClient::did_change_favicon(Gfx::ShareableBitmap const& favicon)
m_view.notify_server_did_change_favicon(*favicon.bitmap());
}
-Messages::WebContentClient::DidRequestCookieResponse WebContentClient::did_request_cookie(URL const& url, u8 source)
+Messages::WebContentClient::DidRequestCookieResponse WebContentClient::did_request_cookie(AK::URL const& url, u8 source)
{
return m_view.notify_server_did_request_cookie({}, url, static_cast<Cookie::Source>(source));
}
-void WebContentClient::did_set_cookie(URL const& url, Web::Cookie::ParsedCookie const& cookie, u8 source)
+void WebContentClient::did_set_cookie(AK::URL const& url, Web::Cookie::ParsedCookie const& cookie, u8 source)
{
m_view.notify_server_did_set_cookie({}, url, cookie, static_cast<Cookie::Source>(source));
}
diff --git a/Userland/Libraries/LibWeb/WebContentClient.h b/Userland/Libraries/LibWeb/WebContentClient.h
index b22fcdb400..4b975d87c5 100644
--- a/Userland/Libraries/LibWeb/WebContentClient.h
+++ b/Userland/Libraries/LibWeb/WebContentClient.h
@@ -30,7 +30,7 @@ private:
virtual void die() override;
virtual void did_paint(Gfx::IntRect const&, i32) override;
- virtual void did_finish_loading(URL const&) override;
+ virtual void did_finish_loading(AK::URL const&) override;
virtual void did_invalidate_content_rect(Gfx::IntRect const&) override;
virtual void did_change_selection() override;
virtual void did_request_cursor_change(i32) override;
@@ -41,15 +41,15 @@ private:
virtual void did_request_scroll_into_view(Gfx::IntRect const&) override;
virtual void did_enter_tooltip_area(Gfx::IntPoint const&, String const&) override;
virtual void did_leave_tooltip_area() override;
- virtual void did_hover_link(URL const&) override;
+ virtual void did_hover_link(AK::URL const&) override;
virtual void did_unhover_link() override;
- virtual void did_click_link(URL const&, String const&, unsigned) override;
- virtual void did_middle_click_link(URL const&, String const&, unsigned) override;
- virtual void did_start_loading(URL const&) override;
+ virtual void did_click_link(AK::URL const&, String const&, unsigned) override;
+ virtual void did_middle_click_link(AK::URL const&, String const&, unsigned) override;
+ virtual void did_start_loading(AK::URL const&) override;
virtual void did_request_context_menu(Gfx::IntPoint const&) override;
- virtual void did_request_link_context_menu(Gfx::IntPoint const&, URL const&, String const&, unsigned) override;
- virtual void did_request_image_context_menu(Gfx::IntPoint const&, URL const&, String const&, unsigned, Gfx::ShareableBitmap const&) override;
- virtual void did_get_source(URL const&, String const&) override;
+ virtual void did_request_link_context_menu(Gfx::IntPoint const&, AK::URL const&, String const&, unsigned) override;
+ virtual void did_request_image_context_menu(Gfx::IntPoint const&, AK::URL const&, String const&, unsigned, Gfx::ShareableBitmap const&) override;
+ virtual void did_get_source(AK::URL const&, String const&) override;
virtual void did_get_dom_tree(String const&) override;
virtual void did_get_dom_node_properties(i32 node_id, String const& specified_style, String const& computed_style) override;
virtual void did_output_js_console_message(i32 message_index) override;
@@ -58,8 +58,8 @@ private:
virtual void did_request_alert(String const&) override;
virtual Messages::WebContentClient::DidRequestConfirmResponse did_request_confirm(String const&) override;
virtual Messages::WebContentClient::DidRequestPromptResponse did_request_prompt(String const&, String const&) override;
- virtual Messages::WebContentClient::DidRequestCookieResponse did_request_cookie(URL const&, u8) override;
- virtual void did_set_cookie(URL const&, Web::Cookie::ParsedCookie const&, u8) override;
+ virtual Messages::WebContentClient::DidRequestCookieResponse did_request_cookie(AK::URL const&, u8) override;
+ virtual void did_set_cookie(AK::URL const&, Web::Cookie::ParsedCookie const&, u8) override;
OutOfProcessWebView& m_view;
};
diff --git a/Userland/Libraries/LibWeb/WebViewHooks.h b/Userland/Libraries/LibWeb/WebViewHooks.h
index f8bcde5c92..2386343f1b 100644
--- a/Userland/Libraries/LibWeb/WebViewHooks.h
+++ b/Userland/Libraries/LibWeb/WebViewHooks.h
@@ -15,24 +15,24 @@ namespace Web {
class WebViewHooks {
public:
Function<void(const Gfx::IntPoint& screen_position)> on_context_menu_request;
- Function<void(const URL&, const String& target, unsigned modifiers)> on_link_click;
- Function<void(const URL&, const Gfx::IntPoint& screen_position)> on_link_context_menu_request;
- Function<void(const URL&, const Gfx::IntPoint& screen_position, const Gfx::ShareableBitmap&)> on_image_context_menu_request;
- Function<void(const URL&, const String& target, unsigned modifiers)> on_link_middle_click;
- Function<void(const URL&)> on_link_hover;
+ Function<void(const AK::URL&, const String& target, unsigned modifiers)> on_link_click;
+ Function<void(const AK::URL&, const Gfx::IntPoint& screen_position)> on_link_context_menu_request;
+ Function<void(const AK::URL&, const Gfx::IntPoint& screen_position, const Gfx::ShareableBitmap&)> on_image_context_menu_request;
+ Function<void(const AK::URL&, const String& target, unsigned modifiers)> on_link_middle_click;
+ Function<void(const AK::URL&)> on_link_hover;
Function<void(const String&)> on_title_change;
- Function<void(const URL&)> on_load_start;
- Function<void(const URL&)> on_load_finish;
+ Function<void(const AK::URL&)> on_load_start;
+ Function<void(const AK::URL&)> on_load_finish;
Function<void(const Gfx::Bitmap&)> on_favicon_change;
- Function<void(const URL&)> on_url_drop;
+ Function<void(const AK::URL&)> on_url_drop;
Function<void(DOM::Document*)> on_set_document;
- Function<void(const URL&, const String&)> on_get_source;
+ Function<void(const AK::URL&, const String&)> on_get_source;
Function<void(const String&)> on_get_dom_tree;
Function<void(i32 node_id, String const& specified_style, String const& computed_style)> on_get_dom_node_properties;
Function<void(i32 message_id)> on_js_console_new_message;
Function<void(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages)> on_get_js_console_messages;
- Function<String(const URL& url, Cookie::Source source)> on_get_cookie;
- Function<void(const URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source)> on_set_cookie;
+ Function<String(const AK::URL& url, Cookie::Source source)> on_get_cookie;
+ Function<void(const AK::URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source)> on_set_cookie;
};
}
diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
index ede8e8b4e6..143fe1c9c6 100644
--- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
+++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
@@ -167,7 +167,7 @@ DOM::ExceptionOr<void> XMLHttpRequest::send()
// FIXME: If body is not null, then:
- URL request_url = m_window->associated_document().parse_url(m_url.to_string());
+ AK::URL request_url = m_window->associated_document().parse_url(m_url.to_string());
dbgln("XHR send from {} to {}", m_window->associated_document().url(), request_url);
// TODO: Add support for preflight requests to support CORS requests
diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h
index 2b3f46d271..a7f78a8c65 100644
--- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h
+++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h
@@ -77,7 +77,7 @@ private:
bool m_send { false };
String m_method;
- URL m_url;
+ AK::URL m_url;
HashMap<String, String, CaseInsensitiveStringTraits> m_request_headers;
HashMap<String, String, CaseInsensitiveStringTraits> m_response_headers;