1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Fix some issues with js.

This commit is contained in:
Witold Filipczyk 2019-02-17 23:33:12 +01:00
parent 4f4df33638
commit 6322d2936a
16 changed files with 294 additions and 226 deletions

View File

@ -88,7 +88,6 @@ jsid_to_string(JSContext *ctx, jsid *id)
}
#define ELINKS_CAST_PROP_PARAMS JSObject *obj = (hobj); \
jsval vp2 = (hvp); \
jsval *vp = &vp2;
jsval vp = hvp; \
#endif

View File

@ -85,9 +85,11 @@ document_get_property_cookie(JSContext *ctx, JSHandleObject hobj, JSHandleId hid
strncpy(cookiestr, cookies->source, 1024);
done_string(cookies);
string_to_jsval(ctx, vp, cookiestr);
string_to_jsval(ctx, &vp, cookiestr);
hvp.set(vp);
} else {
string_to_jsval(ctx, vp, "");
string_to_jsval(ctx, &vp, "");
hvp.set(vp);
}
return JS_TRUE;
@ -113,7 +115,7 @@ document_set_property_cookie(JSContext *ctx, JSHandleObject hobj, JSHandleId hid
vs = JS_GetInstancePrivate(ctx, parent_win,
&window_class, NULL);
set_cookie(vs->uri, jsval_to_string(ctx, vp));
set_cookie(vs->uri, jsval_to_string(ctx, &vp));
return JS_TRUE;
}
@ -135,7 +137,7 @@ document_get_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId h
assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL));
if_assert_failed return JS_FALSE;
JS_GetProperty(ctx, parent_win, "location", vp);
JS_GetProperty(ctx, parent_win, "location", &vp);
return JS_TRUE;
}
@ -162,7 +164,7 @@ document_set_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId h
vs = JS_GetInstancePrivate(ctx, parent_win,
&window_class, NULL);
doc_view = vs->doc_view;
location_goto(doc_view, jsval_to_string(ctx, vp));
location_goto(doc_view, jsval_to_string(ctx, &vp));
return JS_TRUE;
}
@ -196,22 +198,26 @@ document_get_property_referrer(JSContext *ctx, JSHandleObject hobj, JSHandleId h
switch (get_opt_int("protocol.http.referer.policy", NULL)) {
case REFERER_NONE:
/* oh well */
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
hvp.set(vp);
break;
case REFERER_FAKE:
string_to_jsval(ctx, vp, get_opt_str("protocol.http.referer.fake", NULL));
string_to_jsval(ctx, &vp, get_opt_str("protocol.http.referer.fake", NULL));
hvp.set(vp);
break;
case REFERER_TRUE:
/* XXX: Encode as in add_url_to_httset_prop_string(&prop, ) ? --pasky */
if (ses->referrer) {
astring_to_jsval(ctx, vp, get_uri_string(ses->referrer, URI_HTTP_REFERRER));
astring_to_jsval(ctx, &vp, get_uri_string(ses->referrer, URI_HTTP_REFERRER));
hvp.set(vp);
}
break;
case REFERER_SAME_URL:
astring_to_jsval(ctx, vp, get_uri_string(document->uri, URI_HTTP_REFERRER));
astring_to_jsval(ctx, &vp, get_uri_string(document->uri, URI_HTTP_REFERRER));
hvp.set(vp);
break;
}
@ -241,7 +247,8 @@ document_get_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
&window_class, NULL);
doc_view = vs->doc_view;
document = doc_view->document;
string_to_jsval(ctx, vp, document->title);
string_to_jsval(ctx, &vp, document->title);
hvp.set(vp);
return JS_TRUE;
}
@ -270,7 +277,7 @@ document_set_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
&window_class, NULL);
doc_view = vs->doc_view;
document = doc_view->document;
mem_free_set(&document->title, stracpy(jsval_to_string(ctx, vp)));
mem_free_set(&document->title, stracpy(jsval_to_string(ctx, &vp)));
print_screen_status(doc_view->session);
return JS_TRUE;
@ -298,7 +305,8 @@ document_get_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, J
&window_class, NULL);
doc_view = vs->doc_view;
document = doc_view->document;
astring_to_jsval(ctx, vp, get_uri_string(document->uri, URI_ORIGINAL));
astring_to_jsval(ctx, &vp, get_uri_string(document->uri, URI_ORIGINAL));
hvp.set(vp);
return JS_TRUE;
}
@ -325,7 +333,7 @@ document_set_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, J
vs = JS_GetInstancePrivate(ctx, parent_win,
&window_class, NULL);
doc_view = vs->doc_view;
location_goto(doc_view, jsval_to_string(ctx, vp));
location_goto(doc_view, jsval_to_string(ctx, &vp));
return JS_TRUE;
}
@ -378,7 +386,8 @@ document_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMut
if (!form->name || c_strcasecmp(string, form->name))
continue;
object_to_jsval(ctx, vp, get_form_object(ctx, obj, find_form_view(doc_view, form)));
object_to_jsval(ctx, &vp, get_form_object(ctx, obj, find_form_view(doc_view, form)));
hvp.set(vp);
break;
}

View File

