mirror of
https://github.com/status-im/react-native.git
synced 2025-01-10 17:45:59 +00:00
bdf5adc40b
Summary: `Libraries/JavaScriptAppEngine/Initialization/InitializeJavaScriptAppEngine.js` attempts to setup global variables typical in most JavaScript environments. It finds the previous property value using `Object.getOwnPropertyDescriptor` and preserves it as `original[PropertyName]` (if it existed), it then redefines the property using `Object.defineProperty`. Properties may only be redefined if the property descriptor specifies that it is configurable ([MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor)). Attempting to redefine an non-configurable property will result in an error: `TypeError: Cannot redefine property: [PropertyName]`. Not all properties being setup in `InitializeJavaScriptAppEngine.js` are necessarily configurable in the target environment. Closes https://github.com/facebook/react-native/pull/9244 Differential Revision: D3679683 fbshipit-source-id: cd3398ef2cdf38e58c58862e64b159951c2b22c2