From: Jay Freeman (saurik) Date: Sun, 3 Jun 2012 15:18:01 +0000 (-0700) Subject: Use Array.prototype, not Array, to look up functions. X-Git-Tag: v0.9.455~28 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/9772d9bfeff32f00eb6a2c38f11b01530e47482b Use Array.prototype, not Array, to look up functions. --- diff --git a/ObjectiveC/Library.mm b/ObjectiveC/Library.mm index c43957e..957c80c 100644 --- a/ObjectiveC/Library.mm +++ b/ObjectiveC/Library.mm @@ -1244,7 +1244,7 @@ JSValueRef CYCastJSValue(JSContextRef context, NSObject *value) { CYPoolTry { JSValueRef exception(NULL); JSValueRef arguments[1]; arguments[0] = CYCastJSValue(context_, (NSObject *) object); - JSObjectRef Array(CYGetCachedObject(context_, Array_s)); + JSObjectRef Array(CYGetCachedObject(context_, CYJSString("Array_prototype"))); JSObjectCallAsFunction(context_, CYCastJSObject(context_, CYGetProperty(context_, Array, push_s)), object_, 1, arguments, &exception); CYThrow(context_, exception); } CYObjectiveCatch } @@ -1258,14 +1258,14 @@ JSValueRef CYCastJSValue(JSContextRef context, NSObject *value) { CYPoolTry { arguments[0] = CYCastJSValue(context_, index); arguments[1] = CYCastJSValue(context_, 0); arguments[2] = CYCastJSValue(context_, (NSObject *) object); - JSObjectRef Array(CYGetCachedObject(context_, Array_s)); + JSObjectRef Array(CYGetCachedObject(context_, CYJSString("Array_prototype"))); JSObjectCallAsFunction(context_, CYCastJSObject(context_, CYGetProperty(context_, Array, splice_s)), object_, 3, arguments, &exception); CYThrow(context_, exception); } CYObjectiveCatch } - (void) removeLastObject { CYObjectiveTry { JSValueRef exception(NULL); - JSObjectRef Array(CYGetCachedObject(context_, Array_s)); + JSObjectRef Array(CYGetCachedObject(context_, CYJSString("Array_prototype"))); JSObjectCallAsFunction(context_, CYCastJSObject(context_, CYGetProperty(context_, Array, pop_s)), object_, 0, NULL, &exception); CYThrow(context_, exception); } CYObjectiveCatch } @@ -1278,7 +1278,7 @@ JSValueRef CYCastJSValue(JSContextRef context, NSObject *value) { CYPoolTry { JSValueRef arguments[2]; arguments[0] = CYCastJSValue(context_, index); arguments[1] = CYCastJSValue(context_, 1); - JSObjectRef Array(CYGetCachedObject(context_, Array_s)); + JSObjectRef Array(CYGetCachedObject(context_, CYJSString("Array_prototype"))); JSObjectCallAsFunction(context_, CYCastJSObject(context_, CYGetProperty(context_, Array, splice_s)), object_, 2, arguments, &exception); CYThrow(context_, exception); } CYObjectiveCatch }