[gjs/ewlsh/fix-realm-in-async] Ensure the correct realm is entered in the async executor




commit 53e43a342367c32888acc9186ca843efb25e16b8
Author: Evan Welsh <contact evanwelsh com>
Date:   Fri Jul 23 20:02:31 2021 -0700

    Ensure the correct realm is entered in the async executor

 gjs/internal.cpp | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/gjs/internal.cpp b/gjs/internal.cpp
index a803eda4..fea6e71e 100644
--- a/gjs/internal.cpp
+++ b/gjs/internal.cpp
@@ -513,6 +513,8 @@ class PromiseData {
 static void load_async_callback(GObject* file, GAsyncResult* res, void* data) {
     std::unique_ptr<PromiseData> promise(PromiseData::from_ptr(data));
 
+    JSAutoRealm ac(promise->cx, gjs_get_import_global(promise->cx));
+
     char* contents;
     size_t length;
     GError* error = nullptr;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]