Skip to content

Illegal invocation error using ES6 Proxy and node.js #11629

@FranckFreiburger

Description

@FranckFreiburger

Hello,
I am unable to call a node.js native function through a No-op forwarding proxy.

The following case works properly with a v8 native function:

var p = new Proxy(Math, {});
console.log( p.cos.toString() ); // function cos() { [native code] }
console.log( p.cos(0) ); // 1

Whereas the following case throw TypeError: Illegal invocation

var p = new Proxy(require('os'), {});
console.log( p.cpus.toString() ); // function getCPUs() { [native code] }
console.log( p.cpus() ); // TypeError: Illegal invocation

what's wrong ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionIssues that look for answers.v8 engineIssues and PRs related to the V8 dependency.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions