summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/WebDriver
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-01-07 12:24:05 -0500
committerLinus Groh <mail@linusgroh.de>2023-01-08 12:13:15 +0100
commit115baa7e32ba30cc409d52546a78ee97a9cd4f76 (patch)
treea1c12e8c450a667aa99c9f403c3ef0ce830f4dde /Userland/Libraries/LibWeb/WebDriver
parentd793262beba3a113bed4c728b572a78583b43277 (diff)
downloadserenity-115baa7e32ba30cc409d52546a78ee97a9cd4f76.zip
LibJS+Everywhere: Make PrimitiveString and Utf16String fallible
This makes construction of Utf16String fallible in OOM conditions. The immediate impact is that PrimitiveString must then be fallible as well, as it may either transcode UTF-8 to UTF-16, or create a UTF-16 string from ropes. There are a couple of places where it is very non-trivial to propagate the error further. A FIXME has been added to those locations.
Diffstat (limited to 'Userland/Libraries/LibWeb/WebDriver')
-rw-r--r--Userland/Libraries/LibWeb/WebDriver/ExecuteScript.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/WebDriver/ExecuteScript.cpp b/Userland/Libraries/LibWeb/WebDriver/ExecuteScript.cpp
index 1f4744f35d..1fa2b62263 100644
--- a/Userland/Libraries/LibWeb/WebDriver/ExecuteScript.cpp
+++ b/Userland/Libraries/LibWeb/WebDriver/ExecuteScript.cpp
@@ -95,7 +95,7 @@ static ErrorOr<JsonValue, ExecuteScriptResultType> internal_json_clone_algorithm
if (value.is_number())
return JsonValue { value.as_double() };
if (value.is_string())
- return JsonValue { value.as_string().deprecated_string() };
+ return JsonValue { TRY_OR_JS_ERROR(value.as_string().deprecated_string()) };
// NOTE: BigInt and Symbol not mentioned anywhere in the WebDriver spec, as it references ES5.
// It assumes that all primitives are handled above, and the value is an object for the remaining steps.
@@ -114,7 +114,7 @@ static ErrorOr<JsonValue, ExecuteScriptResultType> internal_json_clone_algorithm
auto to_json_result = TRY_OR_JS_ERROR(to_json.as_function().internal_call(value, JS::MarkedVector<JS::Value> { vm.heap() }));
if (!to_json_result.is_string())
return ExecuteScriptResultType::JavaScriptError;
- return to_json_result.as_string().deprecated_string();
+ return TRY_OR_JS_ERROR(to_json_result.as_string().deprecated_string());
}
// -> Otherwise