mirror of
https://github.com/RGBCube/serenity
synced 2025-06-28 21:22:08 +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
18 changed files with 85 additions and 85 deletions
|
@ -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 {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue