From 4ff45c264c55eb43a746b8a4af7f833d49ddda3d Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sun, 18 Apr 2010 15:44:23 -0400 Subject: [PATCH] Remove old EvalCX --- src/node.cc | 57 --------------------------------------------------------- 1 file changed, 57 deletions(-) diff --git a/src/node.cc b/src/node.cc index 6f93a02..c28f8bd 100644 --- a/src/node.cc +++ b/src/node.cc @@ -992,62 +992,6 @@ Handle DLOpen(const v8::Arguments& args) { return Undefined(); } -// evalcx(code, sandbox={}) -// Executes code in a new context -Handle EvalCX(const Arguments& args) { - HandleScope scope; - - Local code = args[0]->ToString(); - Local sandbox = args.Length() > 1 ? args[1]->ToObject() - : Object::New(); - Local filename = args.Length() > 2 ? args[2]->ToString() - : String::New("evalcx"); - // Create the new context - Persistent context = Context::New(); - - // Enter and compile script - context->Enter(); - - // Copy objects from global context, to our brand new context - Handle keys = sandbox->GetPropertyNames(); - - unsigned int i; - for (i = 0; i < keys->Length(); i++) { - Handle key = keys->Get(Integer::New(i))->ToString(); - Handle value = sandbox->Get(key); - context->Global()->Set(key, value); - } - - // Catch errors - TryCatch try_catch; - - Local script = v8::Script::Compile(code, filename); - Handle result; - - if (script.IsEmpty()) { - result = ThrowException(try_catch.Exception()); - } else { - result = script->Run(); - if (result.IsEmpty()) { - result = ThrowException(try_catch.Exception()); - } else { - // success! copy changes back onto the sandbox object. - keys = context->Global()->GetPropertyNames(); - for (i = 0; i < keys->Length(); i++) { - Handle key = keys->Get(Integer::New(i))->ToString(); - Handle value = context->Global()->Get(key); - sandbox->Set(key, value); - } - } - } - - // Clean up, clean up, everybody everywhere! - context->DetachGlobal(); - context->Exit(); - context.Dispose(); - - return scope.Close(result); -} Handle Compile(const Arguments& args) { HandleScope scope; @@ -1432,7 +1376,6 @@ static void Load(int argc, char *argv[]) { // define various internal methods NODE_SET_METHOD(process, "loop", Loop); NODE_SET_METHOD(process, "unloop", Unloop); -// NODE_SET_METHOD(process, "evalcx", EvalCX); NODE_SET_METHOD(process, "compile", Compile); NODE_SET_METHOD(process, "_byteLength", ByteLength); NODE_SET_METHOD(process, "_needTickCallback", NeedTickCallback); -- 2.7.4