summaryrefslogtreecommitdiff
path: root/modules/cairo-surface.cpp
diff options
context:
space:
mode:
authorEvan Welsh <noreply@evanwelsh.com>2020-07-05 18:58:44 -0500
committerPhilip Chimento <philip.chimento@gmail.com>2020-07-27 21:32:26 -0700
commit065df98260317e2e8c4b9ec843e16b9d931e22b3 (patch)
treebc2b7f7dbaf67e443e2332cbaafd4c7d8dd65247 /modules/cairo-surface.cpp
parent143f24459634186e3f3871911cbe6bb7c2b88fe1 (diff)
downloadgjs-065df98260317e2e8c4b9ec843e16b9d931e22b3.tar.gz
js: Define Symbol.toStringTag names on all our custom classes
SpiderMonkey 78 will stop using the JSClass.name string as the string tag. For backwards compatibility, we should make sure the string tag doesn't change. See: GNOME/gjs#329
Diffstat (limited to 'modules/cairo-surface.cpp')
-rw-r--r--modules/cairo-surface.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/cairo-surface.cpp b/modules/cairo-surface.cpp
index 4f7560b4..c95357d5 100644
--- a/modules/cairo-surface.cpp
+++ b/modules/cairo-surface.cpp
@@ -29,6 +29,7 @@
#include <js/CallArgs.h>
#include <js/Class.h>
+#include <js/PropertyDescriptor.h> // for JSPROP_READONLY
#include <js/PropertySpec.h>
#include <js/RootingAPI.h>
#include <js/TypeDecls.h>
@@ -55,9 +56,11 @@ static void gjs_cairo_surface_finalize(JSFreeOp*, JSObject* obj) {
}
/* Properties */
+// clang-format off
JSPropertySpec gjs_cairo_surface_proto_props[] = {
- JS_PS_END
-};
+ JS_STRING_SYM_PS(toStringTag, "Surface", JSPROP_READONLY),
+ JS_PS_END};
+// clang-format on
/* Methods */
GJS_JSAPI_RETURN_CONVENTION