From 97536e468498b91ffa1252e964cbf1ce08eb5944 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Mon, 13 Mar 2023 17:30:51 -0400 Subject: [PATCH] LibWeb+Ladybird+Userland: Port window.[alert,confirm,prompt] to String LibGUI and WebDriver (read: JSON) API boundaries use DeprecatedString, so that is as far as these changes can reach. The one change which isn't just a DeprecatedString to String replacement is handling the "null" prompt response. We previously checked for the null DeprecatedString, whereas we now represent this as an empty Optional. --- Ladybird/WebContentView.cpp | 20 ++++++++--------- Ladybird/WebContentView.h | 8 +++---- Userland/Libraries/LibWeb/HTML/Window.cpp | 12 ++++------ Userland/Libraries/LibWeb/Page/Page.cpp | 8 +++---- Userland/Libraries/LibWeb/Page/Page.h | 22 +++++++++---------- .../LibWebView/OutOfProcessWebView.cpp | 22 +++++++++++-------- .../LibWebView/OutOfProcessWebView.h | 8 +++---- .../Libraries/LibWebView/ViewImplementation.h | 8 +++---- .../Libraries/LibWebView/WebContentClient.cpp | 8 +++---- .../Libraries/LibWebView/WebContentClient.h | 8 +++---- .../WebContent/ConnectionFromClient.cpp | 2 +- .../WebContent/ConnectionFromClient.h | 2 +- Userland/Services/WebContent/PageHost.cpp | 10 ++++----- Userland/Services/WebContent/PageHost.h | 10 ++++----- .../Services/WebContent/WebContentClient.ipc | 8 +++---- .../Services/WebContent/WebContentServer.ipc | 2 +- .../WebContent/WebDriverConnection.cpp | 4 ++-- Userland/Utilities/headless-browser.cpp | 8 +++---- 18 files changed, 85 insertions(+), 85 deletions(-) diff --git a/Ladybird/WebContentView.cpp b/Ladybird/WebContentView.cpp index e16e3f8ad8..76c19c185d 100644 --- a/Ladybird/WebContentView.cpp +++ b/Ladybird/WebContentView.cpp @@ -807,45 +807,45 @@ void WebContentView::notify_server_did_request_image_context_menu(Badge, DeprecatedString const& message) +void WebContentView::notify_server_did_request_alert(Badge, String const& message) { - m_dialog = new QMessageBox(QMessageBox::Icon::Warning, "Ladybird", qstring_from_ak_deprecated_string(message), QMessageBox::StandardButton::Ok, this); + m_dialog = new QMessageBox(QMessageBox::Icon::Warning, "Ladybird", qstring_from_ak_string(message), QMessageBox::StandardButton::Ok, this); m_dialog->exec(); client().async_alert_closed(); m_dialog = nullptr; } -void WebContentView::notify_server_did_request_confirm(Badge, DeprecatedString const& message) +void WebContentView::notify_server_did_request_confirm(Badge, String const& message) { - m_dialog = new QMessageBox(QMessageBox::Icon::Question, "Ladybird", qstring_from_ak_deprecated_string(message), QMessageBox::StandardButton::Ok | QMessageBox::StandardButton::Cancel, this); + m_dialog = new QMessageBox(QMessageBox::Icon::Question, "Ladybird", qstring_from_ak_string(message), QMessageBox::StandardButton::Ok | QMessageBox::StandardButton::Cancel, this); auto result = m_dialog->exec(); client().async_confirm_closed(result == QMessageBox::StandardButton::Ok || result == QDialog::Accepted); m_dialog = nullptr; } -void WebContentView::notify_server_did_request_prompt(Badge, DeprecatedString const& message, DeprecatedString const& default_) +void WebContentView::notify_server_did_request_prompt(Badge, String const& message, String const& default_) { m_dialog = new QInputDialog(this); auto& dialog = static_cast(*m_dialog); dialog.setWindowTitle("Ladybird"); - dialog.setLabelText(qstring_from_ak_deprecated_string(message)); - dialog.setTextValue(qstring_from_ak_deprecated_string(default_)); + dialog.setLabelText(qstring_from_ak_string(message)); + dialog.setTextValue(qstring_from_ak_string(default_)); if (dialog.exec() == QDialog::Accepted) - client().async_prompt_closed(ak_deprecated_string_from_qstring(dialog.textValue())); + client().async_prompt_closed(ak_string_from_qstring(dialog.textValue()).release_value_but_fixme_should_propagate_errors()); else client().async_prompt_closed({}); m_dialog = nullptr; } -void WebContentView::notify_server_did_request_set_prompt_text(Badge, DeprecatedString const& message) +void WebContentView::notify_server_did_request_set_prompt_text(Badge, String const& message) { if (m_dialog && is(*m_dialog)) - static_cast(*m_dialog).setTextValue(qstring_from_ak_deprecated_string(message)); + static_cast(*m_dialog).setTextValue(qstring_from_ak_string(message)); } void WebContentView::notify_server_did_request_accept_dialog(Badge) diff --git a/Ladybird/WebContentView.h b/Ladybird/WebContentView.h index 9963293f80..d7c9d4dbd7 100644 --- a/Ladybird/WebContentView.h +++ b/Ladybird/WebContentView.h @@ -127,10 +127,10 @@ public: virtual void notify_server_did_request_context_menu(Badge, Gfx::IntPoint) override; virtual void notify_server_did_request_link_context_menu(Badge, Gfx::IntPoint, const AK::URL&, DeprecatedString const& target, unsigned modifiers) override; virtual void notify_server_did_request_image_context_menu(Badge, Gfx::IntPoint, const AK::URL&, DeprecatedString const& target, unsigned modifiers, Gfx::ShareableBitmap const&) override; - virtual void notify_server_did_request_alert(Badge, DeprecatedString const& message) override; - virtual void notify_server_did_request_confirm(Badge, DeprecatedString const& message) override; - virtual void notify_server_did_request_prompt(Badge, DeprecatedString const& message, DeprecatedString const& default_) override; - virtual void notify_server_did_request_set_prompt_text(Badge, DeprecatedString const& message) override; + virtual void notify_server_did_request_alert(Badge, String const& message) override; + virtual void notify_server_did_request_confirm(Badge, String const& message) override; + virtual void notify_server_did_request_prompt(Badge, String const& message, String const& default_) override; + virtual void notify_server_did_request_set_prompt_text(Badge, String const& message) override; virtual void notify_server_did_request_accept_dialog(Badge) override; virtual void notify_server_did_request_dismiss_dialog(Badge) override; virtual void notify_server_did_get_source(const AK::URL& url, DeprecatedString const& source) override; diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp index c5c8b0354b..7e2cdd8e76 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.cpp +++ b/Userland/Libraries/LibWeb/HTML/Window.cpp @@ -1096,7 +1096,7 @@ void Window::alert(String const& message) // treated as alert("undefined"), but alert() is treated as alert(""). // FIXME: Make this fully spec compliant. if (auto* page = this->page()) - page->did_request_alert(message.to_deprecated_string()); + page->did_request_alert(message); } // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-confirm @@ -1105,7 +1105,7 @@ bool Window::confirm(Optional const& message) // FIXME: Make this fully spec compliant. // NOTE: `message` has an IDL-provided default value and is never empty. if (auto* page = this->page()) - return page->did_request_confirm(message->to_deprecated_string()); + return page->did_request_confirm(*message); return false; } @@ -1113,12 +1113,8 @@ bool Window::confirm(Optional const& message) Optional Window::prompt(Optional const& message, Optional const& default_) { // FIXME: Make this fully spec compliant. - if (auto* page = this->page()) { - auto response = page->did_request_prompt(message->to_deprecated_string(), default_->to_deprecated_string()); - if (response.is_null()) - return {}; - return String::from_deprecated_string(response).release_value_but_fixme_should_propagate_errors(); - } + if (auto* page = this->page()) + return page->did_request_prompt(*message, *default_); return {}; } diff --git a/Userland/Libraries/LibWeb/Page/Page.cpp b/Userland/Libraries/LibWeb/Page/Page.cpp index 150fa3593a..75264f2c9e 100644 --- a/Userland/Libraries/LibWeb/Page/Page.cpp +++ b/Userland/Libraries/LibWeb/Page/Page.cpp @@ -187,7 +187,7 @@ static ResponseType spin_event_loop_until_dialog_closed(PageClient& client, Opti return response.release_value(); } -void Page::did_request_alert(DeprecatedString const& message) +void Page::did_request_alert(String const& message) { m_pending_dialog = PendingDialog::Alert; m_client.page_did_request_alert(message); @@ -207,7 +207,7 @@ void Page::alert_closed() } } -bool Page::did_request_confirm(DeprecatedString const& message) +bool Page::did_request_confirm(String const& message) { m_pending_dialog = PendingDialog::Confirm; m_client.page_did_request_confirm(message); @@ -227,7 +227,7 @@ void Page::confirm_closed(bool accepted) } } -DeprecatedString Page::did_request_prompt(DeprecatedString const& message, DeprecatedString const& default_) +Optional Page::did_request_prompt(String const& message, String const& default_) { m_pending_dialog = PendingDialog::Prompt; m_client.page_did_request_prompt(message, default_); @@ -238,7 +238,7 @@ DeprecatedString Page::did_request_prompt(DeprecatedString const& message, Depre return spin_event_loop_until_dialog_closed(m_client, m_pending_prompt_response); } -void Page::prompt_closed(DeprecatedString response) +void Page::prompt_closed(Optional response) { if (m_pending_dialog == PendingDialog::Prompt) { m_pending_dialog = PendingDialog::None; diff --git a/Userland/Libraries/LibWeb/Page/Page.h b/Userland/Libraries/LibWeb/Page/Page.h index 7bd0fbdee4..199bac0a8e 100644 --- a/Userland/Libraries/LibWeb/Page/Page.h +++ b/Userland/Libraries/LibWeb/Page/Page.h @@ -93,14 +93,14 @@ public: DevicePixelSize window_size() const { return m_window_size; } void set_window_size(DevicePixelSize size) { m_window_size = size; } - void did_request_alert(DeprecatedString const& message); + void did_request_alert(String const& message); void alert_closed(); - bool did_request_confirm(DeprecatedString const& message); + bool did_request_confirm(String const& message); void confirm_closed(bool accepted); - DeprecatedString did_request_prompt(DeprecatedString const& message, DeprecatedString const& default_); - void prompt_closed(DeprecatedString response); + Optional did_request_prompt(String const& message, String const& default_); + void prompt_closed(Optional response); enum class PendingDialog { None, @@ -110,7 +110,7 @@ public: }; bool has_pending_dialog() const { return m_pending_dialog != PendingDialog::None; } PendingDialog pending_dialog() const { return m_pending_dialog; } - Optional const& pending_dialog_text() const { return m_pending_dialog_text; } + Optional const& pending_dialog_text() const { return m_pending_dialog_text; } void dismiss_dialog(); void accept_dialog(); @@ -137,10 +137,10 @@ private: DevicePixelSize m_window_size {}; PendingDialog m_pending_dialog { PendingDialog::None }; - Optional m_pending_dialog_text; + Optional m_pending_dialog_text; Optional m_pending_alert_response; Optional m_pending_confirm_response; - Optional m_pending_prompt_response; + Optional> m_pending_prompt_response; // https://html.spec.whatwg.org/multipage/system-state.html#pdf-viewer-supported // Each user agent has a PDF viewer supported boolean, whose value is implementation-defined (and might vary according to user preferences). @@ -189,10 +189,10 @@ public: virtual void page_did_request_scroll(i32, i32) { } virtual void page_did_request_scroll_to(CSSPixelPoint) { } virtual void page_did_request_scroll_into_view(CSSPixelRect const&) { } - virtual void page_did_request_alert(DeprecatedString const&) { } - virtual void page_did_request_confirm(DeprecatedString const&) { } - virtual void page_did_request_prompt(DeprecatedString const&, DeprecatedString const&) { } - virtual void page_did_request_set_prompt_text(DeprecatedString const&) { } + virtual void page_did_request_alert(String const&) { } + virtual void page_did_request_confirm(String const&) { } + virtual void page_did_request_prompt(String const&, String const&) { } + virtual void page_did_request_set_prompt_text(String const&) { } virtual void page_did_request_accept_dialog() { } virtual void page_did_request_dismiss_dialog() { } virtual Vector page_did_request_all_cookies(AK::URL const&) { return {}; } diff --git a/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp index c8ddfaef2e..265a426f58 100644 --- a/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp +++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp @@ -346,7 +346,7 @@ void OutOfProcessWebView::notify_server_did_request_image_context_menu(Badge, DeprecatedString const& message) +void OutOfProcessWebView::notify_server_did_request_alert(Badge, String const& message) { m_dialog = GUI::MessageBox::construct(window(), message, "Alert"sv, GUI::MessageBox::Type::Information, GUI::MessageBox::InputType::OK); m_dialog->set_icon(window()->icon()); @@ -356,7 +356,7 @@ void OutOfProcessWebView::notify_server_did_request_alert(Badge, DeprecatedString const& message) +void OutOfProcessWebView::notify_server_did_request_confirm(Badge, String const& message) { m_dialog = GUI::MessageBox::construct(window(), message, "Confirm"sv, GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::OKCancel); m_dialog->set_icon(window()->icon()); @@ -365,23 +365,27 @@ void OutOfProcessWebView::notify_server_did_request_confirm(Badge, DeprecatedString const& message, DeprecatedString const& default_) +void OutOfProcessWebView::notify_server_did_request_prompt(Badge, String const& message, String const& default_) { - m_dialog = GUI::InputBox::construct(window(), default_, message, "Prompt"sv, GUI::InputType::Text, StringView {}); + m_dialog = GUI::InputBox::construct(window(), default_.to_deprecated_string(), message, "Prompt"sv, GUI::InputType::Text, StringView {}); m_dialog->set_icon(window()->icon()); - if (m_dialog->exec() == GUI::InputBox::ExecResult::OK) - client().async_prompt_closed(static_cast(*m_dialog).text_value()); - else + if (m_dialog->exec() == GUI::InputBox::ExecResult::OK) { + auto const& dialog = static_cast(*m_dialog); + auto response = String::from_deprecated_string(dialog.text_value()).release_value_but_fixme_should_propagate_errors(); + + client().async_prompt_closed(move(response)); + } else { client().async_prompt_closed({}); + } m_dialog = nullptr; } -void OutOfProcessWebView::notify_server_did_request_set_prompt_text(Badge, DeprecatedString const& message) +void OutOfProcessWebView::notify_server_did_request_set_prompt_text(Badge, String const& message) { if (m_dialog && is(*m_dialog)) - static_cast(*m_dialog).set_text_value(message); + static_cast(*m_dialog).set_text_value(message.to_deprecated_string()); } void OutOfProcessWebView::notify_server_did_request_accept_dialog(Badge) diff --git a/Userland/Libraries/LibWebView/OutOfProcessWebView.h b/Userland/Libraries/LibWebView/OutOfProcessWebView.h index 5ebd9a6f72..0a2eef0efc 100644 --- a/Userland/Libraries/LibWebView/OutOfProcessWebView.h +++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.h @@ -143,10 +143,10 @@ private: virtual void notify_server_did_request_context_menu(Badge, Gfx::IntPoint) override; virtual void notify_server_did_request_link_context_menu(Badge, Gfx::IntPoint, const AK::URL&, DeprecatedString const& target, unsigned modifiers) override; virtual void notify_server_did_request_image_context_menu(Badge, Gfx::IntPoint, const AK::URL&, DeprecatedString const& target, unsigned modifiers, Gfx::ShareableBitmap const&) override; - virtual void notify_server_did_request_alert(Badge, DeprecatedString const& message) override; - virtual void notify_server_did_request_confirm(Badge, DeprecatedString const& message) override; - virtual void notify_server_did_request_prompt(Badge, DeprecatedString const& message, DeprecatedString const& default_) override; - virtual void notify_server_did_request_set_prompt_text(Badge, DeprecatedString const& message) override; + virtual void notify_server_did_request_alert(Badge, String const& message) override; + virtual void notify_server_did_request_confirm(Badge, String const& message) override; + virtual void notify_server_did_request_prompt(Badge, String const& message, String const& default_) override; + virtual void notify_server_did_request_set_prompt_text(Badge, String const& message) override; virtual void notify_server_did_request_accept_dialog(Badge) override; virtual void notify_server_did_request_dismiss_dialog(Badge) override; virtual void notify_server_did_get_source(const AK::URL& url, DeprecatedString const& source) override; diff --git a/Userland/Libraries/LibWebView/ViewImplementation.h b/Userland/Libraries/LibWebView/ViewImplementation.h index ea4813a9a9..d23e4f7ef4 100644 --- a/Userland/Libraries/LibWebView/ViewImplementation.h +++ b/Userland/Libraries/LibWebView/ViewImplementation.h @@ -78,10 +78,10 @@ public: virtual void notify_server_did_request_context_menu(Badge, Gfx::IntPoint) = 0; virtual void notify_server_did_request_link_context_menu(Badge, Gfx::IntPoint, const AK::URL&, DeprecatedString const& target, unsigned modifiers) = 0; virtual void notify_server_did_request_image_context_menu(Badge, Gfx::IntPoint, const AK::URL&, DeprecatedString const& target, unsigned modifiers, Gfx::ShareableBitmap const&) = 0; - virtual void notify_server_did_request_alert(Badge, DeprecatedString const& message) = 0; - virtual void notify_server_did_request_confirm(Badge, DeprecatedString const& message) = 0; - virtual void notify_server_did_request_prompt(Badge, DeprecatedString const& message, DeprecatedString const& default_) = 0; - virtual void notify_server_did_request_set_prompt_text(Badge, DeprecatedString const& message) = 0; + virtual void notify_server_did_request_alert(Badge, String const& message) = 0; + virtual void notify_server_did_request_confirm(Badge, String const& message) = 0; + virtual void notify_server_did_request_prompt(Badge, String const& message, String const& default_) = 0; + virtual void notify_server_did_request_set_prompt_text(Badge, String const& message) = 0; virtual void notify_server_did_request_accept_dialog(Badge) = 0; virtual void notify_server_did_request_dismiss_dialog(Badge) = 0; virtual void notify_server_did_get_source(const AK::URL& url, DeprecatedString const& source) = 0; diff --git a/Userland/Libraries/LibWebView/WebContentClient.cpp b/Userland/Libraries/LibWebView/WebContentClient.cpp index 6d906a75ff..117bb9d420 100644 --- a/Userland/Libraries/LibWebView/WebContentClient.cpp +++ b/Userland/Libraries/LibWebView/WebContentClient.cpp @@ -176,22 +176,22 @@ void WebContentClient::did_get_js_console_messages(i32 start_index, Vector const& message_types, Vector const& messages) override; virtual void did_change_favicon(Gfx::ShareableBitmap const&) override; - virtual void did_request_alert(DeprecatedString const&) override; - virtual void did_request_confirm(DeprecatedString const&) override; - virtual void did_request_prompt(DeprecatedString const&, DeprecatedString const&) override; - virtual void did_request_set_prompt_text(DeprecatedString const& message) override; + virtual void did_request_alert(String const&) override; + virtual void did_request_confirm(String const&) override; + virtual void did_request_prompt(String const&, String const&) override; + virtual void did_request_set_prompt_text(String const& message) override; virtual void did_request_accept_dialog() override; virtual void did_request_dismiss_dialog() override; virtual Messages::WebContentClient::DidRequestAllCookiesResponse did_request_all_cookies(AK::URL const&) override; diff --git a/Userland/Services/WebContent/ConnectionFromClient.cpp b/Userland/Services/WebContent/ConnectionFromClient.cpp index 3e7b27ef8e..e473217a9f 100644 --- a/Userland/Services/WebContent/ConnectionFromClient.cpp +++ b/Userland/Services/WebContent/ConnectionFromClient.cpp @@ -598,7 +598,7 @@ void ConnectionFromClient::confirm_closed(bool accepted) m_page_host->confirm_closed(accepted); } -void ConnectionFromClient::prompt_closed(DeprecatedString const& response) +void ConnectionFromClient::prompt_closed(Optional const& response) { m_page_host->prompt_closed(response); } diff --git a/Userland/Services/WebContent/ConnectionFromClient.h b/Userland/Services/WebContent/ConnectionFromClient.h index 6727e941e8..ffc116ee8a 100644 --- a/Userland/Services/WebContent/ConnectionFromClient.h +++ b/Userland/Services/WebContent/ConnectionFromClient.h @@ -88,7 +88,7 @@ private: virtual void alert_closed() override; virtual void confirm_closed(bool accepted) override; - virtual void prompt_closed(DeprecatedString const& response) override; + virtual void prompt_closed(Optional const& response) override; virtual Messages::WebContentServer::TakeDocumentScreenshotResponse take_document_screenshot() override; diff --git a/Userland/Services/WebContent/PageHost.cpp b/Userland/Services/WebContent/PageHost.cpp index f8df42e032..ae30fd7cf2 100644 --- a/Userland/Services/WebContent/PageHost.cpp +++ b/Userland/Services/WebContent/PageHost.cpp @@ -282,7 +282,7 @@ void PageHost::page_did_request_link_context_menu(Web::CSSPixelPoint content_pos m_client.async_did_request_link_context_menu(page().css_to_device_point(content_position).to_type(), url, target, modifiers); } -void PageHost::page_did_request_alert(DeprecatedString const& message) +void PageHost::page_did_request_alert(String const& message) { m_client.async_did_request_alert(message); } @@ -292,7 +292,7 @@ void PageHost::alert_closed() page().alert_closed(); } -void PageHost::page_did_request_confirm(DeprecatedString const& message) +void PageHost::page_did_request_confirm(String const& message) { m_client.async_did_request_confirm(message); } @@ -302,17 +302,17 @@ void PageHost::confirm_closed(bool accepted) page().confirm_closed(accepted); } -void PageHost::page_did_request_prompt(DeprecatedString const& message, DeprecatedString const& default_) +void PageHost::page_did_request_prompt(String const& message, String const& default_) { m_client.async_did_request_prompt(message, default_); } -void PageHost::page_did_request_set_prompt_text(DeprecatedString const& text) +void PageHost::page_did_request_set_prompt_text(String const& text) { m_client.async_did_request_set_prompt_text(text); } -void PageHost::prompt_closed(DeprecatedString response) +void PageHost::prompt_closed(Optional response) { page().prompt_closed(move(response)); } diff --git a/Userland/Services/WebContent/PageHost.h b/Userland/Services/WebContent/PageHost.h index bc0496f3a0..b7f3c133c4 100644 --- a/Userland/Services/WebContent/PageHost.h +++ b/Userland/Services/WebContent/PageHost.h @@ -46,7 +46,7 @@ public: void alert_closed(); void confirm_closed(bool accepted); - void prompt_closed(DeprecatedString response); + void prompt_closed(Optional response); private: // ^PageClient @@ -83,10 +83,10 @@ private: virtual void page_did_start_loading(const URL&, bool) override; virtual void page_did_create_main_document() override; virtual void page_did_finish_loading(const URL&) override; - virtual void page_did_request_alert(DeprecatedString const&) override; - virtual void page_did_request_confirm(DeprecatedString const&) override; - virtual void page_did_request_prompt(DeprecatedString const&, DeprecatedString const&) override; - virtual void page_did_request_set_prompt_text(DeprecatedString const&) override; + virtual void page_did_request_alert(String const&) override; + virtual void page_did_request_confirm(String const&) override; + virtual void page_did_request_prompt(String const&, String const&) override; + virtual void page_did_request_set_prompt_text(String const&) override; virtual void page_did_request_accept_dialog() override; virtual void page_did_request_dismiss_dialog() override; virtual void page_did_change_favicon(Gfx::Bitmap const&) override; diff --git a/Userland/Services/WebContent/WebContentClient.ipc b/Userland/Services/WebContent/WebContentClient.ipc index 49922ede3e..2f6423b343 100644 --- a/Userland/Services/WebContent/WebContentClient.ipc +++ b/Userland/Services/WebContent/WebContentClient.ipc @@ -29,10 +29,10 @@ endpoint WebContentClient did_request_context_menu(Gfx::IntPoint content_position) =| did_request_link_context_menu(Gfx::IntPoint content_position, URL url, DeprecatedString target, unsigned modifiers) =| did_request_image_context_menu(Gfx::IntPoint content_position, URL url, DeprecatedString target, unsigned modifiers, Gfx::ShareableBitmap bitmap) =| - did_request_alert(DeprecatedString message) =| - did_request_confirm(DeprecatedString message) =| - did_request_prompt(DeprecatedString message, DeprecatedString default_) =| - did_request_set_prompt_text(DeprecatedString message) =| + did_request_alert(String message) =| + did_request_confirm(String message) =| + did_request_prompt(String message, String default_) =| + did_request_set_prompt_text(String message) =| did_request_accept_dialog() =| did_request_dismiss_dialog() =| did_get_source(URL url, DeprecatedString source) =| diff --git a/Userland/Services/WebContent/WebContentServer.ipc b/Userland/Services/WebContent/WebContentServer.ipc index cb961526f2..36127181ba 100644 --- a/Userland/Services/WebContent/WebContentServer.ipc +++ b/Userland/Services/WebContent/WebContentServer.ipc @@ -70,5 +70,5 @@ endpoint WebContentServer alert_closed() =| confirm_closed(bool accepted) =| - prompt_closed(DeprecatedString response) =| + prompt_closed(Optional response) =| } diff --git a/Userland/Services/WebContent/WebDriverConnection.cpp b/Userland/Services/WebContent/WebDriverConnection.cpp index d1568b4e56..bd32b97ea1 100644 --- a/Userland/Services/WebContent/WebDriverConnection.cpp +++ b/Userland/Services/WebContent/WebDriverConnection.cpp @@ -1640,7 +1640,7 @@ Messages::WebDriverClient::GetAlertTextResponse WebDriverConnection::get_alert_t // 4. Return success with data message. if (message.has_value()) - return *message; + return message->to_deprecated_string(); return JsonValue {}; } @@ -1679,7 +1679,7 @@ Messages::WebDriverClient::SendAlertTextResponse WebDriverConnection::send_alert } // 6. Perform user agent dependent steps to set the value of current user prompt’s text field to text. - m_page_client.page_did_request_set_prompt_text(move(text)); + m_page_client.page_did_request_set_prompt_text(TRY(String::from_deprecated_string(text))); // 7. Return success with data null. return JsonValue {}; diff --git a/Userland/Utilities/headless-browser.cpp b/Userland/Utilities/headless-browser.cpp index 0eb070c1fb..498a23104f 100644 --- a/Userland/Utilities/headless-browser.cpp +++ b/Userland/Utilities/headless-browser.cpp @@ -114,10 +114,10 @@ private: void notify_server_did_request_context_menu(Badge, Gfx::IntPoint) override { } void notify_server_did_request_link_context_menu(Badge, Gfx::IntPoint, const URL&, DeprecatedString const&, unsigned) override { } void notify_server_did_request_image_context_menu(Badge, Gfx::IntPoint, const URL&, DeprecatedString const&, unsigned, Gfx::ShareableBitmap const&) override { } - void notify_server_did_request_alert(Badge, DeprecatedString const&) override { } - void notify_server_did_request_confirm(Badge, DeprecatedString const&) override { } - void notify_server_did_request_prompt(Badge, DeprecatedString const&, DeprecatedString const&) override { } - void notify_server_did_request_set_prompt_text(Badge, DeprecatedString const&) override { } + void notify_server_did_request_alert(Badge, String const&) override { } + void notify_server_did_request_confirm(Badge, String const&) override { } + void notify_server_did_request_prompt(Badge, String const&, String const&) override { } + void notify_server_did_request_set_prompt_text(Badge, String const&) override { } void notify_server_did_request_accept_dialog(Badge) override { } void notify_server_did_request_dismiss_dialog(Badge) override { } void notify_server_did_get_source(const URL&, DeprecatedString const&) override { }