1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-27 02:56:18 -04:00

[spidermonkey] spidermonkey_check_if_function_name()

This commit is contained in:
Witold Filipczyk 2021-08-21 11:30:09 +02:00
parent b459f64be8
commit 6659cad7ab
3 changed files with 16 additions and 4 deletions

View File

@ -124,3 +124,15 @@ spidermonkey_InitClass(JSContext *cx, JSObject *obj,
return proto;
}
bool
spidermonkey_check_if_function_name(const spidermonkeyFunctionSpec funcs[], const char *string)
{
for (int i = 0; funcs[i].name; i++) {
if (!strcmp(funcs[i].name, string)) {
return true;
}
}
return false;
}

View File

@ -53,6 +53,8 @@ JSObject *spidermonkey_InitClass(JSContext *cx, JSObject *obj,
JSPropertySpec *static_ps,
const spidermonkeyFunctionSpec *static_fs);
bool spidermonkey_check_if_function_name(const spidermonkeyFunctionSpec funcs[], const char *string);
static char *jsval_to_string(JSContext *ctx, JS::HandleValue hvp);
static char *jsid_to_string(JSContext *ctx, JS::HandleId hid);

View File

@ -1093,10 +1093,8 @@ document_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, J
}
string = jsid_to_string(ctx, hid);
for (int i = 0; document_funcs[i].name; i++) {
if (!strcmp(document_funcs[i].name, string)) {
return true;
}
if (spidermonkey_check_if_function_name(document_funcs, string)) {
return true;
}
foreach (form, document->forms) {