[gjs/ewlsh/fix-dynamic-module-resolution: 18/18] auto realm in async callback




commit fa82bfacb64d5d221d34fec0aaf5c9fcf4a6e999
Author: Evan Welsh <contact evanwelsh com>
Date:   Fri Jul 23 19:57:44 2021 -0700

    auto realm in async callback

 .eslintignore    | 1 +
 gi/private.cpp   | 1 +
 gjs/internal.cpp | 2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/.eslintignore b/.eslintignore
index 9ee950d3..7a580e14 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -3,4 +3,5 @@
 
 installed-tests/js/jasmine.js
 installed-tests/js/modules/badOverrides/WarnLib.js
+installed-tests/js/testGObjectType.js
 modules/script/jsUnit.js
diff --git a/gi/private.cpp b/gi/private.cpp
index a6ecc723..9ef581f3 100644
--- a/gi/private.cpp
+++ b/gi/private.cpp
@@ -17,6 +17,7 @@
 #include <js/RootingAPI.h>
 #include <js/TypeDecls.h>
 #include <js/Utility.h>  // for UniqueChars
+#include <js/ValueArray.h>
 #include <jsapi.h>       // for JS_GetElement
 
 #include "gi/gobject.h"
diff --git a/gjs/internal.cpp b/gjs/internal.cpp
index a803eda4..325bf867 100644
--- a/gjs/internal.cpp
+++ b/gjs/internal.cpp
@@ -512,7 +512,7 @@ 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]