1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[ecmascript] warnings

This commit is contained in:
Witold Filipczyk 2024-07-15 16:44:13 +02:00
parent adecd52b3a
commit 0ce218f66e
45 changed files with 185 additions and 314 deletions

View File

@ -73,7 +73,7 @@ js_html_document_user_data_handler(dom_node_operation operation,
}
void *
document_parse_text(const char *charset, char *data, size_t length)
document_parse_text(const char *charset, const char *data, size_t length)
{
dom_hubbub_parser *parser = NULL;
dom_hubbub_error error;
@ -294,7 +294,7 @@ static const char *__keys_names[] = {
NULL
};
static enum {
enum {
KEYB_ENTER,
KEYB_ARROW_LEFT,
KEYB_ARROW_RIGHT,
@ -332,7 +332,7 @@ keybstrings_init(void)
int i;
for (i = 0; i < KEYB_COUNT; i++) {
dom_exception err = lwc_intern_string(__keys_names[i], strlen(__keys_names[i]), &keyb_lwc[i]);
lwc_error err = lwc_intern_string(__keys_names[i], strlen(__keys_names[i]), &keyb_lwc[i]);
if (err != lwc_error_ok) {
return;
@ -434,7 +434,7 @@ convert_dom_string_to_keycode(dom_string *dom_key)
return 123;
default:
{
char *utf8 = dom_string_data(dom_key);
char *utf8 = (char *)dom_string_data(dom_key);
char *end = utf8 + dom_string_length(dom_key);
return utf8_to_unicode(&utf8, end);
}

View File

@ -11,7 +11,7 @@ extern "C" {
struct document;
struct string;
void *document_parse_text(const char *charset, char *data, size_t length);
void *document_parse_text(const char *charset, const char *data, size_t length);
void *document_parse(struct document *document, struct string *source);
void free_document(void *doc);
void *el_match_selector(const char *selector, void *node);

View File

@ -519,7 +519,7 @@ walk_tree_query(dom_node *node, const char *selector, int depth)
return NULL;
}
if (res = el_match_selector(selector, node)) {
if ((res = el_match_selector(selector, node))) {
/* There was an error; return */
return res;
}
@ -573,7 +573,7 @@ walk_tree_query_append(dom_node *root, dom_node *node, const char *selector, int
return;
}
if (res = el_match_selector(selector, node)) {
if ((res = el_match_selector(selector, node))) {
struct selector_node *sn = (struct selector_node *)mem_calloc(1, sizeof(*sn));
if (sn) {
@ -633,7 +633,7 @@ node_has_classes(struct dom_node *node, void *ctx)
}
static LIST_OF(struct class_string) *
prepare_strings(char *text)
prepare_strings(const char *text)
{
if (!text) {
return NULL;
@ -644,7 +644,7 @@ prepare_strings(char *text)
return NULL;
}
init_list(*list);
char *pos = text;
char *pos = (char *)text;
while (*pos) {
skip_space(pos);
@ -740,7 +740,7 @@ el_dom_html_collection_create(dom_html_document *doc,
}
void *
get_elements_by_class_name(dom_html_document *doc, dom_node *node, char *classes)
get_elements_by_class_name(dom_html_document *doc, dom_node *node, const char *classes)
{
if (!node || !classes) {
return NULL;

View File

@ -55,7 +55,7 @@ void ecmascript_moved_form_state(struct form_state *fs);
void *walk_tree_query(dom_node *node, const char *selector, int depth);
void walk_tree_query_append(dom_node *root, dom_node *node, const char *selector, int depth, LIST_OF(struct selector_node) *result_list);
void *get_elements_by_class_name(dom_html_document *doc, dom_node *node, char *classes);
void *get_elements_by_class_name(dom_html_document *doc, dom_node *node, const char *classes);
void camel_to_html(struct string *result, const char *camel);
void ecmascript_walk_tree(struct string *buf, void *nod, bool start, bool toSortAttrs);

View File

@ -317,7 +317,7 @@ check_for_rerender(struct ecmascript_interpreter *interpreter, const char* text)
struct cache_entry *cached = document->cached;
#ifdef CONFIG_ECMASCRIPT_SMJS
if (interpreter->document_obj) {
dom_document *doc = JS::GetMaybePtrFromReservedSlot<dom_document>(interpreter->document_obj, 0);
dom_document *doc = JS::GetMaybePtrFromReservedSlot<dom_document>((JSObject *)interpreter->document_obj, 0);
if (doc) {
document->dom = doc;

View File

@ -83,6 +83,7 @@ next:
js_setlength(J, -1, num_attrs);
}
#if 0
static void
mjs_attributes_get_property_length(js_State *J)
{
@ -115,6 +116,7 @@ mjs_attributes_get_property_length(js_State *J)
}
js_pushnumber(J, num_attrs);
}
#endif
static void
mjs_push_attributes_item2(js_State *J, int idx)

View File

@ -31,6 +31,7 @@ mjs_CSSStyleDeclaration_get_property_length(js_State *J)
js_pushnumber(J, 3); // fake
}
#if 0
static void
mjs_push_CSSStyleDeclaration_item2(js_State *J, int idx)
{
@ -39,6 +40,7 @@ mjs_push_CSSStyleDeclaration_item2(js_State *J, int idx)
#endif
js_pushstring(J, "0"); // fake
}
#endif
static void
mjs_CSSStyleDeclaration_getPropertyValue(js_State *J)
@ -58,6 +60,7 @@ mjs_CSSStyleDeclaration_item(js_State *J)
js_pushstring(J, "0"); // fake
}
#if 0
static void
mjs_push_CSSStyleDeclaration_namedItem2(js_State *J, const char *str)
{
@ -66,6 +69,7 @@ mjs_push_CSSStyleDeclaration_namedItem2(js_State *J, const char *str)
#endif
js_pushstring(J, "0"); // fake
}
#endif
static void
mjs_CSSStyleDeclaration_namedItem(js_State *J)

View File

@ -38,7 +38,7 @@ mjs_customEvent_finalizer(js_State *J, void *val)
if (event) {
const char *detail = NULL;
dom_exception exc = dom_custom_event_get_detail(event, &detail);
(void)dom_custom_event_get_detail(event, &detail);
if (detail) {
js_unref(J, detail);
@ -66,7 +66,7 @@ mjs_push_customEvent(js_State *J, char *type_)
}
dom_custom_event *event = NULL;
dom_string *CustomEventStr = NULL;
dom_exception exc = dom_string_create("CustomEvent", sizeof("CustomEvent") - 1, &CustomEventStr);
dom_exception exc = dom_string_create((const uint8_t *)"CustomEvent", sizeof("CustomEvent") - 1, &CustomEventStr);
if (exc != DOM_NO_ERR || !CustomEventStr) {
js_error(J, "error");
@ -121,7 +121,7 @@ mjs_customEvent_get_property_bubbles(js_State *J)
return;
}
bool bubbles = false;
dom_exception exc = dom_event_get_bubbles(event, &bubbles);
(void)dom_event_get_bubbles(event, &bubbles);
js_pushboolean(J, bubbles);
}
@ -138,7 +138,7 @@ mjs_customEvent_get_property_cancelable(js_State *J)
return;
}
bool cancelable = false;
dom_exception exc = dom_event_get_cancelable(event, &cancelable);
(void)dom_event_get_cancelable(event, &cancelable);
js_pushboolean(J, cancelable);
}
@ -172,7 +172,7 @@ mjs_customEvent_get_property_defaultPrevented(js_State *J)
return;
}
bool prevented = false;
dom_exception exc = dom_event_is_default_prevented(event, &prevented);
(void)dom_event_is_default_prevented(event, &prevented);
js_pushboolean(J, prevented);
}
@ -290,7 +290,7 @@ mjs_customEvent_constructor(js_State *J)
}
dom_custom_event *event = NULL;
dom_string *CustomEventStr = NULL;
dom_exception exc = dom_string_create("CustomEvent", sizeof("CustomEvent") - 1, &CustomEventStr);
dom_exception exc = dom_string_create((const uint8_t *)"CustomEvent", sizeof("CustomEvent") - 1, &CustomEventStr);
if (exc != DOM_NO_ERR || !CustomEventStr) {
js_error(J, "error");

View File

@ -53,7 +53,7 @@ mjs_obj_dataset_has(js_State *J, void *p, const char *property)
}
camel_to_html(&data, property);
dom_string *attr_name = NULL;
dom_exception exc = dom_string_create(data.source, data.length, &attr_name);
dom_exception exc = dom_string_create((const uint8_t *)data.source, data.length, &attr_name);
done_string(&data);
if (exc != DOM_NO_ERR || !attr_name) {
@ -96,14 +96,14 @@ mjs_obj_dataset_put(js_State *J, void *p, const char *property)
}
camel_to_html(&data, property);
dom_string *attr_name = NULL;
dom_exception exc = dom_string_create(data.source, data.length, &attr_name);
dom_exception exc = dom_string_create((const uint8_t *)data.source, data.length, &attr_name);
done_string(&data);
if (exc != DOM_NO_ERR || !attr_name) {
return 0;
}
dom_string *attr_value = NULL;
exc = dom_string_create(value, strlen(value), &attr_value);
exc = dom_string_create((const uint8_t *)value, strlen(value), &attr_value);
if (exc != DOM_NO_ERR || !attr_value) {
dom_string_unref(attr_name);
@ -136,14 +136,13 @@ mjs_obj_dataset_del(js_State *J, void *p, const char *property)
}
camel_to_html(&data, property);
dom_string *attr_name = NULL;
dom_exception exc = dom_string_create(data.source, data.length, &attr_name);
dom_exception exc = dom_string_create((const uint8_t *)data.source, data.length, &attr_name);
done_string(&data);
if (exc != DOM_NO_ERR || !attr_name) {
return 0;
}
dom_string *attr_value = NULL;
exc = dom_element_remove_attribute(el, attr_name);
(void)dom_element_remove_attribute(el, attr_name);
dom_string_unref(attr_name);
interpreter->changed = true;

View File

@ -111,7 +111,6 @@ mjs_document_get_property_anchors(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)js_getcontext(J);
dom_html_document *doc = (dom_html_document *)mjs_doc_getprivate(J, 0);
if (!doc) {
@ -165,7 +164,6 @@ mjs_document_get_property_body(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)js_getcontext(J);
dom_html_document *doc = (dom_html_document *)mjs_doc_getprivate(J, 0);
if (!doc) {
@ -266,7 +264,6 @@ mjs_document_get_property_charset(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)js_getcontext(J);
// TODO
js_pushstring(J, "utf-8");
}
@ -277,7 +274,6 @@ mjs_document_get_property_childNodes(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)js_getcontext(J);
dom_html_document *doc = (dom_html_document *)mjs_doc_getprivate(J, 0);
if (!doc) {
@ -317,7 +313,6 @@ mjs_document_get_property_doctype(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)js_getcontext(J);
dom_html_document *doc = (dom_html_document *)mjs_doc_getprivate(J, 0);
if (!doc) {
@ -335,7 +330,6 @@ mjs_document_get_property_documentElement(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)js_getcontext(J);
dom_html_document *doc = (dom_html_document *)mjs_doc_getprivate(J, 0);
if (!doc) {
@ -416,7 +410,6 @@ mjs_document_get_property_forms(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)js_getcontext(J);
dom_html_document *doc = (dom_html_document *)mjs_doc_getprivate(J, 0);
if (!doc) {
@ -471,7 +464,6 @@ mjs_document_get_property_images(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)js_getcontext(J);
dom_html_document *doc = (dom_html_document *)mjs_doc_getprivate(J, 0);
if (!doc) {
@ -503,7 +495,6 @@ mjs_document_get_property_links(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)js_getcontext(J);
dom_html_document *doc = (dom_html_document *)mjs_doc_getprivate(J, 0);
if (!doc) {
@ -983,7 +974,7 @@ mjs_document_addEventListener(js_State *J)
}
}
dom_string *typ = NULL;
exc = dom_string_create(method, strlen(method), &typ);
exc = dom_string_create((const uint8_t *)method, strlen(method), &typ);
if (exc != DOM_NO_ERR || !typ) {
goto ex;
@ -1043,7 +1034,7 @@ mjs_document_removeEventListener(js_State *J)
}
if (l->fun == fun) {
dom_string *typ = NULL;
dom_exception exc = dom_string_create(method, strlen(method), &typ);
dom_exception exc = dom_string_create((const uint8_t *)method, strlen(method), &typ);
if (exc != DOM_NO_ERR || !typ) {
continue;
@ -1071,7 +1062,6 @@ mjs_document_createComment(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)js_getcontext(J);
dom_document *doc = (dom_document *)mjs_doc_getprivate(J, 0);
if (!doc) {
@ -1109,7 +1099,6 @@ mjs_document_createDocumentFragment(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)js_getcontext(J);
dom_document *doc = (dom_document *)mjs_doc_getprivate(J, 0);
if (!doc) {
@ -1132,7 +1121,6 @@ mjs_document_createElement(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)js_getcontext(J);
dom_document *doc = (dom_document *)mjs_doc_getprivate(J, 0);
dom_string *tag_name = NULL;
dom_exception exc;
@ -1165,7 +1153,6 @@ mjs_document_createTextNode(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)js_getcontext(J);
dom_document *doc = (dom_document *)mjs_doc_getprivate(J, 0);
dom_string *data = NULL;
dom_exception exc;
@ -1198,7 +1185,6 @@ mjs_document_getElementById(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)js_getcontext(J);
dom_document *doc = (dom_document *)mjs_doc_getprivate(J, 0);
if (!doc) {
@ -1236,7 +1222,7 @@ mjs_document_getElementsByClassName(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
dom_document *doc = (dom_document *)mjs_doc_getprivate(J, 0);
dom_html_document *doc = (dom_html_document *)mjs_doc_getprivate(J, 0);
if (!doc) {
js_pushnull(J);
@ -1252,6 +1238,7 @@ mjs_document_getElementsByClassName(js_State *J)
mjs_push_collection(J, col);
}
#if 0
static void
mjs_document_getElementsByName(js_State *J)
{
@ -1294,6 +1281,7 @@ mjs_document_getElementsByName(js_State *J)
#endif
js_pushnull(J);
}
#endif
static void
mjs_document_getElementsByTagName(js_State *J)
@ -1301,7 +1289,6 @@ mjs_document_getElementsByTagName(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)js_getcontext(J);
dom_document *doc = (dom_document *)mjs_doc_getprivate(J, 0);
if (!doc) {
@ -1339,7 +1326,6 @@ mjs_document_querySelector(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)js_getcontext(J);
dom_document *doc = (dom_document *)mjs_doc_getprivate(J, 0);
if (!doc) {
@ -1377,7 +1363,6 @@ mjs_document_querySelectorAll(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)js_getcontext(J);
dom_document *doc = (dom_document *)mjs_doc_getprivate(J, 0);
if (!doc) {
@ -1789,7 +1774,7 @@ mjs_document_dispatchEvent(js_State *J)
return;
}
bool result = false;
dom_exception exc = dom_event_target_dispatch_event(doc, event, &result);
(void)dom_event_target_dispatch_event(doc, event, &result);
js_pushboolean(J, result);
}
@ -1802,7 +1787,6 @@ document_event_handler(dom_event *event, void *pw)
struct mjs_document_private *doc_private = (struct mjs_document_private *)pw;
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)doc_private->interpreter;
js_State *J = (js_State *)interpreter->backend_data;
dom_document *doc = (dom_document *)doc_private->node;
if (!event) {
return;

View File

@ -1876,9 +1876,6 @@ mjs_element_set_property_textContent(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
dom_string *titlestr = NULL;
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)js_getcontext(J);
assert(interpreter);
dom_node *el = (dom_node *)(mjs_getprivate(J, 0));
if (!el) {
@ -2098,7 +2095,7 @@ mjs_element_addEventListener(js_State *J)
}
}
dom_string *typ = NULL;
exc = dom_string_create(method, strlen(method), &typ);
exc = dom_string_create((const uint8_t *)method, strlen(method), &typ);
if (exc != DOM_NO_ERR || !typ) {
goto ex;
@ -2158,7 +2155,7 @@ mjs_element_removeEventListener(js_State *J)
}
if (l->fun == fun) {
dom_string *typ = NULL;
dom_exception exc = dom_string_create(method, strlen(method), &typ);
dom_exception exc = dom_string_create((const uint8_t *)method, strlen(method), &typ);
if (exc != DOM_NO_ERR || !typ) {
continue;
@ -3255,7 +3252,7 @@ mjs_element_dispatchEvent(js_State *J)
return;
}
bool result = false;
dom_exception exc = dom_event_target_dispatch_event(el, event, &result);
(void)dom_event_target_dispatch_event(el, event, &result);
js_pushboolean(J, result);
}

View File

@ -56,7 +56,7 @@ mjs_push_event(js_State *J, void *eve)
addproperty(J, "cancelable", mjs_event_get_property_cancelable, NULL);
// addproperty(J, "composed", mjs_event_get_property_composed, NULL);
addproperty(J, "defaultPrevented", mjs_event_get_property_defaultPrevented, NULL);
addproperty(J, "target", mjs_event_get_property_type, NULL);
addproperty(J, "target", mjs_event_get_property_target, NULL);
addproperty(J, "type", mjs_event_get_property_type, NULL);
}
}
@ -74,7 +74,7 @@ mjs_event_get_property_bubbles(js_State *J)
return;
}
bool bubbles = false;
dom_exception exc = dom_event_get_bubbles(event, &bubbles);
(void)dom_event_get_bubbles(event, &bubbles);
js_pushboolean(J, bubbles);
}
@ -91,7 +91,7 @@ mjs_event_get_property_cancelable(js_State *J)
return;
}
bool cancelable = false;
dom_exception exc = dom_event_get_cancelable(event, &cancelable);
(void)dom_event_get_cancelable(event, &cancelable);
js_pushboolean(J, cancelable);
}
@ -125,7 +125,7 @@ mjs_event_get_property_defaultPrevented(js_State *J)
return;
}
bool prevented = false;
dom_exception exc = dom_event_is_default_prevented(event, &prevented);
(void)dom_event_is_default_prevented(event, &prevented);
js_pushboolean(J, prevented);
}
@ -216,7 +216,7 @@ mjs_event_constructor(js_State *J)
const char *str = js_tostring(J, 1);
if (str) {
exc = dom_string_create(str, strlen(str), &typ);
exc = dom_string_create((const uint8_t *)str, strlen(str), &typ);
}
js_getproperty(J, 2, "bubbles");
bool bubbles = js_toboolean(J, -1);

View File

@ -26,7 +26,7 @@ static void mjs_keyboardEvent_get_property_keyCode(js_State *J);
static void mjs_keyboardEvent_get_property_bubbles(js_State *J);
static void mjs_keyboardEvent_get_property_cancelable(js_State *J);
static void mjs_keyboardEvent_get_property_composed(js_State *J);
//static void mjs_keyboardEvent_get_property_composed(js_State *J);
static void mjs_keyboardEvent_get_property_defaultPrevented(js_State *J);
static void mjs_keyboardEvent_get_property_target(js_State *J);
static void mjs_keyboardEvent_get_property_type(js_State *J);
@ -59,7 +59,7 @@ mjs_push_keyboardEvent(js_State *J, struct term_event *ev, const char *type_)
dom_string *typ = NULL;
const char *t = type_ ?: "keydown";
exc = dom_string_create(t, strlen(t), &typ);
exc = dom_string_create((const uint8_t *)t, strlen(t), &typ);
dom_string *dom_key = NULL;
convert_key_to_dom_string(keyCode, &dom_key);
@ -100,7 +100,7 @@ mjs_keyboardEvent_get_property_bubbles(js_State *J)
return;
}
bool bubbles = false;
dom_exception exc = dom_event_get_bubbles(event, &bubbles);
(void)dom_event_get_bubbles(event, &bubbles);
js_pushboolean(J, bubbles);
}
@ -117,7 +117,7 @@ mjs_keyboardEvent_get_property_cancelable(js_State *J)
return;
}
bool cancelable = false;
dom_exception exc = dom_event_get_cancelable(event, &cancelable);
(void)dom_event_get_cancelable(event, &cancelable);
js_pushboolean(J, cancelable);
}
@ -151,7 +151,7 @@ mjs_keyboardEvent_get_property_defaultPrevented(js_State *J)
return;
}
bool prevented = false;
dom_exception exc = dom_event_is_default_prevented(event, &prevented);
(void)dom_event_is_default_prevented(event, &prevented);
js_pushboolean(J, prevented);
}
@ -313,7 +313,7 @@ mjs_keyboardEvent_constructor(js_State *J)
const char *t = js_tostring(J, 1);
if (t) {
exc = dom_string_create(t, strlen(t), &typ);
exc = dom_string_create((const uint8_t *)t, strlen(t), &typ);
}
bool bubbles = false;
bool cancelable = false;
@ -333,7 +333,7 @@ mjs_keyboardEvent_constructor(js_State *J)
js_pop(J, 1);
if (c) {
exc = dom_string_create(c, strlen(c), &code);
exc = dom_string_create((const uint8_t *)c, strlen(c), &code);
}
js_getproperty(J, 2, "key");
@ -341,7 +341,7 @@ mjs_keyboardEvent_constructor(js_State *J)
js_pop(J, 1);
if (k) {
exc = dom_string_create(k, strlen(k), &key);
exc = dom_string_create((const uint8_t *)k, strlen(k), &key);
}
exc = dom_keyboard_event_init(event, typ, bubbles, cancelable, NULL/*view*/,
key, code, DOM_KEY_LOCATION_STANDARD,

View File

@ -109,6 +109,7 @@ mjs_nodeList_finalizer(js_State *J, void *node)
attr_erase_from_map(map_nodelist, node);
}
#if 0
static void
mjs_nodeList_get_property_length(js_State *J)
{
@ -132,6 +133,7 @@ mjs_nodeList_get_property_length(js_State *J)
js_pushnumber(J, length);
}
#endif
void
mjs_push_nodelist(js_State *J, void *node)

View File

@ -28,8 +28,6 @@ mjs_push_nodeList2_item2(js_State *J, int idx)
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
LIST_OF(struct selector_node) *sni = (LIST_OF(struct selector_node) *)(js_touserdata(J, 0, "nodelist2"));
dom_node *element = NULL;
dom_exception err;
if (!sni) {
js_pushundefined(J);
@ -100,6 +98,7 @@ mjs_nodeList2_finalizer(js_State *J, void *node)
attr_erase_from_map(map_nodelist2, node);
}
#if 0
static void
mjs_nodeList2_get_property_length(js_State *J)
{
@ -116,6 +115,7 @@ mjs_nodeList2_get_property_length(js_State *J)
length = list_size(sni);
js_pushnumber(J, length);
}
#endif
void
mjs_push_nodelist2(js_State *J, void *nodes)

View File

@ -42,7 +42,7 @@ mjs_tokenlist_add(js_State *J)
return;
}
dom_string *kl = NULL;
dom_exception exc = dom_string_create(klass, strlen(klass), &kl);
dom_exception exc = dom_string_create((const uint8_t *)klass, strlen(klass), &kl);
if (exc != DOM_NO_ERR || !kl) {
js_pushundefined(J);
@ -63,7 +63,6 @@ mjs_tokenlist_contains(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)js_getcontext(J);
dom_tokenlist *tl = (dom_tokenlist *)(js_touserdata(J, 0, "tokenlist"));
if (!tl) {
@ -77,7 +76,7 @@ mjs_tokenlist_contains(js_State *J)
return;
}
dom_string *kl = NULL;
dom_exception exc = dom_string_create(klass, strlen(klass), &kl);
dom_exception exc = dom_string_create((const uint8_t *)klass, strlen(klass), &kl);
if (exc != DOM_NO_ERR || !kl) {
js_pushundefined(J);
@ -114,7 +113,7 @@ mjs_tokenlist_remove(js_State *J)
return;
}
dom_string *kl = NULL;
dom_exception exc = dom_string_create(klass, strlen(klass), &kl);
dom_exception exc = dom_string_create((const uint8_t *)klass, strlen(klass), &kl);
if (exc != DOM_NO_ERR || !kl) {
js_pushundefined(J);
@ -149,7 +148,7 @@ mjs_tokenlist_toggle(js_State *J)
return;
}
dom_string *kl = NULL;
dom_exception exc = dom_string_create(klass, strlen(klass), &kl);
dom_exception exc = dom_string_create((const uint8_t *)klass, strlen(klass), &kl);
if (exc != DOM_NO_ERR || !kl) {
js_pushundefined(J);

View File

@ -568,12 +568,14 @@ mjs_url_constructor(js_State *J)
return;
}
const char *urlstring = js_tostring(J, 1);
char *us = null_or_stracpy(urlstring);
if (!urlstring) {
if (!us) {
js_error(J, "out of memory");
return;
}
int ret = parse_uri(&url->uri, urlstring);
int ret = parse_uri(&url->uri, us);
mem_free(us);
if (ret != URI_ERRNO_OK) {
js_error(J, "error");

View File

@ -281,7 +281,7 @@ quickjs_get_interpreter(struct ecmascript_interpreter *interpreter)
interpreter->document_obj = getDocument(ctx, document->dom);
JS_SetModuleLoaderFunc(interpreter->rt, NULL, el_js_module_loader, NULL);
JSModuleDef *m = el_js_module_loader(ctx, "a", NULL);
(void)el_js_module_loader(ctx, "a", NULL);
JSValue r = JS_Eval(ctx, "import {fetch,Headers,Request,Response} from 'a';", sizeof("import {fetch,Headers,Request,Response} from 'a';") - 1,
"top", 0);

View File

@ -27,6 +27,7 @@
void *map_csses;
void *map_rev_csses;
#if 0
static void *
js_CSSStyleDeclaration_GetOpaque(JSValueConst this_val)
{
@ -34,7 +35,9 @@ js_CSSStyleDeclaration_GetOpaque(JSValueConst this_val)
return attr_find_in_map_rev(map_rev_csses, this_val);
}
#endif
#if 0
static void
js_CSSStyleDeclaration_SetOpaque(JSValueConst this_val, void *node)
{
@ -46,6 +49,7 @@ js_CSSStyleDeclaration_SetOpaque(JSValueConst this_val, void *node)
attr_save_in_map_rev(map_rev_csses, this_val, node);
}
}
#endif
static JSValue
js_CSSStyleDeclaration_get_property_length(JSContext *ctx, JSValueConst this_val)
@ -69,6 +73,7 @@ js_CSSStyleDeclaration_getPropertyValue(JSContext *ctx, JSValueConst this_val, i
return JS_UNDEFINED;
}
#if 0
static JSValue
js_CSSStyleDeclaration_item2(JSContext *ctx, JSValueConst this_val, int idx)
{
@ -79,6 +84,7 @@ js_CSSStyleDeclaration_item2(JSContext *ctx, JSValueConst this_val, int idx)
return JS_NewString(ctx, "0"); // fake
}
#endif
static JSValue
js_CSSStyleDeclaration_item(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
@ -94,6 +100,7 @@ js_CSSStyleDeclaration_item(JSContext *ctx, JSValueConst this_val, int argc, JSV
return JS_NewString(ctx, "0"); // fake
}
#if 0
static JSValue
js_CSSStyleDeclaration_namedItem2(JSContext *ctx, JSValueConst this_val, const char *str)
{
@ -103,6 +110,7 @@ js_CSSStyleDeclaration_namedItem2(JSContext *ctx, JSValueConst this_val, const c
REF_JS(this_val);
return JS_NewString(ctx, "0"); // fake
}
#endif
static JSValue
js_CSSStyleDeclaration_namedItem(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)

View File

@ -44,7 +44,7 @@ void js_customEvent_finalizer(JSRuntime *rt, JSValue val)
if (event) {
JSValue *detail = NULL;
dom_exception exc = dom_custom_event_get_detail(event, &detail);
(void)dom_custom_event_get_detail(event, &detail);
if (detail) {
free(detail);
@ -85,7 +85,7 @@ js_customEvent_get_property_bubbles(JSContext *ctx, JSValueConst this_val)
}
dom_event_ref(event);
bool bubbles = false;
dom_exception exc = dom_event_get_bubbles(event, &bubbles);
(void)dom_event_get_bubbles(event, &bubbles);
JSValue r = JS_NewBool(ctx, bubbles);
dom_event_unref(event);
@ -108,7 +108,7 @@ js_customEvent_get_property_cancelable(JSContext *ctx, JSValueConst this_val)
dom_event_ref(event);
bool cancelable = false;
dom_exception exc = dom_event_get_cancelable(event, &cancelable);
(void)dom_event_get_cancelable(event, &cancelable);
JSValue r = JS_NewBool(ctx, cancelable);
dom_event_unref(event);
@ -150,7 +150,7 @@ js_customEvent_get_property_defaultPrevented(JSContext *ctx, JSValueConst this_v
}
dom_event_ref(event);
bool prevented = false;
dom_exception exc = dom_event_is_default_prevented(event, &prevented);
(void)dom_event_is_default_prevented(event, &prevented);
JSValue r = JS_NewBool(ctx, prevented);
dom_event_unref(event);
@ -205,7 +205,7 @@ js_customEvent_get_property_target(JSContext *ctx, JSValueConst this_val)
return JS_NULL;
}
JSValue r = getElement(ctx, target);
dom_string_unref(target);
dom_node_unref(target);
dom_event_unref(event);
RETURN_JS(r);
@ -287,7 +287,7 @@ js_customEvent_constructor(JSContext *ctx, JSValueConst new_target, int argc, JS
}
dom_custom_event *event = NULL;
dom_string *CustomEventStr = NULL;
dom_exception exc = dom_string_create("CustomEvent", sizeof("CustomEvent") - 1, &CustomEventStr);
dom_exception exc = dom_string_create((const uint8_t *)"CustomEvent", sizeof("CustomEvent") - 1, &CustomEventStr);
if (exc != DOM_NO_ERR || !CustomEventStr) {
return JS_EXCEPTION;
@ -372,7 +372,7 @@ js_customEvent_init(JSContext *ctx)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSValue proto, obj;
JSValue proto;
/* Event class */
JS_NewClassID(&js_customEvent_class_id);
@ -384,8 +384,8 @@ js_customEvent_init(JSContext *ctx)
JS_SetClassProto(ctx, js_customEvent_class_id, proto);
/* Event object */
obj = JS_NewGlobalCConstructor(ctx, "CustomEvent", js_customEvent_constructor, 1, proto);
REF_JS(obj);
(void)JS_NewGlobalCConstructor(ctx, "CustomEvent", js_customEvent_constructor, 1, proto);
//REF_JS(obj);
// JS_SetPropertyFunctionList(ctx, obj, js_customEvent_class_funcs, countof(js_customEvent_class_funcs));

View File

@ -65,20 +65,20 @@ js_obj_delete_property(JSContext *ctx, JSValueConst obj, JSAtom prop)
JS_FreeCString(ctx, property);
dom_string *attr_name = NULL;
dom_exception exc = dom_string_create(data.source, data.length, &attr_name);
dom_exception exc = dom_string_create((const uint8_t *)data.source, data.length, &attr_name);
done_string(&data);
if (exc != DOM_NO_ERR || !attr_name) {
return 0;
}
dom_string *attr_value = NULL;
exc = dom_element_remove_attribute(el, attr_name);
(void)dom_element_remove_attribute(el, attr_name);
dom_string_unref(attr_name);
interpreter->changed = true;
return 1;
}
#if 0
/* The following methods can be emulated with the previous ones,
so they are usually not needed */
/* return < 0 if exception or TRUE/FALSE */
@ -91,6 +91,7 @@ js_obj_has_property(JSContext *ctx, JSValueConst obj, JSAtom atom)
fprintf(stderr, "has_property\n");
return 1;
}
#endif
static JSValue
js_obj_get_property(JSContext *ctx, JSValueConst obj, JSAtom atom, JSValueConst receiver)
@ -114,7 +115,7 @@ js_obj_get_property(JSContext *ctx, JSValueConst obj, JSAtom atom, JSValueConst
JS_FreeCString(ctx, property);
dom_string *attr_name = NULL;
dom_exception exc = dom_string_create(data.source, data.length, &attr_name);
dom_exception exc = dom_string_create((const uint8_t *)data.source, data.length, &attr_name);
done_string(&data);
if (exc != DOM_NO_ERR || !attr_name) {
@ -165,7 +166,7 @@ js_obj_set_property(JSContext *ctx, JSValueConst obj, JSAtom atom, JSValueConst
JS_FreeCString(ctx, property);
dom_string *attr_name = NULL;
dom_exception exc = dom_string_create(data.source, data.length, &attr_name);
dom_exception exc = dom_string_create((const uint8_t *)data.source, data.length, &attr_name);
done_string(&data);
if (exc != DOM_NO_ERR || !attr_name) {
@ -173,7 +174,7 @@ js_obj_set_property(JSContext *ctx, JSValueConst obj, JSAtom atom, JSValueConst
return 0;
}
dom_string *attr_value = NULL;
exc = dom_string_create(value, strlen(value), &attr_value);
exc = dom_string_create((const uint8_t *)value, strlen(value), &attr_value);
JS_FreeCString(ctx, value);
if (exc != DOM_NO_ERR || !attr_value) {

View File

@ -109,7 +109,6 @@ js_document_get_property_anchors(JSContext *ctx, JSValueConst this_val)
#endif
REF_JS(this_val);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
dom_html_document *doc = (struct dom_html_document *)js_doc_getopaque(this_val);
if (!doc) {
@ -171,7 +170,6 @@ js_document_get_property_body(JSContext *ctx, JSValueConst this_val)
#endif
REF_JS(this_val);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
dom_html_document *doc = (struct dom_html_document *)js_doc_getopaque(this_val);
if (!doc) {
@ -288,7 +286,6 @@ js_document_get_property_charset(JSContext *ctx, JSValueConst this_val)
#endif
REF_JS(this_val);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
// TODO
JSValue r = JS_NewStringLen(ctx, "utf-8", strlen("utf-8"));
@ -303,7 +300,6 @@ js_document_get_property_childNodes(JSContext *ctx, JSValueConst this_val)
#endif
REF_JS(this_val);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
dom_html_document *doc = (struct dom_html_document *)js_doc_getopaque(this_val);
if (!doc) {
@ -373,7 +369,6 @@ js_document_get_property_documentElement(JSContext *ctx, JSValueConst this_val)
#endif
REF_JS(this_val);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
dom_html_document *doc = (struct dom_html_document *)js_doc_getopaque(this_val);
if (!doc) {
@ -466,7 +461,6 @@ js_document_get_property_forms(JSContext *ctx, JSValueConst this_val)
#endif
REF_JS(this_val);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
dom_html_document *doc = (struct dom_html_document *)js_doc_getopaque(this_val);
if (!doc) {
@ -496,7 +490,6 @@ js_document_get_property_head(JSContext *ctx, JSValueConst this_val)
#endif
REF_JS(this_val);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
// TODO
return JS_NULL;
@ -511,7 +504,6 @@ js_document_get_property_images(JSContext *ctx, JSValueConst this_val)
#endif
REF_JS(this_val);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
dom_html_document *doc = (struct dom_html_document *)js_doc_getopaque(this_val);
if (!doc) {
@ -551,7 +543,6 @@ js_document_get_property_links(JSContext *ctx, JSValueConst this_val)
#endif
REF_JS(this_val);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
dom_html_document *doc = (struct dom_html_document *)js_doc_getopaque(this_val);
if (!doc) {
@ -733,7 +724,6 @@ js_document_get_property_scripts(JSContext *ctx, JSValueConst this_val)
#endif
REF_JS(this_val);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
// TODO
//dom_html_document *doc = (dom_html_document *)document->dom;
@ -1103,7 +1093,7 @@ js_document_addEventListener(JSContext *ctx, JSValueConst this_val, int argc, JS
}
}
dom_string *typ = NULL;
exc = dom_string_create(method, strlen(method), &typ);
exc = dom_string_create((const uint8_t *)method, strlen(method), &typ);
if (exc != DOM_NO_ERR || !typ) {
goto ex;
@ -1154,7 +1144,7 @@ js_document_dispatchEvent(JSContext *ctx, JSValueConst this_val, int argc, JSVal
dom_event_ref(event);
}
bool result = false;
dom_exception exc = dom_event_target_dispatch_event(doc, event, &result);
(void)dom_event_target_dispatch_event(doc, event, &result);
if (event) {
dom_event_unref(event);
@ -1209,7 +1199,7 @@ js_document_removeEventListener(JSContext *ctx, JSValueConst this_val, int argc,
if (JS_VALUE_GET_PTR(l->fun) == JS_VALUE_GET_PTR(fun)) {
dom_string *typ = NULL;
dom_exception exc = dom_string_create(method, strlen(method), &typ);
dom_exception exc = dom_string_create((const uint8_t *)method, strlen(method), &typ);
if (exc != DOM_NO_ERR || !typ) {
continue;
@ -1243,7 +1233,6 @@ js_document_createComment(JSContext *ctx, JSValueConst this_val, int argc, JSVal
if (argc != 1) {
return JS_FALSE;
}
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
dom_html_document *doc = (struct dom_html_document *)js_doc_getopaque(this_val);
if (!doc) {
@ -1293,7 +1282,6 @@ js_document_createDocumentFragment(JSContext *ctx, JSValueConst this_val, int ar
if (argc != 0) {
return JS_FALSE;
}
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
dom_document *doc = (struct dom_document *)js_doc_getopaque(this_val);
if (!doc) {
@ -1324,7 +1312,6 @@ js_document_createElement(JSContext *ctx, JSValueConst this_val, int argc, JSVal
if (argc != 1) {
return JS_FALSE;
}
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
dom_document *doc = (struct dom_document *)js_doc_getopaque(this_val);
if (!doc) {
@ -1374,7 +1361,6 @@ js_document_createTextNode(JSContext *ctx, JSValueConst this_val, int argc, JSVa
if (argc != 1) {
return JS_FALSE;
}
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
dom_document *doc = (struct dom_document *)js_doc_getopaque(this_val);
if (!doc) {
@ -1424,7 +1410,6 @@ js_document_getElementById(JSContext *ctx, JSValueConst this_val, int argc, JSVa
if (argc != 1) {
return JS_FALSE;
}
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
dom_html_document *doc = (struct dom_html_document *)js_doc_getopaque(this_val);
if (!doc) {
@ -1493,6 +1478,7 @@ js_document_getElementsByClassName(JSContext *ctx, JSValueConst this_val, int ar
RETURN_JS(ret);
}
#if 0
static JSValue
js_document_getElementsByName(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
{
@ -1539,6 +1525,7 @@ js_document_getElementsByName(JSContext *ctx, JSValueConst this_val, int argc, J
RETURN_JS(rr);
#endif
}
#endif
static JSValue
js_document_getElementsByTagName(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
@ -1551,7 +1538,6 @@ js_document_getElementsByTagName(JSContext *ctx, JSValueConst this_val, int argc
if (argc != 1) {
return JS_FALSE;
}
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
dom_document *doc = (struct dom_document *)js_doc_getopaque(this_val);
if (!doc) {
@ -1602,7 +1588,6 @@ js_document_querySelector(JSContext *ctx, JSValueConst this_val, int argc, JSVal
if (argc != 1) {
return JS_FALSE;
}
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
dom_html_document *doc = (struct dom_html_document *)js_doc_getopaque(this_val);
if (!doc) {
@ -1650,7 +1635,6 @@ js_document_querySelectorAll(JSContext *ctx, JSValueConst this_val, int argc, JS
if (argc != 1) {
return JS_FALSE;
}
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
dom_html_document *doc = (struct dom_html_document *)js_doc_getopaque(this_val);
if (!doc) {
@ -2060,7 +2044,6 @@ document_event_handler(dom_event *event, void *pw)
struct js_document_private *doc_private = (struct js_document_private *)pw;
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)doc_private->interpreter;
JSContext *ctx = (JSContext *)interpreter->backend_data;
dom_document *doc = (dom_document *)doc_private->node;
if (!event) {
return;

View File

@ -105,7 +105,7 @@ js_domparser_init(JSContext *ctx)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSValue proto, obj;
JSValue proto;
/* DOMParser class */
JS_NewClassID(&js_domparser_class_id);
@ -117,8 +117,8 @@ js_domparser_init(JSContext *ctx)
JS_SetClassProto(ctx, js_domparser_class_id, proto);
/* DOMParser object */
obj = JS_NewGlobalCConstructor(ctx, "DOMParser", js_domparser_constructor, 1, proto);
REF_JS(obj);
(void)JS_NewGlobalCConstructor(ctx, "DOMParser", js_domparser_constructor, 1, proto);
//REF_JS(obj);
return 0;
}

View File

@ -375,7 +375,7 @@ getDomRect(JSContext *ctx)
#endif
struct eljs_domrect *d = mem_calloc(1, sizeof(*d));
JSValue proto, obj;
JSValue proto;
{
static int initialised;

View File

@ -126,7 +126,6 @@ js_element_get_property_checked(JSContext *ctx, JSValueConst this_val)
#endif
REF_JS(this_val);
JSValue r;
dom_node *el = (dom_node *)(js_getopaque(this_val, js_element_class_id));
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
struct view_state *vs = interpreter->vs;
@ -194,7 +193,6 @@ js_element_set_property_checked(JSContext *ctx, JSValueConst this_val, JSValue v
#endif
REF_JS(this_val);
JSValue r;
dom_node *el = (dom_node *)(js_getopaque(this_val, js_element_class_id));
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
struct view_state *vs = interpreter->vs;
@ -350,7 +348,6 @@ js_element_get_property_classList(JSContext *ctx, JSValueConst this_val)
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
REF_JS(this_val);
JSValue r;
dom_element *el = (dom_element *)(js_getopaque(this_val, js_element_class_id));
@ -2041,7 +2038,6 @@ js_element_set_property_textContent(JSContext *ctx, JSValueConst this_val, JSVal
REF_JS(this_val);
REF_JS(val);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
dom_node *el = (dom_node *)(js_getopaque(this_val, js_element_class_id));
if (!el) {
@ -2116,7 +2112,6 @@ js_element_set_property_value(JSContext *ctx, JSValueConst this_val, JSValue val
#endif
REF_JS(this_val);
JSValue r;
dom_node *el = (dom_node *)(js_getopaque(this_val, js_element_class_id));
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
struct view_state *vs = interpreter->vs;
@ -2241,7 +2236,7 @@ js_element_dispatchEvent(JSContext *ctx, JSValueConst this_val, int argc, JSValu
dom_event_ref(event);
}
bool result = false;
dom_exception exc = dom_event_target_dispatch_event(el, event, &result);
(void)dom_event_target_dispatch_event(el, event, &result);
if (event) {
dom_event_unref(event);
@ -2325,7 +2320,7 @@ js_element_addEventListener(JSContext *ctx, JSValueConst this_val, int argc, JSV
}
}
dom_string *typ = NULL;
exc = dom_string_create(method, strlen(method), &typ);
exc = dom_string_create((const uint8_t *)method, strlen(method), &typ);
if (exc != DOM_NO_ERR || !typ) {
goto ex;
@ -2396,7 +2391,7 @@ js_element_removeEventListener(JSContext *ctx, JSValueConst this_val, int argc,
if (JS_VALUE_GET_PTR(l->fun) == JS_VALUE_GET_PTR(fun)) {
dom_string *typ = NULL;
dom_exception exc = dom_string_create(method, strlen(method), &typ);
dom_exception exc = dom_string_create((const uint8_t *)method, strlen(method), &typ);
if (exc != DOM_NO_ERR || !typ) {
continue;
@ -2564,6 +2559,7 @@ js_element_cloneNode(JSContext *ctx, JSValueConst this_val, int argc, JSValueCon
return getElement(ctx, clone);
}
#if 0
static bool
isAncestor(dom_node *el, dom_node *node)
{
@ -2587,7 +2583,7 @@ isAncestor(dom_node *el, dom_node *node)
return false;
}
#endif
static JSValue
js_element_closest(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)

View File

@ -73,7 +73,7 @@ js_event_get_property_bubbles(JSContext *ctx, JSValueConst this_val)
}
dom_event_ref(event);
bool bubbles = false;
dom_exception exc = dom_event_get_bubbles(event, &bubbles);
(void)dom_event_get_bubbles(event, &bubbles);
JSValue r = JS_NewBool(ctx, bubbles);
dom_event_unref(event);
@ -95,7 +95,7 @@ js_event_get_property_cancelable(JSContext *ctx, JSValueConst this_val)
}
dom_event_ref(event);
bool cancelable = false;
dom_exception exc = dom_event_get_cancelable(event, &cancelable);
(void)dom_event_get_cancelable(event, &cancelable);
JSValue r = JS_NewBool(ctx, cancelable);
dom_event_unref(event);
@ -137,7 +137,7 @@ js_event_get_property_defaultPrevented(JSContext *ctx, JSValueConst this_val)
}
dom_event_ref(event);
bool prevented = false;
dom_exception exc = dom_event_is_default_prevented(event, &prevented);
(void)dom_event_is_default_prevented(event, &prevented);
JSValue r = JS_NewBool(ctx, prevented);
dom_event_unref(event);
@ -250,7 +250,7 @@ js_event_constructor(JSContext *ctx, JSValueConst new_target, int argc, JSValueC
str = JS_ToCStringLen(ctx, &len, argv[0]);
if (str) {
exc = dom_string_create(str, len, &typ);
exc = dom_string_create((const uint8_t *)str, len, &typ);
JS_FreeCString(ctx, str);
}
}
@ -309,7 +309,7 @@ js_event_init(JSContext *ctx)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSValue proto, obj;
JSValue proto;
/* Event class */
JS_NewClassID(&js_event_class_id);
@ -321,8 +321,8 @@ js_event_init(JSContext *ctx)
JS_SetClassProto(ctx, js_event_class_id, proto);
/* Event object */
obj = JS_NewGlobalCConstructor(ctx, "Event", js_event_constructor, 1, proto);
REF_JS(obj);
(void)JS_NewGlobalCConstructor(ctx, "Event", js_event_constructor, 1, proto);
//REF_JS(obj);
// JS_SetPropertyFunctionList(ctx, obj, js_event_class_funcs, countof(js_event_class_funcs));

View File

@ -12,6 +12,7 @@
#include "ecmascript/libdom/dom.h"
#include "document/libdom/corestrings.h"
#include "document/libdom/doc.h"
#include "ecmascript/ecmascript.h"
#include "ecmascript/quickjs.h"
@ -30,7 +31,7 @@ static JSValue js_keyboardEvent_get_property_keyCode(JSContext *ctx, JSValueCons
static JSValue js_keyboardEvent_get_property_bubbles(JSContext *ctx, JSValueConst this_val);
static JSValue js_keyboardEvent_get_property_cancelable(JSContext *ctx, JSValueConst this_val);
static JSValue js_keyboardEvent_get_property_composed(JSContext *ctx, JSValueConst this_val);
//static JSValue js_keyboardEvent_get_property_composed(JSContext *ctx, JSValueConst this_val);
static JSValue js_keyboardEvent_get_property_defaultPrevented(JSContext *ctx, JSValueConst this_val);
static JSValue js_keyboardEvent_get_property_target(JSContext *ctx, JSValueConst this_val);
static JSValue js_keyboardEvent_get_property_type(JSContext *ctx, JSValueConst this_val);
@ -81,7 +82,7 @@ js_keyboardEvent_get_property_bubbles(JSContext *ctx, JSValueConst this_val)
}
dom_event_ref(event);
bool bubbles = false;
dom_exception exc = dom_event_get_bubbles(event, &bubbles);
(void)dom_event_get_bubbles(event, &bubbles);
JSValue r = JS_NewBool(ctx, bubbles);
dom_event_unref(event);
@ -102,7 +103,7 @@ js_keyboardEvent_get_property_cancelable(JSContext *ctx, JSValueConst this_val)
}
dom_event_ref(event);
bool cancelable = false;
dom_exception exc = dom_event_get_cancelable(event, &cancelable);
(void)dom_event_get_cancelable(event, &cancelable);
JSValue r = JS_NewBool(ctx, cancelable);
dom_event_unref(event);
@ -143,7 +144,7 @@ js_keyboardEvent_get_property_defaultPrevented(JSContext *ctx, JSValueConst this
}
dom_event_ref(event);
bool prevented = false;
dom_exception exc = dom_event_is_default_prevented(event, &prevented);
(void)dom_event_is_default_prevented(event, &prevented);
JSValue r = JS_NewBool(ctx, prevented);
dom_event_unref(event);
@ -333,16 +334,12 @@ get_keyboardEvent(JSContext *ctx, struct term_event *ev)
dom_string *dom_key = NULL;
convert_key_to_dom_string(keyCode, &dom_key);
dom_string *keydown = NULL;
exc = dom_string_create("keydown", strlen("keydown"), &keydown);
exc = dom_keyboard_event_init(event, keydown, false, false,
exc = dom_keyboard_event_init(event, corestring_dom_keydown, false, false,
NULL, dom_key, NULL, DOM_KEY_LOCATION_STANDARD,
false, false, false, false,
false, false);
if (dom_key) dom_string_unref(dom_key);
if (keydown) dom_string_unref(keydown);
JSValue keyb_obj = JS_NewObjectClass(ctx, js_keyboardEvent_class_id);
JS_SetPropertyFunctionList(ctx, keyb_obj, js_keyboardEvent_proto_funcs, countof(js_keyboardEvent_proto_funcs));
@ -377,10 +374,10 @@ js_keyboardEvent_constructor(JSContext *ctx, JSValueConst new_target, int argc,
size_t len;
if (argc > 0) {
char *t = JS_ToCStringLen(ctx, &len, argv[0]);
const char *t = JS_ToCStringLen(ctx, &len, argv[0]);
if (t) {
exc = dom_string_create(t, strlen(t), &typ);
exc = dom_string_create((const uint8_t *)t, strlen(t), &typ);
JS_FreeCString(ctx, t);
}
}
@ -399,7 +396,7 @@ js_keyboardEvent_constructor(JSContext *ctx, JSValueConst new_target, int argc,
const char *k = JS_ToCStringLen(ctx, &len, r);
if (k) {
exc = dom_string_create(k, strlen(k), &key);
exc = dom_string_create((const uint8_t *)k, strlen(k), &key);
JS_FreeCString(ctx, k);
JS_FreeValue(ctx, r);
}
@ -407,7 +404,7 @@ js_keyboardEvent_constructor(JSContext *ctx, JSValueConst new_target, int argc,
const char *c = JS_ToCStringLen(ctx, &len, r);
if (c) {
exc = dom_string_create(c, strlen(c), &code);
exc = dom_string_create((const uint8_t *)c, strlen(c), &code);
JS_FreeCString(ctx, c);
JS_FreeValue(ctx, r);
}
@ -459,7 +456,7 @@ js_keyboardEvent_init(JSContext *ctx)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSValue proto, obj;
JSValue proto;
/* Event class */
JS_NewClassID(&js_keyboardEvent_class_id);
@ -471,8 +468,8 @@ js_keyboardEvent_init(JSContext *ctx)
JS_SetClassProto(ctx, js_keyboardEvent_class_id, proto);
/* Event object */
obj = JS_NewGlobalCConstructor(ctx, "KeyboardEvent", js_keyboardEvent_constructor, 1, proto);
REF_JS(obj);
(void)JS_NewGlobalCConstructor(ctx, "KeyboardEvent", js_keyboardEvent_constructor, 1, proto);
//REF_JS(obj);
// JS_SetPropertyFunctionList(ctx, obj, js_keyboardEvent_class_funcs, countof(js_keyboardEvent_class_funcs));

View File

@ -417,7 +417,7 @@ js_messageEvent_init(JSContext *ctx)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSValue proto, obj;
JSValue proto;
/* Event class */
JS_NewClassID(&js_messageEvent_class_id);
@ -429,8 +429,8 @@ js_messageEvent_init(JSContext *ctx)
JS_SetClassProto(ctx, js_messageEvent_class_id, proto);
/* Event object */
obj = JS_NewGlobalCConstructor(ctx, "MessageEvent", js_messageEvent_constructor, 1, proto);
REF_JS(obj);
(void)JS_NewGlobalCConstructor(ctx, "MessageEvent", js_messageEvent_constructor, 1, proto);
//REF_JS(obj);
// JS_SetPropertyFunctionList(ctx, obj, js_messageEvent_class_funcs, countof(js_messageEvent_class_funcs));

View File

@ -52,6 +52,7 @@ js_nodeList_SetOpaque(JSValueConst this_val, void *node)
}
}
#if 0
static JSValue
js_nodeList_get_property_length(JSContext *ctx, JSValueConst this_val)
{
@ -78,6 +79,7 @@ js_nodeList_get_property_length(JSContext *ctx, JSValueConst this_val)
return JS_NewInt32(ctx, size);
}
#endif
static JSValue
js_nodeList_item2(JSContext *ctx, JSValueConst this_val, int idx)

View File

@ -76,6 +76,7 @@ js_nodeList2_SetOpaque(JSValueConst this_val, void *node)
}
}
#if 0
static JSValue
js_nodeList2_get_property_length(JSContext *ctx, JSValueConst this_val)
{
@ -88,6 +89,7 @@ js_nodeList2_get_property_length(JSContext *ctx, JSValueConst this_val)
return JS_NewInt32(ctx, size);
}
#endif
static JSValue
js_nodeList2_item(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)

View File

@ -60,7 +60,7 @@ js_tokenlist_add(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *
return JS_UNDEFINED;
}
dom_string *kl = NULL;
dom_exception exc = dom_string_create(klass, size, &kl);
dom_exception exc = dom_string_create((const uint8_t *)klass, size, &kl);
JS_FreeCString(ctx, klass);
if (exc != DOM_NO_ERR || !kl) {
@ -95,7 +95,7 @@ js_tokenlist_contains(JSContext *ctx, JSValueConst this_val, int argc, JSValueCo
return JS_UNDEFINED;
}
dom_string *kl = NULL;
dom_exception exc = dom_string_create(klass, size, &kl);
dom_exception exc = dom_string_create((const uint8_t *)klass, size, &kl);
JS_FreeCString(ctx, klass);
if (exc != DOM_NO_ERR || !kl) {
@ -133,7 +133,7 @@ js_tokenlist_remove(JSContext *ctx, JSValueConst this_val, int argc, JSValueCons
}
dom_string *kl = NULL;
dom_exception exc = dom_string_create(klass, size, &kl);
dom_exception exc = dom_string_create((const uint8_t *)klass, size, &kl);
JS_FreeCString(ctx, klass);
if (exc != DOM_NO_ERR || !kl) {
@ -169,7 +169,7 @@ js_tokenlist_toggle(JSContext *ctx, JSValueConst this_val, int argc, JSValueCons
return JS_UNDEFINED;
}
dom_string *kl = NULL;
dom_exception exc = dom_string_create(klass, size, &kl);
dom_exception exc = dom_string_create((const uint8_t *)klass, size, &kl);
JS_FreeCString(ctx, klass);
if (exc != DOM_NO_ERR || !kl) {
@ -228,7 +228,7 @@ getTokenlist(JSContext *ctx, void *node)
if (!initialized) {
JS_NewClassID(&js_tokenlist_class_id);
//JS_NewClass(JS_GetRuntime(ctx), js_tokenlist_class_id, &js_tokenlist_class);
JS_NewClass(JS_GetRuntime(ctx), js_tokenlist_class_id, &js_tokenlist_class);
initialized = 1;
}
JSValue proto = JS_NewObjectClass(ctx, js_tokenlist_class_id);

View File

@ -726,7 +726,7 @@ js_url_init(JSContext *ctx)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSValue proto, obj;
JSValue proto;
/* url class */
JS_NewClassID(&js_url_class_id);
@ -738,8 +738,8 @@ js_url_init(JSContext *ctx)
JS_SetClassProto(ctx, js_url_class_id, proto);
/* url object */
obj = JS_NewGlobalCConstructor(ctx, "URL", js_url_constructor, 1, proto);
REF_JS(obj);
(void)JS_NewGlobalCConstructor(ctx, "URL", js_url_constructor, 1, proto);
//REF_JS(obj);
return 0;
}

View File

@ -109,7 +109,7 @@ parse_text(JSContext *ctx, JSValue map, char *str)
argv[0] = JS_NewString(ctx, key);
argv[1] = JS_NewString(ctx, value);
JSValue set = JS_GetPropertyStr(ctx, map, "set");
JSValue ret = JS_Call(ctx, set, map, 2, argv);
(void)JS_Call(ctx, set, map, 2, argv);
JS_FreeValue(ctx, set);
JS_FreeValue(ctx, argv[0]);
JS_FreeValue(ctx, argv[1]);
@ -478,7 +478,7 @@ js_urlSearchParams_init(JSContext *ctx)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSValue proto, obj;
JSValue proto;
/* urlSearchParams class */
JS_NewClassID(&js_urlSearchParams_class_id);
@ -490,8 +490,8 @@ js_urlSearchParams_init(JSContext *ctx)
JS_SetClassProto(ctx, js_urlSearchParams_class_id, proto);
/* url object */
obj = JS_NewGlobalCConstructor(ctx, "URLSearchParams", js_urlSearchParams_constructor, 1, proto);
REF_JS(obj);
(void)JS_NewGlobalCConstructor(ctx, "URLSearchParams", js_urlSearchParams_constructor, 1, proto);
//REF_JS(obj);
return 0;
}

View File

@ -107,16 +107,6 @@ CSSStyleDeclaration_get_property_length(JSContext *ctx, unsigned int argc, JS::V
#endif
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
return false;
}
args.rval().setInt32(3); // fake
return true;

View File

@ -62,7 +62,7 @@
static bool customEvent_get_property_bubbles(JSContext *ctx, unsigned int argc, JS::Value *vp);
static bool customEvent_get_property_cancelable(JSContext *ctx, unsigned int argc, JS::Value *vp);
static bool customEvent_get_property_composed(JSContext *ctx, unsigned int argc, JS::Value *vp);
//static bool customEvent_get_property_composed(JSContext *ctx, unsigned int argc, JS::Value *vp);
static bool customEvent_get_property_defaultPrevented(JSContext *ctx, unsigned int argc, JS::Value *vp);
static bool customEvent_get_property_detail(JSContext *ctx, unsigned int argc, JS::Value *vp);
static bool customEvent_get_property_target(JSContext *ctx, unsigned int argc, JS::Value *vp);
@ -134,7 +134,7 @@ customEvent_constructor(JSContext* ctx, unsigned argc, JS::Value* vp)
}
dom_custom_event *event = NULL;
dom_string *CustomEventStr = NULL;
dom_exception exc = dom_string_create("CustomEvent", sizeof("CustomEvent") - 1, &CustomEventStr);
dom_exception exc = dom_string_create((const uint8_t *)"CustomEvent", sizeof("CustomEvent") - 1, &CustomEventStr);
if (exc != DOM_NO_ERR || !CustomEventStr) {
return false;
@ -225,7 +225,7 @@ customEvent_get_property_bubbles(JSContext *ctx, unsigned int argc, JS::Value *v
return false;
}
bool bubbles = false;
dom_exception exc = dom_event_get_bubbles(event, &bubbles);
(void)dom_event_get_bubbles(event, &bubbles);
args.rval().setBoolean(bubbles);
return true;
@ -253,7 +253,7 @@ customEvent_get_property_cancelable(JSContext *ctx, unsigned int argc, JS::Value
return false;
}
bool cancelable = false;
dom_exception exc = dom_event_get_cancelable(event, &cancelable);
(void)dom_event_get_cancelable(event, &cancelable);
args.rval().setBoolean(cancelable);
return true;
@ -309,7 +309,7 @@ customEvent_get_property_defaultPrevented(JSContext *ctx, unsigned int argc, JS:
return false;
}
bool prevented = false;
dom_exception exc = dom_event_is_default_prevented(event, &prevented);
(void)dom_event_is_default_prevented(event, &prevented);
args.rval().setBoolean(prevented);
return true;

View File

@ -93,7 +93,7 @@ dataset_obj_getProperty(JSContext* ctx, JS::HandleObject obj, JS::HandleValue re
mem_free(property);
dom_string *attr_name = NULL;
dom_exception exc = dom_string_create(data.source, data.length, &attr_name);
dom_exception exc = dom_string_create((const uint8_t *)data.source, data.length, &attr_name);
done_string(&data);
if (exc != DOM_NO_ERR || !attr_name) {
@ -154,7 +154,7 @@ dataset_obj_setProperty(JSContext* ctx, JS::HandleObject obj, JS::HandleId id, J
mem_free(property);
dom_string *attr_name = NULL;
dom_exception exc = dom_string_create(data.source, data.length, &attr_name);
dom_exception exc = dom_string_create((const uint8_t *)data.source, data.length, &attr_name);
done_string(&data);
if (exc != DOM_NO_ERR || !attr_name) {
@ -162,7 +162,7 @@ dataset_obj_setProperty(JSContext* ctx, JS::HandleObject obj, JS::HandleId id, J
return result.failInvalidDescriptor();
}
dom_string *attr_value = NULL;
exc = dom_string_create(value, strlen(value), &attr_value);
exc = dom_string_create((const uint8_t *)value, strlen(value), &attr_value);
mem_free(value);
if (exc != DOM_NO_ERR || !attr_value) {
@ -211,13 +211,12 @@ dataset_obj_deleteProperty(JSContext* ctx, JS::HandleObject obj, JS::HandleId id
mem_free(property);
dom_string *attr_name = NULL;
dom_exception exc = dom_string_create(data.source, data.length, &attr_name);
dom_exception exc = dom_string_create((const uint8_t *)data.source, data.length, &attr_name);
done_string(&data);
if (exc != DOM_NO_ERR || !attr_name) {
return result.failCantDelete();
}
dom_string *attr_value = NULL;
exc = dom_element_remove_attribute(el, attr_name);
dom_string_unref(attr_name);
interpreter->changed = true;
@ -256,10 +255,6 @@ static const spidermonkeyFunctionSpec dataset_funcs[] = {
{ NULL }
};
static JSPropertySpec dataset_props[] = {
JS_PS_END
};
JSObject *
getDataset(JSContext *ctx, void *node)
{

View File

@ -161,9 +161,6 @@ document_get_property_anchors(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &document_class, NULL)) {
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
@ -252,9 +249,6 @@ document_get_property_body(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &document_class, NULL)) {
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
@ -382,9 +376,6 @@ document_get_property_charset(JSContext *ctx, unsigned int argc, JS::Value *vp)
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
// TODO
args.rval().setString(JS_NewStringCopyZ(ctx, "utf-8"));
@ -400,18 +391,6 @@ document_get_property_childNodes(JSContext *ctx, unsigned int argc, JS::Value *v
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
return false;
}
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
* such calls. */
@ -476,9 +455,6 @@ document_get_property_doctype(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &document_class, NULL)) {
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
@ -509,9 +485,6 @@ document_get_property_documentElement(JSContext *ctx, unsigned int argc, JS::Val
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &document_class, NULL)) {
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
@ -651,9 +624,6 @@ document_get_property_forms(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &document_class, NULL)) {
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
@ -686,9 +656,6 @@ document_get_property_head(JSContext *ctx, unsigned int argc, JS::Value *vp)
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
// TODO
args.rval().setNull();
return true;
@ -703,9 +670,6 @@ document_get_property_images(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &document_class, NULL)) {
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
@ -739,11 +703,8 @@ document_get_property_implementation(JSContext *ctx, unsigned int argc, JS::Valu
#endif
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
JSObject *obj = getImplementation(ctx);
if (!obj) {
args.rval().setNull();
} else {
@ -761,9 +722,6 @@ document_get_property_links(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &document_class, NULL)) {
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
@ -1008,8 +966,6 @@ document_get_property_scripts(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
// TODO
args.rval().setNull();
@ -1226,7 +1182,7 @@ static bool document_writeln(JSContext *ctx, unsigned int argc, JS::Value *rval)
static bool document_replace(JSContext *ctx, unsigned int argc, JS::Value *rval);
static bool document_getElementById(JSContext *ctx, unsigned int argc, JS::Value *rval);
static bool document_getElementsByClassName(JSContext *ctx, unsigned int argc, JS::Value *rval);
static bool document_getElementsByName(JSContext *ctx, unsigned int argc, JS::Value *rval);
//static bool document_getElementsByName(JSContext *ctx, unsigned int argc, JS::Value *rval);
static bool document_getElementsByTagName(JSContext *ctx, unsigned int argc, JS::Value *rval);
static bool document_querySelector(JSContext *ctx, unsigned int argc, JS::Value *rval);
static bool document_querySelectorAll(JSContext *ctx, unsigned int argc, JS::Value *rval);
@ -1485,7 +1441,7 @@ document_addEventListener(JSContext *ctx, unsigned int argc, JS::Value *rval)
handler_privates[doc_private] = true;
}
dom_string *typ = NULL;
exc = dom_string_create(method, strlen(method), &typ);
exc = dom_string_create((const uint8_t *)method, strlen(method), &typ);
if (exc != DOM_NO_ERR || !typ) {
goto ex;
@ -1556,9 +1512,8 @@ document_removeEventListener(JSContext *ctx, unsigned int argc, JS::Value *rval)
continue;
}
if (*(l->fun) == fun) {
dom_string *typ = NULL;
dom_exception exc = dom_string_create(method, strlen(method), &typ);
dom_exception exc = dom_string_create((const uint8_t *)method, strlen(method), &typ);
if (exc != DOM_NO_ERR || !typ) {
continue;
@ -1600,8 +1555,6 @@ document_createComment(JSContext *ctx, unsigned int argc, JS::Value *vp)
args.rval().setBoolean(false);
return true;
}
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
dom_document *doc = JS::GetMaybePtrFromReservedSlot<dom_document>(hobj, 0);
if (!doc) {
@ -1660,9 +1613,6 @@ document_createDocumentFragment(JSContext *ctx, unsigned int argc, JS::Value *vp
args.rval().setBoolean(false);
return true;
}
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
dom_document *doc = JS::GetMaybePtrFromReservedSlot<dom_document>(hobj, 0);
if (!doc) {
@ -1703,8 +1653,6 @@ document_createElement(JSContext *ctx, unsigned int argc, JS::Value *vp)
args.rval().setBoolean(false);
return true;
}
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
dom_document *doc = JS::GetMaybePtrFromReservedSlot<dom_document>(hobj, 0);
dom_string *tag_name = NULL;
dom_exception exc;
@ -1778,9 +1726,9 @@ document_dispatchEvent(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::RootedObject eve(ctx, &args[0].toObject());
dom_event *event = (dom_event *)JS::GetMaybePtrFromReservedSlot<dom_event>(eve, 0);
bool result = false;
dom_exception exc = dom_event_target_dispatch_event(doc, event, &result);
(void)dom_event_target_dispatch_event(doc, event, &result);
args.rval().setBoolean(result);
return true;
}
@ -1793,8 +1741,6 @@ document_event_handler(dom_event *event, void *pw)
struct document_private *doc_private = (struct document_private *)pw;
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)doc_private->interpreter;
JSContext *ctx = (JSContext *)interpreter->backend_data;
dom_document *doc = (dom_document *)doc_private->doc;
JSAutoRealm ar(ctx, (JSObject *)interpreter->ac->get());
JS::RootedValue r_val(ctx);
@ -1860,8 +1806,6 @@ document_createTextNode(JSContext *ctx, unsigned int argc, JS::Value *vp)
args.rval().setBoolean(false);
return true;
}
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
dom_document *doc = JS::GetMaybePtrFromReservedSlot<dom_document>(hobj, 0);
dom_string *data = NULL;
dom_exception exc;
@ -1915,9 +1859,6 @@ document_getElementById(JSContext *ctx, unsigned int argc, JS::Value *vp)
args.rval().setBoolean(false);
return true;
}
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
dom_document *doc = JS::GetMaybePtrFromReservedSlot<dom_document>(hobj, 0);
if (!doc) {
@ -1971,7 +1912,7 @@ document_getElementsByClassName(JSContext *ctx, unsigned int argc, JS::Value *vp
#endif
return false;
}
dom_html_document *doc = JS::GetMaybePtrFromReservedSlot<dom_html_document>(hobj, 0);
dom_html_document *doc = (dom_html_document *)JS::GetMaybePtrFromReservedSlot<dom_html_document>(hobj, 0);
if (!doc) {
args.rval().setNull();
@ -1983,7 +1924,7 @@ document_getElementsByClassName(JSContext *ctx, unsigned int argc, JS::Value *vp
return true;
}
char *classes = jsval_to_string(ctx, args[0]);
dom_html_collection *col = get_elements_by_class_name(doc, (dom_node *)doc, classes);
dom_html_collection *col = (dom_html_collection *)get_elements_by_class_name(doc, (dom_node *)doc, classes);
mem_free_if(classes);
if (!col) {
@ -1996,6 +1937,7 @@ document_getElementsByClassName(JSContext *ctx, unsigned int argc, JS::Value *vp
return true;
}
#if 0
static bool
document_getElementsByName(JSContext *ctx, unsigned int argc, JS::Value *vp)
{
@ -2017,6 +1959,7 @@ document_getElementsByName(JSContext *ctx, unsigned int argc, JS::Value *vp)
return true;
}
#endif
static bool
document_getElementsByTagName(JSContext *ctx, unsigned int argc, JS::Value *vp)
@ -2038,9 +1981,6 @@ document_getElementsByTagName(JSContext *ctx, unsigned int argc, JS::Value *vp)
args.rval().setBoolean(false);
return true;
}
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
dom_document *doc = JS::GetMaybePtrFromReservedSlot<dom_document>(hobj, 0);
if (!doc) {
@ -2099,9 +2039,6 @@ document_querySelector(JSContext *ctx, unsigned int argc, JS::Value *vp)
args.rval().setBoolean(false);
return true;
}
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
dom_document *doc = JS::GetMaybePtrFromReservedSlot<dom_document>(hobj, 0);
if (!doc) {
@ -2157,8 +2094,6 @@ document_querySelectorAll(JSContext *ctx, unsigned int argc, JS::Value *vp)
args.rval().setBoolean(false);
return true;
}
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
dom_document *doc = JS::GetMaybePtrFromReservedSlot<dom_document>(hobj, 0);
if (!doc) {
@ -2425,7 +2360,7 @@ getDocument(JSContext *ctx, void *doc)
}
init_list(doc_private->listeners);
doc_private->ref_count = 1;
doc_private->doc = doc;
doc_private->doc = (dom_document *)doc;
JSObject *el = JS_NewObject(ctx, &document_class);
if (!el) {
@ -2463,7 +2398,7 @@ initDocument(JSContext *ctx, struct ecmascript_interpreter *interpreter, JSObjec
JS::RootedObject r_el(ctx, document_obj);
doc_private->interpreter = interpreter;
doc_private->thisval = r_el;
doc_private->doc = doc;
doc_private->doc = (dom_document *)doc;
init_list(doc_private->listeners);
doc_private->ref_count = 1;

View File

@ -540,7 +540,7 @@ domRect_set_property_y(JSContext *ctx, unsigned int argc, JS::Value *vp)
JSObject *
getDomRect(JSContext *ctx)
{
struct eljs_domrect *d = mem_calloc(1, sizeof(*d));
struct eljs_domrect *d = (struct eljs_domrect *)mem_calloc(1, sizeof(*d));
if (!d) {
return NULL;

View File

@ -3513,9 +3513,6 @@ element_set_property_textContent(JSContext *ctx, unsigned int argc, JS::Value *v
#endif
return false;
}
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
* such calls. */
@ -3531,7 +3528,7 @@ element_set_property_textContent(JSContext *ctx, unsigned int argc, JS::Value *v
args.rval().setUndefined();
return true;
}
const char *str = jsval_to_string(ctx, args[0]);
char *str = jsval_to_string(ctx, args[0]);
if (!str) {
return false;
@ -3840,7 +3837,7 @@ element_addEventListener(JSContext *ctx, unsigned int argc, JS::Value *rval)
}
}
dom_string *typ = NULL;
exc = dom_string_create(method, strlen(method), &typ);
exc = dom_string_create((const uint8_t *)method, strlen(method), &typ);
if (exc != DOM_NO_ERR || !typ) {
goto ex;
@ -3914,7 +3911,7 @@ element_removeEventListener(JSContext *ctx, unsigned int argc, JS::Value *rval)
if (*(l->fun) == fun) {
dom_string *typ = NULL;
dom_exception exc = dom_string_create(method, strlen(method), &typ);
dom_exception exc = dom_string_create((const uint8_t *)method, strlen(method), &typ);
if (exc != DOM_NO_ERR || !typ) {
continue;
@ -5431,9 +5428,9 @@ element_dispatchEvent(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::RootedObject eve(ctx, &args[0].toObject());
dom_event *event = (dom_event *)JS::GetMaybePtrFromReservedSlot<dom_event>(eve, 0);
bool result = false;
dom_exception exc = dom_event_target_dispatch_event(element, event, &result);
(void)dom_event_target_dispatch_event(element, event, &result);
args.rval().setBoolean(result);
return true;
}
@ -5446,11 +5443,8 @@ element_event_handler(dom_event *event, void *pw)
struct element_private *el_private = (struct element_private *)pw;
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)el_private->interpreter;
JSContext *ctx = (JSContext *)interpreter->backend_data;
dom_node *element = (dom_node *)el_private->node;
JSAutoRealm ar(ctx, (JSObject *)interpreter->ac->get());
JS::RootedValue r_val(ctx);
interpreter->heartbeat = add_heartbeat(interpreter);
if (!event) {
return;
@ -5461,6 +5455,7 @@ element_event_handler(dom_event *event, void *pw)
if (exc != DOM_NO_ERR || !typ) {
return;
}
interpreter->heartbeat = add_heartbeat(interpreter);
JSObject *obj_ev = getEvent(ctx, event);
interpreter->heartbeat = add_heartbeat(interpreter);

View File

@ -201,7 +201,7 @@ event_get_property_bubbles(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
bool bubbles = false;
dom_exception exc = dom_event_get_bubbles(event, &bubbles);
(void)dom_event_get_bubbles(event, &bubbles);
args.rval().setBoolean(bubbles);
return true;
@ -229,7 +229,7 @@ event_get_property_cancelable(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
bool cancelable = false;
dom_exception exc = dom_event_get_cancelable(event, &cancelable);
(void)dom_event_get_cancelable(event, &cancelable);
args.rval().setBoolean(cancelable);
return true;
@ -285,7 +285,7 @@ event_get_property_defaultPrevented(JSContext *ctx, unsigned int argc, JS::Value
return false;
}
bool prevented = false;
dom_exception exc = dom_event_is_default_prevented(event, &prevented);
(void)dom_event_is_default_prevented(event, &prevented);
args.rval().setBoolean(prevented);
return true;

View File

@ -24,6 +24,7 @@
#include "document/html/frames.h"
#include "document/document.h"
#include "document/forms.h"
#include "document/libdom/corestrings.h"
#include "document/libdom/doc.h"
#include "document/view.h"
#include "ecmascript/ecmascript.h"
@ -76,9 +77,6 @@ static bool keyboardEvent_get_property_type(JSContext *ctx, unsigned int argc, J
static bool keyboardEvent_preventDefault(JSContext *ctx, unsigned int argc, JS::Value *vp);
static term_event_key_T keyCode;
static void
keyboardEvent_finalize(JS::GCContext *op, JSObject *keyb_obj)
{
@ -142,7 +140,7 @@ keyboardEvent_constructor(JSContext* ctx, unsigned argc, JS::Value* vp)
char *t = jsval_to_string(ctx, args[0]);
if (t) {
exc = dom_string_create(t, strlen(t), &typ);
exc = dom_string_create((const uint8_t *)t, strlen(t), &typ);
mem_free(t);
}
}
@ -168,7 +166,7 @@ keyboardEvent_constructor(JSContext* ctx, unsigned argc, JS::Value* vp)
char *k = jsval_to_string(ctx, v);
if (k) {
exc = dom_string_create(k, strlen(k), &key);
exc = dom_string_create((const uint8_t *)k, strlen(k), &key);
mem_free(k);
}
}
@ -176,7 +174,7 @@ keyboardEvent_constructor(JSContext* ctx, unsigned argc, JS::Value* vp)
char *c = jsval_to_string(ctx, v);
if (c) {
exc = dom_string_create(c, strlen(c), &code);
exc = dom_string_create((const uint8_t *)c, strlen(c), &code);
mem_free(c);
}
}
@ -235,7 +233,7 @@ keyboardEvent_get_property_bubbles(JSContext *ctx, unsigned int argc, JS::Value
return false;
}
bool bubbles = false;
dom_exception exc = dom_event_get_bubbles(event, &bubbles);
(void)dom_event_get_bubbles(event, &bubbles);
args.rval().setBoolean(bubbles);
return true;
@ -263,7 +261,7 @@ keyboardEvent_get_property_cancelable(JSContext *ctx, unsigned int argc, JS::Val
return false;
}
bool cancelable = false;
dom_exception exc = dom_event_get_cancelable(event, &cancelable);
(void)dom_event_get_cancelable(event, &cancelable);
args.rval().setBoolean(cancelable);
return true;
@ -319,7 +317,7 @@ keyboardEvent_get_property_defaultPrevented(JSContext *ctx, unsigned int argc, J
return false;
}
bool prevented = false;
dom_exception exc = dom_event_is_default_prevented(event, &prevented);
(void)dom_event_is_default_prevented(event, &prevented);
args.rval().setBoolean(prevented);
return true;
@ -540,14 +538,9 @@ get_keyboardEvent(JSContext *ctx, struct term_event *ev)
return NULL;
}
term_event_key_T keyCode = get_kbd_key(ev);
dom_string *dom_key = NULL;
convert_key_to_dom_string(keyCode, &dom_key);
dom_string *keydown = NULL;
exc = dom_string_create("keydown", strlen("keydown"), &keydown);
exc = dom_keyboard_event_init(keyb, keydown, false, false,
exc = dom_keyboard_event_init(keyb, corestring_dom_keydown, false, false,
NULL, dom_key, NULL, DOM_KEY_LOCATION_STANDARD,
false, false, false, false,
false, false);
@ -555,9 +548,6 @@ get_keyboardEvent(JSContext *ctx, struct term_event *ev)
if (dom_key) {
dom_string_unref(dom_key);
}
if (keydown) {
dom_string_unref(keydown);
}
// keyb->keyCode = keyCode;
JS::SetReservedSlot(k, 0, JS::PrivateValue(keyb));

View File

@ -55,8 +55,6 @@
#include <string>
static bool nodeList2_item(JSContext *ctx, unsigned int argc, JS::Value *rval);
static bool nodeList2_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::MutableHandleValue hvp);
static void nodeList2_finalize(JS::GCContext *op, JSObject *obj)
{
#ifdef ECMASCRIPT_DEBUG
@ -108,8 +106,6 @@ nodeList2_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
@ -118,9 +114,6 @@ nodeList2_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif
return false;
}
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
* such calls. */

View File

@ -627,7 +627,6 @@ style_get_property_cssText(JSContext *ctx, unsigned int argc, JS::Value *vp)
dom_node *el = (dom_node *)JS::GetMaybePtrFromReservedSlot<dom_node>(hobj, 0);
dom_exception exc;
dom_string *style = NULL;
char *res = NULL;
if (!el) {
args.rval().setNull();

View File

@ -132,7 +132,7 @@ tokenlist_add(JSContext *ctx, unsigned int argc, JS::Value *vp)
return true;
}
dom_string *kl = NULL;
dom_exception exc = dom_string_create(klass, strlen(klass), &kl);
dom_exception exc = dom_string_create((const uint8_t *)klass, strlen(klass), &kl);
mem_free(klass);
if (exc != DOM_NO_ERR || !kl) {
@ -167,7 +167,6 @@ tokenlist_contains(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif
return false;
}
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
dom_tokenlist *tl = JS::GetMaybePtrFromReservedSlot<dom_tokenlist>(hobj, 0);
if (!tl || argc < 1) {
@ -181,7 +180,7 @@ tokenlist_contains(JSContext *ctx, unsigned int argc, JS::Value *vp)
return true;
}
dom_string *kl = NULL;
dom_exception exc = dom_string_create(klass, strlen(klass), &kl);
dom_exception exc = dom_string_create((const uint8_t *)klass, strlen(klass), &kl);
mem_free(klass);
if (exc != DOM_NO_ERR || !kl) {
@ -232,7 +231,7 @@ tokenlist_remove(JSContext *ctx, unsigned int argc, JS::Value *vp)
return true;
}
dom_string *kl = NULL;
dom_exception exc = dom_string_create(klass, strlen(klass), &kl);
dom_exception exc = dom_string_create((const uint8_t *)klass, strlen(klass), &kl);
mem_free(klass);
if (exc != DOM_NO_ERR || !kl) {
@ -281,7 +280,7 @@ tokenlist_toggle(JSContext *ctx, unsigned int argc, JS::Value *vp)
return true;
}
dom_string *kl = NULL;
dom_exception exc = dom_string_create(klass, strlen(klass), &kl);
dom_exception exc = dom_string_create((const uint8_t *)klass, strlen(klass), &kl);
mem_free(klass);
if (exc != DOM_NO_ERR || !kl) {

View File

@ -64,9 +64,6 @@ struct eljs_urlSearchParams {
JS::Heap<JSObject *> map;
};
static bool url_get_property_hash(JSContext *ctx, unsigned int argc, JS::Value *vp);
static bool url_set_property_hash(JSContext *ctx, unsigned int argc, JS::Value *vp);
static void
urlSearchParams_finalize(JS::GCContext *op, JSObject *u_obj)
{
@ -463,7 +460,7 @@ urlSearchParams_set(JSContext *ctx, unsigned int argc, JS::Value *rval)
}
static struct string result;
static char *prepend;
static const char *prepend;
static bool
map_foreach_callback(JSContext *ctx, unsigned int argc, JS::Value *rval)