[gjs/wip/xulrunner-2-rebase3: 1/6] 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-rebase3: 1/6] Handle JS_InitClass throwing an error more cleanly
- Date: Thu, 28 Oct 2010 16:04:38 +0000 (UTC)
commit 553b27eaf25be3f5ce2143819cee85d51ea9471c
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 afc752a..e2ab31f 100644
--- a/gi/boxed.c
+++ b/gi/boxed.c
@@ -431,7 +431,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,
@@ -1175,8 +1174,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]