@ -142,16 +142,20 @@ input_get_property_accessKey(JSContext *ctx, JSHandleObject hobj, JSHandleId hid
/* Hiddens have no link. */
if (linknum >= 0) link = &document->links[linknum];
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
hvp.set(vp);
if (!link) return JS_TRUE;
if (!link->accesskey) {
*vp = JS_GetEmptyStringValue(ctx);
vp = JS_GetEmptyStringValue(ctx);
hvp.set(vp);
} else {
keystr = unicode_to_jsstring(ctx, link->accesskey);
if (keystr)
*vp = STRING_TO_JSVAL(keystr);
if (keystr) {
vp = STRING_TO_JSVAL(keystr);
hvp.set(vp);
}
else
return JS_FALSE;
}
@ -205,7 +209,7 @@ input_set_property_accessKey(JSContext *ctx, JSHandleObject hobj, JSHandleId hid
/* Hiddens have no link. */
if (linknum >= 0) link = &document->links[linknum];
accesskey = jsval_to_accesskey(ctx, vp);
accesskey = jsval_to_accesskey(ctx, &vp);
if (accesskey == UCS_NO_CHAR)
return JS_FALSE;
@ -258,7 +262,8 @@ input_get_property_alt(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMu
assert(fc);
assert(fc->form && fs);
string_to_jsval(ctx, vp, fc->alt);
string_to_jsval(ctx, &vp, fc->alt);
hvp.set(vp);
return JS_TRUE;
}
@ -303,7 +308,7 @@ input_set_property_alt(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBo
assert(fc);
assert(fc->form && fs);
mem_free_set(&fc->alt, stracpy(jsval_to_string(ctx, vp)));
mem_free_set(&fc->alt, stracpy(jsval_to_string(ctx, &vp)));
return JS_TRUE;
}
@ -324,7 +329,8 @@ input_get_property_checked(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
fs = input_get_form_state(ctx, obj);
if (!fs) return JS_FALSE; /* detached */
boolean_to_jsval(ctx, vp, fs->state);
boolean_to_jsval(ctx, &vp, fs->state);
hvp.set(vp);
return JS_TRUE;
}
@ -371,7 +377,7 @@ input_set_property_checked(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
if (fc->type != FC_CHECKBOX && fc->type != FC_RADIO)
return JS_TRUE;
fs->state = jsval_to_boolean(ctx, vp);
fs->state = jsval_to_boolean(ctx, &vp);
return JS_TRUE;
}
@ -419,7 +425,8 @@ input_get_property_defaultChecked(JSContext *ctx, JSHandleObject hobj, JSHandleI
assert(fc);
assert(fc->form && fs);
boolean_to_jsval(ctx, vp, fc->default_state);
boolean_to_jsval(ctx, &vp, fc->default_state);
hvp.set(vp);
return JS_TRUE;
}
@ -468,7 +475,8 @@ input_get_property_defaultValue(JSContext *ctx, JSHandleObject hobj, JSHandleId
assert(fc->form && fs);
/* FIXME (bug 805): convert from the charset of the document */
string_to_jsval(ctx, vp, fc->default_value);
string_to_jsval(ctx, &vp, fc->default_value);
hvp.set(vp);
return JS_TRUE;
}
@ -517,7 +525,8 @@ input_get_property_disabled(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
assert(fc->form && fs);
/* FIXME: <input readonly disabled> --pasky */
boolean_to_jsval(ctx, vp, fc->mode == FORM_MODE_DISABLED);
boolean_to_jsval(ctx, &vp, fc->mode == FORM_MODE_DISABLED);
hvp.set(vp);
return JS_TRUE;
}
@ -563,7 +572,7 @@ input_set_property_disabled(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
assert(fc->form && fs);
/* FIXME: <input readonly disabled> --pasky */
fc->mode = (jsval_to_boolean(ctx, vp) ? FORM_MODE_DISABLED
fc->mode = (jsval_to_boolean(ctx, &vp) ? FORM_MODE_DISABLED
: fc->mode == FORM_MODE_READONLY ? FORM_MODE_READONLY
: FORM_MODE_NORMAL);
@ -587,7 +596,8 @@ input_get_property_form(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSM
assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL));
if_assert_failed return JS_FALSE;
object_to_jsval(ctx, vp, parent_form);
object_to_jsval(ctx, &vp, parent_form);
hvp.set(vp);
return JS_TRUE;
}
@ -635,7 +645,8 @@ input_get_property_maxLength(JSContext *ctx, JSHandleObject hobj, JSHandleId hid
assert(fc);
assert(fc->form && fs);
int_to_jsval(ctx, vp, fc->maxlength);
int_to_jsval(ctx, &vp, fc->maxlength);
hvp.set(vp);
return JS_TRUE;
}
@ -680,7 +691,7 @@ input_set_property_maxLength(JSContext *ctx, JSHandleObject hobj, JSHandleId hid
assert(fc);
assert(fc->form && fs);
if (!JS_ValueToInt32(ctx, *vp, &fc->maxlength))
if (!JS_ValueToInt32(ctx, vp, &fc->maxlength))
return JS_FALSE;
return JS_TRUE;
@ -729,7 +740,8 @@ input_get_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSM
assert(fc);
assert(fc->form && fs);
string_to_jsval(ctx, vp, fc->name);
string_to_jsval(ctx, &vp, fc->name);
hvp.set(vp);
return JS_TRUE;
}
@ -775,7 +787,7 @@ input_set_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSB
assert(fc);
assert(fc->form && fs);
mem_free_set(&fc->name, stracpy(jsval_to_string(ctx, vp)));
mem_free_set(&fc->name, stracpy(jsval_to_string(ctx, &vp)));
return JS_TRUE;
}
@ -824,7 +836,8 @@ input_get_property_readonly(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
assert(fc->form && fs);
/* FIXME: <input readonly disabled> --pasky */
boolean_to_jsval(ctx, vp, fc->mode == FORM_MODE_READONLY);
boolean_to_jsval(ctx, &vp, fc->mode == FORM_MODE_READONLY);
hvp.set(vp);
return JS_TRUE;
}
@ -871,7 +884,7 @@ input_set_property_readonly(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
assert(fc->form && fs);
/* FIXME: <input readonly disabled> --pasky */
fc->mode = (jsval_to_boolean(ctx, vp) ? FORM_MODE_READONLY
fc->mode = (jsval_to_boolean(ctx, &vp) ? FORM_MODE_READONLY
: fc->mode == FORM_MODE_DISABLED ? FORM_MODE_DISABLED
: FORM_MODE_NORMAL);
@ -921,9 +934,10 @@ input_get_property_selectedIndex(JSContext *ctx, JSHandleObject hobj, JSHandleId
assert(fc);
assert(fc->form && fs);
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
if (fc->type == FC_SELECT) int_to_jsval(ctx, vp, fs->state);
if (fc->type == FC_SELECT) int_to_jsval(ctx, &vp, fs->state);
hvp.set(vp);
return JS_TRUE;
}
@ -972,7 +986,7 @@ input_set_property_selectedIndex(JSContext *ctx, JSHandleObject hobj, JSHandleId
if (fc->type == FC_SELECT) {
int item;
if (!JS_ValueToInt32(ctx, *vp, &item))
if (!JS_ValueToInt32(ctx, vp, &item))
return JS_FALSE;
if (item >= 0 && item < fc->nvalues) {
@ -1027,7 +1041,8 @@ input_get_property_size(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSM
assert(fc);
assert(fc->form && fs);
int_to_jsval(ctx, vp, fc->size);
int_to_jsval(ctx, &vp, fc->size);
hvp.set(vp);
return JS_TRUE;
}
@ -1080,10 +1095,12 @@ input_get_property_src(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMu
/* Hiddens have no link. */
if (linknum >= 0) link = &document->links[linknum];
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
if (link && link->where_img)
string_to_jsval(ctx, vp, link->where_img);
string_to_jsval(ctx, &vp, link->where_img);
hvp.set(vp);
return JS_TRUE;
}
@ -1135,7 +1152,7 @@ input_set_property_src(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBo
if (linknum >= 0) link = &document->links[linknum];
if (link) {
mem_free_set(&link->where_img, stracpy(jsval_to_string(ctx, vp)));
mem_free_set(&link->where_img, stracpy(jsval_to_string(ctx, &vp)));
}
return JS_TRUE;
@ -1190,11 +1207,13 @@ input_get_property_tabIndex(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
/* Hiddens have no link. */
if (linknum >= 0) link = &document->links[linknum];
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
if (link)
/* FIXME: This is WRONG. --pasky */
int_to_jsval(ctx, vp, link->number);
int_to_jsval(ctx, &vp, link->number);
hvp.set(vp);
return JS_TRUE;
}
@ -1257,7 +1276,8 @@ input_get_property_type(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSM
case FC_SELECT: s = "select"; break;
default: INTERNAL("input_get_property() upon a non-input item."); break;
}
string_to_jsval(ctx, vp, s);
string_to_jsval(ctx, &vp, s);
hvp.set(vp);
return JS_TRUE;
}
@ -1277,7 +1297,8 @@ input_get_property_value(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS
fs = input_get_form_state(ctx, obj);
if (!fs) return JS_FALSE; /* detached */
string_to_jsval(ctx, vp, fs->value);
string_to_jsval(ctx, &vp, fs->value);
hvp.set(vp);
return JS_TRUE;
}
@ -1323,7 +1344,7 @@ input_set_property_value(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS
assert(fc->form && fs);
if (fc->type != FC_FILE) {
mem_free_set(&fs->value, stracpy(jsval_to_string(ctx, vp)));
mem_free_set(&fs->value, stracpy(jsval_to_string(ctx, &vp)));
if (fc->type == FC_TEXT || fc->type == FC_PASSWORD)
fs->state = strlen(fs->value);
}
@ -1438,7 +1459,8 @@ input_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutabl
/* Hiddens have no link. */
if (linknum >= 0) link = &document->links[linknum];
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
hvp.set(vp);
switch (JSID_TO_INT(id)) {
case JSP_INPUT_ACCESSKEY:
@ -1448,57 +1470,57 @@ input_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutabl
if (!link) break;
if (!link->accesskey) {
*vp = JS_GetEmptyStringValue(ctx);
vp = JS_GetEmptyStringValue(ctx);
} else {
keystr = unicode_to_jsstring(ctx, link->accesskey);
if (keystr)
*vp = STRING_TO_JSVAL(keystr);
vp = STRING_TO_JSVAL(keystr);
else
return JS_FALSE;
}
break;
}
case JSP_INPUT_ALT:
string_to_jsval(ctx, vp, fc->alt);
string_to_jsval(ctx, &vp, fc->alt);
break;
case JSP_INPUT_CHECKED:
boolean_to_jsval(ctx, vp, fs->state);
boolean_to_jsval(ctx, &vp, fs->state);
break;
case JSP_INPUT_DEFAULT_CHECKED:
boolean_to_jsval(ctx, vp, fc->default_state);
boolean_to_jsval(ctx, &vp, fc->default_state);
break;
case JSP_INPUT_DEFAULT_VALUE:
/* FIXME (bug 805): convert from the charset of the document */
string_to_jsval(ctx, vp, fc->default_value);
string_to_jsval(ctx, &vp, fc->default_value);
break;
case JSP_INPUT_DISABLED:
/* FIXME: <input readonly disabled> --pasky */
boolean_to_jsval(ctx, vp, fc->mode == FORM_MODE_DISABLED);
boolean_to_jsval(ctx, &vp, fc->mode == FORM_MODE_DISABLED);
break;
case JSP_INPUT_FORM:
object_to_jsval(ctx, vp, parent_form);
object_to_jsval(ctx, &vp, parent_form);
break;
case JSP_INPUT_MAX_LENGTH:
int_to_jsval(ctx, vp, fc->maxlength);
int_to_jsval(ctx, &vp, fc->maxlength);
break;
case JSP_INPUT_NAME:
string_to_jsval(ctx, vp, fc->name);
string_to_jsval(ctx, &vp, fc->name);
break;
case JSP_INPUT_READONLY:
/* FIXME: <input readonly disabled> --pasky */
boolean_to_jsval(ctx, vp, fc->mode == FORM_MODE_READONLY);
boolean_to_jsval(ctx, &vp, fc->mode == FORM_MODE_READONLY);
break;
case JSP_INPUT_SIZE:
int_to_jsval(ctx, vp, fc->size);
int_to_jsval(ctx, &vp, fc->size);
break;
case JSP_INPUT_SRC:
if (link && link->where_img)
string_to_jsval(ctx, vp, link->where_img);
string_to_jsval(ctx, &vp, link->where_img);
break;
case JSP_INPUT_TABINDEX:
if (link)
/* FIXME: This is WRONG. --pasky */
int_to_jsval(ctx, vp, link->number);
int_to_jsval(ctx, &vp, link->number);
break;
case JSP_INPUT_TYPE:
{
@ -1518,15 +1540,15 @@ input_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutabl
case FC_SELECT: s = "select"; break;
default: INTERNAL("input_get_property() upon a non-input item."); break;
}
string_to_jsval(ctx, vp, s);
string_to_jsval(ctx, &vp, s);
break;
}
case JSP_INPUT_VALUE:
string_to_jsval(ctx, vp, fs->value);
string_to_jsval(ctx, &vp, fs->value);
break;
case JSP_INPUT_SELECTED_INDEX:
if (fc->type == FC_SELECT) int_to_jsval(ctx, vp, fs->state);
if (fc->type == FC_SELECT) int_to_jsval(ctx, &vp, fs->state);
break;
default:
/* Unrecognized integer property ID; someone is using
@ -1537,6 +1559,7 @@ input_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutabl
* @undef_to_jsval.) */
break;
}
hvp.set(vp);
return JS_TRUE;
}
@ -1595,48 +1618,48 @@ input_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool s
switch (JSID_TO_INT(id)) {
case JSP_INPUT_ACCESSKEY:
accesskey = jsval_to_accesskey(ctx, vp);
accesskey = jsval_to_accesskey(ctx, &vp);
if (accesskey == UCS_NO_CHAR)
return JS_FALSE;
else if (link)
link->accesskey = accesskey;
break;
case JSP_INPUT_ALT:
mem_free_set(&fc->alt, stracpy(jsval_to_string(ctx, vp)));
mem_free_set(&fc->alt, stracpy(jsval_to_string(ctx, &vp)));
break;
case JSP_INPUT_CHECKED:
if (fc->type != FC_CHECKBOX && fc->type != FC_RADIO)
break;
fs->state = jsval_to_boolean(ctx, vp);
fs->state = jsval_to_boolean(ctx, &vp);
break;
case JSP_INPUT_DISABLED:
/* FIXME: <input readonly disabled> --pasky */
fc->mode = (jsval_to_boolean(ctx, vp) ? FORM_MODE_DISABLED
fc->mode = (jsval_to_boolean(ctx, &vp) ? FORM_MODE_DISABLED
: fc->mode == FORM_MODE_READONLY ? FORM_MODE_READONLY
: FORM_MODE_NORMAL);
break;
case JSP_INPUT_MAX_LENGTH:
if (!JS_ValueToInt32(ctx, *vp, &fc->maxlength))
if (!JS_ValueToInt32(ctx, vp, &fc->maxlength))
return JS_FALSE;
break;
case JSP_INPUT_NAME:
mem_free_set(&fc->name, stracpy(jsval_to_string(ctx, vp)));
mem_free_set(&fc->name, stracpy(jsval_to_string(ctx, &vp)));
break;
case JSP_INPUT_READONLY:
/* FIXME: <input readonly disabled> --pasky */
fc->mode = (jsval_to_boolean(ctx, vp) ? FORM_MODE_READONLY
fc->mode = (jsval_to_boolean(ctx, &vp) ? FORM_MODE_READONLY
: fc->mode == FORM_MODE_DISABLED ? FORM_MODE_DISABLED
: FORM_MODE_NORMAL);
break;
case JSP_INPUT_SRC:
if (link) {
mem_free_set(&link->where_img, stracpy(jsval_to_string(ctx, vp)));
mem_free_set(&link->where_img, stracpy(jsval_to_string(ctx, &vp)));
}
break;
case JSP_INPUT_VALUE:
if (fc->type == FC_FILE)
break; /* A huge security risk otherwise. */
mem_free_set(&fs->value, stracpy(jsval_to_string(ctx, vp)));
mem_free_set(&fs->value, stracpy(jsval_to_string(ctx, &vp)));
if (fc->type == FC_TEXT || fc->type == FC_PASSWORD)
fs->state = strlen(fs->value);
break;
@ -1644,7 +1667,7 @@ input_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool s
if (fc->type == FC_SELECT) {
int item;
if (!JS_ValueToInt32(ctx, *vp, &item))
if (!JS_ValueToInt32(ctx, vp, &item))
return JS_FALSE;
if (item >= 0 && item < fc->nvalues) {
@ -1990,25 +2013,27 @@ form_elements_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
if (JSID_IS_STRING(id)) {
JS_IdToValue(ctx, id, &idval);
form_elements_namedItem2(ctx, obj, 1, &idval, vp);
form_elements_namedItem2(ctx, obj, 1, &idval, &vp);
hvp.set(vp);
return JS_TRUE;
}
if (!JSID_IS_INT(id))
return JS_TRUE;
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
switch (JSID_TO_INT(id)) {
case JSP_FORM_ELEMENTS_LENGTH:
int_to_jsval(ctx, vp, list_size(&form->items));
int_to_jsval(ctx, &vp, list_size(&form->items));
break;
default:
/* Array index. */
JS_IdToValue(ctx, id, &idval);
form_elements_item2(ctx, obj, 1, &idval, vp);
form_elements_item2(ctx, obj, 1, &idval, &vp);
break;
}
hvp.set(vp);
return JS_TRUE;
}
@ -2050,7 +2075,8 @@ form_elements_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleI
if (!form_view) return JS_FALSE; /* detached */
form = find_form_by_form_view(document, form_view);
int_to_jsval(ctx, vp, list_size(&form->items));
int_to_jsval(ctx, &vp, list_size(&form->items));
hvp.set(vp);
return JS_TRUE;
}
@ -2323,26 +2349,27 @@ form_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutable
&& (!fc->name || c_strcasecmp(string, fc->name)))
continue;
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
fs = find_form_state(doc_view, fc);
if (fs) {
fcobj = get_form_control_object(ctx, obj, fc->type, fs);
if (fcobj)
object_to_jsval(ctx, vp, fcobj);
object_to_jsval(ctx, &vp, fcobj);
}
break;
}
hvp.set(vp);
return JS_TRUE;
}
if (!JSID_IS_INT(id))
return JS_TRUE;
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
switch (JSID_TO_INT(id)) {
case JSP_FORM_ACTION:
string_to_jsval(ctx, vp, form->action);
string_to_jsval(ctx, &vp, form->action);
break;
case JSP_FORM_ELEMENTS:
@ -2353,7 +2380,7 @@ form_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutable
JS_DefineProperties(ctx, jsform_elems, (JSPropertySpec *) form_elements_props);
spidermonkey_DefineFunctions(ctx, jsform_elems,
form_elements_funcs);
object_to_jsval(ctx, vp, jsform_elems);
object_to_jsval(ctx, &vp, jsform_elems);
/* SM will cache this property value for us so we create this
* just once per form. */
}
@ -2363,41 +2390,41 @@ form_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutable
switch (form->method) {
case FORM_METHOD_GET:
case FORM_METHOD_POST:
string_to_jsval(ctx, vp, "application/x-www-form-urlencoded");
string_to_jsval(ctx, &vp, "application/x-www-form-urlencoded");
break;
case FORM_METHOD_POST_MP:
string_to_jsval(ctx, vp, "multipart/form-data");
string_to_jsval(ctx, &vp, "multipart/form-data");
break;
case FORM_METHOD_POST_TEXT_PLAIN:
string_to_jsval(ctx, vp, "text/plain");
string_to_jsval(ctx, &vp, "text/plain");
break;
}
break;
case JSP_FORM_LENGTH:
int_to_jsval(ctx, vp, list_size(&form->items));
int_to_jsval(ctx, &vp, list_size(&form->items));
break;
case JSP_FORM_METHOD:
switch (form->method) {
case FORM_METHOD_GET:
string_to_jsval(ctx, vp, "GET");
string_to_jsval(ctx, &vp, "GET");
break;
case FORM_METHOD_POST:
case FORM_METHOD_POST_MP:
case FORM_METHOD_POST_TEXT_PLAIN:
string_to_jsval(ctx, vp, "POST");
string_to_jsval(ctx, &vp, "POST");
break;
}
break;
case JSP_FORM_NAME:
string_to_jsval(ctx, vp, form->name);
string_to_jsval(ctx, &vp, form->name);
break;
case JSP_FORM_TARGET:
string_to_jsval(ctx, vp, form->target);
string_to_jsval(ctx, &vp, form->target);
break;
default:
@ -2409,6 +2436,7 @@ form_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutable
* @undef_to_jsval.) */
break;
}
hvp.set(vp);
return JS_TRUE;
}
@ -2446,7 +2474,8 @@ form_get_property_action(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS
form = find_form_by_form_view(doc_view->document, fv);
assert(form);
string_to_jsval(ctx, vp, form->action);
string_to_jsval(ctx, &vp, form->action);
hvp.set(vp);
return JS_TRUE;
}
@ -2485,7 +2514,7 @@ form_set_property_action(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS
assert(form);
string = stracpy(jsval_to_string(ctx, vp));
string = stracpy(jsval_to_string(ctx, &vp));
if (form->action) {
ecmascript_set_action(&form->action, string);
} else {
@ -2518,9 +2547,10 @@ form_get_property_elements(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
JS_DefineProperties(ctx, jsform_elems, (JSPropertySpec *) form_elements_props);
spidermonkey_DefineFunctions(ctx, jsform_elems,
form_elements_funcs);
object_to_jsval(ctx, vp, jsform_elems);
object_to_jsval(ctx, &vp, jsform_elems);
/* SM will cache this property value for us so we create this
* just once per form. */
hvp.set(vp);
return JS_TRUE;
}
@ -2561,15 +2591,16 @@ form_get_property_encoding(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
switch (form->method) {
case FORM_METHOD_GET:
case FORM_METHOD_POST:
string_to_jsval(ctx, vp, "application/x-www-form-urlencoded");
string_to_jsval(ctx, &vp, "application/x-www-form-urlencoded");
break;
case FORM_METHOD_POST_MP:
string_to_jsval(ctx, vp, "multipart/form-data");
string_to_jsval(ctx, &vp, "multipart/form-data");
break;
case FORM_METHOD_POST_TEXT_PLAIN:
string_to_jsval(ctx, vp, "text/plain");
string_to_jsval(ctx, &vp, "text/plain");
break;
}
hvp.set(vp);
return JS_TRUE;
}
@ -2609,7 +2640,7 @@ form_set_property_encoding(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
assert(form);
string = jsval_to_string(ctx, vp);
string = jsval_to_string(ctx, &vp);
if (!c_strcasecmp(string, "application/x-www-form-urlencoded")) {
form->method = form->method == FORM_METHOD_GET ? FORM_METHOD_GET
: FORM_METHOD_POST;
@ -2655,7 +2686,8 @@ form_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS
assert(form);
int_to_jsval(ctx, vp, list_size(&form->items));
int_to_jsval(ctx, &vp, list_size(&form->items));
hvp.set(vp);
return JS_TRUE;
}
@ -2695,15 +2727,16 @@ form_get_property_method(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS
switch (form->method) {
case FORM_METHOD_GET:
string_to_jsval(ctx, vp, "GET");
string_to_jsval(ctx, &vp, "GET");
break;
case FORM_METHOD_POST:
case FORM_METHOD_POST_MP:
case FORM_METHOD_POST_TEXT_PLAIN:
string_to_jsval(ctx, vp, "POST");
string_to_jsval(ctx, &vp, "POST");
break;
}
hvp.set(vp);
return JS_TRUE;
}
@ -2743,7 +2776,7 @@ form_set_property_method(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS
assert(form);
string = jsval_to_string(ctx, vp);
string = jsval_to_string(ctx, &vp);
if (!c_strcasecmp(string, "GET")) {
form->method = FORM_METHOD_GET;
} else if (!c_strcasecmp(string, "POST")) {
@ -2786,7 +2819,8 @@ form_get_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMu
assert(form);
string_to_jsval(ctx, vp, form->name);
string_to_jsval(ctx, &vp, form->name);
hvp.set(vp);
return JS_TRUE;
}
@ -2824,7 +2858,7 @@ form_set_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBo
form = find_form_by_form_view(doc_view->document, fv);
assert(form);
mem_free_set(&form->name, stracpy(jsval_to_string(ctx, vp)));
mem_free_set(&form->name, stracpy(jsval_to_string(ctx, &vp)));
return JS_TRUE;
}
@ -2861,7 +2895,8 @@ form_get_property_target(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS
form = find_form_by_form_view(doc_view->document, fv);
assert(form);
string_to_jsval(ctx, vp, form->target);
string_to_jsval(ctx, &vp, form->target);
hvp.set(vp);
return JS_TRUE;
}
@ -2898,7 +2933,7 @@ form_set_property_target(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS
form = find_form_by_form_view(doc_view->document, fv);
assert(form);
mem_free_set(&form->target, stracpy(jsval_to_string(ctx, vp)));
mem_free_set(&form->target, stracpy(jsval_to_string(ctx, &vp)));
return JS_TRUE;
}
@ -3160,14 +3195,16 @@ forms_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutabl
* we must leave *vp unchanged here, to avoid
* "TypeError: forms.namedItem is not a function". */
JS_IdToValue(ctx, id, &idval);
find_form_by_name(ctx, parent_doc, doc_view, idval, vp);
find_form_by_name(ctx, parent_doc, doc_view, idval, &vp);
hvp.set(vp);
return JS_TRUE;
}
}
/* Array index. */
JS_IdToValue(ctx, id, &idval);
forms_item2(ctx, obj, 1, &idval, vp);
forms_item2(ctx, obj, 1, &idval, &vp);
hvp.set(vp);
return JS_TRUE;
}
@ -3201,7 +3238,8 @@ forms_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, J
&window_class, NULL);
doc_view = vs->doc_view;
document = doc_view->document;
int_to_jsval(ctx, vp, list_size(&document->forms));
int_to_jsval(ctx, &vp, list_size(&document->forms));
hvp.set(vp);
return JS_TRUE;
}

