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

Object.getOwnPropertyDescriptors is not available in Hermes, RN 0.62.2 #274

Closed
mweststrate opened this issue Jun 19, 2020 · 6 comments
Closed

Comments

@mweststrate
Copy link

mweststrate commented Jun 19, 2020

We got some bug reports that immer@7 is broken on Hermes engine. From debugging it seems that Object.getOwnPropertyDescriptors is not defined in Hermes (in contrast to Object.getOwnPropertyDescriptor). See screenshot:

Screen Shot 2020-06-19 at 16 31 29

Minimal reproduction test project is available in the original issue: immerjs/immer#626 (comment)

(P.s. would be great if the error message could be improved from TypeError: undefined is not a function to something like Uncaught TypeError: Object.bla is not a function at <anonymous>:1:8 as is done in Chrome for example)

@ljharb
Copy link

ljharb commented Jun 19, 2020

That's because it's in ES2017, and Hermes only implements ES2015.

@avp
Copy link
Contributor

avp commented Jun 19, 2020

@mweststrate I'll look into implementing this soon, thanks for the report.

@ljharb Hermes implements various features past ES2015 (particularly in terms of library functions), just missed this one.

@mweststrate
Copy link
Author

mweststrate commented Jun 19, 2020

@ljharb well, IE 9 has it, we can't do less than that 😏

EDIT: never mind, that s in the end is really hard :-P.

@avp awesome, thanks!

@avp
Copy link
Contributor

avp commented Jun 19, 2020

@mweststrate In terms of the error message: the general issue is that Hermes doesn't typically run directly on source but by executing bytecode, so it doesn't have access to source level expressions like Object.bla, and adding support for that is a significant amount of design work with tradeoffs we haven't fully investigated. The solution that we're trying to rely on instead is to use the line/column numbers, and it looks like they worked for you in this case.

If the line/column numbers are ever incorrect (they're too large, for example, indicating bytecode addresses instead of actual source locations) and you have some useful reproduction instructions, then you can file an issue in the React Native repository, since the symbolication logic for RN lives over there. We're trying to make sure the debugging experience is as smooth as it can be given that the Hermes execution model is different from most other ways of running JS.

@avp
Copy link
Contributor

avp commented Jul 8, 2020

Added in ad42e5c

@avp avp closed this as completed Jul 8, 2020
@mweststrate
Copy link
Author

Awesome, thanks @avp!

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

3 participants