ref: 8b52b57782033cae677d40b373fd4fe2b032e105
parent: ed1c27989656ef743049cc5c81b86dfde4a2f456
author: Tor Andersson <tor.andersson@artifex.com>
date: Fri Mar 8 08:30:25 EST 2019
Allow js_newobjectx to take null as prototype.
--- a/jsvalue.c
+++ b/jsvalue.c
@@ -366,7 +366,9 @@
void js_newobjectx(js_State *J)
{
- js_Object *prototype = js_toobject(J, -1);
+ js_Object *prototype = NULL;
+ if (js_isobject(J, -1))
+ prototype = js_toobject(J, -1);
js_pop(J, 1);
js_pushobject(J, jsV_newobject(J, JS_COBJECT, prototype));
}