1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-12 02:30:30 +09:00

LibJS: Convert Object::get() to ThrowCompletionOr

To no one's surprise, this patch is pretty big - this is possibly the
most used AO of all of them. Definitely worth it though.
This commit is contained in:
Linus Groh 2021-10-02 23:52:27 +01:00
parent 9b6c09e2c4
commit b7e5f08e56
Notes: sideshowbarker 2024-07-18 03:07:41 +09:00
61 changed files with 326 additions and 686 deletions

View file

@ -239,8 +239,7 @@ inline AK::Result<NonnullRefPtr<JS::SourceTextModule>, ParserError> parse_module
inline Optional<JsonValue> get_test_results(JS::Interpreter& interpreter)
{
auto results = interpreter.global_object().get("__TestResults__");
VERIFY(!results.is_empty());
auto results = MUST(interpreter.global_object().get("__TestResults__"));
auto json_string = JS::JSONObject::stringify_impl(interpreter.global_object(), results, JS::js_undefined(), JS::js_undefined());
auto json = JsonValue::from_string(json_string);
@ -388,12 +387,11 @@ inline JSFileResult TestRunner::run_file_test(const String& test_path)
JSFileResult file_result { test_path.substring(m_test_root.length() + 1, test_path.length() - m_test_root.length() - 1) };
// Collect logged messages
auto user_output = interpreter->global_object().get("__UserOutput__");
VERIFY(!user_output.is_empty());
auto user_output = MUST(interpreter->global_object().get("__UserOutput__"));
auto& arr = user_output.as_array();
for (auto& entry : arr.indexed_properties()) {
auto message = arr.get(entry.index());
auto message = MUST(arr.get(entry.index()));
file_result.logged_messages.append(message.to_string_without_side_effects());
}