]> git.saurik.com Git - cycript.git/commitdiff
Removed with(Cycript.all), unified the All_ instances, and moved Cycript.all prototyp...
authorJay Freeman (saurik) <saurik@saurik.com>
Wed, 11 Nov 2009 04:22:17 +0000 (04:22 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Wed, 11 Nov 2009 04:22:17 +0000 (04:22 +0000)
Console.cpp
Library.cpp
ObjectiveC/Library.mm

index a6a1c544dcef60b2e33174a35b9690f7fcbb1bb4..53571037ef6157d1e702462d2c474d938639204f 100644 (file)
@@ -332,8 +332,6 @@ static void Console(apr_pool_t *pool, int client) {
 
         if (debug)
             std::cout << code << std::endl;
-        if (!bypass)
-            code = "with(Cycript.all){" + code + "}";
 
         Run(client, code, fout, expand);
     }
@@ -601,7 +599,6 @@ int Main(int argc, char const * const argv[], char const * const envp[]) {
         } else if (driver.program_ != NULL)
             if (client != -1) {
                 std::string code(start, end-start);
-                code = "with(Cycript.all){" + code + "}";
                 Run(client, code, stdout);
             } else {
                 std::ostringstream str;
@@ -611,10 +608,8 @@ int Main(int argc, char const * const argv[], char const * const envp[]) {
                 std::string code(str.str());
                 if (compile)
                     std::cout << code;
-                else {
-                    code = "with(Cycript.all){" + code + "}";
+                else
                     Run(client, code, stdout);
-                }
             }
     }
 
index 2c6e31bcb73f83d929e62378deb5597541a6ce5c..f95cf9e805bde5df9d1ca4db1aaaa2c656ff7d6e 100644 (file)
@@ -1466,21 +1466,6 @@ const char *CYExecute(apr_pool_t *pool, const char *code) {
 
 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) {
@@ -1716,6 +1701,19 @@ extern "C" void CYSetupContext(JSGlobalContextRef context) {
     JSObjectRef all(JSObjectMake(context, All_, NULL));
     CYSetProperty(context, cycript, CYJSString("all"), all);
 
+    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);
+    }
+
+    JSObjectSetPrototype(context, last, all);
+
     CYSetProperty(context, global, CYJSString("$cyq"), &$cyq);
 
     JSObjectRef System(JSObjectMake(context, NULL, NULL));
@@ -1738,7 +1736,6 @@ JSGlobalContextRef CYGetJSContext() {
     if (context_ == NULL) {
         context_ = JSGlobalContextCreate(Global_);
         CYSetupContext(context_);
-        JSObjectSetPrototype(context_, CYGetGlobalObject(context_), JSObjectMake(context_, All_, NULL));
     }
 
     return context_;
index a39d4c376774c27358d65785515c4b9f192b6393..88c7426ee9ca101f7a6715a5c188ca0fc2c3f669 100644 (file)
@@ -2425,10 +2425,10 @@ void CYObjectiveC_SetupContext(JSContextRef context) { CYPoolTry {
     CYSetProperty(context, cycript, CYJSString("Super"), Super);
 
 #if defined(__APPLE__) && defined(__arm__)
-    CYSetProperty(context, all, CYJSString("objc_registerClassPair"), &objc_registerClassPair_);
+    CYSetProperty(context, all, CYJSString("objc_registerClassPair"), &objc_registerClassPair_, kJSPropertyAttributeDontEnum);
 #endif
 
-    CYSetProperty(context, all, CYJSString("objc_msgSend"), &$objc_msgSend);
+    CYSetProperty(context, all, CYJSString("objc_msgSend"), &$objc_msgSend, kJSPropertyAttributeDontEnum);
 
     JSObjectRef Function_prototype(CYGetCachedObject(context, CYJSString("Function_prototype")));
     JSObjectSetPrototype(context, CYCastJSObject(context, CYGetProperty(context, Message, prototype_s)), Function_prototype);