Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Revert "removing copy-back-to-sandbox in vm"

After a long discussion with @isaacs, we’ve decided to defer consideration of
API changes to ~0.7, and reduce this change to a relatively safe subset of
changes that don’t affect the API for immediate inclusion in 0.6.

The changes reverted in this commit will be coming back in 0.7, after a
discussion of the alternatives.

This reverts commit 2c1f5206bbb23bd34624acbcfb475dddcda0b883.
  • Loading branch information...
commit 209ed865e5a4142947d6b13c58b646d0a650d796 1 parent a568777
@ELLIOTTCABLE ELLIOTTCABLE authored
View
5 src/node_script.cc
@@ -439,6 +439,11 @@ Handle<Value> WrappedScript::EvalMachine(const Arguments& args) {
result = args.This();
}
+ if (context_flag == userContext || context_flag == newContext) {
+ // success! copy changes back onto the sandbox object.
+ CloneObject(args.This(), context->Global()->GetPrototype(), sandbox);
+ }
+
if (context_flag == newContext) {
// Clean up, clean up, everybody everywhere!
context->Exit();
View
2  test/simple/test-script-context.js
@@ -40,7 +40,7 @@ assert.equal('lala', context.thing);
common.debug('test updating context');
script = new Script('foo = 3;');
result = script.runInContext(context);
-//assert.equal(3, context.foo); // TODO: REIMPLEMENT ME
+assert.equal(3, context.foo);
assert.equal('lala', context.thing);
// Issue GH-1801
View
4 test/simple/test-script-new.js
@@ -69,8 +69,8 @@ foo = 2;
sandbox = { foo: 0, baz: 3 };
script = new Script(code);
var baz = script.runInNewContext(sandbox);
-//assert.equal(1, context.foo); // TODO: REIMPLEMENT ME
-//assert.equal(2, context.bar); // TODO: REIMPLEMENT ME
+assert.equal(1, sandbox.foo);
+assert.equal(2, sandbox.bar);
assert.equal(2, foo);
common.debug('call a function by reference');
Please sign in to comment.
Something went wrong with that request. Please try again.