[gjs/wip/xulrunner-2-rebase4: 5/8] Handle JS_InitClass throwing an error more cleanly
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/xulrunner-2-rebase4: 5/8] Handle JS_InitClass throwing an error more cleanly
- Date: Fri, 29 Oct 2010 17:03:04 +0000 (UTC)
commit 420303448cd8d855dddf1c7be084cac53be42b91
Author: Colin Walters <walters verbum org>
Date: Fri Oct 22 11:45:13 2010 -0400
Handle JS_InitClass throwing an error more cleanly
gi/boxed.c | 5 +++--
gjs/jsapi-util.c | 2 ++
2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gi/boxed.c b/gi/boxed.c
index a29867c..c0b504c 100644
--- a/gi/boxed.c
+++ b/gi/boxed.c
@@ -426,7 +426,6 @@ boxed_constructor(JSContext *context,
GJS_INC_COUNTER(boxed);
- g_assert(priv_from_js(context, obj) == NULL);
JS_SetPrivate(context, obj, priv);
gjs_debug_lifecycle(GJS_DEBUG_GBOXED,
@@ -1170,8 +1169,10 @@ gjs_define_boxed_class(JSContext *context,
NULL,
/* funcs of constructor, MyConstructor.myfunc() */
NULL);
- if (prototype == NULL)
+ if (prototype == NULL) {
+ gjs_log_exception(context, NULL);
gjs_fatal("Can't init class %s", constructor_name);
+ }
g_assert(gjs_object_has_property(context, in_object, constructor_name));
diff --git a/gjs/jsapi-util.c b/gjs/jsapi-util.c
index 9b80499..bf7cc6f 100644
--- a/gjs/jsapi-util.c
+++ b/gjs/jsapi-util.c
@@ -535,6 +535,8 @@ gjs_init_class_dynamic(JSContext *context,
constructor, nargs,
ps, fs,
static_ps, static_fs);
+ if (prototype == NULL)
+ goto error;
/* Retrieve the property again so we can define it in
* in_object
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]