mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-06 17:11:51 +00:00
AK+Everywhere: Store JSON object keys as String
This commit is contained in:
parent
70eb0ba1cd
commit
e591636419
Notes:
github-actions[bot]
2025-02-21 00:29:28 +00:00
Author: https://github.com/trflynn89
Commit: e591636419
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3631
Reviewed-by: https://github.com/awesomekling ✅
23 changed files with 119 additions and 111 deletions
|
@ -135,7 +135,7 @@ Response deserialize_as_an_unhandled_prompt_behavior(JsonValue value)
|
|||
JsonObject user_prompt_handler;
|
||||
|
||||
// 6. For each prompt type → handler in value:
|
||||
TRY(value.as_object().try_for_each_member([&](ByteString const& prompt_type, JsonValue const& handler_value) -> ErrorOr<void, WebDriver::Error> {
|
||||
TRY(value.as_object().try_for_each_member([&](String const& prompt_type, JsonValue const& handler_value) -> ErrorOr<void, WebDriver::Error> {
|
||||
// 1. If is string value is false and valid prompt types does not contain prompt type return error with error code invalid argument.
|
||||
if (!is_string_value && !valid_prompt_types.contains_slow(prompt_type))
|
||||
return WebDriver::Error::from_code(ErrorCode::InvalidArgument, ByteString::formatted("'{}' is not a valid prompt type", prompt_type));
|
||||
|
@ -192,7 +192,7 @@ bool check_user_prompt_handler_matches(JsonObject const& requested_prompt_handle
|
|||
return true;
|
||||
|
||||
// 2. For each request prompt type → request handler in requested prompt handler:
|
||||
auto result = requested_prompt_handler.try_for_each_member([&](ByteString const& request_prompt_type, JsonValue const& request_handler) -> ErrorOr<void> {
|
||||
auto result = requested_prompt_handler.try_for_each_member([&](String const& request_prompt_type, JsonValue const& request_handler) -> ErrorOr<void> {
|
||||
// 1. If the user prompt handler contains request prompt type:
|
||||
if (auto handler = s_user_prompt_handler->get(prompt_type_from_string(request_prompt_type)); handler.has_value()) {
|
||||
// 1. If the requested prompt handler's handler is not equal to the user prompt handler's handler, return false.
|
||||
|
@ -215,7 +215,7 @@ void update_the_user_prompt_handler(JsonObject const& requested_prompt_handler)
|
|||
s_user_prompt_handler = UserPromptHandler::ValueType {};
|
||||
|
||||
// 2. For each request prompt type → request handler in requested prompt handler:
|
||||
requested_prompt_handler.for_each_member([&](ByteString const& request_prompt_type, JsonValue const& request_handler) {
|
||||
requested_prompt_handler.for_each_member([&](String const& request_prompt_type, JsonValue const& request_handler) {
|
||||
// 1. Set user prompt handler[request prompt type] to request handler.
|
||||
s_user_prompt_handler->set(
|
||||
prompt_type_from_string(request_prompt_type),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue