mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
LibJS+Everywhere: Convert JS::Error to String
This includes an Error::create overload to create an Error from a UTF-8 StringView. If creating a String from that view fails, the factory will return an OOM InternalError instead. VM::throw_completion can also make use of this overload via its perfect forwarding.
This commit is contained in:
@@ -68,7 +68,7 @@ JS::VM& main_thread_vm()
|
||||
vm->host_ensure_can_add_private_element = [](JS::Object const& object) -> JS::ThrowCompletionOr<void> {
|
||||
// 1. If O is a WindowProxy object, or implements Location, then return Completion { [[Type]]: throw, [[Value]]: a new TypeError }.
|
||||
if (is<HTML::WindowProxy>(object) || is<HTML::Location>(object))
|
||||
return vm->throw_completion<JS::TypeError>("Cannot add private elements to window or location object");
|
||||
return vm->throw_completion<JS::TypeError>("Cannot add private elements to window or location object"sv);
|
||||
|
||||
// 2. Return NormalCompletion(unused).
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user