mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Renumber all tinyids of SMJS properties to negative integers.
This change does not fix any bug, but the SMJS builtin classes use negative tinyids already, so I presume this is the preferred practice. At least it means the tinyids won't have to be renumbered later if some of these objects are changed to behave as arrays.
This commit is contained in:
parent
95ec00fbec
commit
d731fe2db0
@ -59,7 +59,16 @@ const JSClass document_class = {
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
|
||||
};
|
||||
|
||||
enum document_prop { JSP_DOC_LOC, JSP_DOC_REF, JSP_DOC_TITLE, JSP_DOC_URL };
|
||||
/* Tinyids of properties. Use negative values to distinguish these
|
||||
* from array indexes (even though this object has no array elements).
|
||||
* ECMAScript code should not use these directly as in document[-1];
|
||||
* future versions of ELinks may change the numbers. */
|
||||
enum document_prop {
|
||||
JSP_DOC_LOC = -1,
|
||||
JSP_DOC_REF = -2,
|
||||
JSP_DOC_TITLE = -3,
|
||||
JSP_DOC_URL = -4,
|
||||
};
|
||||
/* "cookie" is special; it isn't a regular property but we channel it to the
|
||||
* cookie-module. XXX: Would it work if "cookie" was defined in this array? */
|
||||
const JSPropertySpec document_props[] = {
|
||||
|
@ -66,23 +66,27 @@ static const JSClass input_class = {
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
|
||||
};
|
||||
|
||||
/* Tinyids of properties. Use negative values to distinguish these
|
||||
* from array indexes (even though this object has no array elements).
|
||||
* ECMAScript code should not use these directly as in input[-1];
|
||||
* future versions of ELinks may change the numbers. */
|
||||
enum input_prop {
|
||||
JSP_INPUT_ACCESSKEY,
|
||||
JSP_INPUT_ALT,
|
||||
JSP_INPUT_CHECKED,
|
||||
JSP_INPUT_DEFAULT_CHECKED,
|
||||
JSP_INPUT_DEFAULT_VALUE,
|
||||
JSP_INPUT_DISABLED,
|
||||
JSP_INPUT_FORM,
|
||||
JSP_INPUT_MAX_LENGTH,
|
||||
JSP_INPUT_NAME,
|
||||
JSP_INPUT_READONLY,
|
||||
JSP_INPUT_SELECTED_INDEX,
|
||||
JSP_INPUT_SIZE,
|
||||
JSP_INPUT_SRC,
|
||||
JSP_INPUT_TABINDEX,
|
||||
JSP_INPUT_TYPE,
|
||||
JSP_INPUT_VALUE
|
||||
JSP_INPUT_ACCESSKEY = -1,
|
||||
JSP_INPUT_ALT = -2,
|
||||
JSP_INPUT_CHECKED = -3,
|
||||
JSP_INPUT_DEFAULT_CHECKED = -4,
|
||||
JSP_INPUT_DEFAULT_VALUE = -5,
|
||||
JSP_INPUT_DISABLED = -6,
|
||||
JSP_INPUT_FORM = -7,
|
||||
JSP_INPUT_MAX_LENGTH = -8,
|
||||
JSP_INPUT_NAME = -9,
|
||||
JSP_INPUT_READONLY = -10,
|
||||
JSP_INPUT_SELECTED_INDEX = -11,
|
||||
JSP_INPUT_SIZE = -12,
|
||||
JSP_INPUT_SRC = -13,
|
||||
JSP_INPUT_TABINDEX = -14,
|
||||
JSP_INPUT_TYPE = -15,
|
||||
JSP_INPUT_VALUE = -16,
|
||||
};
|
||||
|
||||
/* XXX: Some of those are marked readonly just because we can't change them
|
||||
@ -575,9 +579,13 @@ static const JSFunctionSpec form_elements_funcs[] = {
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
/* INTs from 0 up are equivalent to item(INT), so we have to stuff length out
|
||||
* of the way. */
|
||||
enum form_elements_prop { JSP_FORM_ELEMENTS_LENGTH = -1 };
|
||||
/* Tinyids of properties. Use negative values to distinguish these
|
||||
* from array indexes (elements[INT] for INT>=0 is equivalent to
|
||||
* elements.item(INT)). ECMAScript code should not use these directly
|
||||
* as in elements[-1]; future versions of ELinks may change the numbers. */
|
||||
enum form_elements_prop {
|
||||
JSP_FORM_ELEMENTS_LENGTH = -1,
|
||||
};
|
||||
static const JSPropertySpec form_elements_props[] = {
|
||||
{ "length", JSP_FORM_ELEMENTS_LENGTH, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{ NULL }
|
||||
@ -764,14 +772,18 @@ static const JSClass form_class = {
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
|
||||
};
|
||||
|
||||
/* Tinyids of properties. Use negative values to distinguish these
|
||||
* from array indexes (even though this object has no array elements).
|
||||
* ECMAScript code should not use these directly as in form[-1];
|
||||
* future versions of ELinks may change the numbers. */
|
||||
enum form_prop {
|
||||
JSP_FORM_ACTION,
|
||||
JSP_FORM_ELEMENTS,
|
||||
JSP_FORM_ENCODING,
|
||||
JSP_FORM_LENGTH,
|
||||
JSP_FORM_METHOD,
|
||||
JSP_FORM_NAME,
|
||||
JSP_FORM_TARGET
|
||||
JSP_FORM_ACTION = -1,
|
||||
JSP_FORM_ELEMENTS = -2,
|
||||
JSP_FORM_ENCODING = -3,
|
||||
JSP_FORM_LENGTH = -4,
|
||||
JSP_FORM_METHOD = -5,
|
||||
JSP_FORM_NAME = -6,
|
||||
JSP_FORM_TARGET = -7,
|
||||
};
|
||||
|
||||
static const JSPropertySpec form_props[] = {
|
||||
@ -1114,9 +1126,13 @@ const JSFunctionSpec forms_funcs[] = {
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
/* INTs from 0 up are equivalent to item(INT), so we have to stuff length out
|
||||
* of the way. */
|
||||
enum forms_prop { JSP_FORMS_LENGTH = -1 };
|
||||
/* Tinyids of properties. Use negative values to distinguish these from
|
||||
* array indexes (forms[INT] for INT>=0 is equivalent to forms.item(INT)).
|
||||
* ECMAScript code should not use these directly as in forms[-1];
|
||||
* future versions of ELinks may change the numbers. */
|
||||
enum forms_prop {
|
||||
JSP_FORMS_LENGTH = -1,
|
||||
};
|
||||
const JSPropertySpec forms_props[] = {
|
||||
{ "length", JSP_FORMS_LENGTH, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{ NULL }
|
||||
|
@ -136,7 +136,13 @@ const JSClass location_class = {
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
|
||||
};
|
||||
|
||||
enum location_prop { JSP_LOC_HREF };
|
||||
/* Tinyids of properties. Use negative values to distinguish these
|
||||
* from array indexes (even though this object has no array elements).
|
||||
* ECMAScript code should not use these directly as in location[-1];
|
||||
* future versions of ELinks may change the numbers. */
|
||||
enum location_prop {
|
||||
JSP_LOC_HREF = -1,
|
||||
};
|
||||
const JSPropertySpec location_props[] = {
|
||||
{ "href", JSP_LOC_HREF, JSPROP_ENUMERATE },
|
||||
{ NULL }
|
||||
|
@ -54,15 +54,19 @@ const JSClass navigator_class = {
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
|
||||
};
|
||||
|
||||
/* Tinyids of properties. Use negative values to distinguish these
|
||||
* from array indexes (even though this object has no array elements).
|
||||
* ECMAScript code should not use these directly as in navigator[-1];
|
||||
* future versions of ELinks may change the numbers. */
|
||||
enum navigator_prop {
|
||||
JSP_NAVIGATOR_APP_CODENAME,
|
||||
JSP_NAVIGATOR_APP_NAME,
|
||||
JSP_NAVIGATOR_APP_VERSION,
|
||||
JSP_NAVIGATOR_LANGUAGE,
|
||||
/* JSP_NAVIGATOR_MIME_TYPES, */
|
||||
JSP_NAVIGATOR_PLATFORM,
|
||||
/* JSP_NAVIGATOR_PLUGINS, */
|
||||
JSP_NAVIGATOR_USER_AGENT,
|
||||
JSP_NAVIGATOR_APP_CODENAME = -1,
|
||||
JSP_NAVIGATOR_APP_NAME = -2,
|
||||
JSP_NAVIGATOR_APP_VERSION = -3,
|
||||
JSP_NAVIGATOR_LANGUAGE = -4,
|
||||
/* JSP_NAVIGATOR_MIME_TYPES = -5, */
|
||||
JSP_NAVIGATOR_PLATFORM = -6,
|
||||
/* JSP_NAVIGATOR_PLUGINS = -7, */
|
||||
JSP_NAVIGATOR_USER_AGENT = -8,
|
||||
};
|
||||
const JSPropertySpec navigator_props[] = {
|
||||
{ "appCodeName", JSP_NAVIGATOR_APP_CODENAME, JSPROP_ENUMERATE | JSPROP_READONLY },
|
||||
|
@ -65,7 +65,13 @@ const JSClass statusbar_class = {
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
|
||||
};
|
||||
|
||||
enum unibar_prop { JSP_UNIBAR_VISIBLE };
|
||||
/* Tinyids of properties. Use negative values to distinguish these
|
||||
* from array indexes (even though this object has no array elements).
|
||||
* ECMAScript code should not use these directly as in menubar[-1];
|
||||
* future versions of ELinks may change the numbers. */
|
||||
enum unibar_prop {
|
||||
JSP_UNIBAR_VISIBLE = -1,
|
||||
};
|
||||
const JSPropertySpec unibar_props[] = {
|
||||
{ "visible", JSP_UNIBAR_VISIBLE, JSPROP_ENUMERATE },
|
||||
{ NULL }
|
||||
|
@ -56,12 +56,16 @@ const JSClass window_class = {
|
||||
};
|
||||
|
||||
|
||||
/* Tinyids of properties. Use negative values to distinguish these
|
||||
* from array indexes (even though this object has no array elements).
|
||||
* ECMAScript code should not use these directly as in window[-1];
|
||||
* future versions of ELinks may change the numbers. */
|
||||
enum window_prop {
|
||||
JSP_WIN_CLOSED,
|
||||
JSP_WIN_PARENT,
|
||||
JSP_WIN_SELF,
|
||||
JSP_WIN_STATUS,
|
||||
JSP_WIN_TOP,
|
||||
JSP_WIN_CLOSED = -1,
|
||||
JSP_WIN_PARENT = -2,
|
||||
JSP_WIN_SELF = -3,
|
||||
JSP_WIN_STATUS = -4,
|
||||
JSP_WIN_TOP = -5,
|
||||
};
|
||||
/* "location" is special because we need to simulate "location.href"
|
||||
* when the code is asking directly for "location". We do not register
|
||||
|
@ -59,10 +59,14 @@ bookmark_finalize(JSContext *ctx, JSObject *obj)
|
||||
|
||||
/*** bookmark object ***/
|
||||
|
||||
/* Tinyids of properties. Use negative values to distinguish these
|
||||
* from array indexes (even though this object has no array elements).
|
||||
* ECMAScript code should not use these directly as in bookmark[-1];
|
||||
* future versions of ELinks may change the numbers. */
|
||||
enum bookmark_prop {
|
||||
BOOKMARK_TITLE,
|
||||
BOOKMARK_URL,
|
||||
BOOKMARK_CHILDREN,
|
||||
BOOKMARK_TITLE = -1,
|
||||
BOOKMARK_URL = -2,
|
||||
BOOKMARK_CHILDREN = -3,
|
||||
};
|
||||
|
||||
static const JSPropertySpec bookmark_props[] = {
|
||||
|
@ -16,12 +16,16 @@
|
||||
|
||||
static const JSClass cache_entry_class; /* defined below */
|
||||
|
||||
/* Tinyids of properties. Use negative values to distinguish these
|
||||
* from array indexes (even though this object has no array elements).
|
||||
* ECMAScript code should not use these directly as in cache_entry[-1];
|
||||
* future versions of ELinks may change the numbers. */
|
||||
enum cache_entry_prop {
|
||||
CACHE_ENTRY_CONTENT,
|
||||
CACHE_ENTRY_TYPE,
|
||||
CACHE_ENTRY_LENGTH,
|
||||
CACHE_ENTRY_HEAD,
|
||||
CACHE_ENTRY_URI,
|
||||
CACHE_ENTRY_CONTENT = -1,
|
||||
CACHE_ENTRY_TYPE = -2,
|
||||
CACHE_ENTRY_LENGTH = -3,
|
||||
CACHE_ENTRY_HEAD = -4,
|
||||
CACHE_ENTRY_URI = -5,
|
||||
};
|
||||
|
||||
static const JSPropertySpec cache_entry_props[] = {
|
||||
|
@ -30,10 +30,14 @@ smjs_globhist_item_finalize(JSContext *ctx, JSObject *obj)
|
||||
if (history_item) object_unlock(history_item);
|
||||
}
|
||||
|
||||
/* Tinyids of properties. Use negative values to distinguish these
|
||||
* from array indexes (even though this object has no array elements).
|
||||
* ECMAScript code should not use these directly as in global_history_item[-1];
|
||||
* future future versions of ELinks may change the numbers. */
|
||||
enum smjs_globhist_item_prop {
|
||||
GLOBHIST_TITLE,
|
||||
GLOBHIST_URL,
|
||||
GLOBHIST_LAST_VISIT,
|
||||
GLOBHIST_TITLE = -1,
|
||||
GLOBHIST_URL = -2,
|
||||
GLOBHIST_LAST_VISIT = -3,
|
||||
};
|
||||
|
||||
static const JSPropertySpec smjs_globhist_item_props[] = {
|
||||
|
@ -22,9 +22,13 @@
|
||||
|
||||
static const JSClass view_state_class; /* defined below */
|
||||
|
||||
/* Tinyids of properties. Use negative values to distinguish these
|
||||
* from array indexes (even though this object has no array elements).
|
||||
* ECMAScript code should not use these directly as in view_state[-1];
|
||||
* future versions of ELinks may change the numbers. */
|
||||
enum view_state_prop {
|
||||
VIEW_STATE_PLAIN,
|
||||
VIEW_STATE_URI,
|
||||
VIEW_STATE_PLAIN = -1,
|
||||
VIEW_STATE_URI = -2,
|
||||
};
|
||||
|
||||
static const JSPropertySpec view_state_props[] = {
|
||||
|
Loading…
Reference in New Issue
Block a user