1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:37:35 +00:00

LibWeb: Stop using Bindings::wrap() in a bunch of places

wrap() is now basically a no-op so we should stop using it everywhere
and eventually remove it. This patch removes uses of wrap() in
non-generated code.
This commit is contained in:
Andreas Kling 2022-09-04 21:48:54 +02:00
parent 45425de849
commit 9176a0de99
7 changed files with 32 additions and 56 deletions

View file

@ -37,9 +37,9 @@ JS::Promise* SubtleCrypto::digest(String const& algorithm, JS::Handle<JS::Object
// 2. Let data be the result of getting a copy of the bytes held by the data parameter passed to the digest() method.
auto data_buffer_or_error = Bindings::IDL::get_buffer_source_copy(*data.cell());
if (data_buffer_or_error.is_error()) {
auto* error = wrap(realm, DOM::OperationError::create(global_object(), "Failed to copy bytes from ArrayBuffer"));
auto error = DOM::OperationError::create(global_object(), "Failed to copy bytes from ArrayBuffer");
auto* promise = JS::Promise::create(realm);
promise->reject(error);
promise->reject(error.ptr());
return promise;
}
auto& data_buffer = data_buffer_or_error.value();
@ -58,9 +58,9 @@ JS::Promise* SubtleCrypto::digest(String const& algorithm, JS::Handle<JS::Object
}
// 4. If an error occurred, return a Promise rejected with normalizedAlgorithm.
else {
auto* error = wrap(realm, DOM::NotSupportedError::create(global_object(), String::formatted("Invalid hash function '{}'", algorithm)));
auto error = DOM::NotSupportedError::create(global_object(), String::formatted("Invalid hash function '{}'", algorithm));
auto* promise = JS::Promise::create(realm);
promise->reject(error);
promise->reject(error.ptr());
return promise;
}
@ -79,8 +79,8 @@ JS::Promise* SubtleCrypto::digest(String const& algorithm, JS::Handle<JS::Object
auto digest = hash.digest();
auto result_buffer = ByteBuffer::copy(digest.immutable_data(), hash.digest_size());
if (result_buffer.is_error()) {
auto* error = wrap(realm, DOM::OperationError::create(global_object(), "Failed to create result buffer"));
promise->reject(error);
auto error = DOM::OperationError::create(global_object(), "Failed to create result buffer");
promise->reject(error.ptr());
return promise;
}