From: Jay Freeman (saurik) Date: Mon, 9 Nov 2009 06:32:53 +0000 (+0000) Subject: Fixed cycript.all for Cydget and isolated the new function namespaces (as I hate... X-Git-Tag: v0.9.432~173 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/4dc2cd21090bbbff96db8ef94d5956fc27c49a3c?ds=sidebyside Fixed cycript.all for Cydget and isolated the new function namespaces (as I hate them). --- diff --git a/Console.cpp b/Console.cpp index fad7dda..a6a1c54 100644 --- a/Console.cpp +++ b/Console.cpp @@ -332,7 +332,8 @@ static void Console(apr_pool_t *pool, int client) { if (debug) std::cout << code << std::endl; - code = "with(Cycript.all){" + code + "}"; + if (!bypass) + code = "with(Cycript.all){" + code + "}"; Run(client, code, fout, expand); } diff --git a/Library.cpp b/Library.cpp index df3a95a..2c6e31b 100644 --- a/Library.cpp +++ b/Library.cpp @@ -1464,7 +1464,26 @@ const char *CYExecute(apr_pool_t *pool, const char *code) { return json; } -extern "C" void CYParseWebCore(apr_pool_t *pool, const uint16_t **data, size_t *size) { +extern "C" void CydgetSetupContext(JSGlobalContextRef context) { + CYSetupContext(context); + + JSObjectRef last(NULL); + JSObjectRef curr(CYGetGlobalObject(context)); + + goto next; for (JSValueRef next;;) { + if (JSValueIsNull(context, next)) + break; + last = curr; + curr = CYCastJSObject(context, next); + next: + next = JSObjectGetPrototype(context, curr); + } + + JSObjectRef all(JSObjectMake(context, All_, NULL)); + JSObjectSetPrototype(context, last, all); +} + +extern "C" void CydgetPoolParse(apr_pool_t *pool, const uint16_t **data, size_t *size) { CYDriver driver(""); cy::parser parser(driver);