1
0
Fork 0

[mujs] Some js_pushnull replaced by js_error

This commit is contained in:
Witold Filipczyk 2023-01-28 21:39:22 +01:00
parent c058675c5d
commit 2faa4a6ff3
13 changed files with 127 additions and 127 deletions

View File

@ -65,7 +65,7 @@ mjs_attr_get_property_name(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
xmlpp::AttributeNode *attr = static_cast<xmlpp::AttributeNode *>(js_touserdata(J, 0, "attr"));
@ -91,7 +91,7 @@ mjs_attr_get_property_value(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}

View File

@ -109,7 +109,7 @@ mjs_attributes_get_property_length(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
xmlpp::Element::AttributeList *al = static_cast<xmlpp::Element::AttributeList *>(js_touserdata(J, 0, "attribute"));

View File

@ -193,7 +193,7 @@ mjs_document_get_property_cookie(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
cookies = send_cookies_js(vs->uri);
@ -226,7 +226,7 @@ mjs_document_set_property_cookie(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
const char *text = js_tostring(J, 1);
@ -407,7 +407,7 @@ mjs_document_get_property_documentURI(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!str");
return;
}
js_pushstring(J, str);
@ -428,7 +428,7 @@ mjs_document_get_property_domain(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
@ -438,7 +438,7 @@ mjs_document_get_property_domain(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!str");
return;
}
js_pushstring(J, str);
@ -641,7 +641,7 @@ mjs_document_get_property_referrer(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -746,7 +746,7 @@ mjs_document_get_property_title(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -770,7 +770,7 @@ mjs_document_set_property_title(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs || !doc_view");
return;
}
doc_view = vs->doc_view;
@ -780,7 +780,7 @@ mjs_document_set_property_title(js_State *J)
char *string;
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
string = stracpy(str);
@ -805,7 +805,7 @@ mjs_document_get_property_url(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -837,14 +837,14 @@ mjs_document_set_property_url(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
const char *url = js_tostring(J, 1);
if (!url) {
js_pushnull(J);
js_error(J, "!url");
return;
}
location_goto_const(doc_view, url);
@ -931,12 +931,12 @@ mjs_document_replace(js_State *J)
struct string heystack;
if (!init_string(&needle)) {
js_pushnull(J);
js_error(J, "out of memory");
return;
}
if (!init_string(&heystack)) {
done_string(&needle);
js_pushnull(J);
js_error(J, "out of memory");
return;
}
@ -1005,7 +1005,7 @@ mjs_document_createComment(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
xmlpp::ustring text = str;
@ -1076,7 +1076,7 @@ mjs_document_createElement(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
xmlpp::ustring text = str;
@ -1110,7 +1110,7 @@ mjs_document_createTextNode(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
xmlpp::ustring text = str;
@ -1147,7 +1147,7 @@ mjs_document_getElementById(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
xmlpp::ustring id = str;
@ -1190,7 +1190,7 @@ mjs_document_getElementsByClassName(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
xmlpp::ustring id = str;
@ -1232,7 +1232,7 @@ mjs_document_getElementsByName(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
xmlpp::ustring id = str;
@ -1274,7 +1274,7 @@ mjs_document_getElementsByTagName(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
xmlpp::ustring id = str;
@ -1315,7 +1315,7 @@ mjs_document_querySelector(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
xmlpp::ustring css = str;
@ -1362,7 +1362,7 @@ mjs_document_querySelectorAll(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
xmlpp::ustring css = str;

View File

@ -781,7 +781,7 @@ mjs_element_get_property_innerHtml(js_State *J)
}
struct string buf;
if (!init_string(&buf)) {
js_pushnull(J);
js_error(J, "out of memory");
return;
}
walk_tree(&buf, el);
@ -803,7 +803,7 @@ mjs_element_get_property_outerHtml(js_State *J)
}
struct string buf;
if (!init_string(&buf)) {
js_pushnull(J);
js_error(J, "out of memory");
return;
}
walk_tree(&buf, el, false);
@ -825,7 +825,7 @@ mjs_element_get_property_textContent(js_State *J)
}
struct string buf;
if (!init_string(&buf)) {
js_pushnull(J);
js_error(J, "out of memory");
return;
}
walk_tree_content(&buf, el);
@ -1059,13 +1059,13 @@ mjs_element_addEventListener(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
char *method = stracpy(str);
if (!method) {
js_pushnull(J);
js_error(J, "out of memory");
return;
}
js_copy(J, 2);
@ -1108,13 +1108,13 @@ mjs_element_removeEventListener(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
char *method = stracpy(str);
if (!method) {
js_pushnull(J);
js_error(J, "out of memory");
return;
}
js_copy(J, 2);
@ -1331,7 +1331,7 @@ mjs_element_getAttributeNode(js_State *J)
}
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
xmlpp::ustring v = str;
@ -1356,7 +1356,7 @@ mjs_element_getElementsByTagName(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
xmlpp::ustring id = str;
@ -1474,12 +1474,12 @@ mjs_element_isEqualNode(js_State *J)
struct string second;
if (!init_string(&first)) {
js_pushnull(J);
js_error(J, "out of memory");
return;
}
if (!init_string(&second)) {
done_string(&first);
js_pushnull(J);
js_error(J, "out of memory");
return;
}

View File

@ -345,7 +345,7 @@ mjs_form_elements_namedItem(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
mjs_form_elements_namedItem2(J, str);
@ -408,7 +408,7 @@ mjs_form_set_property_action(js_State *J)
char *string;
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
string = stracpy(str);
@ -513,7 +513,7 @@ mjs_form_get_property_encoding(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
form = (struct form *)js_touserdata(J, 0, "form");
@ -557,7 +557,7 @@ mjs_form_set_property_encoding(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
@ -654,7 +654,7 @@ mjs_form_set_property_method(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
@ -714,7 +714,7 @@ mjs_form_set_property_name(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
mem_free_set(&form->name, stracpy(str));
@ -768,7 +768,7 @@ mjs_form_set_property_target(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
mem_free_set(&form->target, stracpy(str));

View File

@ -190,7 +190,7 @@ mjs_forms_namedItem(js_State *J)
const char *str = js_tostring(J, 1);;
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
mjs_find_form_by_name(J, doc_view, str);

View File

@ -28,13 +28,13 @@ mjs_implementation_createHTMLDocument(js_State *J)
const char *title = js_tostring(J, 1);
if (!title) {
js_pushnull(J);
js_error(J, "!title");
return;
}
struct string str;
if (!init_string(&str)) {
js_pushnull(J);
js_error(J, "out of memory");
return;
}
add_to_string(&str, "<!doctype html>\n<html><head><title>");

View File

@ -136,7 +136,7 @@ mjs_input_get_property_accessKey(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -194,7 +194,7 @@ mjs_input_set_property_accessKey(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -244,7 +244,7 @@ mjs_input_get_property_alt(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -282,7 +282,7 @@ mjs_input_set_property_alt(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -303,7 +303,7 @@ mjs_input_set_property_alt(js_State *J)
char *string;
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
string = stracpy(str);
@ -347,7 +347,7 @@ mjs_input_set_property_checked(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -392,7 +392,7 @@ mjs_input_get_property_defaultChecked(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -430,7 +430,7 @@ mjs_input_get_property_defaultValue(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -467,7 +467,7 @@ mjs_input_get_property_disabled(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -508,7 +508,7 @@ mjs_input_set_property_disabled(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -564,7 +564,7 @@ mjs_input_get_property_maxLength(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -603,7 +603,7 @@ mjs_input_set_property_maxLength(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -643,7 +643,7 @@ mjs_input_get_property_name(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -683,7 +683,7 @@ mjs_input_set_property_name(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -703,7 +703,7 @@ mjs_input_set_property_name(js_State *J)
char *string;
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
@ -730,7 +730,7 @@ mjs_input_get_property_readonly(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -771,7 +771,7 @@ mjs_input_set_property_readonly(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -817,7 +817,7 @@ mjs_input_get_property_selectedIndex(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -864,7 +864,7 @@ mjs_input_set_property_selectedIndex(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -912,7 +912,7 @@ mjs_input_get_property_size(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -953,7 +953,7 @@ mjs_input_get_property_src(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -1029,7 +1029,7 @@ mjs_input_set_property_src(js_State *J)
char *string;
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
@ -1059,7 +1059,7 @@ mjs_input_get_property_tabIndex(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -1111,7 +1111,7 @@ mjs_input_get_property_type(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -1185,7 +1185,7 @@ mjs_input_set_property_value(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
doc_view = vs->doc_view;
@ -1209,7 +1209,7 @@ mjs_input_set_property_value(js_State *J)
char *string;
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}

View File

@ -79,7 +79,7 @@ mjs_push_keyboardEvent(js_State *J, struct term_event *ev)
struct keyboard *keyb = (struct keyboard *)mem_calloc(1, sizeof(*keyb));
if (!keyb) {
js_pushnull(J);
js_error(J, "out of memory");
return;
}
keyCode = keyb->keyCode = get_kbd_key(ev);

View File

@ -56,13 +56,13 @@ mjs_location_get_property_hash(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
struct string fragment;
if (!init_string(&fragment)) {
js_pushnull(J);
js_error(J, "out of memory");
return;
}
@ -86,7 +86,7 @@ mjs_location_get_property_host(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
@ -96,7 +96,7 @@ mjs_location_get_property_host(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!str");
return;
}
js_pushstring(J, str);
@ -116,7 +116,7 @@ mjs_location_get_property_hostname(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
@ -126,7 +126,7 @@ mjs_location_get_property_hostname(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!str");
return;
}
js_pushstring(J, str);
@ -146,7 +146,7 @@ mjs_location_get_property_href(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
@ -156,7 +156,7 @@ mjs_location_get_property_href(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!str");
return;
}
js_pushstring(J, str);
@ -176,7 +176,7 @@ mjs_location_get_property_origin(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
@ -186,7 +186,7 @@ mjs_location_get_property_origin(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!str");
return;
}
js_pushstring(J, str);
@ -206,13 +206,13 @@ mjs_location_get_property_pathname(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
struct string pathname;
if (!init_string(&pathname)) {
js_pushnull(J);
js_error(J, "out of memory");
return;
}
@ -237,13 +237,13 @@ mjs_location_get_property_port(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
struct string port;
if (!init_string(&port)) {
js_pushnull(J);
js_error(J, "out of memory");
return;
}
if (vs->uri->portlen) {
@ -266,13 +266,13 @@ mjs_location_get_property_protocol(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
struct string proto;
if (!init_string(&proto)) {
js_pushnull(J);
js_error(J, "out of memory");
return;
}
@ -300,13 +300,13 @@ mjs_location_get_property_search(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
struct string search;
if (!init_string(&search)) {
js_pushnull(J);
js_error(J, "out of memory");
return;
}
@ -332,13 +332,13 @@ mjs_location_set_property_hash(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
location_goto_const(vs->doc_view, str);
@ -358,13 +358,13 @@ mjs_location_set_property_host(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
location_goto_const(vs->doc_view, str);
@ -384,13 +384,13 @@ mjs_location_set_property_hostname(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
location_goto_const(vs->doc_view, str);
@ -410,13 +410,13 @@ mjs_location_set_property_href(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
location_goto_const(vs->doc_view, str);
@ -436,13 +436,13 @@ mjs_location_set_property_pathname(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
location_goto_const(vs->doc_view, str);
@ -462,13 +462,13 @@ mjs_location_set_property_port(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
location_goto_const(vs->doc_view, str);
@ -488,13 +488,13 @@ mjs_location_set_property_protocol(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
location_goto_const(vs->doc_view, str);
@ -514,13 +514,13 @@ mjs_location_set_property_search(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
location_goto_const(vs->doc_view, str);
@ -540,7 +540,7 @@ mjs_location_reload(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif
js_pushnull(J);
js_error(J, "!vs");
return;
}
location_goto_const(vs->doc_view, "");

View File

@ -93,7 +93,7 @@ mjs_push_messageEvent(js_State *J, char *data, char *origin, char *source)
struct message_event *event = (struct message_event *)mem_calloc(1, sizeof(*event));
if (!event) {
js_pushnull(J);
js_error(J, "out of memory");
return;
}
event->data = null_or_stracpy(data);

View File

@ -145,7 +145,7 @@ mjs_window_set_property_status(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
char *text = stracpy(str);
@ -437,7 +437,7 @@ mjs_window_addEventListener(js_State *J)
elwin = (struct el_window *)mem_calloc(1, sizeof(*elwin));
if (!elwin) {
js_pushnull(J);
js_error(J, "out of memory");
return;
}
init_list(elwin->listeners);
@ -448,13 +448,13 @@ mjs_window_addEventListener(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
char *method = stracpy(str);
if (!method) {
js_pushnull(J);
js_error(J, "out of memory");
return;
}
js_copy(J, 2);
@ -497,13 +497,13 @@ mjs_window_removeEventListener(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
char *method = stracpy(str);
if (!method) {
js_pushnull(J);
js_error(J, "out of memory");
return;
}
js_copy(J, 2);
@ -580,7 +580,7 @@ mjs_window_postMessage(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
char *data = stracpy(str);
@ -589,7 +589,7 @@ mjs_window_postMessage(js_State *J)
if (!str2) {
mem_free_if(data);
js_pushnull(J);
js_error(J, "!str2");
return;
}
char *targetOrigin = stracpy(str2);
@ -606,7 +606,7 @@ mjs_window_postMessage(js_State *J)
struct el_message *mess = (struct el_message *)mem_calloc(1, sizeof(*mess));
if (!mess) {
js_pushnull(J);
js_error(J, "out of memory");
return;
}
mess->messageObject = val;

View File

@ -278,13 +278,13 @@ mjs_xhr_addEventListener(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
char *method = stracpy(str);
if (!method) {
js_pushnull(J);
js_error(J, "out of memory");
return;
}
js_copy(J, 2);
@ -327,13 +327,13 @@ mjs_xhr_removeEventListener(js_State *J)
const char *str = js_tostring(J, 1);
if (!str) {
js_pushnull(J);
js_error(J, "!str");
return;
}
char *method = stracpy(str);
if (!method) {
js_pushnull(J);
js_error(J, "out of memory");
return;
}
js_copy(J, 2);
@ -426,7 +426,7 @@ mjs_xhr_open(js_State *J)
const char *method = js_tostring(J, 1);
if (!method) {
js_pushnull(J);
js_error(J, "!method");
return;
}
@ -495,7 +495,7 @@ mjs_xhr_open(js_State *J)
char *url2 = get_uri_string(xhr->uri, URI_DIR_LOCATION | URI_PATH | URI_USER | URI_PASSWORD);
if (!url2) {
js_pushnull(J);
js_error(J, "!url2");
return;
}
done_uri(xhr->uri);
@ -811,7 +811,7 @@ mjs_xhr_send(js_State *J)
if (body) {
struct string post;
if (!init_string(&post)) {
js_pushnull(J);
js_error(J, "out of memory");
return;
}
@ -827,7 +827,7 @@ mjs_xhr_send(js_State *J)
done_string(&post);
if (!url2) {
js_pushnull(J);
js_error(J, "!url2");
return;
}
done_uri(xhr->uri);