Skip to content
This repository was archived by the owner on Mar 19, 2026. It is now read-only.
This repository was archived by the owner on Mar 19, 2026. It is now read-only.

getNativeObject: ensure the js object corresponds to the expected native type #189

Description

@krichprollsch

getNativeObject doesn't check if the given js object corresponds to the expected native type.

Indeed, if we pass Car js object instead of a Brand, getNativeObject casts a native Car pointer as a Brand native object, leading to unknown behavior.

See https://github.com/lightpanda-io/jsruntime-lib/blob/main/src/engines/v8/generate.zig#L727

To ways are possible to do the check:

  • use a C++ function to check if the js object prototype corresponds to the expected native type
  • add a second internal field with an integer identifying the native type

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions