[gjs/gnome-40] Ensure the correct realm is entered in the async executor



commit 9788bc549acba74946818b78c61b661f57f86e45
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 1c1a57de..1f05579c 100644
--- a/gjs/internal.cpp
+++ b/gjs/internal.cpp
@@ -525,6 +525,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]