mirror of
https://github.com/rkd77/elinks.git
synced 2024-08-23 21:24:44 -04:00
Bug 846: Document the JSClass assumed in each JS_{Set,Get}Private call.
(Adapted from 356678dd80
in ELinks 0.12.GIT.)
This commit is contained in:
parent
92290b73a9
commit
59df2a3d11
@ -190,7 +190,7 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter)
|
||||
JS_InitStandardClasses(ctx, window_obj);
|
||||
JS_DefineProperties(ctx, window_obj, (JSPropertySpec *) window_props);
|
||||
JS_DefineFunctions(ctx, window_obj, (JSFunctionSpec *) window_funcs);
|
||||
JS_SetPrivate(ctx, window_obj, interpreter->vs);
|
||||
JS_SetPrivate(ctx, window_obj, interpreter->vs); /* to @window_class */
|
||||
|
||||
document_obj = JS_InitClass(ctx, window_obj, NULL,
|
||||
(JSClass *) &document_class, NULL, 0,
|
||||
@ -220,13 +220,13 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter)
|
||||
(JSClass *) &menubar_class, NULL, 0,
|
||||
(JSPropertySpec *) unibar_props, NULL,
|
||||
NULL, NULL);
|
||||
JS_SetPrivate(ctx, menubar_obj, "t");
|
||||
JS_SetPrivate(ctx, menubar_obj, "t"); /* to @menubar_class */
|
||||
|
||||
statusbar_obj = JS_InitClass(ctx, window_obj, NULL,
|
||||
(JSClass *) &statusbar_class, NULL, 0,
|
||||
(JSPropertySpec *) unibar_props, NULL,
|
||||
NULL, NULL);
|
||||
JS_SetPrivate(ctx, statusbar_obj, "s");
|
||||
JS_SetPrivate(ctx, statusbar_obj, "s"); /* to @statusbar_class */
|
||||
|
||||
navigator_obj = JS_InitClass(ctx, window_obj, NULL,
|
||||
(JSClass *) &navigator_class, NULL, 0,
|
||||
|
@ -74,7 +74,7 @@ static JSBool
|
||||
document_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
JSObject *parent = JS_GetParent(ctx, obj);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent); /* from @window_class */
|
||||
struct document_view *doc_view = vs->doc_view;
|
||||
struct document *document = doc_view->document;
|
||||
struct session *ses = doc_view->session;
|
||||
@ -158,7 +158,7 @@ static JSBool
|
||||
document_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
JSObject *parent = JS_GetParent(ctx, obj);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent); /* from @window_class */
|
||||
struct document_view *doc_view = vs->doc_view;
|
||||
struct document *document = doc_view->document;
|
||||
|
||||
|
@ -123,10 +123,10 @@ input_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
JSObject *parent_form = JS_GetParent(ctx, obj);
|
||||
JSObject *parent_doc = JS_GetParent(ctx, parent_form);
|
||||
JSObject *parent_win = JS_GetParent(ctx, parent_doc);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
struct document_view *doc_view = vs->doc_view;
|
||||
struct document *document = doc_view->document;
|
||||
struct form_state *fs = JS_GetPrivate(ctx, obj);
|
||||
struct form_state *fs = JS_GetPrivate(ctx, obj); /* from @input_class */
|
||||
struct form_control *fc = find_form_control(document, fs);
|
||||
int linknum;
|
||||
struct link *link = NULL;
|
||||
@ -236,10 +236,10 @@ input_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
JSObject *parent_form = JS_GetParent(ctx, obj);
|
||||
JSObject *parent_doc = JS_GetParent(ctx, parent_form);
|
||||
JSObject *parent_win = JS_GetParent(ctx, parent_doc);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
struct document_view *doc_view = vs->doc_view;
|
||||
struct document *document = doc_view->document;
|
||||
struct form_state *fs = JS_GetPrivate(ctx, obj);
|
||||
struct form_state *fs = JS_GetPrivate(ctx, obj); /* from @input_class */
|
||||
struct form_control *fc = find_form_control(document, fs);
|
||||
int linknum;
|
||||
struct link *link = NULL;
|
||||
@ -322,11 +322,11 @@ input_click(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
JSObject *parent_form = JS_GetParent(ctx, obj);
|
||||
JSObject *parent_doc = JS_GetParent(ctx, parent_form);
|
||||
JSObject *parent_win = JS_GetParent(ctx, parent_doc);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
struct document_view *doc_view = vs->doc_view;
|
||||
struct document *document = doc_view->document;
|
||||
struct session *ses = doc_view->session;
|
||||
struct form_state *fs = JS_GetPrivate(ctx, obj);
|
||||
struct form_state *fs = JS_GetPrivate(ctx, obj); /* from @input_class */
|
||||
struct form_control *fc;
|
||||
int linknum;
|
||||
|
||||
@ -357,11 +357,11 @@ input_focus(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
JSObject *parent_form = JS_GetParent(ctx, obj);
|
||||
JSObject *parent_doc = JS_GetParent(ctx, parent_form);
|
||||
JSObject *parent_win = JS_GetParent(ctx, parent_doc);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
struct document_view *doc_view = vs->doc_view;
|
||||
struct document *document = doc_view->document;
|
||||
struct session *ses = doc_view->session;
|
||||
struct form_state *fs = JS_GetPrivate(ctx, obj);
|
||||
struct form_state *fs = JS_GetPrivate(ctx, obj); /* from @input_class */
|
||||
struct form_control *fc;
|
||||
int linknum;
|
||||
|
||||
@ -400,7 +400,7 @@ get_input_object(JSContext *ctx, JSObject *jsform, struct form_state *fs)
|
||||
|
||||
JS_DefineProperties(ctx, jsinput, (JSPropertySpec *) input_props);
|
||||
JS_DefineFunctions(ctx, jsinput, (JSFunctionSpec *) input_funcs);
|
||||
JS_SetPrivate(ctx, jsinput, fs);
|
||||
JS_SetPrivate(ctx, jsinput, fs); /* to @input_class */
|
||||
fs->ecmascript_obj = jsinput;
|
||||
}
|
||||
return fs->ecmascript_obj;
|
||||
@ -470,10 +470,10 @@ form_elements_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
JSObject *parent_form = JS_GetParent(ctx, obj);
|
||||
JSObject *parent_doc = JS_GetParent(ctx, parent_form);
|
||||
JSObject *parent_win = JS_GetParent(ctx, parent_doc);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
struct document_view *doc_view = vs->doc_view;
|
||||
struct document *document = doc_view->document;
|
||||
struct form_view *form_view = JS_GetPrivate(ctx, parent_form);
|
||||
struct form_view *form_view = JS_GetPrivate(ctx, parent_form); /* from @form_class */
|
||||
struct form *form = find_form_by_form_view(document, form_view);
|
||||
|
||||
if (JSVAL_IS_STRING(id)) {
|
||||
@ -506,10 +506,10 @@ form_elements_item(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval
|
||||
JSObject *parent_form = JS_GetParent(ctx, obj);
|
||||
JSObject *parent_doc = JS_GetParent(ctx, parent_form);
|
||||
JSObject *parent_win = JS_GetParent(ctx, parent_doc);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
struct document_view *doc_view = vs->doc_view;
|
||||
struct document *document = doc_view->document;
|
||||
struct form_view *form_view = JS_GetPrivate(ctx, parent_form);
|
||||
struct form_view *form_view = JS_GetPrivate(ctx, parent_form); /* from @form_class */
|
||||
struct form *form = find_form_by_form_view(document, form_view);
|
||||
struct form_control *fc;
|
||||
int counter = -1;
|
||||
@ -544,10 +544,10 @@ form_elements_namedItem(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv,
|
||||
JSObject *parent_form = JS_GetParent(ctx, obj);
|
||||
JSObject *parent_doc = JS_GetParent(ctx, parent_form);
|
||||
JSObject *parent_win = JS_GetParent(ctx, parent_doc);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
struct document_view *doc_view = vs->doc_view;
|
||||
struct document *document = doc_view->document;
|
||||
struct form_view *form_view = JS_GetPrivate(ctx, parent_form);
|
||||
struct form_view *form_view = JS_GetPrivate(ctx, parent_form); /* from @form_class */
|
||||
struct form *form = find_form_by_form_view(document, form_view);
|
||||
struct form_control *fc;
|
||||
unsigned char *string;
|
||||
@ -626,9 +626,9 @@ form_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
/* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */
|
||||
JSObject *parent_doc = JS_GetParent(ctx, obj);
|
||||
JSObject *parent_win = JS_GetParent(ctx, parent_doc);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
struct document_view *doc_view = vs->doc_view;
|
||||
struct form_view *fv = JS_GetPrivate(ctx, obj);
|
||||
struct form_view *fv = JS_GetPrivate(ctx, obj); /* from @form_class */
|
||||
struct form *form = find_form_by_form_view(doc_view->document, fv);
|
||||
|
||||
assert(form);
|
||||
@ -733,9 +733,9 @@ form_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
JSObject *parent_doc = JS_GetParent(ctx, obj);
|
||||
JSObject *parent_win = JS_GetParent(ctx, parent_doc);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
struct document_view *doc_view = vs->doc_view;
|
||||
struct form_view *fv = JS_GetPrivate(ctx, obj);
|
||||
struct form_view *fv = JS_GetPrivate(ctx, obj); /* from @form_class */
|
||||
struct form *form = find_form_by_form_view(doc_view->document, fv);
|
||||
unsigned char *string;
|
||||
|
||||
@ -792,9 +792,9 @@ form_reset(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
JSObject *parent_doc = JS_GetParent(ctx, obj);
|
||||
JSObject *parent_win = JS_GetParent(ctx, parent_doc);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
struct document_view *doc_view = vs->doc_view;
|
||||
struct form_view *fv = JS_GetPrivate(ctx, obj);
|
||||
struct form_view *fv = JS_GetPrivate(ctx, obj); /* from @form_class */
|
||||
struct form *form = find_form_by_form_view(doc_view->document, fv);
|
||||
|
||||
assert(form);
|
||||
@ -813,10 +813,10 @@ form_submit(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
JSObject *parent_doc = JS_GetParent(ctx, obj);
|
||||
JSObject *parent_win = JS_GetParent(ctx, parent_doc);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
struct document_view *doc_view = vs->doc_view;
|
||||
struct session *ses = doc_view->session;
|
||||
struct form_view *fv = JS_GetPrivate(ctx, obj);
|
||||
struct form_view *fv = JS_GetPrivate(ctx, obj); /* from @form_class */
|
||||
struct form *form = find_form_by_form_view(doc_view->document, fv);
|
||||
|
||||
assert(form);
|
||||
@ -838,7 +838,7 @@ get_form_object(JSContext *ctx, JSObject *jsdoc, struct form_view *fv)
|
||||
|
||||
JS_DefineProperties(ctx, jsform, (JSPropertySpec *) form_props);
|
||||
JS_DefineFunctions(ctx, jsform, (JSFunctionSpec *) form_funcs);
|
||||
JS_SetPrivate(ctx, jsform, fv);
|
||||
JS_SetPrivate(ctx, jsform, fv); /* to @form_class */
|
||||
fv->ecmascript_obj = jsform;
|
||||
}
|
||||
return fv->ecmascript_obj;
|
||||
@ -879,7 +879,7 @@ forms_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
JSObject *parent_doc = JS_GetParent(ctx, obj);
|
||||
JSObject *parent_win = JS_GetParent(ctx, parent_doc);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
struct document_view *doc_view = vs->doc_view;
|
||||
struct document *document = doc_view->document;
|
||||
|
||||
@ -910,7 +910,7 @@ forms_item(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
JSObject *parent_doc = JS_GetParent(ctx, obj);
|
||||
JSObject *parent_win = JS_GetParent(ctx, parent_doc);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
struct form_view *fv;
|
||||
int counter = -1;
|
||||
int index;
|
||||
@ -939,7 +939,7 @@ forms_namedItem(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *r
|
||||
{
|
||||
JSObject *parent_doc = JS_GetParent(ctx, obj);
|
||||
JSObject *parent_win = JS_GetParent(ctx, parent_doc);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
struct document_view *doc_view = vs->doc_view;
|
||||
struct document *document = doc_view->document;
|
||||
struct form *form;
|
||||
|
@ -146,7 +146,7 @@ static JSBool
|
||||
location_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
JSObject *parent = JS_GetParent(ctx, obj);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent); /* from @window_class */
|
||||
|
||||
if (!JSVAL_IS_INT(id))
|
||||
return JS_TRUE;
|
||||
@ -170,7 +170,7 @@ static JSBool
|
||||
location_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
JSObject *parent = JS_GetParent(ctx, obj);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent); /* from @window_class */
|
||||
struct document_view *doc_view = vs->doc_view;
|
||||
|
||||
if (!JSVAL_IS_INT(id))
|
||||
|
@ -76,10 +76,10 @@ static JSBool
|
||||
unibar_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
JSObject *parent = JS_GetParent(ctx, obj);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent); /* from @window_class */
|
||||
struct document_view *doc_view = vs->doc_view;
|
||||
struct session_status *status = &doc_view->session->status;
|
||||
unsigned char *bar = JS_GetPrivate(ctx, obj);
|
||||
unsigned char *bar = JS_GetPrivate(ctx, obj); /* from @menubar_class or @statusbar_class */
|
||||
|
||||
if (!JSVAL_IS_INT(id))
|
||||
return JS_TRUE;
|
||||
@ -116,10 +116,10 @@ static JSBool
|
||||
unibar_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
JSObject *parent = JS_GetParent(ctx, obj);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, parent); /* from @window_class */
|
||||
struct document_view *doc_view = vs->doc_view;
|
||||
struct session_status *status = &doc_view->session->status;
|
||||
unsigned char *bar = JS_GetPrivate(ctx, obj);
|
||||
unsigned char *bar = JS_GetPrivate(ctx, obj); /* from @menubar_class or @statusbar_class */
|
||||
|
||||
if (!JSVAL_IS_INT(id))
|
||||
return JS_TRUE;
|
||||
|
@ -118,7 +118,7 @@ find_child_frame(struct document_view *doc_view, struct frame_desc *tframe)
|
||||
static JSBool
|
||||
window_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
struct view_state *vs = JS_GetPrivate(ctx, obj);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, obj); /* from @window_class */
|
||||
|
||||
/* No need for special window.location measurements - when
|
||||
* location is then evaluated in string context, toString()
|
||||
@ -235,7 +235,7 @@ void location_goto(struct document_view *doc_view, unsigned char *url);
|
||||
static JSBool
|
||||
window_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
struct view_state *vs = JS_GetPrivate(ctx, obj);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, obj); /* from @window_class */
|
||||
|
||||
if (JSVAL_IS_STRING(id)) {
|
||||
if (!strcmp(jsval_to_string(ctx, &id), "location")) {
|
||||
@ -275,7 +275,7 @@ const JSFunctionSpec window_funcs[] = {
|
||||
static JSBool
|
||||
window_alert(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
struct view_state *vs = JS_GetPrivate(ctx, obj);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, obj); /* from @window_class */
|
||||
unsigned char *string;
|
||||
|
||||
if (argc != 1)
|
||||
@ -324,7 +324,7 @@ delayed_goto_uri_frame(void *data)
|
||||
static JSBool
|
||||
window_open(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
struct view_state *vs = JS_GetPrivate(ctx, obj);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, obj); /* from @window_class */
|
||||
struct document_view *doc_view = vs->doc_view;
|
||||
struct session *ses = doc_view->session;
|
||||
unsigned char *target = "";
|
||||
|
@ -26,7 +26,7 @@ smjs_get_bookmark_generic_object(struct bookmark *bookmark, JSClass *clasp)
|
||||
|
||||
if (!bookmark) return jsobj;
|
||||
|
||||
if (JS_TRUE == JS_SetPrivate(smjs_ctx, jsobj, bookmark)) {
|
||||
if (JS_TRUE == JS_SetPrivate(smjs_ctx, jsobj, bookmark)) { /* to @bookmark_class or @bookmark_folder_class */
|
||||
object_lock(bookmark);
|
||||
|
||||
return jsobj;
|
||||
@ -39,7 +39,7 @@ smjs_get_bookmark_generic_object(struct bookmark *bookmark, JSClass *clasp)
|
||||
static void
|
||||
bookmark_finalize(JSContext *ctx, JSObject *obj)
|
||||
{
|
||||
struct bookmark *bookmark = JS_GetPrivate(ctx, obj);
|
||||
struct bookmark *bookmark = JS_GetPrivate(ctx, obj); /* from @bookmark_class or @bookmark_folder_class */
|
||||
|
||||
if (bookmark) object_unlock(bookmark);
|
||||
}
|
||||
@ -66,7 +66,7 @@ static JSObject *smjs_get_bookmark_folder_object(struct bookmark *bookmark);
|
||||
static JSBool
|
||||
bookmark_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
struct bookmark *bookmark = JS_GetPrivate(ctx, obj);
|
||||
struct bookmark *bookmark = JS_GetPrivate(ctx, obj); /* from @bookmark_class */
|
||||
|
||||
if (!bookmark) return JS_FALSE;
|
||||
|
||||
@ -102,7 +102,7 @@ bookmark_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
static JSBool
|
||||
bookmark_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
struct bookmark *bookmark = JS_GetPrivate(ctx, obj);
|
||||
struct bookmark *bookmark = JS_GetPrivate(ctx, obj); /* from @bookmark_class */
|
||||
|
||||
if (!bookmark) return JS_FALSE;
|
||||
|
||||
@ -166,7 +166,7 @@ static JSBool
|
||||
bookmark_folder_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
struct bookmark *bookmark;
|
||||
struct bookmark *folder = JS_GetPrivate(ctx, obj);
|
||||
struct bookmark *folder = JS_GetPrivate(ctx, obj); /* from @bookmark_folder_class */
|
||||
unsigned char *title;
|
||||
|
||||
title = JS_GetStringBytes(JS_ValueToString(ctx, id));
|
||||
|
@ -35,7 +35,7 @@ static const JSPropertySpec cache_entry_props[] = {
|
||||
static JSBool
|
||||
cache_entry_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
struct cache_entry *cached = JS_GetPrivate(ctx, obj);
|
||||
struct cache_entry *cached = JS_GetPrivate(ctx, obj); /* from @cache_entry_class */
|
||||
|
||||
if (!cache_entry_is_valid(cached)) return JS_FALSE;
|
||||
|
||||
@ -87,7 +87,7 @@ cache_entry_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
static JSBool
|
||||
cache_entry_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
struct cache_entry *cached = JS_GetPrivate(ctx, obj);
|
||||
struct cache_entry *cached = JS_GetPrivate(ctx, obj); /* from @cache_entry_class */
|
||||
|
||||
if (!cache_entry_is_valid(cached)) return JS_FALSE;
|
||||
|
||||
@ -135,7 +135,7 @@ cache_entry_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
static void
|
||||
cache_entry_finalize(JSContext *ctx, JSObject *obj)
|
||||
{
|
||||
struct cache_entry *cached = JS_GetPrivate(ctx, obj);
|
||||
struct cache_entry *cached = JS_GetPrivate(ctx, obj); /* from @cache_entry_class */
|
||||
|
||||
if (!cached) return;
|
||||
|
||||
@ -163,7 +163,7 @@ smjs_get_cache_entry_object(struct cache_entry *cached)
|
||||
|
||||
if (!cache_entry_object) return NULL;
|
||||
|
||||
if (JS_FALSE == JS_SetPrivate(smjs_ctx, cache_entry_object, cached))
|
||||
if (JS_FALSE == JS_SetPrivate(smjs_ctx, cache_entry_object, cached)) /* to @cache_entry_class */
|
||||
return NULL;
|
||||
|
||||
object_lock(cached);
|
||||
|
@ -19,7 +19,7 @@ keymap_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
unsigned char *action_str;
|
||||
unsigned char *keystroke_str;
|
||||
int *data = JS_GetPrivate(ctx, obj);
|
||||
int *data = JS_GetPrivate(ctx, obj); /* from @keymap_class */
|
||||
enum keymap_id keymap_id = *data;
|
||||
|
||||
keystroke_str = JS_GetStringBytes(JS_ValueToString(ctx, id));
|
||||
@ -63,7 +63,7 @@ smjs_keybinding_action_callback(va_list ap, void *data)
|
||||
static JSBool
|
||||
keymap_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
int *data = JS_GetPrivate(ctx, obj);
|
||||
int *data = JS_GetPrivate(ctx, obj); /* from @keymap_class */
|
||||
enum keymap_id keymap_id = *data;
|
||||
unsigned char *keymap_str;
|
||||
unsigned char *keystroke_str;
|
||||
@ -133,7 +133,7 @@ keymap_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
static void
|
||||
keymap_finalize(JSContext *ctx, JSObject *obj)
|
||||
{
|
||||
void *data = JS_GetPrivate(ctx, obj);
|
||||
void *data = JS_GetPrivate(ctx, obj); /* from @keymap_class */
|
||||
|
||||
mem_free(data);
|
||||
}
|
||||
@ -162,7 +162,7 @@ smjs_get_keymap_object(enum keymap_id keymap_id)
|
||||
data = intdup(keymap_id);
|
||||
if (!data) return NULL;
|
||||
|
||||
if (JS_TRUE == JS_SetPrivate(smjs_ctx, keymap_object, data))
|
||||
if (JS_TRUE == JS_SetPrivate(smjs_ctx, keymap_object, data)) /* to @keymap_class */
|
||||
return keymap_object;
|
||||
|
||||
mem_free(data);
|
||||
|
@ -31,7 +31,7 @@ static const JSPropertySpec view_state_props[] = {
|
||||
static JSBool
|
||||
view_state_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
struct view_state *vs = JS_GetPrivate(ctx, obj);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, obj); /* from @view_state_class */
|
||||
|
||||
undef_to_jsval(ctx, vp);
|
||||
|
||||
@ -60,7 +60,7 @@ view_state_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
static JSBool
|
||||
view_state_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
struct view_state *vs = JS_GetPrivate(ctx, obj);
|
||||
struct view_state *vs = JS_GetPrivate(ctx, obj); /* from @view_state_class */
|
||||
|
||||
if (!JSVAL_IS_INT(id))
|
||||
return JS_FALSE;
|
||||
@ -100,7 +100,7 @@ smjs_get_view_state_object(struct view_state *vs)
|
||||
|
||||
if (!view_state_object) return NULL;
|
||||
|
||||
if (JS_FALSE == JS_SetPrivate(smjs_ctx, view_state_object, vs))
|
||||
if (JS_FALSE == JS_SetPrivate(smjs_ctx, view_state_object, vs)) /* to @view_state_class */
|
||||
return NULL;
|
||||
|
||||
if (JS_FALSE == JS_DefineProperties(smjs_ctx, view_state_object,
|
||||
|
Loading…
Reference in New Issue
Block a user