Skip to content

Shouldn't dispose of iframe after run #6

Open

Description

@amasad

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.

Activity

  1. pluma commented on Jan 20, 2014

    @pluma
    Contributor

    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.

  2. amasad commented on Jan 20, 2014

    @amasad
    ContributorAuthor

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

  3. tcql commented on Mar 17, 2015

    @tcql

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions