summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/FileAPI/Blob.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-08-22 19:00:49 +0100
committerLinus Groh <mail@linusgroh.de>2022-08-23 13:58:30 +0100
commitb345a0acca725d1b4e4d6df26fc602d69e97f073 (patch)
treec1a1b7936505373fc3be8cb7b6f0ced444d05d63 /Userland/Libraries/LibWeb/FileAPI/Blob.cpp
parente3895e6c808d4606f02b26b1eaad3a3a803bba12 (diff)
downloadserenity-b345a0acca725d1b4e4d6df26fc602d69e97f073.zip
LibJS+LibWeb: Reduce use of GlobalObject as an intermediary
- Prefer VM::current_realm() over GlobalObject::associated_realm() - Prefer VM::heap() over GlobalObject::heap() - Prefer Cell::vm() over Cell::global_object() - Prefer Wrapper::vm() over Wrapper::global_object() - Inline Realm::global_object() calls used to access intrinsics as they will later perform a direct lookup without going through the global object
Diffstat (limited to 'Userland/Libraries/LibWeb/FileAPI/Blob.cpp')
-rw-r--r--Userland/Libraries/LibWeb/FileAPI/Blob.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Libraries/LibWeb/FileAPI/Blob.cpp b/Userland/Libraries/LibWeb/FileAPI/Blob.cpp
index 23c713f7f4..573330e83b 100644
--- a/Userland/Libraries/LibWeb/FileAPI/Blob.cpp
+++ b/Userland/Libraries/LibWeb/FileAPI/Blob.cpp
@@ -221,8 +221,8 @@ DOM::ExceptionOr<NonnullRefPtr<Blob>> Blob::slice(Optional<i64> start, Optional<
// https://w3c.github.io/FileAPI/#dom-blob-text
JS::Promise* Blob::text()
{
- auto& global_object = wrapper()->global_object();
- auto& realm = *global_object.associated_realm();
+ auto& vm = wrapper()->vm();
+ auto& realm = *vm.current_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.
@@ -230,7 +230,7 @@ JS::Promise* Blob::text()
// 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(realm);
- auto* result = JS::js_string(global_object.heap(), String { m_byte_buffer.bytes() });
+ auto* result = JS::js_string(vm, 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.
promise->fulfill(result);
@@ -240,8 +240,8 @@ JS::Promise* Blob::text()
// https://w3c.github.io/FileAPI/#dom-blob-arraybuffer
JS::Promise* Blob::array_buffer()
{
- auto& global_object = wrapper()->global_object();
- auto& realm = *global_object.associated_realm();
+ auto& vm = wrapper()->vm();
+ auto& realm = *vm.current_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.