View File

@ -173,7 +173,8 @@ location_get_property_href(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
vs = JS_GetInstancePrivate(ctx, parent_win,
&window_class, NULL);
astring_to_jsval(ctx, vp, get_uri_string(vs->uri, URI_ORIGINAL));
astring_to_jsval(ctx, &vp, get_uri_string(vs->uri, URI_ORIGINAL));
hvp.set(vp);
return JS_TRUE;
}
@ -198,7 +199,7 @@ location_set_property_href(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
vs = JS_GetInstancePrivate(ctx, parent_win,
&window_class, NULL);
doc_view = vs->doc_view;
location_goto(doc_view, jsval_to_string(ctx, vp));
location_goto(doc_view, jsval_to_string(ctx, &vp));
return JS_TRUE;
}

View File

@ -92,7 +92,8 @@ navigator_get_property_appCodeName(JSContext *ctx, JSHandleObject hobj, JSHandle
ELINKS_CAST_PROP_PARAMS
(void)obj;
string_to_jsval(ctx, vp, "Mozilla"); /* More like a constant nowadays. */
string_to_jsval(ctx, &vp, "Mozilla"); /* More like a constant nowadays. */
hvp.set(vp);
return JS_TRUE;
}
@ -103,7 +104,8 @@ navigator_get_property_appName(JSContext *ctx, JSHandleObject hobj, JSHandleId h
ELINKS_CAST_PROP_PARAMS
(void)obj;
string_to_jsval(ctx, vp, "ELinks (roughly compatible with Netscape Navigator, Mozilla and Microsoft Internet Explorer)");
string_to_jsval(ctx, &vp, "ELinks (roughly compatible with Netscape Navigator, Mozilla and Microsoft Internet Explorer)");
hvp.set(vp);
return JS_TRUE;
}
@ -114,7 +116,8 @@ navigator_get_property_appVersion(JSContext *ctx, JSHandleObject hobj, JSHandleI
ELINKS_CAST_PROP_PARAMS
(void)obj;
string_to_jsval(ctx, vp, VERSION);
string_to_jsval(ctx, &vp, VERSION);
hvp.set(vp);
return JS_TRUE;
}
@ -125,12 +128,14 @@ navigator_get_property_language(JSContext *ctx, JSHandleObject hobj, JSHandleId
ELINKS_CAST_PROP_PARAMS
(void)obj;
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
#ifdef CONFIG_NLS
if (get_opt_bool("protocol.http.accept_ui_language", NULL))
string_to_jsval(ctx, vp, language_to_iso639(current_language));
string_to_jsval(ctx, &vp, language_to_iso639(current_language));
#endif
hvp.set(vp);
return JS_TRUE;
}
@ -140,7 +145,8 @@ navigator_get_property_platform(JSContext *ctx, JSHandleObject hobj, JSHandleId
ELINKS_CAST_PROP_PARAMS
(void)obj;
string_to_jsval(ctx, vp, system_name);
string_to_jsval(ctx, &vp, system_name);
hvp.set(vp);
return JS_TRUE;
}
@ -173,12 +179,14 @@ navigator_get_property_userAgent(JSContext *ctx, JSHandleObject hobj, JSHandleId
if (ustr) {
safe_strncpy(custr, ustr, 256);
mem_free(ustr);
string_to_jsval(ctx, vp, custr);
string_to_jsval(ctx, &vp, custr);
hvp.set(vp);
return JS_TRUE;
}
}
string_to_jsval(ctx, vp, system_name);
string_to_jsval(ctx, &vp, system_name);
hvp.set(vp);
return JS_TRUE;
}

