diff --git a/src/mujs/jserror.c b/src/mujs/jserror.c index 99a1bbc..6dd3bb1 100644 --- a/src/mujs/jserror.c +++ b/src/mujs/jserror.c @@ -61,7 +61,7 @@ static int jsB_ErrorX(js_State *J, js_Object *prototype) js_defproperty(J, -2, "message", JS_DONTENUM); } if (jsB_stacktrace(J, 1)) - js_defproperty(J, -2, "stackTrace", JS_DONTENUM); + js_defproperty(J, -2, "stack", JS_DONTENUM); return 1; } @@ -71,7 +71,7 @@ static void js_newerrorx(js_State *J, const char *message, js_Object *prototype) js_pushstring(J, message); js_setproperty(J, -2, "message"); if (jsB_stacktrace(J, 0)) - js_setproperty(J, -2, "stackTrace"); + js_setproperty(J, -2, "stack"); } #define DERROR(name, Name) \ diff --git a/src/mujs/jsstring.c b/src/mujs/jsstring.c index 4954d75..da12431 100644 --- a/src/mujs/jsstring.c +++ b/src/mujs/jsstring.c @@ -288,8 +288,10 @@ static void Sp_slice(js_State *J) if (s < e) Sp_substring_imp(J, str, s, e - s); - else + else if (s > e) Sp_substring_imp(J, str, e, s - e); + else + js_pushliteral(J, ""); } static void Sp_substring(js_State *J) @@ -304,8 +306,10 @@ static void Sp_substring(js_State *J) if (s < e) Sp_substring_imp(J, str, s, e - s); - else + else if (s > e) Sp_substring_imp(J, str, e, s - e); + else + js_pushliteral(J, ""); } static void Sp_toLowerCase(js_State *J) diff --git a/src/mujs/regexp.c b/src/mujs/regexp.c index 952a1d2..26d534f 100644 --- a/src/mujs/regexp.c +++ b/src/mujs/regexp.c @@ -147,7 +147,7 @@ static int nextrune(struct cstate *g) g->yychar = '0'; return 1; } - return 0; + return 1; case 'u': if (!g->source[0] || !g->source[1] || !g->source[2] || !g->source[3]) die(g, "unterminated escape sequence"); @@ -159,7 +159,7 @@ static int nextrune(struct cstate *g) g->yychar = '0'; return 1; } - return 0; + return 1; case 0: g->yychar = '0'; return 1;