1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:17:34 +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:
Timothy Flynn 2023-03-13 17:30:51 -04:00 committed by Linus Groh
parent b4d3fea002
commit 97536e4684
18 changed files with 85 additions and 85 deletions

View file

@ -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;