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

Calling Object.getOwnPropertySymbols() on a Proxy throws an error #71

Closed
not-an-aardvark opened this issue Apr 4, 2016 · 2 comments
Closed

Comments

@not-an-aardvark
Copy link
Contributor

require('harmony-reflect');
var myProxy = new Proxy({}, {});
Object.getOwnPropertySymbols(myProxy)
TypeError: Array.prototype.concat called on null or undefined
    at Function.getOwnPropertySymbols (native)
    at repl:1:8
    at REPLServer.defaultEval (repl.js:269:27)
    at bound (domain.js:287:14)
    at REPLServer.runBound [as eval] (domain.js:300:12)
    at REPLServer.<anonymous> (repl.js:439:12)
    at emitOne (events.js:95:20)
    at REPLServer.emit (events.js:182:7)
    at REPLServer.Interface._onLine (readline.js:211:10)
    at REPLServer.Interface._line (readline.js:550:8)

This might be related to #57. Ideally, it would be nice if this didn't throw an error, even if the alternative is to just return an empty array every time. The current implementation causes an error to be thrown when calling certain lodash functions on Proxies, for example.

This behavior was tested on node 5.10.0.

@tvcutsem
Copy link
Owner

tvcutsem commented Apr 5, 2016

I just committed a fix implementing your suggestion: let Object.getOwnPropertySymbols(proxy) return []. This shim still does not support symbols, but at least the patch stops code from crashing. The getOwnPropertySymbols method is now patched conditionally (if it exists).

Published on npm as harmony-reflect @ 1.4.5.

@tvcutsem tvcutsem closed this as completed Apr 5, 2016
tvcutsem pushed a commit that referenced this issue Apr 5, 2016
@not-an-aardvark
Copy link
Contributor Author

Thanks!

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