shithub: libmujs

Download patch

ref: bd2470847c92b37a4106083bf6767e2f74f15dd3
parent: 49271d3cf2fbdb165f09238666d9e7aa91f1305f
author: Tor Andersson <tor.andersson@artifex.com>
date: Mon Jul 16 09:28:04 EDT 2018

Fix logic in Object.isFrozen to comply with spec.

--- a/jsobject.c
+++ b/jsobject.c
@@ -458,8 +458,10 @@
 	if (ref->left->level)
 		if (!O_isFrozen_walk(J, ref->left))
 			return 0;
-	if (!(ref->atts & (JS_READONLY | JS_DONTCONF)))
+	if (!(ref->atts & JS_READONLY))
 		return 0;
+	if (!(ref->atts & JS_DONTCONF))
+		return 0;
 	if (ref->right->level)
 		if (!O_isFrozen_walk(J, ref->right))
 			return 0;
@@ -474,15 +476,15 @@
 		js_typeerror(J, "not an object");
 
 	obj = js_toobject(J, 1);
-	if (obj->extensible) {
-		js_pushboolean(J, 0);
-		return;
+
+	if (obj->properties->level) {
+		if (!O_isFrozen_walk(J, obj->properties)) {
+			js_pushboolean(J, 0);
+			return;
+		}
 	}
 
-	if (obj->properties->level)
-		js_pushboolean(J, O_isFrozen_walk(J, obj->properties));
-	else
-		js_pushboolean(J, 1);
+	js_pushboolean(J, !obj->extensible);
 }
 
 void jsB_initobject(js_State *J)