summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/FileAPI/Blob.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibWeb/FileAPI/Blob.cpp')
-rw-r--r--Userland/Libraries/LibWeb/FileAPI/Blob.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/FileAPI/Blob.cpp b/Userland/Libraries/LibWeb/FileAPI/Blob.cpp
index 9487334ce9..4c5f9993c4 100644
--- a/Userland/Libraries/LibWeb/FileAPI/Blob.cpp
+++ b/Userland/Libraries/LibWeb/FileAPI/Blob.cpp
@@ -222,13 +222,14 @@ DOM::ExceptionOr<NonnullRefPtr<Blob>> Blob::slice(Optional<i64> start, Optional<
JS::Promise* Blob::text()
{
auto& global_object = wrapper()->global_object();
+ auto& realm = *global_object.associated_realm();
// FIXME: 1. Let stream be the result of calling get stream on this.
// FIXME: 2. Let reader be the result of getting a reader from stream. If that threw an exception, return a new promise rejected with that exception.
// FIXME: We still need to implement ReadableStream for this step to be fully valid.
// 3. Let promise be the result of reading all bytes from stream with reader
- auto* promise = JS::Promise::create(global_object);
+ auto* promise = JS::Promise::create(realm);
auto* result = JS::js_string(global_object.heap(), String { m_byte_buffer.bytes() });
// 4. Return the result of transforming promise by a fulfillment handler that returns the result of running UTF-8 decode on its first argument.
@@ -240,14 +241,15 @@ JS::Promise* Blob::text()
JS::Promise* Blob::array_buffer()
{
auto& global_object = wrapper()->global_object();
+ auto& realm = *global_object.associated_realm();
// FIXME: 1. Let stream be the result of calling get stream on this.
// FIXME: 2. Let reader be the result of getting a reader from stream. If that threw an exception, return a new promise rejected with that exception.
// FIXME: We still need to implement ReadableStream for this step to be fully valid.
// 3. Let promise be the result of reading all bytes from stream with reader.
- auto* promise = JS::Promise::create(global_object);
- auto buffer_result = JS::ArrayBuffer::create(global_object, m_byte_buffer.size());
+ auto* promise = JS::Promise::create(realm);
+ auto buffer_result = JS::ArrayBuffer::create(realm, m_byte_buffer.size());
if (buffer_result.is_error()) {
promise->reject(buffer_result.release_error().value().release_value());
return promise;