1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00

LibJS: Convert Promise::create() to NonnullGCPtr

This commit is contained in:
Linus Groh 2022-12-13 20:49:50 +00:00
parent ddc6e139a6
commit a4d85cd522
16 changed files with 26 additions and 26 deletions

View file

@ -38,7 +38,7 @@ JS::Promise* SubtleCrypto::digest(DeprecatedString const& algorithm, JS::Handle<
auto data_buffer_or_error = WebIDL::get_buffer_source_copy(*data.cell());
if (data_buffer_or_error.is_error()) {
auto error = WebIDL::OperationError::create(realm, "Failed to copy bytes from ArrayBuffer");
auto* promise = JS::Promise::create(realm);
auto promise = JS::Promise::create(realm);
promise->reject(error.ptr());
return promise;
}
@ -59,13 +59,13 @@ JS::Promise* SubtleCrypto::digest(DeprecatedString const& algorithm, JS::Handle<
// 4. If an error occurred, return a Promise rejected with normalizedAlgorithm.
else {
auto error = WebIDL::NotSupportedError::create(realm, DeprecatedString::formatted("Invalid hash function '{}'", algorithm));
auto* promise = JS::Promise::create(realm);
auto promise = JS::Promise::create(realm);
promise->reject(error.ptr());
return promise;
}
// 5. Let promise be a new Promise.
auto* promise = JS::Promise::create(realm);
auto promise = JS::Promise::create(realm);
// 6. Return promise and perform the remaining steps in parallel.
// FIXME: We don't have a good abstraction for this yet, so we do it in sync.