From 79492f212da2fcaa4ce44d00fc08530e1630d05b Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 14 Sep 2015 21:11:42 -0700 Subject: [PATCH] On iOS 9, JSObjectGetPrototype changes JSValueRef. --- Execute.cpp | 6 +++++- JavaScript.hpp | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Execute.cpp b/Execute.cpp index 11fada2..f7ee724 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(JSObjectGetPrototype(context, object) == value); + _assert(CYIsEqual(context, JSObjectGetPrototype(context, object), value)); } /* }}} */ /* JavaScript Strings {{{ */ @@ -322,6 +322,10 @@ bool CYIsCallable(JSContextRef context, JSValueRef value) { return value != NULL && JSValueIsObject(context, value) && JSObjectIsFunction(context, (JSObjectRef) value); } +bool CYIsEqual(JSContextRef context, JSValueRef lhs, JSValueRef rhs) { + return _jsccall(JSValueIsEqual, 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 9408c78..e80be76 100644 --- a/JavaScript.hpp +++ b/JavaScript.hpp @@ -66,6 +66,8 @@ void CYSetArgs(int argc, const char *argv[]); bool CYCastBool(JSContextRef context, JSValueRef value); double CYCastDouble(JSContextRef context, JSValueRef value); +bool CYIsEqual(JSContextRef context, JSValueRef lhs, JSValueRef rhs); + CYUTF8String CYPoolUTF8String(CYPool &pool, JSContextRef context, JSStringRef value); const char *CYPoolCString(CYPool &pool, JSContextRef context, JSStringRef value); -- 2.45.2