Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Shouldn't dispose of iframe after run #6

Open
amasad opened this Issue Dec 27, 2013 · 3 comments

Comments

Projects
None yet
3 participants
Contributor

amasad commented Dec 27, 2013

In node vm:

var c = vm.createContext({});
vm.runInContext('Array.foo = 1', c);
assert(1 === vm.runInContext('Array.foo'));

And that's not the case in this module because it disposes of iframe (real context) after each run.

Contributor

pluma commented Jan 20, 2014

Interesting. Closer inspection of node's context objects reveals that upon running something in a context the context object receives its own (non-enumerable) copy of every global, which is not identical with the current global.

I think the problem is that vm-browserify only copies properties which were already on the context before the eval or were introduced by the eval'd code.

Contributor

amasad commented Jan 20, 2014

It seems very hard to match the exact behavior on both so I wrote a more simplified module: context-eval

tcql commented Mar 17, 2015

it seems that the iframe disposal also prevents you from running async code inside a context, which breaks some stuff I wanted to do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment