1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-07-01 02:05:33 +00:00

bookmark_folder_get_property: xulrunner-2.0 fix

In bookmark_folder_get_property, convert the jsid value into
a jsval value before passing it to jsval_to_bookmark_string.

This commit fixes a bug in the xulrunner-2.0 compatibility changes
of commit 2844f8b715, which rendered
the bookmarks scripting interface for SpiderMonkey nonfunctional.
This commit is contained in:
Miciah Dashiel Butler Masters 2011-05-08 03:04:10 +00:00
parent 5ddf20b85e
commit a1c5fe518b

View File

@ -107,15 +107,21 @@ bookmark_string_to_jsval(JSContext *ctx, const unsigned char *str, jsval *vp)
* @return JS_TRUE if successful. On error, report the error to
* SpiderMonkey and return JS_FALSE. */
static JSBool
jsval_to_bookmark_string(JSContext *ctx, jsval val, unsigned char **result)
jsval_to_bookmark_string(JSContext *ctx, jsid id, unsigned char **result)
{
JSString *jsstr = NULL;
unsigned char *str;
jsval val;
/* jsstring_to_utf8() might GC; protect the string to come. */
if (!JS_AddNamedStringRoot(ctx, &jsstr, "jsval_to_bookmark_string"))
return JS_FALSE;
if (JS_TRUE != JS_IdToValue(ctx, id, &val)) {
JS_RemoveStringRoot(ctx, &jsstr);
return JS_FALSE;
}
jsstr = JS_ValueToString(ctx, val);
if (jsstr == NULL) {
JS_RemoveStringRoot(ctx, &jsstr);