shithub: libmujs

Download patch

ref: e25c83d6b578525b7689bda2101cb1b59d2dfdc7
parent: 66cf4ccd82d4425c9c53093bc745c19a711f93a9
author: Tor Andersson <tor.andersson@artifex.com>
date: Tue Jan 23 11:19:29 EST 2018

Fix issue #62: Handle 'this' binding consistently in REPL.

The promotion of 'this' to the global object happens in the interpreter
on the OP_THIS instruction, depending on the current strictness. Don't
push the global object in eval_print in main.c.

--- a/main.c
+++ b/main.c
@@ -134,7 +134,7 @@
 		js_pop(J, 1);
 		return 1;
 	}
-	js_pushglobal(J);
+	js_pushundefined(J);
 	if (js_pcall(J, 0)) {
 		fprintf(stderr, "%s\n", js_trystring(J, -1, "Error"));
 		js_pop(J, 1);