[gjs/mozjs78] Add 'Symbol.toStringTag' to GjsGlobal.
- From: Evan Welsh <ewlsh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/mozjs78] Add 'Symbol.toStringTag' to GjsGlobal.
- Date: Mon, 6 Jul 2020 01:24:28 +0000 (UTC)
commit dccba25c1294760cd1b583c795845fe4c3a2caad
Author: Evan Welsh <noreply evanwelsh com>
Date: Sun Jul 5 20:23:56 2020 -0500
Add 'Symbol.toStringTag' to GjsGlobal.
gjs/global.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/gjs/global.cpp b/gjs/global.cpp
index f0c58b49..b25fe270 100644
--- a/gjs/global.cpp
+++ b/gjs/global.cpp
@@ -236,6 +236,9 @@ class GjsGlobal {
&defaultclassops,
};
+ static constexpr JSPropertySpec static_props[] = {
+ JS_STRING_SYM_PS(toStringTag, "GjsGlobal", JSPROP_READONLY), JS_PS_END};
+
static constexpr JSFunctionSpec static_funcs[] = {
JS_FN("log", gjs_log, 1, GJS_MODULE_PROP_FLAGS),
JS_FN("logError", gjs_log_error, 2, GJS_MODULE_PROP_FLAGS),
@@ -279,7 +282,8 @@ class GjsGlobal {
const GjsAtoms& atoms = GjsContextPrivate::atoms(cx);
if (!JS_DefinePropertyById(cx, global, atoms.window(), global,
JSPROP_READONLY | JSPROP_PERMANENT) ||
- !JS_DefineFunctions(cx, global, GjsGlobal::static_funcs))
+ !JS_DefineFunctions(cx, global, GjsGlobal::static_funcs) ||
+ !JS_DefineProperties(cx, global, GjsGlobal::static_props))
return false;
JS::Realm* realm = JS::GetObjectRealmOrNull(global);
@@ -375,3 +379,4 @@ gjs_get_global_slot(JSContext *cx,
decltype(GjsGlobal::klass) constexpr GjsGlobal::klass;
decltype(GjsGlobal::static_funcs) constexpr GjsGlobal::static_funcs;
+decltype(GjsGlobal::static_props) constexpr GjsGlobal::static_props;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]