diff --git a/Ladybird/AppKit/UI/LadybirdWebView.mm b/Ladybird/AppKit/UI/LadybirdWebView.mm index 1b60ed200b..e4d775f181 100644 --- a/Ladybird/AppKit/UI/LadybirdWebView.mm +++ b/Ladybird/AppKit/UI/LadybirdWebView.mm @@ -636,7 +636,7 @@ static void copy_data_to_clipboard(StringView data, NSPasteboardType pasteboard_ return [delegate cookieJar].get_named_cookie(url, name); }; - m_web_view_bridge->on_get_cookie = [](auto const& url, auto source) -> ByteString { + m_web_view_bridge->on_get_cookie = [](auto const& url, auto source) { auto* delegate = (ApplicationDelegate*)[NSApp delegate]; return [delegate cookieJar].get_cookie(url, source); }; diff --git a/Ladybird/Qt/BrowserWindow.cpp b/Ladybird/Qt/BrowserWindow.cpp index 73fceae2ba..90bbf37cf7 100644 --- a/Ladybird/Qt/BrowserWindow.cpp +++ b/Ladybird/Qt/BrowserWindow.cpp @@ -541,7 +541,7 @@ Tab& BrowserWindow::create_new_tab(Web::HTML::ActivateTab activate_tab) return m_cookie_jar.get_named_cookie(url, name); }; - tab->view().on_get_cookie = [this](auto& url, auto source) -> ByteString { + tab->view().on_get_cookie = [this](auto& url, auto source) { return m_cookie_jar.get_cookie(url, source); }; diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 190eccfa29..7734cad659 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -2006,7 +2006,7 @@ void Document::completely_finish_loading() String Document::cookie(Cookie::Source source) { - return MUST(String::from_byte_string(page().client().page_did_request_cookie(m_url, source))); + return page().client().page_did_request_cookie(m_url, source); } void Document::set_cookie(StringView cookie_string, Cookie::Source source) diff --git a/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp b/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp index df90ea6608..f668f653bd 100644 --- a/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp @@ -1431,7 +1431,7 @@ WebIDL::ExceptionOr> http_network_or_cache_fet // FIXME: Getting to the page client reliably is way too complicated, and going via the document won't work in workers. auto document = Bindings::host_defined_environment_settings_object(realm).responsible_document(); if (!document) - return ByteString::empty(); + return String {}; return document->page().client().page_did_request_cookie(http_request->current_url(), Cookie::Source::Http); })(); diff --git a/Userland/Libraries/LibWeb/Loader/LoadRequest.cpp b/Userland/Libraries/LibWeb/Loader/LoadRequest.cpp index 8ee1e19240..0ffbccc622 100644 --- a/Userland/Libraries/LibWeb/Loader/LoadRequest.cpp +++ b/Userland/Libraries/LibWeb/Loader/LoadRequest.cpp @@ -16,9 +16,9 @@ LoadRequest LoadRequest::create_for_url_on_page(const AK::URL& url, Page* page) request.set_url(url); if (page) { - ByteString cookie = page->client().page_did_request_cookie(url, Cookie::Source::Http); + auto cookie = page->client().page_did_request_cookie(url, Cookie::Source::Http); if (!cookie.is_empty()) - request.set_header("Cookie", cookie); + request.set_header("Cookie", cookie.to_byte_string()); request.set_page(*page); } diff --git a/Userland/Libraries/LibWeb/Page/Page.h b/Userland/Libraries/LibWeb/Page/Page.h index 32ab01a93c..8fcab42c31 100644 --- a/Userland/Libraries/LibWeb/Page/Page.h +++ b/Userland/Libraries/LibWeb/Page/Page.h @@ -264,7 +264,7 @@ public: virtual void page_did_request_dismiss_dialog() { } virtual Vector page_did_request_all_cookies(AK::URL const&) { return {}; } virtual Optional page_did_request_named_cookie(AK::URL const&, ByteString const&) { return {}; } - virtual ByteString page_did_request_cookie(const AK::URL&, Cookie::Source) { return {}; } + virtual String page_did_request_cookie(const AK::URL&, Cookie::Source) { return {}; } virtual void page_did_set_cookie(const AK::URL&, Cookie::ParsedCookie const&, Cookie::Source) { } virtual void page_did_update_cookie(Web::Cookie::Cookie) { } virtual void page_did_update_resource_count(i32) { } diff --git a/Userland/Libraries/LibWebView/CookieJar.cpp b/Userland/Libraries/LibWebView/CookieJar.cpp index 22cf2149eb..168970331b 100644 --- a/Userland/Libraries/LibWebView/CookieJar.cpp +++ b/Userland/Libraries/LibWebView/CookieJar.cpp @@ -80,7 +80,7 @@ CookieJar::CookieJar(TransientStorage storage) { } -ByteString CookieJar::get_cookie(const URL& url, Web::Cookie::Source source) +String CookieJar::get_cookie(const URL& url, Web::Cookie::Source source) { purge_expired_cookies(); @@ -100,7 +100,7 @@ ByteString CookieJar::get_cookie(const URL& url, Web::Cookie::Source source) builder.appendff("{}={}", cookie.name, cookie.value); } - return builder.to_byte_string(); + return MUST(builder.to_string()); } void CookieJar::set_cookie(const URL& url, Web::Cookie::ParsedCookie const& parsed_cookie, Web::Cookie::Source source) diff --git a/Userland/Libraries/LibWebView/CookieJar.h b/Userland/Libraries/LibWebView/CookieJar.h index 4b51c23f8e..8f7e576eba 100644 --- a/Userland/Libraries/LibWebView/CookieJar.h +++ b/Userland/Libraries/LibWebView/CookieJar.h @@ -49,7 +49,7 @@ public: static ErrorOr create(Database&); static CookieJar create(); - ByteString get_cookie(const URL& url, Web::Cookie::Source source); + String get_cookie(const URL& url, Web::Cookie::Source source); void set_cookie(const URL& url, Web::Cookie::ParsedCookie const& parsed_cookie, Web::Cookie::Source source); void update_cookie(Web::Cookie::Cookie); void dump_cookies(); diff --git a/Userland/Libraries/LibWebView/ViewImplementation.h b/Userland/Libraries/LibWebView/ViewImplementation.h index c50e480e29..816158b309 100644 --- a/Userland/Libraries/LibWebView/ViewImplementation.h +++ b/Userland/Libraries/LibWebView/ViewImplementation.h @@ -153,7 +153,7 @@ public: Function const& message_types, Vector const& messages)> on_received_console_messages; Function(AK::URL const& url)> on_get_all_cookies; Function(AK::URL const& url, ByteString const& name)> on_get_named_cookie; - Function on_get_cookie; + Function on_get_cookie; Function on_set_cookie; Function on_update_cookie; Function on_resource_status_change; diff --git a/Userland/Libraries/LibWebView/WebContentClient.cpp b/Userland/Libraries/LibWebView/WebContentClient.cpp index 6f033fa2fc..541ecbb92a 100644 --- a/Userland/Libraries/LibWebView/WebContentClient.cpp +++ b/Userland/Libraries/LibWebView/WebContentClient.cpp @@ -313,7 +313,7 @@ Messages::WebContentClient::DidRequestCookieResponse WebContentClient::did_reque { if (m_view.on_get_cookie) return m_view.on_get_cookie(url, static_cast(source)); - return ByteString {}; + return String {}; } void WebContentClient::did_set_cookie(AK::URL const& url, Web::Cookie::ParsedCookie const& cookie, u8 source) diff --git a/Userland/Services/WebContent/PageClient.cpp b/Userland/Services/WebContent/PageClient.cpp index 66006f1825..c214a70e36 100644 --- a/Userland/Services/WebContent/PageClient.cpp +++ b/Userland/Services/WebContent/PageClient.cpp @@ -468,7 +468,7 @@ Optional PageClient::page_did_request_named_cookie(URL cons return client().did_request_named_cookie(url, name); } -ByteString PageClient::page_did_request_cookie(const URL& url, Web::Cookie::Source source) +String PageClient::page_did_request_cookie(const URL& url, Web::Cookie::Source source) { auto response = client().send_sync_but_allow_failure(move(url), static_cast(source)); if (!response) { diff --git a/Userland/Services/WebContent/PageClient.h b/Userland/Services/WebContent/PageClient.h index 2b6b167f92..af63e0d82f 100644 --- a/Userland/Services/WebContent/PageClient.h +++ b/Userland/Services/WebContent/PageClient.h @@ -114,7 +114,7 @@ private: virtual void page_did_change_favicon(Gfx::Bitmap const&) override; virtual Vector page_did_request_all_cookies(URL const&) override; virtual Optional page_did_request_named_cookie(URL const&, ByteString const&) override; - virtual ByteString page_did_request_cookie(const URL&, Web::Cookie::Source) override; + virtual String page_did_request_cookie(const URL&, Web::Cookie::Source) override; virtual void page_did_set_cookie(const URL&, Web::Cookie::ParsedCookie const&, Web::Cookie::Source) override; virtual void page_did_update_cookie(Web::Cookie::Cookie) override; virtual void page_did_update_resource_count(i32) override; diff --git a/Userland/Services/WebContent/WebContentClient.ipc b/Userland/Services/WebContent/WebContentClient.ipc index 1050f25e00..fd674832d0 100644 --- a/Userland/Services/WebContent/WebContentClient.ipc +++ b/Userland/Services/WebContent/WebContentClient.ipc @@ -54,7 +54,7 @@ endpoint WebContentClient did_change_favicon(Gfx::ShareableBitmap favicon) =| did_request_all_cookies(URL url) => (Vector cookies) did_request_named_cookie(URL url, ByteString name) => (Optional cookie) - did_request_cookie(URL url, u8 source) => (ByteString cookie) + did_request_cookie(URL url, u8 source) => (String cookie) did_set_cookie(URL url, Web::Cookie::ParsedCookie cookie, u8 source) => () did_update_cookie(Web::Cookie::Cookie cookie) =| did_update_resource_count(i32 count_waiting) =| diff --git a/Userland/Utilities/headless-browser.cpp b/Userland/Utilities/headless-browser.cpp index 0cc3792d51..08c5280f02 100644 --- a/Userland/Utilities/headless-browser.cpp +++ b/Userland/Utilities/headless-browser.cpp @@ -168,7 +168,7 @@ private: on_scroll_to_point(position); }; - on_get_cookie = [this](auto const& url, auto source) -> ByteString { + on_get_cookie = [this](auto const& url, auto source) { return m_cookie_jar.get_cookie(url, source); };