mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05: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.
This commit is contained in:
parent
aa410301f1
commit
7894e30ace
@ -164,7 +164,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;
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,12 @@ input_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
if (fc->type == FC_SELECT) int_to_jsval(ctx, vp, fs->state);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -374,7 +379,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;
|
||||
}
|
||||
|
||||
@ -904,7 +912,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;
|
||||
}
|
||||
|
||||
@ -985,7 +998,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;
|
||||
}
|
||||
|
||||
|
@ -234,7 +234,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;
|
||||
}
|
||||
|
||||
@ -278,7 +283,10 @@ window_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
print_screen_status(vs->doc_view->session);
|
||||
return JS_TRUE;
|
||||
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 */
|
||||
|
@ -97,11 +97,14 @@ smjs_globhist_item_get_property(JSContext *ctx, JSObject *obj, jsval id,
|
||||
|
||||
return JS_TRUE;
|
||||
default:
|
||||
INTERNAL("Invalid ID %d in globhist_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;
|
||||
}
|
||||
|
||||
/* @smjs_globhist_item_class.setProperty */
|
||||
@ -149,11 +152,12 @@ smjs_globhist_item_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *
|
||||
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 smjs_globhist_item_class = {
|
||||
|
@ -63,11 +63,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 */
|
||||
@ -94,11 +97,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