diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-11-27 01:39:57 +0200 |
---|---|---|
committer | Idan Horowitz <idan.horowitz@gmail.com> | 2021-11-27 01:58:05 +0200 |
commit | 957f54d96fbc1847a175b0dc4f82c3da5df7fa90 (patch) | |
tree | 11c93745b7031e675dc605684de37f9db710b149 /Userland/Libraries/LibJS/Runtime | |
parent | 7341faceeb35b1b60f0946494268283192fca9c8 (diff) | |
download | serenity-957f54d96fbc1847a175b0dc4f82c3da5df7fa90.zip |
LibJS: Throw InternalErrors instead of Errors on CallStackSizeExceeded
These seem more appropriate.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/ProxyObject.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/VM.h | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp index 6e7b409f35..15672a5873 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp @@ -1517,7 +1517,7 @@ static ThrowCompletionOr<size_t> flatten_into_array(GlobalObject& global_object, if (depth > 0 && TRY(value.is_array(global_object))) { if (vm.did_reach_stack_space_limit()) - return vm.throw_completion<Error>(global_object, ErrorType::CallStackSizeExceeded); + return vm.throw_completion<InternalError>(global_object, ErrorType::CallStackSizeExceeded); auto length = TRY(length_of_array_like(global_object, value.as_object())); target_index = TRY(flatten_into_array(global_object, new_array, value.as_object(), length, target_index, depth - 1)); diff --git a/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp b/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp index 5afd0bf72d..70480ce8f8 100644 --- a/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp @@ -487,7 +487,7 @@ ThrowCompletionOr<Value> ProxyObject::internal_get(PropertyKey const& property_n // // In JS code: `h = {}; p = new Proxy({}, h); h.__proto__ = p; p.foo // or h.foo` if (vm.did_reach_stack_space_limit()) - return vm.throw_completion<Error>(global_object, ErrorType::CallStackSizeExceeded); + return vm.throw_completion<InternalError>(global_object, ErrorType::CallStackSizeExceeded); // 6. Let trap be ? GetMethod(handler, "get"). auto trap = TRY(Value(&m_handler).get_method(global_object, vm.names.get)); diff --git a/Userland/Libraries/LibJS/Runtime/VM.h b/Userland/Libraries/LibJS/Runtime/VM.h index 2330273c60..8f0fcee700 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.h +++ b/Userland/Libraries/LibJS/Runtime/VM.h @@ -103,7 +103,7 @@ public: VERIFY(!exception()); // Ensure we got some stack space left, so the next function call doesn't kill us. if (did_reach_stack_space_limit()) - return throw_completion<Error>(global_object, ErrorType::CallStackSizeExceeded); + return throw_completion<InternalError>(global_object, ErrorType::CallStackSizeExceeded); m_execution_context_stack.append(&context); return {}; } |