[gjs/mozjs78: 11/17] global: Allow uneval() in debugger global
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/mozjs78: 11/17] global: Allow uneval() in debugger global
- Date: Tue, 11 Aug 2020 20:17:45 +0000 (UTC)
commit 1f767c9cd149f6807f19457d6b32ea62f9d18695
Author: Philip Chimento <philip chimento gmail com>
Date: Tue Jul 28 09:45:51 2020 -0700
global: Allow uneval() in debugger global
This global function has been removed from Firefox in general, but you
can still expose it in a particular realm using a flag. Our debugger
requires it, so use that flag on the debugger realm.
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]