]> git.saurik.com Git - cycript.git/commitdiff
Use the same trick on Object that made StringInstance.
authorJay Freeman (saurik) <saurik@saurik.com>
Sun, 3 Jun 2012 20:58:49 +0000 (13:58 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Sun, 3 Jun 2012 20:59:20 +0000 (13:59 -0700)
ObjectiveC/Library.mm

index c5722c87f83b7c307bbf9bf3722ff5a5f4ee0bbe..64281a301e9669900f56e46f05c5e78a6b10ad07 100644 (file)
@@ -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);