shithub: libmujs

Download patch

ref: f18f2c0c9965f4ccf80da9b00ff518bff3f81a32
parent: 44d4109a1c58e29e185b73bdd3b91a39dbd883d7
author: Tor Andersson <[email protected]>
date: Tue May 9 09:17:11 EDT 2017

Don't force 'this' to be the global object in js_dostring/dofile.

Set it to 'undefined' so the behavior will be according to strictness.

--- a/jsstate.c
+++ b/jsstate.c
@@ -131,7 +131,7 @@
 		return 1;
 	}
 	js_loadstring(J, "[string]", source);
-	js_pushglobal(J);
+	js_pushundefined(J);
 	js_call(J, 0);
 	js_pop(J, 1);
 	js_endtry(J);
@@ -146,7 +146,7 @@
 		return 1;
 	}
 	js_loadfile(J, filename);
-	js_pushglobal(J);
+	js_pushundefined(J);
 	js_call(J, 0);
 	js_pop(J, 1);
 	js_endtry(J);