Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

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
Open

Shouldn't dispose of iframe after run #6

amasad opened this issue Dec 27, 2013 · 3 comments

Comments

@amasad
Copy link
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.

@pluma
Copy link
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.

@amasad
Copy link
Contributor Author

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
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants