JavaScriptCore Node-API conformance defects

Open
#2,129 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp, javascript
Domain
backend, testing

Research direction

Start with Dependencies/JsRuntimeHost/Core/Node-API/Source/js_native_api_javascriptcore.cc and the skipped test list in Dependencies/JsRuntimeHost/Tests/NodeApi/test_main.cpp. Choose one defect and run its named Node-API conformance test to understand the expected behavior; the issue lists several independent failures across value conversion, classes, finalizers, and Android. Done means fixing the selected behavior and removing its corresponding exclusion so the test guards the fix.

Written by the indexing model from the issue text.

Description

[Filed by Copilot on behalf of @bghgary]

The Node-API conformance suite added in #2097 skips these tests on JavaScriptCore. Their exclusions in Dependencies/JsRuntimeHost/Tests/NodeApi/test_main.cpp link here; the implementation is Dependencies/JsRuntimeHost/Core/Node-API/Source/js_native_api_javascriptcore.cc. Remove an exclusion when its item is fixed, so the test guards the fix.

  • There is no napi_create_date, napi_is_date or napi_get_date_value, so the test_date addon cannot load and is not built. Skips test_date/.
  • napi_create_array_with_length throws a RangeError for the maximum array length (2^32-1) instead of returning an array. Skips test_array/test.js.
  • napi_define_class dereferences a NULL properties array and crashes. Skips test_constructor/test.js and test_constructor/test_null.js.
  • napi_define_properties takes enumerable from napi_configurable, and read-only assignment errors use different message text from V8's. Both also fail test_constructor/test.js.
  • napi_define_class does not set the constructor's name. Skips test_constructor/test2.js.
  • Value getters coerce instead of returning napi_*_expected, and string getters write through a NULL result when buf is NULL, which crashes. Skips test_conversions/test.js.
  • An external's finalizer runs only at context teardown, where napi_throw_error allocates during garbage collection and aborts. Skips test_exception/testFinalizerException.js.
  • napi_create_function ignores the name length and accepts a NULL callback. Skips test_function/test.js.
  • napi_add_finalizer callbacks are not called before exit (0 of 2 expected calls). Skips test_general/testFinalizer.js.
  • napi_run_script converts a non-string script to a string instead of returning napi_string_expected. Skips test_general/testNapiRun.js.
  • napi_get_value_double coerces a string instead of returning napi_number_expected. Skips test_general/testNapiStatus.js.
  • napi_instanceof passes a non-object constructor to JSValueIsInstanceOfConstructor, which crashes. Skips test_general/testV8Instanceof.js.
  • Integer getters cast out-of-range doubles instead of wrapping (int32 and uint32) or saturating (int64). Skips test_number/test.js.
  • napi_remove_wrap rejects an object wrapped with a NULL native pointer. Skips test_reference_double_free/test_wrap.js.
  • napi_create_function creates the function with JSObjectMakeFunctionWithCallback, which is not a constructor, so a class cannot extend it. Skips test_new_target/test.js.
  • On Android, jsc-android (WebKit r250231) predates WebKit's 2020 fix that gives JSObjectMakeConstructor instances new.target's prototype, so subclass instances lose their methods. test_new_target/test.js also needs this fixed on Android.
Dominant language
C++
Stars
931
Forks
169
Avg merge
2d 17h
Merged PRs (30d)
66

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from BabylonJS/BabylonNative

All issues in BabylonJS/BabylonNative

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.