From: Jay Freeman (saurik) Date: Sun, 3 Jun 2012 20:58:49 +0000 (-0700) Subject: Use the same trick on Object that made StringInstance. X-Git-Tag: v0.9.455~15 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/11f3e89e6b60ef97ca4f885126e50621dce37bde?hp=4a2eef6cff35853235c7c63de87783ceb23595f3 Use the same trick on Object that made StringInstance. --- diff --git a/ObjectiveC/Library.mm b/ObjectiveC/Library.mm index c5722c8..64281a3 100644 --- a/ObjectiveC/Library.mm +++ b/ObjectiveC/Library.mm @@ -298,7 +298,7 @@ JSValueRef CYGetClassPrototype(JSContextRef context, id self) { if (self == NSArray_) prototype = CYGetCachedObject(context, CYJSString("ArrayInstance_prototype")); else if (self == NSDictionary_) - prototype = CYGetCachedObject(context, CYJSString("Object_prototype")); + prototype = CYGetCachedObject(context, CYJSString("ObjectInstance_prototype")); else if (self == NSString_) prototype = CYGetCachedObject(context, CYJSString("StringInstance_prototype")); else @@ -2549,6 +2549,12 @@ void CYObjectiveC_SetupContext(JSContextRef context) { CYPoolTry { JSObjectRef Array_prototype(CYGetCachedObject(context, CYJSString("Array_prototype"))); JSObjectSetPrototype(context, ArrayInstance_prototype, Array_prototype); + JSObjectRef ObjectInstance(JSObjectMakeConstructor(context, Instance_, NULL)); + JSObjectRef ObjectInstance_prototype(CYCastJSObject(context, CYGetProperty(context, ObjectInstance, prototype_s))); + CYSetProperty(context, cy, CYJSString("ObjectInstance_prototype"), ObjectInstance_prototype); + JSObjectRef Object_prototype(CYGetCachedObject(context, CYJSString("Object_prototype"))); + JSObjectSetPrototype(context, ObjectInstance_prototype, Object_prototype); + JSObjectRef StringInstance(JSObjectMakeConstructor(context, Instance_, NULL)); JSObjectRef StringInstance_prototype(CYCastJSObject(context, CYGetProperty(context, StringInstance, prototype_s))); CYSetProperty(context, cy, CYJSString("StringInstance_prototype"), StringInstance_prototype);