Open CoPrez opened 2 years ago
I tested this with V8 (reference), Chakra, and JSI using the following code:
auto arg = info[0];
auto arrayBuffer = arg.As<Napi::ArrayBuffer>();
auto argIsNull = arg.IsNull();
(void)argIsNull;
auto arrayBufferIsNull = arrayBuffer.IsNull();
(void)arrayBufferIsNull;
V8: argIsNull is true, arrayBufferIsNull is true Chakra: argIsNull is true, arrayBufferIsNull is false JSI: argIsNull is true, arrayBufferIsNull causes assert
These should all be the same.
While testing out the BaseTexture::readPixels() function I found that the behavior of the Napi ArrayBuffer construction at this line was behaving differently in Babylon Native vs Babylon React Native where the implementations of Napi differ.
In Babylon Native the ArrayBuffer construction works as expected and later on IsNull() on the buffer returns true. In Babylon React Native an exception is thrown at that line and the readPixels operation is aborted.
To Reproduce Steps to reproduce the behavior:
Expected behavior The call to readPixels() succeeds
Screenshots If applicable, add screenshots to help explain your problem.
Other Tested on React-Native Android