LibWeb: Allow parsing of "file" prompt types in WebDriver

See: https://github.com/w3c/webdriver/commit/3055808

This isn't actually used outside of BiDi.
This commit is contained in:
Timothy Flynn 2025-03-31 18:12:28 -04:00 committed by Alexander Kalenik
parent 952ad4e68b
commit 004173f88b
Notes: github-actions[bot] 2025-04-01 01:52:55 +00:00
2 changed files with 6 additions and 1 deletions

View file

@ -20,7 +20,7 @@ static UserPromptHandler s_user_prompt_handler;
static constexpr Array known_prompt_handlers { "dismiss"sv, "accept"sv, "dismiss and notify"sv, "accept and notify"sv, "ignore"sv };
// https://w3c.github.io/webdriver/#dfn-valid-prompt-types
static constexpr Array valid_prompt_types { "alert"sv, "beforeUnload"sv, "confirm"sv, "default"sv, "prompt"sv };
static constexpr Array valid_prompt_types { "alert"sv, "beforeUnload"sv, "confirm"sv, "default"sv, "file"sv, "prompt"sv };
static constexpr PromptHandler prompt_handler_from_string(StringView prompt_handler)
{
@ -44,6 +44,8 @@ static constexpr StringView prompt_type_to_string(PromptType prompt_type)
return "confirm"sv;
case PromptType::Default:
return "default"sv;
case PromptType::File:
return "file"sv;
case PromptType::Prompt:
return "prompt"sv;
case PromptType::FallbackDefault:
@ -62,6 +64,8 @@ static constexpr PromptType prompt_type_from_string(StringView prompt_type)
return PromptType::Confirm;
if (prompt_type == "default"sv)
return PromptType::Default;
if (prompt_type == "file"sv)
return PromptType::File;
if (prompt_type == "prompt"sv)
return PromptType::Prompt;
if (prompt_type == "fallbackDefault"sv)

View file

@ -28,6 +28,7 @@ enum class PromptType {
BeforeUnload,
Confirm,
Default,
File,
Prompt,
FallbackDefault,
};