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

Use node's vm module to run in clean context #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Oct 10, 2016

  1. Use node's vm module to run in clean context

    As suggested by Joshua Peek in a previous issue. Node's vm module gives
    us full control over the globals passed to the context the code is run
    in.
    
    In order to do this we store our code as a JS string, wrap it in an IFFE
    (to support the `return` symantics we use for all runtimes)
    
    vm.runInNewContext is called with {filename: "(execjs)"} in order to
    have the proper filename appear in backtraces. Normally this string is
    inserted into backtraces via a gsub in external_runtime.rb which
    replaces the filename.
    
    See https://nodejs.org/api/vm.html
    jhawthorn committed Oct 10, 2016
    Configuration menu
    Copy the full SHA
    06bfd33 View commit details
    Browse the repository at this point in the history