View File

@ -106,7 +106,7 @@ unibar_get_property_visible(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
bar = JS_GetPrivate(obj); /* from @menubar_class or @statusbar_class */
#define unibar_fetch(bar) \
boolean_to_jsval(ctx, vp, status->force_show_##bar##_bar >= 0 \
boolean_to_jsval(ctx, &vp, status->force_show_##bar##_bar >= 0 \
? status->force_show_##bar##_bar \
: status->show_##bar##_bar)
switch (*bar) {
@ -117,10 +117,11 @@ unibar_get_property_visible(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
unibar_fetch(title);
break;
default:
boolean_to_jsval(ctx, vp, 0);
boolean_to_jsval(ctx, &vp, 0);
break;
}
#undef unibar_fetch
hvp.set(vp);
return JS_TRUE;
}
@ -154,10 +155,10 @@ unibar_set_property_visible(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
switch (*bar) {
case 's':
status->force_show_status_bar = jsval_to_boolean(ctx, vp);
status->force_show_status_bar = jsval_to_boolean(ctx, &vp);
break;
case 't':
status->force_show_title_bar = jsval_to_boolean(ctx, vp);
status->force_show_title_bar = jsval_to_boolean(ctx, &vp);
break;
default:
break;

View File

@ -153,7 +153,8 @@ window_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutab
/* TODO: Try other lookups (mainly element lookup) until
* something yields data. */
if (obj) {
object_to_jsval(ctx, vp, obj);
object_to_jsval(ctx, &vp, obj);
hvp.set(vp);
}
return JS_TRUE;
}
@ -161,17 +162,20 @@ window_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutab
if (!JSID_IS_INT(id))
return JS_TRUE;
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
hvp.set(vp);
switch (JSID_TO_INT(id)) {
case JSP_WIN_CLOSED:
/* TODO: It will be a major PITA to implement this properly.
* Well, perhaps not so much if we introduce reference tracking
* for (struct session)? Still... --pasky */
boolean_to_jsval(ctx, vp, 0);
boolean_to_jsval(ctx, &vp, 0);
hvp.set(vp);
break;
case JSP_WIN_SELF:
object_to_jsval(ctx, vp, obj);
object_to_jsval(ctx, &vp, obj);
hvp.set(vp);
break;
case JSP_WIN_PARENT:
/* XXX: It would be nice if the following worked, yes.
@ -211,7 +215,8 @@ found_parent:
if (doc_view->vs.ecmascript_fragile)
ecmascript_reset_state(&doc_view->vs);
assert(doc_view->ecmascript);
object_to_jsval(ctx, vp, JS_GetGlobalObject(doc_view->ecmascript->backend_data));
object_to_jsval(ctx, &vp, JS_GetGlobalObject(doc_view->ecmascript->backend_data));
hvp.set(vp);
break;
}
#endif
@ -237,7 +242,8 @@ found_parent:
* let the script walk thru. That'd mean moving the check to
* other individual properties in this switch. */
if (compare_uri(vs->uri, top_view->vs->uri, URI_HOST))
object_to_jsval(ctx, vp, newjsframe);
object_to_jsval(ctx, &vp, newjsframe);
hvp.set(vp);
/* else */
/****X*X*X*** SECURITY VIOLATION! RED ALERT, SHIELDS UP! ***X*X*X****\
|* (Pasky was apparently looking at the Links2 JS code . ___ ^.^ *|
@ -449,7 +455,8 @@ window_get_property_closed(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
if (!JS_InstanceOf(ctx, obj, &window_class, NULL))
return JS_FALSE;
boolean_to_jsval(ctx, vp, 0);
boolean_to_jsval(ctx, &vp, 0);
hvp.set(vp);
return JS_TRUE;
}
@ -476,7 +483,8 @@ window_get_property_parent(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
* INCORRECT but works for the most common cases of just two
* frames. Better something than nothing. */
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
hvp.set(vp);
return JS_TRUE;
}
@ -492,7 +500,8 @@ window_get_property_self(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS
if (!JS_InstanceOf(ctx, obj, &window_class, NULL))
return JS_FALSE;
object_to_jsval(ctx, vp, obj);
object_to_jsval(ctx, &vp, obj);
hvp.set(vp);
return JS_TRUE;
}
@ -508,7 +517,8 @@ window_get_property_status(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
if (!JS_InstanceOf(ctx, obj, &window_class, NULL))
return JS_FALSE;
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
hvp.set(vp);
return JS_TRUE;
}
@ -528,7 +538,7 @@ window_set_property_status(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
vs = JS_GetInstancePrivate(ctx, obj, &window_class, NULL);
mem_free_set(&vs->doc_view->session->status.window_status, stracpy(jsval_to_string(ctx, vp)));
mem_free_set(&vs->doc_view->session->status.window_status, stracpy(jsval_to_string(ctx, &vp)));
print_screen_status(vs->doc_view->session);
return JS_TRUE;
@ -554,7 +564,8 @@ window_get_property_top(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSM
doc_view = vs->doc_view;
top_view = doc_view->session->doc_view;
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
hvp.set(vp);
assert(top_view && top_view->vs);
if (top_view->vs->ecmascript_fragile)
@ -570,7 +581,8 @@ window_get_property_top(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSM
* let the script walk thru. That'd mean moving the check to
* other individual properties in this switch. */
if (compare_uri(vs->uri, top_view->vs->uri, URI_HOST))
object_to_jsval(ctx, vp, newjsframe);
object_to_jsval(ctx, &vp, newjsframe);
hvp.set(vp);
/* else */
/****X*X*X*** SECURITY VIOLATION! RED ALERT, SHIELDS UP! ***X*X*X****\
|* (Pasky was apparently looking at the Links2 JS code . ___ ^.^ *|

View File

@ -174,7 +174,7 @@ action_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutab
JSObject *action_fn;
unsigned char *action_str;
*vp = JSVAL_NULL;
vp = JSVAL_NULL;
JS_IdToValue(ctx, id, &val);
action_str = JS_EncodeString(ctx, JS_ValueToString(ctx, val));
@ -183,7 +183,7 @@ action_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutab
action_fn = smjs_get_action_fn_object(action_str);
if (!action_fn) return JS_TRUE;
*vp = OBJECT_TO_JSVAL(action_fn);
vp = OBJECT_TO_JSVAL(action_fn);
return JS_TRUE;
}

View File

@ -183,7 +183,7 @@ bookmark_get_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
if (!bookmark) return JS_FALSE;
return bookmark_string_to_jsval(ctx, bookmark->title, vp);
return bookmark_string_to_jsval(ctx, bookmark->title, &vp);
}
static JSBool
@ -207,7 +207,7 @@ bookmark_set_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
if (!bookmark) return JS_FALSE;
if (!jsval_to_bookmark_string(ctx, *vp, &title))
if (!jsval_to_bookmark_string(ctx, vp, &title))
return JS_FALSE;
ok = update_bookmark(bookmark, get_cp_index("UTF-8"), title, url);
@ -234,7 +234,7 @@ bookmark_get_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, J
if (!bookmark) return JS_FALSE;
return bookmark_string_to_jsval(ctx, bookmark->url, vp);
return bookmark_string_to_jsval(ctx, bookmark->url, &vp);
}
static JSBool
@ -258,7 +258,7 @@ bookmark_set_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, J
if (!bookmark) return JS_FALSE;
if (!jsval_to_bookmark_string(ctx, *vp, &url))
if (!jsval_to_bookmark_string(ctx, vp, &url))
return JS_FALSE;
ok = update_bookmark(bookmark, get_cp_index("UTF-8"), title, url);
@ -285,7 +285,7 @@ bookmark_get_property_children(JSContext *ctx, JSHandleObject hobj, JSHandleId h
if (!bookmark) return JS_FALSE;
*vp = OBJECT_TO_JSVAL(smjs_get_bookmark_folder_object(bookmark));
vp = OBJECT_TO_JSVAL(smjs_get_bookmark_folder_object(bookmark));
return JS_TRUE;
}
@ -331,7 +331,7 @@ bookmark_folder_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid
folder = JS_GetInstancePrivate(ctx, obj,
(JSClass *) &bookmark_folder_class, NULL);
*vp = JSVAL_NULL;
vp = JSVAL_NULL;
if (!JS_IdToValue(ctx, id, &title_jsval))
return JS_FALSE;
@ -341,7 +341,7 @@ bookmark_folder_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid
bookmark = get_bookmark_by_name(folder, title);
if (bookmark) {
*vp = OBJECT_TO_JSVAL(smjs_get_bookmark_object(bookmark));
vp = OBJECT_TO_JSVAL(smjs_get_bookmark_object(bookmark));
}
mem_free(title);

View File

@ -83,13 +83,13 @@ cache_entry_get_property_content(JSContext *ctx, JSHandleObject hobj, JSHandleId
* eventually unlock the object. */
object_lock(cached);
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
fragment = get_cache_fragment(cached);
if (!fragment) {
ret = JS_FALSE;
} else {
*vp = STRING_TO_JSVAL(JS_NewStringCopyN(smjs_ctx, fragment->data, fragment->length));
vp = STRING_TO_JSVAL(JS_NewStringCopyN(smjs_ctx, fragment->data, fragment->length));
ret = JS_TRUE;
}
@ -126,7 +126,7 @@ cache_entry_set_property_content(JSContext *ctx, JSHandleObject hobj, JSHandleId
* eventually unlock the object. */
object_lock(cached);
jsstr = JS_ValueToString(smjs_ctx, *vp);
jsstr = JS_ValueToString(smjs_ctx, vp);
str = JS_EncodeString(smjs_ctx, jsstr);
len = JS_GetStringLength(jsstr);
add_fragment(cached, 0, str, len);
@ -161,7 +161,7 @@ cache_entry_get_property_type(JSContext *ctx, JSHandleObject hobj, JSHandleId hi
* collect garbage. After this, all code paths must
* eventually unlock the object. */
object_lock(cached);
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, cached->content_type));
vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, cached->content_type));
object_unlock(cached);
return JS_TRUE;
@ -195,7 +195,7 @@ cache_entry_set_property_type(JSContext *ctx, JSHandleObject hobj, JSHandleId hi
* eventually unlock the object. */
object_lock(cached);
jsstr = JS_ValueToString(smjs_ctx, *vp);
jsstr = JS_ValueToString(smjs_ctx, vp);
str = JS_EncodeString(smjs_ctx, jsstr);
mem_free_set(&cached->content_type, stracpy(str));
@ -313,7 +313,7 @@ cache_entry_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId
* collect garbage. After this, all code paths must
* eventually unlock the object. */
object_lock(cached);
*vp = INT_TO_JSVAL(cached->length);
vp = INT_TO_JSVAL(cached->length);
object_unlock(cached);
return JS_TRUE;
@ -344,7 +344,7 @@ cache_entry_get_property_head(JSContext *ctx, JSHandleObject hobj, JSHandleId hi
* collect garbage. After this, all code paths must
* eventually unlock the object. */
object_lock(cached);
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, cached->head));
vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, cached->head));
object_unlock(cached);
return JS_TRUE;
@ -378,7 +378,7 @@ cache_entry_set_property_head(JSContext *ctx, JSHandleObject hobj, JSHandleId hi
* eventually unlock the object. */
object_lock(cached);
jsstr = JS_ValueToString(smjs_ctx, *vp);
jsstr = JS_ValueToString(smjs_ctx, vp);
str = JS_EncodeString(smjs_ctx, jsstr);
mem_free_set(&cached->head, stracpy(str));
@ -412,7 +412,7 @@ cache_entry_get_property_uri(JSContext *ctx, JSHandleObject hobj, JSHandleId hid
* collect garbage. After this, all code paths must
* eventually unlock the object. */
object_lock(cached);
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, struri(cached->uri)));
vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, struri(cached->uri)));
object_unlock(cached);
return JS_TRUE;

View File

@ -137,11 +137,11 @@ elinks_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutab
return JS_TRUE;
}
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
switch (JSID_TO_INT(id)) {
case ELINKS_HOME:
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, elinks_home));
vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, elinks_home));
return JS_TRUE;
case ELINKS_LOCATION: {
@ -152,7 +152,7 @@ elinks_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutab
uri = have_location(smjs_ses) ? cur_loc(smjs_ses)->vs.uri
: smjs_ses->loading_uri;
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx,
vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx,
uri ? (const char *) struri(uri) : ""));
return JS_TRUE;
@ -165,7 +165,7 @@ elinks_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutab
jsobj = smjs_get_session_object(smjs_ses);
if (!jsobj) return JS_FALSE;
object_to_jsval(ctx, vp, jsobj);
object_to_jsval(ctx, &vp, jsobj);
return JS_TRUE;
}
@ -202,7 +202,7 @@ elinks_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool
if (!smjs_ses) return JS_FALSE;
jsstr = JS_ValueToString(smjs_ctx, *vp);
jsstr = JS_ValueToString(smjs_ctx, vp);
if (!jsstr) return JS_FALSE;
url = JS_EncodeString(smjs_ctx, jsstr);
@ -287,7 +287,7 @@ elinks_get_property_home(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS
if (!JS_InstanceOf(ctx, obj, (JSClass *) &elinks_class, NULL))
return JS_FALSE;
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, elinks_home));
vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, elinks_home));
return JS_TRUE;
}
@ -307,7 +307,7 @@ elinks_get_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId hid
if (!smjs_ses) return JS_FALSE;
uri = have_location(smjs_ses) ? cur_loc(smjs_ses)->vs.uri : smjs_ses->loading_uri;
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, uri ? (const char *) struri(uri) : ""));
vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, uri ? (const char *) struri(uri) : ""));
return JS_TRUE;
}
@ -327,7 +327,7 @@ elinks_set_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId hid
if (!smjs_ses) return JS_FALSE;
jsstr = JS_ValueToString(smjs_ctx, *vp);
jsstr = JS_ValueToString(smjs_ctx, vp);
if (!jsstr) return JS_FALSE;
url = JS_EncodeString(smjs_ctx, jsstr);
@ -355,7 +355,7 @@ elinks_get_property_session(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
jsobj = smjs_get_session_object(smjs_ses);
if (!jsobj) return JS_FALSE;
object_to_jsval(ctx, vp, jsobj);
object_to_jsval(ctx, &vp, jsobj);
return JS_TRUE;
}

