Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Float32Array undefined when evaluated in vm.runInNewContext() #9121

@jmm

Description

@jmm

Can someone clue me in as to why Float32Array is undefined when referenced in a script executed by vm.runInNewContext()? I arrived here while debugging test failures after bumping the traceur version in es6ify.

Given the following:

  • Node v0.10.32 on Ubuntu 12

  • Float32Array.js:

    Float32Array;
  • vm-Float32Array.js:

    var
      fs = require('fs'),
      vm = require('vm');
    
    vm.runInNewContext(
      fs.readFileSync('./Float32Array.js')
    );

node ./Float32Array.js is fine, but node ./vm-Float32Array.js results in:

/.../vm-Float32Array.js:5
vm.runInNewContext(
   ^
ReferenceError: Float32Array is not defined
    at evalmachine.<anonymous>:1:1
    at Object.<anonymous> (/.../vm-Float32Array.js:5:4)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3

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