From 3c7fc7a8650c2310ec92465ec0ac77bfae6b652f Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 12 Oct 2015 02:24:30 -0700 Subject: [PATCH] Prefer JSValueIsStrictEqual to compare prototypes. --- Execute.cpp | 6 +++++- JavaScript.hpp | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Execute.cpp b/Execute.cpp index f7ee724..c724259 100644 --- a/Execute.cpp +++ b/Execute.cpp @@ -86,7 +86,7 @@ void CYSetProperty(JSContextRef context, JSObjectRef object, JSStringRef name, J void CYSetPrototype(JSContextRef context, JSObjectRef object, JSValueRef value) { JSObjectSetPrototype(context, object, value); - _assert(CYIsEqual(context, JSObjectGetPrototype(context, object), value)); + _assert(CYIsStrictEqual(context, JSObjectGetPrototype(context, object), value)); } /* }}} */ /* JavaScript Strings {{{ */ @@ -326,6 +326,10 @@ bool CYIsEqual(JSContextRef context, JSValueRef lhs, JSValueRef rhs) { return _jsccall(JSValueIsEqual, context, lhs, rhs); } +bool CYIsStrictEqual(JSContextRef context, JSValueRef lhs, JSValueRef rhs) { + return JSValueIsStrictEqual(context, lhs, rhs); +} + size_t CYArrayLength(JSContextRef context, JSObjectRef array) { return CYCastDouble(context, CYGetProperty(context, array, length_s)); } diff --git a/JavaScript.hpp b/JavaScript.hpp index e80be76..38b2f60 100644 --- a/JavaScript.hpp +++ b/JavaScript.hpp @@ -67,6 +67,7 @@ bool CYCastBool(JSContextRef context, JSValueRef value); double CYCastDouble(JSContextRef context, JSValueRef value); bool CYIsEqual(JSContextRef context, JSValueRef lhs, JSValueRef rhs); +bool CYIsStrictEqual(JSContextRef context, JSValueRef lhs, JSValueRef rhs); CYUTF8String CYPoolUTF8String(CYPool &pool, JSContextRef context, JSStringRef value); const char *CYPoolCString(CYPool &pool, JSContextRef context, JSStringRef value); -- 2.49.0