[gjs/mozjs78: 47/50] global: Allow uneval() in debugger global




commit 23c80d241480a39a2c04dc46cbb490acf895c42c
Author: Philip Chimento <philip chimento gmail com>
Date:   Tue Jul 28 09:45:51 2020 -0700

    global: Allow uneval() in debugger global
    
    See: GNOME/gjs#329

 gjs/global.cpp | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/gjs/global.cpp b/gjs/global.cpp
index 82fb427c..a5b1a0dd 100644
--- a/gjs/global.cpp
+++ b/gjs/global.cpp
@@ -79,19 +79,18 @@ class GjsBaseGlobal {
     }
 
  protected:
-    [[nodiscard]] static JSObject* create(JSContext* cx, const JSClass* clasp) {
-        JS::RealmCreationOptions creation;
-        creation.setNewCompartmentAndZone();
-
-        return base(cx, clasp, creation);
+    [[nodiscard]] static JSObject* create(
+        JSContext* cx, const JSClass* clasp,
+        JS::RealmCreationOptions options = JS::RealmCreationOptions()) {
+        options.setNewCompartmentAndZone();
+        return base(cx, clasp, options);
     }
 
     [[nodiscard]] static JSObject* create_with_compartment(
-        JSContext* cx, JS::HandleObject existing, const JSClass* clasp) {
-        JS::RealmCreationOptions creation;
-        creation.setExistingCompartment(existing);
-
-        return base(cx, clasp, creation);
+        JSContext* cx, JS::HandleObject existing, const JSClass* clasp,
+        JS::RealmCreationOptions options = JS::RealmCreationOptions()) {
+        options.setExistingCompartment(existing);
+        return base(cx, clasp, options);
     }
 
     GJS_JSAPI_RETURN_CONVENTION
@@ -234,7 +233,9 @@ class GjsDebuggerGlobal : GjsBaseGlobal {
 
  public:
     [[nodiscard]] static JSObject* create(JSContext* cx) {
-        return GjsBaseGlobal::create(cx, &klass);
+        JS::RealmCreationOptions options;
+        options.setToSourceEnabled(true);  // debugger uses uneval()
+        return GjsBaseGlobal::create(cx, &klass, options);
     }
 
     [[nodiscard]] static JSObject* create_with_compartment(


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