ref: e4c77a78fb539bd135d92df9be3e30be42a65a8a
parent: a2fcfd69fecf79bb76020b042af00070e1f26eab
author: Tor Andersson <tor.andersson@artifex.com>
date: Thu Apr 28 09:04:48 EDT 2016
Handle null/undefined argArray in Function.prototype.apply().
--- a/jsfunction.c
+++ b/jsfunction.c
@@ -92,9 +92,13 @@
js_copy(J, 0);
js_copy(J, 1);
- n = js_getlength(J, 2);
- for (i = 0; i < n; ++i)
- js_getindex(J, 2, i);
+ if (js_isnull(J, 2) || js_isundefined(J, 2)) {
+ n = 0;
+ } else {
+ n = js_getlength(J, 2);
+ for (i = 0; i < n; ++i)
+ js_getindex(J, 2, i);
+ }
js_call(J, n);
}