From: Jay Freeman (saurik) Date: Mon, 26 Apr 2010 20:52:53 +0000 (+0000) Subject: Give Global_ a className, indent the global prototype code, and fail to mark $cyq... X-Git-Tag: v0.9.432~77 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/56a66df3a7e954e0821180d4313b43c53e92180e?hp=fe123f47092fe716bf5111ca57b2670932c10d6d Give Global_ a className, indent the global prototype code, and fail to mark $cyq DontEnum (JSC bug). --- diff --git a/Execute.cpp b/Execute.cpp index 8ac1b14..6197bc9 100644 --- a/Execute.cpp +++ b/Execute.cpp @@ -1302,6 +1302,7 @@ void CYInitializeDynamic() { Type_privateData::Class_ = JSClassCreate(&definition); definition = kJSClassDefinitionEmpty; + definition.className = "Global"; //definition.getProperty = &Global_getProperty; Global_ = JSClassCreate(&definition); @@ -1422,20 +1423,22 @@ extern "C" void CYSetupContext(JSGlobalContextRef context) { JSObjectRef all(JSObjectMake(context, All_, NULL)); CYSetProperty(context, cycript, CYJSString("all"), all); - JSObjectRef last(NULL), curr(global); + if (true) { + JSObjectRef last(NULL), curr(global); - goto next; for (JSValueRef next;;) { - if (JSValueIsNull(context, next)) - break; - last = curr; - curr = CYCastJSObject(context, next); - next: - next = JSObjectGetPrototype(context, curr); - } + goto next; for (JSValueRef next;;) { + if (JSValueIsNull(context, next)) + break; + last = curr; + curr = CYCastJSObject(context, next); + next: + next = JSObjectGetPrototype(context, curr); + } - JSObjectSetPrototype(context, last, all); + JSObjectSetPrototype(context, last, all); + } - CYSetProperty(context, global, CYJSString("$cyq"), &$cyq); + CYSetProperty(context, global, CYJSString("$cyq"), &$cyq, kJSPropertyAttributeDontEnum); JSObjectRef System(JSObjectMake(context, NULL, NULL)); CYSetProperty(context, cy, CYJSString("System"), System);