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

Error: arguments is undefined #13

Open
daniele-pini opened this issue Nov 28, 2022 · 1 comment
Open

Error: arguments is undefined #13

daniele-pini opened this issue Nov 28, 2022 · 1 comment

Comments

@daniele-pini
Copy link

This code doesn't currently work in SandboxJS (you can try it quick on the dev tools in https://nyariv.github.io/SandboxJS/):

const sandbox = new Sandbox();

const code = `
  function test() {
    console.log(arguments); // Uncaught ReferenceError: arguments is not defined
  }

  test(1, 2, 3);
`;

const exec = sandbox.compile(code);
exec(scope).run();

However in normal JS the content code should work:

function test() {
  console.log(arguments); // OK, prints an Arguments object
}

test(1, 2, 3);
@nyariv
Copy link
Owner

nyariv commented Dec 3, 2022

This is not supported by design, because it could be used to pollute a scope wrapping a piece of untrusted code.

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

2 participants