[gjs/globals2: 4/4] context: Switch to CurrentGlobalOrNull in job queue



commit 21dcd0f25bf201649ea7317ed7532ed9a98c9ab4
Author: Evan Welsh <noreply evanwelsh com>
Date:   Sat May 23 15:26:06 2020 -0700

    context: Switch to CurrentGlobalOrNull in job queue
    
    This is how SpiderMonkey does it. We can probably assume in GJS as well,
    that the context will have entered a realm whenever this is called.

 gjs/context.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 5f8e042a..04f28f73 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -692,7 +692,8 @@ gboolean GjsContextPrivate::drain_job_queue_idle_handler(void* data) {
 }
 
 JSObject* GjsContextPrivate::getIncumbentGlobal(JSContext* cx) {
-    return gjs_get_import_global(cx);
+    // This is equivalent to SpiderMonkey's behavior.
+    return JS::CurrentGlobalOrNull(cx);
 }
 
 /* See engine.cpp and JS::SetEnqueuePromiseJobCallback(). */


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