shithub: libmujs

Download patch

ref: 5aed7d6e94028464e7fefffef407c28e42082d8b
parent: 3e3c382a0c8ccc2bec4a581115fc8a86f174d87e
author: Tor Andersson <tor.andersson@artifex.com>
date: Thu Apr 28 08:40:52 EDT 2016

Fix bug in Function.prototype.bind().

We were not setting the prototype of the bound function properly.

--- a/jsfunction.c
+++ b/jsfunction.c
@@ -171,11 +171,9 @@
 	else
 		n = 0;
 
-	js_newcconstructor(J, callbound, constructbound, "[bind]", n);
-
 	/* Reuse target function's prototype for HasInstance check. */
 	js_getproperty(J, 0, "prototype");
-	js_defproperty(J, -2, "prototype", JS_READONLY | JS_DONTENUM | JS_DONTCONF);
+	js_newcconstructor(J, callbound, constructbound, "[bind]", n);
 
 	/* target function */
 	js_copy(J, 0);