diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-09-13 00:33:23 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-13 01:43:10 +0200 |
commit | 4629f2e4ad0640087d48e9e427e117620b09d7e8 (patch) | |
tree | 55f77b9b91c9dba677a7fd7e4b512fc75a49f27b /Userland/Libraries/LibWeb/Loader | |
parent | 2b78e227f2bba96ebdf10f5aa0a83e0c9fd022cb (diff) | |
download | serenity-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/Loader')
-rw-r--r-- | Userland/Libraries/LibWeb/Loader/CSSLoader.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Loader/CSSLoader.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Loader/ContentFilter.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Loader/ContentFilter.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Loader/FrameLoader.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Loader/FrameLoader.h | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Loader/ImageLoader.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Loader/ImageLoader.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Loader/LoadRequest.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Loader/LoadRequest.h | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Loader/Resource.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Loader/ResourceLoader.h | 2 |
13 files changed, 21 insertions, 21 deletions
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; |