mirror of
https://github.com/rkd77/elinks.git
synced 2024-10-02 03:46:21 -04:00
Bug 870: Don't panic if an SMJS property ID is unrecognized.
If ECMAScript code does obj[42], then the getProperty or setProperty
function of the JSClass of obj gets 42 as the property ID and must not
treat that as an internal error.
(Adapted from 7894e30ace
in ELinks 0.12.GIT.)
This commit is contained in:
parent
aac8f4582f
commit
796791296a
@ -161,7 +161,12 @@ document_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
astring_to_jsval(ctx, vp, get_uri_string(document->uri, URI_ORIGINAL));
|
||||
break;
|
||||
default:
|
||||
INTERNAL("Invalid ID %d in document_get_property().", JSVAL_TO_INT(id));
|
||||
/* Unrecognized property ID; someone is using the
|
||||
* object as an array. SMJS builtin classes (e.g.
|
||||
* js_RegExpClass) just return JS_TRUE in this case
|
||||
* and leave *@vp unchanged. Do the same here.
|
||||
* (Actually not quite the same, as we already used
|
||||
* @undef_to_jsval.) */
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,12 @@ input_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
break;
|
||||
|
||||
default:
|
||||
INTERNAL("Invalid ID %d in input_get_property().", JSVAL_TO_INT(id));
|
||||
/* Unrecognized property ID; someone is using the
|
||||
* object as an array. SMJS builtin classes (e.g.
|
||||
* js_RegExpClass) just return JS_TRUE in this case
|
||||
* and leave *@vp unchanged. Do the same here.
|
||||
* (Actually not quite the same, as we already used
|
||||
* @undef_to_jsval.) */
|
||||
break;
|
||||
}
|
||||
|
||||
@ -346,7 +351,10 @@ input_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
break;
|
||||
|
||||
default:
|
||||
INTERNAL("Invalid ID %d in input_set_property().", JSVAL_TO_INT(id));
|
||||
/* Unrecognized property ID; someone is using the
|
||||
* object as an array. SMJS builtin classes (e.g.
|
||||
* js_RegExpClass) just return JS_TRUE in this case.
|
||||
* Do the same here. */
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
@ -874,7 +882,12 @@ form_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
break;
|
||||
|
||||
default:
|
||||
INTERNAL("Invalid ID %d in form_get_property().", JSVAL_TO_INT(id));
|
||||
/* Unrecognized property ID; someone is using the
|
||||
* object as an array. SMJS builtin classes (e.g.
|
||||
* js_RegExpClass) just return JS_TRUE in this case
|
||||
* and leave *@vp unchanged. Do the same here.
|
||||
* (Actually not quite the same, as we already used
|
||||
* @undef_to_jsval.) */
|
||||
break;
|
||||
}
|
||||
|
||||
@ -950,7 +963,10 @@ form_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
break;
|
||||
|
||||
default:
|
||||
INTERNAL("Invalid ID %d in form_set_property().", JSVAL_TO_INT(id));
|
||||
/* Unrecognized property ID; someone is using the
|
||||
* object as an array. SMJS builtin classes (e.g.
|
||||
* js_RegExpClass) just return JS_TRUE in this case.
|
||||
* Do the same here. */
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,12 @@ location_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
astring_to_jsval(ctx, vp, get_uri_string(vs->uri, URI_ORIGINAL));
|
||||
break;
|
||||
default:
|
||||
INTERNAL("Invalid ID %d in location_get_property().", JSVAL_TO_INT(id));
|
||||
/* Unrecognized property ID; someone is using the
|
||||
* object as an array. SMJS builtin classes (e.g.
|
||||
* js_RegExpClass) just return JS_TRUE in this case
|
||||
* and leave *@vp unchanged. Do the same here.
|
||||
* (Actually not quite the same, as we already used
|
||||
* @undef_to_jsval.) */
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,12 @@ navigator_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
INTERNAL("Invalid ID %d in navigator_get_property().", JSVAL_TO_INT(id));
|
||||
/* Unrecognized property ID; someone is using the
|
||||
* object as an array. SMJS builtin classes (e.g.
|
||||
* js_RegExpClass) just return JS_TRUE in this case
|
||||
* and leave *@vp unchanged. Do the same here.
|
||||
* (Actually not quite the same, as we already used
|
||||
* @undef_to_jsval.) */
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,10 @@ unibar_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
#undef unibar_fetch
|
||||
break;
|
||||
default:
|
||||
INTERNAL("Invalid ID %d in unibar_get_property().", JSVAL_TO_INT(id));
|
||||
/* Unrecognized property ID; someone is using the
|
||||
* object as an array. SMJS builtin classes (e.g.
|
||||
* js_RegExpClass) just return JS_TRUE in this case
|
||||
* and leave *@vp unchanged. Do the same here. */
|
||||
break;
|
||||
}
|
||||
|
||||
@ -170,7 +173,10 @@ unibar_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
register_bottom_half(update_status, NULL);
|
||||
break;
|
||||
default:
|
||||
INTERNAL("Invalid ID %d in unibar_set_property().", JSVAL_TO_INT(id));
|
||||
/* Unrecognized property ID; someone is using the
|
||||
* object as an array. SMJS builtin classes (e.g.
|
||||
* js_RegExpClass) just return JS_TRUE in this case.
|
||||
* Do the same here. */
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,12 @@ found_parent:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
INTERNAL("Invalid ID %d in window_get_property().", JSVAL_TO_INT(id));
|
||||
/* Unrecognized property ID; someone is using the
|
||||
* object as an array. SMJS builtin classes (e.g.
|
||||
* js_RegExpClass) just return JS_TRUE in this case
|
||||
* and leave *@vp unchanged. Do the same here.
|
||||
* (Actually not quite the same, as we already used
|
||||
* @undef_to_jsval.) */
|
||||
break;
|
||||
}
|
||||
|
||||
@ -270,7 +275,10 @@ window_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
|
||||
switch (JSVAL_TO_INT(id)) {
|
||||
default:
|
||||
INTERNAL("Invalid ID %d in window_set_property().", JSVAL_TO_INT(id));
|
||||
/* Unrecognized property ID; someone is using the
|
||||
* object as an array. SMJS builtin classes (e.g.
|
||||
* js_RegExpClass) just return JS_TRUE in this case.
|
||||
* Do the same here. */
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
@ -111,11 +111,14 @@ bookmark_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
|
||||
return JS_TRUE;
|
||||
default:
|
||||
INTERNAL("Invalid ID %d in bookmark_get_property().",
|
||||
JSVAL_TO_INT(id));
|
||||
/* Unrecognized property ID; someone is using the
|
||||
* object as an array. SMJS builtin classes (e.g.
|
||||
* js_RegExpClass) just return JS_TRUE in this case
|
||||
* and leave *@vp unchanged. Do the same here.
|
||||
* (Actually not quite the same, as we already used
|
||||
* @undef_to_jsval.) */
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
/* @bookmark_class.setProperty */
|
||||
@ -155,11 +158,12 @@ bookmark_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
return JS_TRUE;
|
||||
}
|
||||
default:
|
||||
INTERNAL("Invalid ID %d in bookmark_set_property().",
|
||||
JSVAL_TO_INT(id));
|
||||
/* Unrecognized property ID; someone is using the
|
||||
* object as an array. SMJS builtin classes (e.g.
|
||||
* js_RegExpClass) just return JS_TRUE in this case.
|
||||
* Do the same here. */
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
static const JSClass bookmark_class = {
|
||||
|
@ -86,11 +86,14 @@ cache_entry_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
|
||||
return JS_TRUE;
|
||||
default:
|
||||
INTERNAL("Invalid ID %d in cache_entry_get_property().",
|
||||
JSVAL_TO_INT(id));
|
||||
/* Unrecognized property ID; someone is using the
|
||||
* object as an array. SMJS builtin classes (e.g.
|
||||
* js_RegExpClass) just return JS_TRUE in this case
|
||||
* and leave *@vp unchanged. Do the same here.
|
||||
* (Actually not quite the same, as we already used
|
||||
* @undef_to_jsval.) */
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
/* @cache_entry_class.setProperty */
|
||||
@ -140,13 +143,12 @@ cache_entry_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
return JS_TRUE;
|
||||
}
|
||||
default:
|
||||
INTERNAL("Invalid ID %d in cache_entry_set_property().",
|
||||
JSVAL_TO_INT(id));
|
||||
/* Unrecognized property ID; someone is using the
|
||||
* object as an array. SMJS builtin classes (e.g.
|
||||
* js_RegExpClass) just return JS_TRUE in this case.
|
||||
* Do the same here. */
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
/* @cache_entry_class.finalize */
|
||||
|
@ -59,11 +59,14 @@ view_state_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
|
||||
return JS_TRUE;
|
||||
default:
|
||||
INTERNAL("Invalid ID %d in view_state_get_property().",
|
||||
JSVAL_TO_INT(id));
|
||||
/* Unrecognized property ID; someone is using the
|
||||
* object as an array. SMJS builtin classes (e.g.
|
||||
* js_RegExpClass) just return JS_TRUE in this case
|
||||
* and leave *@vp unchanged. Do the same here.
|
||||
* (Actually not quite the same, as we already used
|
||||
* @undef_to_jsval.) */
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
/* @view_state_class.setProperty */
|
||||
@ -90,11 +93,12 @@ view_state_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
return JS_TRUE;
|
||||
}
|
||||
default:
|
||||
INTERNAL("Invalid ID %d in view_state_set_property().",
|
||||
JSVAL_TO_INT(id));
|
||||
/* Unrecognized property ID; someone is using the
|
||||
* object as an array. SMJS builtin classes (e.g.
|
||||
* js_RegExpClass) just return JS_TRUE in this case.
|
||||
* Do the same here. */
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
static const JSClass view_state_class = {
|
||||
|
Loading…
Reference in New Issue
Block a user