mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
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<String>.
This commit is contained in:
parent
b4d3fea002
commit
97536e4684
Notes:
sideshowbarker
2024-07-17 08:37:36 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/97536e4684 Pull-request: https://github.com/SerenityOS/serenity/pull/17841 Reviewed-by: https://github.com/gmta Reviewed-by: https://github.com/linusg ✅
18 changed files with 85 additions and 85 deletions
|
@ -807,45 +807,45 @@ void WebContentView::notify_server_did_request_image_context_menu(Badge<WebConte
|
|||
(void)bitmap;
|
||||
}
|
||||
|
||||
void WebContentView::notify_server_did_request_alert(Badge<WebContentClient>, DeprecatedString const& message)
|
||||
void WebContentView::notify_server_did_request_alert(Badge<WebContentClient>, 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<WebContentClient>, DeprecatedString const& message)
|
||||
void WebContentView::notify_server_did_request_confirm(Badge<WebContentClient>, 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<WebContentClient>, DeprecatedString const& message, DeprecatedString const& default_)
|
||||
void WebContentView::notify_server_did_request_prompt(Badge<WebContentClient>, String const& message, String const& default_)
|
||||
{
|
||||
m_dialog = new QInputDialog(this);
|
||||
auto& dialog = static_cast<QInputDialog&>(*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<WebContentClient>, DeprecatedString const& message)
|
||||
void WebContentView::notify_server_did_request_set_prompt_text(Badge<WebContentClient>, String const& message)
|
||||
{
|
||||
if (m_dialog && is<QInputDialog>(*m_dialog))
|
||||
static_cast<QInputDialog&>(*m_dialog).setTextValue(qstring_from_ak_deprecated_string(message));
|
||||
static_cast<QInputDialog&>(*m_dialog).setTextValue(qstring_from_ak_string(message));
|
||||
}
|
||||
|
||||
void WebContentView::notify_server_did_request_accept_dialog(Badge<WebContentClient>)
|
||||
|
|
|
@ -127,10 +127,10 @@ public:
|
|||
virtual void notify_server_did_request_context_menu(Badge<WebContentClient>, Gfx::IntPoint) override;
|
||||
virtual void notify_server_did_request_link_context_menu(Badge<WebContentClient>, Gfx::IntPoint, const AK::URL&, DeprecatedString const& target, unsigned modifiers) override;
|
||||
virtual void notify_server_did_request_image_context_menu(Badge<WebContentClient>, Gfx::IntPoint, const AK::URL&, DeprecatedString const& target, unsigned modifiers, Gfx::ShareableBitmap const&) override;
|
||||
virtual void notify_server_did_request_alert(Badge<WebContentClient>, DeprecatedString const& message) override;
|
||||
virtual void notify_server_did_request_confirm(Badge<WebContentClient>, DeprecatedString const& message) override;
|
||||
virtual void notify_server_did_request_prompt(Badge<WebContentClient>, DeprecatedString const& message, DeprecatedString const& default_) override;
|
||||
virtual void notify_server_did_request_set_prompt_text(Badge<WebContentClient>, DeprecatedString const& message) override;
|
||||
virtual void notify_server_did_request_alert(Badge<WebContentClient>, String const& message) override;
|
||||
virtual void notify_server_did_request_confirm(Badge<WebContentClient>, String const& message) override;
|
||||
virtual void notify_server_did_request_prompt(Badge<WebContentClient>, String const& message, String const& default_) override;
|
||||
virtual void notify_server_did_request_set_prompt_text(Badge<WebContentClient>, String const& message) override;
|
||||
virtual void notify_server_did_request_accept_dialog(Badge<WebContentClient>) override;
|
||||
virtual void notify_server_did_request_dismiss_dialog(Badge<WebContentClient>) override;
|
||||
virtual void notify_server_did_get_source(const AK::URL& url, DeprecatedString const& source) override;
|
||||
|
|
|
@ -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<String> 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<String> const& message)
|
|||
Optional<String> Window::prompt(Optional<String> const& message, Optional<String> 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 {};
|
||||
}
|
||||
|
||||
|
|
|
@ -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<String> 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<String> response)
|
||||
{
|
||||
if (m_pending_dialog == PendingDialog::Prompt) {
|
||||
m_pending_dialog = PendingDialog::None;
|
||||
|
|
|
@ -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<String> did_request_prompt(String const& message, String const& default_);
|
||||
void prompt_closed(Optional<String> 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<DeprecatedString> const& pending_dialog_text() const { return m_pending_dialog_text; }
|
||||
Optional<String> 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<DeprecatedString> m_pending_dialog_text;
|
||||
Optional<String> m_pending_dialog_text;
|
||||
Optional<Empty> m_pending_alert_response;
|
||||
Optional<bool> m_pending_confirm_response;
|
||||
Optional<DeprecatedString> m_pending_prompt_response;
|
||||
Optional<Optional<String>> 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<Web::Cookie::Cookie> page_did_request_all_cookies(AK::URL const&) { return {}; }
|
||||
|
|
|
@ -346,7 +346,7 @@ void OutOfProcessWebView::notify_server_did_request_image_context_menu(Badge<Web
|
|||
on_image_context_menu_request(url, screen_relative_rect().location().translated(to_widget_position(content_position)), bitmap);
|
||||
}
|
||||
|
||||
void OutOfProcessWebView::notify_server_did_request_alert(Badge<WebContentClient>, DeprecatedString const& message)
|
||||
void OutOfProcessWebView::notify_server_did_request_alert(Badge<WebContentClient>, 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<WebContentClient
|
|||
m_dialog = nullptr;
|
||||
}
|
||||
|
||||
void OutOfProcessWebView::notify_server_did_request_confirm(Badge<WebContentClient>, DeprecatedString const& message)
|
||||
void OutOfProcessWebView::notify_server_did_request_confirm(Badge<WebContentClient>, 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<WebContentClie
|
|||
m_dialog = nullptr;
|
||||
}
|
||||
|
||||
void OutOfProcessWebView::notify_server_did_request_prompt(Badge<WebContentClient>, DeprecatedString const& message, DeprecatedString const& default_)
|
||||
void OutOfProcessWebView::notify_server_did_request_prompt(Badge<WebContentClient>, 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<GUI::InputBox&>(*m_dialog).text_value());
|
||||
else
|
||||
if (m_dialog->exec() == GUI::InputBox::ExecResult::OK) {
|
||||
auto const& dialog = static_cast<GUI::InputBox const&>(*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<WebContentClient>, DeprecatedString const& message)
|
||||
void OutOfProcessWebView::notify_server_did_request_set_prompt_text(Badge<WebContentClient>, String const& message)
|
||||
{
|
||||
if (m_dialog && is<GUI::InputBox>(*m_dialog))
|
||||
static_cast<GUI::InputBox&>(*m_dialog).set_text_value(message);
|
||||
static_cast<GUI::InputBox&>(*m_dialog).set_text_value(message.to_deprecated_string());
|
||||
}
|
||||
|
||||
void OutOfProcessWebView::notify_server_did_request_accept_dialog(Badge<WebContentClient>)
|
||||
|
|
|
@ -143,10 +143,10 @@ private:
|
|||
virtual void notify_server_did_request_context_menu(Badge<WebContentClient>, Gfx::IntPoint) override;
|
||||
virtual void notify_server_did_request_link_context_menu(Badge<WebContentClient>, Gfx::IntPoint, const AK::URL&, DeprecatedString const& target, unsigned modifiers) override;
|
||||
virtual void notify_server_did_request_image_context_menu(Badge<WebContentClient>, Gfx::IntPoint, const AK::URL&, DeprecatedString const& target, unsigned modifiers, Gfx::ShareableBitmap const&) override;
|
||||
virtual void notify_server_did_request_alert(Badge<WebContentClient>, DeprecatedString const& message) override;
|
||||
virtual void notify_server_did_request_confirm(Badge<WebContentClient>, DeprecatedString const& message) override;
|
||||
virtual void notify_server_did_request_prompt(Badge<WebContentClient>, DeprecatedString const& message, DeprecatedString const& default_) override;
|
||||
virtual void notify_server_did_request_set_prompt_text(Badge<WebContentClient>, DeprecatedString const& message) override;
|
||||
virtual void notify_server_did_request_alert(Badge<WebContentClient>, String const& message) override;
|
||||
virtual void notify_server_did_request_confirm(Badge<WebContentClient>, String const& message) override;
|
||||
virtual void notify_server_did_request_prompt(Badge<WebContentClient>, String const& message, String const& default_) override;
|
||||
virtual void notify_server_did_request_set_prompt_text(Badge<WebContentClient>, String const& message) override;
|
||||
virtual void notify_server_did_request_accept_dialog(Badge<WebContentClient>) override;
|
||||
virtual void notify_server_did_request_dismiss_dialog(Badge<WebContentClient>) override;
|
||||
virtual void notify_server_did_get_source(const AK::URL& url, DeprecatedString const& source) override;
|
||||
|
|
|
@ -78,10 +78,10 @@ public:
|
|||
virtual void notify_server_did_request_context_menu(Badge<WebContentClient>, Gfx::IntPoint) = 0;
|
||||
virtual void notify_server_did_request_link_context_menu(Badge<WebContentClient>, Gfx::IntPoint, const AK::URL&, DeprecatedString const& target, unsigned modifiers) = 0;
|
||||
virtual void notify_server_did_request_image_context_menu(Badge<WebContentClient>, Gfx::IntPoint, const AK::URL&, DeprecatedString const& target, unsigned modifiers, Gfx::ShareableBitmap const&) = 0;
|
||||
virtual void notify_server_did_request_alert(Badge<WebContentClient>, DeprecatedString const& message) = 0;
|
||||
virtual void notify_server_did_request_confirm(Badge<WebContentClient>, DeprecatedString const& message) = 0;
|
||||
virtual void notify_server_did_request_prompt(Badge<WebContentClient>, DeprecatedString const& message, DeprecatedString const& default_) = 0;
|
||||
virtual void notify_server_did_request_set_prompt_text(Badge<WebContentClient>, DeprecatedString const& message) = 0;
|
||||
virtual void notify_server_did_request_alert(Badge<WebContentClient>, String const& message) = 0;
|
||||
virtual void notify_server_did_request_confirm(Badge<WebContentClient>, String const& message) = 0;
|
||||
virtual void notify_server_did_request_prompt(Badge<WebContentClient>, String const& message, String const& default_) = 0;
|
||||
virtual void notify_server_did_request_set_prompt_text(Badge<WebContentClient>, String const& message) = 0;
|
||||
virtual void notify_server_did_request_accept_dialog(Badge<WebContentClient>) = 0;
|
||||
virtual void notify_server_did_request_dismiss_dialog(Badge<WebContentClient>) = 0;
|
||||
virtual void notify_server_did_get_source(const AK::URL& url, DeprecatedString const& source) = 0;
|
||||
|
|
|
@ -176,22 +176,22 @@ void WebContentClient::did_get_js_console_messages(i32 start_index, Vector<Depre
|
|||
m_view.notify_server_did_get_js_console_messages(start_index, message_types, messages);
|
||||
}
|
||||
|
||||
void WebContentClient::did_request_alert(DeprecatedString const& message)
|
||||
void WebContentClient::did_request_alert(String const& message)
|
||||
{
|
||||
m_view.notify_server_did_request_alert({}, message);
|
||||
}
|
||||
|
||||
void WebContentClient::did_request_confirm(DeprecatedString const& message)
|
||||
void WebContentClient::did_request_confirm(String const& message)
|
||||
{
|
||||
m_view.notify_server_did_request_confirm({}, message);
|
||||
}
|
||||
|
||||
void WebContentClient::did_request_prompt(DeprecatedString const& message, DeprecatedString const& default_)
|
||||
void WebContentClient::did_request_prompt(String const& message, String const& default_)
|
||||
{
|
||||
m_view.notify_server_did_request_prompt({}, message, default_);
|
||||
}
|
||||
|
||||
void WebContentClient::did_request_set_prompt_text(DeprecatedString const& message)
|
||||
void WebContentClient::did_request_set_prompt_text(String const& message)
|
||||
{
|
||||
m_view.notify_server_did_request_set_prompt_text({}, message);
|
||||
}
|
||||
|
|
|
@ -58,10 +58,10 @@ private:
|
|||
virtual void did_output_js_console_message(i32 message_index) override;
|
||||
virtual void did_get_js_console_messages(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> 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;
|
||||
|
|
|
@ -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<String> const& response)
|
||||
{
|
||||
m_page_host->prompt_closed(response);
|
||||
}
|
||||
|
|
|
@ -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<String> const& response) override;
|
||||
|
||||
virtual Messages::WebContentServer::TakeDocumentScreenshotResponse take_document_screenshot() override;
|
||||
|
||||
|
|
|
@ -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<int>(), 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<String> response)
|
||||
{
|
||||
page().prompt_closed(move(response));
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
|
||||
void alert_closed();
|
||||
void confirm_closed(bool accepted);
|
||||
void prompt_closed(DeprecatedString response);
|
||||
void prompt_closed(Optional<String> 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;
|
||||
|
|
|
@ -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) =|
|
||||
|
|
|
@ -70,5 +70,5 @@ endpoint WebContentServer
|
|||
|
||||
alert_closed() =|
|
||||
confirm_closed(bool accepted) =|
|
||||
prompt_closed(DeprecatedString response) =|
|
||||
prompt_closed(Optional<String> response) =|
|
||||
}
|
||||
|
|
|
@ -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 {};
|
||||
|
|
|
@ -114,10 +114,10 @@ private:
|
|||
void notify_server_did_request_context_menu(Badge<WebView::WebContentClient>, Gfx::IntPoint) override { }
|
||||
void notify_server_did_request_link_context_menu(Badge<WebView::WebContentClient>, Gfx::IntPoint, const URL&, DeprecatedString const&, unsigned) override { }
|
||||
void notify_server_did_request_image_context_menu(Badge<WebView::WebContentClient>, Gfx::IntPoint, const URL&, DeprecatedString const&, unsigned, Gfx::ShareableBitmap const&) override { }
|
||||
void notify_server_did_request_alert(Badge<WebView::WebContentClient>, DeprecatedString const&) override { }
|
||||
void notify_server_did_request_confirm(Badge<WebView::WebContentClient>, DeprecatedString const&) override { }
|
||||
void notify_server_did_request_prompt(Badge<WebView::WebContentClient>, DeprecatedString const&, DeprecatedString const&) override { }
|
||||
void notify_server_did_request_set_prompt_text(Badge<WebView::WebContentClient>, DeprecatedString const&) override { }
|
||||
void notify_server_did_request_alert(Badge<WebView::WebContentClient>, String const&) override { }
|
||||
void notify_server_did_request_confirm(Badge<WebView::WebContentClient>, String const&) override { }
|
||||
void notify_server_did_request_prompt(Badge<WebView::WebContentClient>, String const&, String const&) override { }
|
||||
void notify_server_did_request_set_prompt_text(Badge<WebView::WebContentClient>, String const&) override { }
|
||||
void notify_server_did_request_accept_dialog(Badge<WebView::WebContentClient>) override { }
|
||||
void notify_server_did_request_dismiss_dialog(Badge<WebView::WebContentClient>) override { }
|
||||
void notify_server_did_get_source(const URL&, DeprecatedString const&) override { }
|
||||
|
|
Loading…
Add table
Reference in a new issue