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

Napi ArrayBuffer constructor behaves inconsistently with undefined #1118

Open
CoPrez opened this issue Aug 15, 2022 · 1 comment
Open

Napi ArrayBuffer constructor behaves inconsistently with undefined #1118

CoPrez opened this issue Aug 15, 2022 · 1 comment
Assignees
Milestone

Comments

@CoPrez
Copy link
Contributor

CoPrez commented Aug 15, 2022

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:

  1. In the Babylon React Native playground call readPixels() on a texture with no arguments

Expected behavior
The call to readPixels() succeeds

Screenshots
If applicable, add screenshots to help explain your problem.

Other
Tested on React-Native Android

@bghgary bghgary self-assigned this Aug 25, 2022
@bghgary
Copy link
Contributor

bghgary commented Aug 29, 2022

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.

@thomlucc thomlucc added this to the 6.0 milestone Sep 23, 2022
@bghgary bghgary modified the milestones: 6.0, Future Feb 9, 2023
@bghgary bghgary modified the milestones: Future, 7.0 May 11, 2023
@thomlucc thomlucc modified the milestones: 7.0, 8.0 Mar 26, 2024
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