diff options
author | Colin Walters <walters@verbum.org> | 2010-09-21 10:55:22 -0400 |
---|---|---|
committer | Owen W. Taylor <otaylor@fishsoup.net> | 2010-09-30 10:47:40 -0400 |
commit | f0473a63dca1eb6ad9dbf8f18370ebf7ed296a64 (patch) | |
tree | 31abecea8f3a0010d45593d109eab45aec2f8188 /gjs | |
parent | c8de0d2683dc5a5953b4c6e15c0357546a48985b (diff) | |
download | gjs-f0473a63dca1eb6ad9dbf8f18370ebf7ed296a64.tar.gz |
Use separate SetPrototype() and SetParent calls
In XULRunner 1.9.3, passing a custom prototype or parent to
JS_ConstructObject for Object fails, so work around with a separate calls
to SetPrototype()/SetParent().
See https://bugzilla.mozilla.org/show_bug.cgi?id=599651.
https://bugzilla.gnome.org/show_bug.cgi?id=622896
Diffstat (limited to 'gjs')
-rw-r--r-- | gjs/importer.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gjs/importer.c b/gjs/importer.c index 5265e934..0c6f6f39 100644 --- a/gjs/importer.c +++ b/gjs/importer.c @@ -285,12 +285,16 @@ load_module_init(JSContext *context, } } - module_obj = JS_NewObject(context, NULL, NULL, - gjs_get_import_global(context)); + module_obj = JS_NewObject(context, NULL, NULL, NULL); if (module_obj == NULL) { return JS_FALSE; } + /* https://bugzilla.mozilla.org/show_bug.cgi?id=599651 means we + * can't just pass in the global as the parent */ + JS_SetParent(context, module_obj, + gjs_get_import_global (context)); + /* Define module in importer for future use and to avoid module_obj * object to be garbage collected during the evaluation of the script */ JS_DefineProperty(context, in_object, |