View File

@ -94,19 +94,19 @@ smjs_globhist_item_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId
if (!history_item) return JS_FALSE;
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
if (!JSID_IS_INT(id))
return JS_FALSE;
switch (JSID_TO_INT(id)) {
case GLOBHIST_TITLE:
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx,
vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx,
history_item->title));
return JS_TRUE;
case GLOBHIST_URL:
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx,
vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx,
history_item->url));
return JS_TRUE;
@ -127,7 +127,7 @@ smjs_globhist_item_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId
* Since the Date object uses milliseconds since the epoch,
* I'd rather export that, but SpiderMonkey doesn't provide
* a suitable type. -- Miciah */
*vp = JS_NumberValue(history_item->last_visit);
vp = JS_NumberValue(history_item->last_visit);
return JS_TRUE;
default:
@ -167,7 +167,7 @@ smjs_globhist_item_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId
switch (JSID_TO_INT(id)) {
case GLOBHIST_TITLE: {
JSString *jsstr = JS_ValueToString(smjs_ctx, *vp);
JSString *jsstr = JS_ValueToString(smjs_ctx, vp);
unsigned char *str = JS_EncodeString(smjs_ctx, jsstr);
mem_free_set(&history_item->title, stracpy(str));
@ -175,7 +175,7 @@ smjs_globhist_item_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId
return JS_TRUE;
}
case GLOBHIST_URL: {
JSString *jsstr = JS_ValueToString(smjs_ctx, *vp);
JSString *jsstr = JS_ValueToString(smjs_ctx, vp);
unsigned char *str = JS_EncodeString(smjs_ctx, jsstr);
mem_free_set(&history_item->url, stracpy(str));
@ -186,7 +186,7 @@ smjs_globhist_item_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId
uint32_t seconds;
/* Bug 923: Assumes time_t values fit in uint32. */
JS_ValueToECMAUint32(smjs_ctx, *vp, &seconds);
JS_ValueToECMAUint32(smjs_ctx, vp, &seconds);
history_item->last_visit = seconds;
return JS_TRUE;
@ -245,12 +245,12 @@ smjs_globhist_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
jsobj = smjs_get_globhist_item_object(history_item);
if (!jsobj) goto ret_null;
*vp = OBJECT_TO_JSVAL(jsobj);
vp = OBJECT_TO_JSVAL(jsobj);
return JS_TRUE;
ret_null:
*vp = JSVAL_NULL;
vp = JSVAL_NULL;
return JS_TRUE;
}
@ -305,7 +305,7 @@ smjs_globhist_item_get_property_title(JSContext *ctx, JSHandleObject hobj, JSHan
if (!history_item) return JS_FALSE;
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, history_item->title));
vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, history_item->title));
return JS_TRUE;
}
@ -331,7 +331,7 @@ smjs_globhist_item_set_property_title(JSContext *ctx, JSHandleObject hobj, JSHan
if (!history_item) return JS_FALSE;
jsstr = JS_ValueToString(smjs_ctx, *vp);
jsstr = JS_ValueToString(smjs_ctx, vp);
str = JS_EncodeString(smjs_ctx, jsstr);
mem_free_set(&history_item->title, stracpy(str));
@ -358,7 +358,7 @@ smjs_globhist_item_get_property_url(JSContext *ctx, JSHandleObject hobj, JSHandl
if (!history_item) return JS_FALSE;
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, history_item->url));
vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, history_item->url));
return JS_TRUE;
}
@ -384,7 +384,7 @@ smjs_globhist_item_set_property_url(JSContext *ctx, JSHandleObject hobj, JSHandl
if (!history_item) return JS_FALSE;
jsstr = JS_ValueToString(smjs_ctx, *vp);
jsstr = JS_ValueToString(smjs_ctx, vp);
str = JS_EncodeString(smjs_ctx, jsstr);
mem_free_set(&history_item->url, stracpy(str));
@ -427,7 +427,7 @@ smjs_globhist_item_get_property_last_visit(JSContext *ctx, JSHandleObject hobj,
* Since the Date object uses milliseconds since the epoch,
* I'd rather export that, but SpiderMonkey doesn't provide
* a suitable type. -- Miciah */
*vp = JS_NumberValue(history_item->last_visit);
vp = JS_NumberValue(history_item->last_visit);
return JS_TRUE;
}
@ -454,7 +454,7 @@ smjs_globhist_item_set_property_last_visit(JSContext *ctx, JSHandleObject hobj,
if (!history_item) return JS_FALSE;
/* Bug 923: Assumes time_t values fit in uint32. */
JS_ValueToECMAUint32(smjs_ctx, *vp, &seconds);
JS_ValueToECMAUint32(smjs_ctx, vp, &seconds);
history_item->last_visit = seconds;
return JS_TRUE;

View File

@ -56,12 +56,12 @@ keymap_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutab
keystroke_str);
if (!action_str || !strcmp(action_str, "none")) goto ret_null;
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(ctx, action_str));
vp = STRING_TO_JSVAL(JS_NewStringCopyZ(ctx, action_str));
return JS_TRUE;
ret_null:
*vp = JSVAL_NULL;
vp = JSVAL_NULL;
return JS_TRUE;
}
@ -115,10 +115,10 @@ keymap_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool
keystroke_str = JS_EncodeString(ctx, JS_ValueToString(ctx, val));
if (!keystroke_str) return JS_FALSE;
if (JSVAL_IS_STRING(*vp)) {
if (JSVAL_IS_STRING(vp)) {
unsigned char *action_str;
action_str = JS_EncodeString(ctx, JS_ValueToString(ctx, *vp));
action_str = JS_EncodeString(ctx, JS_ValueToString(ctx, vp));
if (!action_str) return JS_FALSE;
if (bind_do(keymap_str, keystroke_str, action_str, 0))
@ -126,17 +126,17 @@ keymap_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool
return JS_TRUE;
} else if (JSVAL_IS_NULL(*vp)) { /* before JSVAL_IS_OBJECT */
} else if (JSVAL_IS_NULL(vp)) { /* before JSVAL_IS_OBJECT */
if (bind_do(keymap_str, keystroke_str, "none", 0))
return JS_FALSE;
return JS_TRUE;
} else if (!JSVAL_IS_PRIMITIVE(*vp) || JSVAL_IS_NULL(*vp)) {
} else if (!JSVAL_IS_PRIMITIVE(vp) || JSVAL_IS_NULL(vp)) {
unsigned char *err = NULL;
int event_id;
struct string_ event_name = NULL_STRING;
JSObject *jsobj = JSVAL_TO_OBJECT(*vp);
JSObject *jsobj = JSVAL_TO_OBJECT(vp);
if (JS_FALSE == JS_ObjectIsFunction(ctx, jsobj))
return JS_FALSE;

View File

@ -80,7 +80,7 @@ smjs_location_array_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId
(JSClass *) &location_array_class, NULL);
if (!ses) return JS_FALSE;
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
if (!JSID_IS_INT(id))
return JS_FALSE;
@ -97,7 +97,7 @@ smjs_location_array_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId
if (!index) {
JSObject *obj = smjs_get_view_state_object(&loc->vs);
if (obj) object_to_jsval(ctx, vp, obj);
if (obj) object_to_jsval(ctx, &vp, obj);
return JS_TRUE;
}
@ -227,17 +227,17 @@ session_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMuta
/* XXX: Lock session here if it is ever changed to have an OBJECT_HEAD. */
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
switch (JSID_TO_INT(id)) {
case SESSION_VISITED:
int_to_jsval(ctx, vp, ses->status.visited);
int_to_jsval(ctx, &vp, ses->status.visited);
return JS_TRUE;
case SESSION_HISTORY: {
JSObject *obj = smjs_get_session_location_array_object(ses);
if (obj) object_to_jsval(ctx, vp, obj);
if (obj) object_to_jsval(ctx, &vp, obj);
return JS_TRUE;
}
@ -245,29 +245,29 @@ session_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMuta
struct uri *uri = have_location(ses) ? cur_loc(ses)->vs.uri
: ses->loading_uri;
if (uri) string_to_jsval(ctx, vp, struri(uri));
if (uri) string_to_jsval(ctx, &vp, struri(uri));
return JS_TRUE;
}
case SESSION_RELOADLEVEL:
int_to_jsval(ctx, vp, ses->reloadlevel);
int_to_jsval(ctx, &vp, ses->reloadlevel);
return JS_TRUE;
case SESSION_REDIRECT_CNT:
int_to_jsval(ctx, vp, ses->redirect_cnt);
int_to_jsval(ctx, &vp, ses->redirect_cnt);
return JS_TRUE;
case SESSION_SEARCH_DIRECTION:
string_to_jsval(ctx, vp, ses->search_direction == 1 ? "down"
string_to_jsval(ctx, &vp, ses->search_direction == 1 ? "down"
: "up");
return JS_TRUE;
case SESSION_KBDPREFIX:
int_to_jsval(ctx, vp, ses->kbdprefix.repeat_count);
int_to_jsval(ctx, &vp, ses->kbdprefix.repeat_count);
return JS_TRUE;
case SESSION_MARK_WAITING_FOR:
string_to_jsval(ctx, vp, ses->kbdprefix.mark == KP_MARK_NOTHING
string_to_jsval(ctx, &vp, ses->kbdprefix.mark == KP_MARK_NOTHING
? "nothing"
: ses->kbdprefix.mark == KP_MARK_SET
? "set"
@ -275,11 +275,11 @@ session_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMuta
return JS_TRUE;
case SESSION_EXIT_QUERY:
int_to_jsval(ctx, vp, ses->exit_query);
int_to_jsval(ctx, &vp, ses->exit_query);
return JS_TRUE;
case SESSION_INSERT_MODE:
string_to_jsval(ctx, vp,
string_to_jsval(ctx, &vp,
ses->insert_mode == INSERT_MODE_LESS
? "disabled"
: ses->insert_mode == INSERT_MODE_ON
@ -288,18 +288,18 @@ session_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMuta
return JS_TRUE;
case SESSION_NAVIGATE_MODE:
string_to_jsval(ctx, vp,
string_to_jsval(ctx, &vp,
ses->navigate_mode == NAVIGATE_CURSOR_ROUTING
? "cursor"
: "linkwise");
return JS_TRUE;
case SESSION_SEARCH_WORD:
string_to_jsval(ctx, vp, ses->search_word);
string_to_jsval(ctx, &vp, ses->search_word);
return JS_TRUE;
case SESSION_LAST_SEARCH_WORD:
string_to_jsval(ctx, vp, ses->last_search_word);
string_to_jsval(ctx, &vp, ses->last_search_word);
return JS_TRUE;
default:
@ -333,24 +333,24 @@ session_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool
switch (JSID_TO_INT(id)) {
case SESSION_VISITED:
ses->status.visited = atol(jsval_to_string(ctx, vp));
ses->status.visited = atol(jsval_to_string(ctx, &vp));
return JS_TRUE;
/* SESSION_HISTORY is RO */
/* SESSION_LOADING_URI is RO */
case SESSION_RELOADLEVEL:
ses->reloadlevel = atol(jsval_to_string(ctx, vp));
ses->reloadlevel = atol(jsval_to_string(ctx, &vp));
return JS_TRUE;
case SESSION_REDIRECT_CNT:
ses->redirect_cnt = atol(jsval_to_string(ctx, vp));
ses->redirect_cnt = atol(jsval_to_string(ctx, &vp));
return JS_TRUE;
case SESSION_SEARCH_DIRECTION: {
unsigned char *str;
JSString *jsstr;
jsstr = JS_ValueToString(ctx, *vp);
jsstr = JS_ValueToString(ctx, vp);
if (!jsstr) return JS_TRUE;
str = JS_EncodeString(ctx, jsstr);
@ -366,14 +366,14 @@ session_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool
return JS_TRUE;
}
case SESSION_KBDPREFIX:
ses->kbdprefix.repeat_count = atol(jsval_to_string(ctx, vp));
ses->kbdprefix.repeat_count = atol(jsval_to_string(ctx, &vp));
return JS_TRUE;
case SESSION_MARK_WAITING_FOR: {
unsigned char *str;
JSString *jsstr;
jsstr = JS_ValueToString(ctx, *vp);
jsstr = JS_ValueToString(ctx, vp);
if (!jsstr) return JS_TRUE;
str = JS_EncodeString(ctx, jsstr);
@ -395,7 +395,7 @@ session_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool
unsigned char *str;
JSString *jsstr;
jsstr = JS_ValueToString(ctx, *vp);
jsstr = JS_ValueToString(ctx, vp);
if (!jsstr) return JS_TRUE;
str = JS_EncodeString(ctx, jsstr);
@ -416,7 +416,7 @@ session_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool
unsigned char *str;
JSString *jsstr;
jsstr = JS_ValueToString(ctx, *vp);
jsstr = JS_ValueToString(ctx, vp);
if (!jsstr) return JS_TRUE;
str = JS_EncodeString(ctx, jsstr);
@ -435,7 +435,7 @@ session_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool
unsigned char *str;
JSString *jsstr;
jsstr = JS_ValueToString(ctx, *vp);
jsstr = JS_ValueToString(ctx, vp);
if (!jsstr) return JS_TRUE;
str = JS_EncodeString(ctx, jsstr);
@ -449,7 +449,7 @@ session_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool
unsigned char *str;
JSString *jsstr;
jsstr = JS_ValueToString(ctx, *vp);
jsstr = JS_ValueToString(ctx, vp);
if (!jsstr) return JS_TRUE;
str = JS_EncodeString(ctx, jsstr);
@ -602,7 +602,7 @@ session_array_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
int index;
struct window *tab;
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
if (!JSID_IS_INT(id))
return JS_FALSE;
@ -618,7 +618,7 @@ session_array_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
if ((void *) tab == (void *) &term->windows) return JS_FALSE;
tabobj = smjs_get_session_object(tab->data);
if (tabobj) object_to_jsval(ctx, vp, tabobj);
if (tabobj) object_to_jsval(ctx, &vp, tabobj);
return JS_TRUE;
}

View File

@ -56,7 +56,7 @@ terminal_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMut
(JSClass *) &terminal_class, NULL);
if (!term) return JS_FALSE; /* already detached */
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
if (!JSID_IS_INT(id)) return JS_FALSE;
@ -64,7 +64,7 @@ terminal_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMut
case TERMINAL_TAB: {
JSObject *obj = smjs_get_session_array_object(term);
if (obj) object_to_jsval(ctx, vp, obj);
if (obj) object_to_jsval(ctx, &vp, obj);
return JS_TRUE;
}
@ -163,7 +163,7 @@ terminal_array_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
int index;
struct terminal *term;
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
if (!JSID_IS_INT(id))
return JS_FALSE;
@ -176,7 +176,7 @@ terminal_array_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
if ((void *) term == (void *) &terminals) return JS_FALSE;
obj = smjs_get_terminal_object(term);
if (obj) object_to_jsval(ctx, vp, obj);
if (obj) object_to_jsval(ctx, &vp, obj);
return JS_TRUE;
;

View File

@ -67,18 +67,18 @@ view_state_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSM
(JSClass *) &view_state_class, NULL);
if (!vs) return JS_FALSE;
undef_to_jsval(ctx, vp);
undef_to_jsval(ctx, &vp);
if (!JSID_IS_INT(id))
return JS_FALSE;
switch (JSID_TO_INT(id)) {
case VIEW_STATE_PLAIN:
*vp = INT_TO_JSVAL(vs->plain);
vp = INT_TO_JSVAL(vs->plain);
return JS_TRUE;
case VIEW_STATE_URI:
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx,
vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx,
struri(vs->uri)));
return JS_TRUE;
@ -117,7 +117,7 @@ view_state_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSB
switch (JSID_TO_INT(id)) {
case VIEW_STATE_PLAIN: {
vs->plain = atol(jsval_to_string(ctx, vp));
vs->plain = atol(jsval_to_string(ctx, &vp));
return JS_TRUE;
}
@ -196,7 +196,7 @@ smjs_elinks_get_view_state(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
JSObject *vs_obj;
struct view_state *vs;
*vp = JSVAL_NULL;
vp = JSVAL_NULL;
if (!smjs_ses || !have_location(smjs_ses)) return JS_TRUE;
@ -206,7 +206,7 @@ smjs_elinks_get_view_state(JSContext *ctx, JSHandleObject hobj, JSHandleId hid,
vs_obj = smjs_get_view_state_object(vs);
if (!vs_obj) return JS_TRUE;
*vp = OBJECT_TO_JSVAL(vs_obj);
vp = OBJECT_TO_JSVAL(vs_obj);
return JS_TRUE;
}