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

Crash when accessing HTMLElement properties from node's vm module #4018

Closed
rogual opened this issue Dec 1, 2015 · 4 comments
Closed

Crash when accessing HTMLElement properties from node's vm module #4018

rogual opened this issue Dec 1, 2015 · 4 comments
Assignees

Comments

@rogual
Copy link

rogual commented Dec 1, 2015

Here's a minimal example:

package.json:

{
    "name": "crash test",
    "main": "bug.html"
}

bug.html:

<script src='bug.js'></script>

bug.js:

window.onload = function() {
  var vm = require('vm');
  var c = vm.createContext({e: document.body});
  var script = 'e.style';
  vm.runInContext(script, c);
};

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@chaseWillden
Copy link
Contributor

I think you are forgetting the new keyword.

var c = new vm.createContext({e: document.body});

See Documentation

@rogual
Copy link
Author

rogual commented Dec 1, 2015

I think that's a mistake in the docs — seems weird to require new there, and there's another sample on that page that doesn't have it.

Tried anyway, but it doesn't stop the crash.

@imyzf
Copy link
Contributor

imyzf commented Jan 6, 2017

Modified code according to newest node.js doc, still crash.

var vm = require('vm');
var c = new vm.createContext({e: document.body});
var script = new vm.Script('e.style');
script.runInContext(c);

@rogerwang rogerwang self-assigned this Jan 6, 2017
@rogerwang
Copy link
Member

This is fixed in git and is available in the latest nightly build.

rogerwang added a commit that referenced this issue Jan 9, 2017
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

4 participants