From b969e36ccc8c5a2ec141608f04121c415f675af3 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Wed, 23 Dec 2015 13:54:13 +0000 Subject: [PATCH] Fix bridge cache (it must be *below* Cycript.all). --- Execute.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Execute.cpp b/Execute.cpp index e8684c5..2a314ca 100644 --- a/Execute.cpp +++ b/Execute.cpp @@ -1177,7 +1177,8 @@ static JSValueRef All_getProperty(JSContextRef context, JSObjectRef object, JSSt CYPool pool; if (const char *code = CYBridgeHash(pool, CYPoolUTF8String(pool, context, property))) { JSValueRef result(_jsccall(JSEvaluateScript, context, CYJSString(CYPoolCode(pool, code)), NULL, NULL, 0)); - CYSetProperty(context, object, property, result, kJSPropertyAttributeDontEnum); + JSObjectRef cache(CYGetCachedObject(context, CYJSString("cache"))); + CYSetProperty(context, cache, property, result); return result; } @@ -2143,6 +2144,10 @@ extern "C" void CYSetupContext(JSGlobalContextRef context) { JSObjectRef all(JSObjectMake(context, All_, NULL)); CYSetProperty(context, cycript, CYJSString("all"), all); + JSObjectRef cache(JSObjectMake(context, NULL, NULL)); + CYSetProperty(context, cy, CYJSString("cache"), cache); + CYSetPrototype(context, cache, all); + JSObjectRef alls(_jsccall(JSObjectCallAsConstructor, context, Array, 0, NULL)); CYSetProperty(context, cycript, CYJSString("alls"), alls); @@ -2158,7 +2163,7 @@ extern "C" void CYSetupContext(JSGlobalContextRef context) { next = JSObjectGetPrototype(context, curr); } - CYSetPrototype(context, last, all); + CYSetPrototype(context, last, cache); } JSObjectRef System(JSObjectMake(context, NULL, NULL)); -- 2.50.0