From 2faa4a6ff3cfd0f1bc24447658a6a30b62bdff48 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sat, 28 Jan 2023 21:39:22 +0100 Subject: [PATCH] [mujs] Some js_pushnull replaced by js_error --- src/ecmascript/mujs/attr.cpp | 4 +- src/ecmascript/mujs/attributes.cpp | 2 +- src/ecmascript/mujs/document.cpp | 46 ++++++++--------- src/ecmascript/mujs/element.cpp | 22 ++++---- src/ecmascript/mujs/form.cpp | 14 +++--- src/ecmascript/mujs/forms.cpp | 2 +- src/ecmascript/mujs/implementation.cpp | 4 +- src/ecmascript/mujs/input.cpp | 52 +++++++++---------- src/ecmascript/mujs/keyboard.cpp | 2 +- src/ecmascript/mujs/location.cpp | 70 +++++++++++++------------- src/ecmascript/mujs/message.cpp | 2 +- src/ecmascript/mujs/window.cpp | 18 +++---- src/ecmascript/mujs/xhr.cpp | 16 +++--- 13 files changed, 127 insertions(+), 127 deletions(-) diff --git a/src/ecmascript/mujs/attr.cpp b/src/ecmascript/mujs/attr.cpp index 5e6b9f8e..c03377b6 100644 --- a/src/ecmascript/mujs/attr.cpp +++ b/src/ecmascript/mujs/attr.cpp @@ -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(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; } diff --git a/src/ecmascript/mujs/attributes.cpp b/src/ecmascript/mujs/attributes.cpp index 5be601de..b86b402a 100644 --- a/src/ecmascript/mujs/attributes.cpp +++ b/src/ecmascript/mujs/attributes.cpp @@ -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(js_touserdata(J, 0, "attribute")); diff --git a/src/ecmascript/mujs/document.cpp b/src/ecmascript/mujs/document.cpp index 9a03c97d..5851bdb4 100644 --- a/src/ecmascript/mujs/document.cpp +++ b/src/ecmascript/mujs/document.cpp @@ -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; diff --git a/src/ecmascript/mujs/element.cpp b/src/ecmascript/mujs/element.cpp index 933f2384..bf3e71ef 100644 --- a/src/ecmascript/mujs/element.cpp +++ b/src/ecmascript/mujs/element.cpp @@ -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; } diff --git a/src/ecmascript/mujs/form.cpp b/src/ecmascript/mujs/form.cpp index 7d245d5b..cb0aded9 100644 --- a/src/ecmascript/mujs/form.cpp +++ b/src/ecmascript/mujs/form.cpp @@ -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)); diff --git a/src/ecmascript/mujs/forms.cpp b/src/ecmascript/mujs/forms.cpp index 534fa1a6..3644d186 100644 --- a/src/ecmascript/mujs/forms.cpp +++ b/src/ecmascript/mujs/forms.cpp @@ -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); diff --git a/src/ecmascript/mujs/implementation.cpp b/src/ecmascript/mujs/implementation.cpp index 9ab4c3b5..8e2da8bd 100644 --- a/src/ecmascript/mujs/implementation.cpp +++ b/src/ecmascript/mujs/implementation.cpp @@ -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, "\n"); diff --git a/src/ecmascript/mujs/input.cpp b/src/ecmascript/mujs/input.cpp index 4e540fc2..6edc260d 100644 --- a/src/ecmascript/mujs/input.cpp +++ b/src/ecmascript/mujs/input.cpp @@ -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; } diff --git a/src/ecmascript/mujs/keyboard.cpp b/src/ecmascript/mujs/keyboard.cpp index 4e7911d7..1d6563a9 100644 --- a/src/ecmascript/mujs/keyboard.cpp +++ b/src/ecmascript/mujs/keyboard.cpp @@ -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); diff --git a/src/ecmascript/mujs/location.cpp b/src/ecmascript/mujs/location.cpp index d0cb5476..145dccd5 100644 --- a/src/ecmascript/mujs/location.cpp +++ b/src/ecmascript/mujs/location.cpp @@ -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, ""); diff --git a/src/ecmascript/mujs/message.cpp b/src/ecmascript/mujs/message.cpp index 63d0e5ef..db7a5c84 100644 --- a/src/ecmascript/mujs/message.cpp +++ b/src/ecmascript/mujs/message.cpp @@ -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); diff --git a/src/ecmascript/mujs/window.cpp b/src/ecmascript/mujs/window.cpp index 032c8e57..9ae6cf25 100644 --- a/src/ecmascript/mujs/window.cpp +++ b/src/ecmascript/mujs/window.cpp @@ -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; diff --git a/src/ecmascript/mujs/xhr.cpp b/src/ecmascript/mujs/xhr.cpp index fc57ae89..a1e39675 100644 --- a/src/ecmascript/mujs/xhr.cpp +++ b/src/ecmascript/mujs/xhr.cpp @@ -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);