11cb0ef41Sopenharmony_ci// we define NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED here to 21cb0ef41Sopenharmony_ci// validate that it can be used as a form of test itself. It is 31cb0ef41Sopenharmony_ci// not related to any of the other tests 41cb0ef41Sopenharmony_ci// defined in the file 51cb0ef41Sopenharmony_ci#define NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED 61cb0ef41Sopenharmony_ci#include <js_native_api.h> 71cb0ef41Sopenharmony_ci#include <stdint.h> 81cb0ef41Sopenharmony_ci#include <stdio.h> 91cb0ef41Sopenharmony_ci#include <stdlib.h> 101cb0ef41Sopenharmony_ci#include "../common.h" 111cb0ef41Sopenharmony_ci#include "../entry_point.h" 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_cistatic napi_value testStrictEquals(napi_env env, napi_callback_info info) { 141cb0ef41Sopenharmony_ci size_t argc = 2; 151cb0ef41Sopenharmony_ci napi_value args[2]; 161cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ci bool bool_result; 191cb0ef41Sopenharmony_ci napi_value result; 201cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_strict_equals(env, args[0], args[1], &bool_result)); 211cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_get_boolean(env, bool_result, &result)); 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ci return result; 241cb0ef41Sopenharmony_ci} 251cb0ef41Sopenharmony_ci 261cb0ef41Sopenharmony_cistatic napi_value testGetPrototype(napi_env env, napi_callback_info info) { 271cb0ef41Sopenharmony_ci size_t argc = 1; 281cb0ef41Sopenharmony_ci napi_value args[1]; 291cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); 301cb0ef41Sopenharmony_ci 311cb0ef41Sopenharmony_ci napi_value result; 321cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_get_prototype(env, args[0], &result)); 331cb0ef41Sopenharmony_ci 341cb0ef41Sopenharmony_ci return result; 351cb0ef41Sopenharmony_ci} 361cb0ef41Sopenharmony_ci 371cb0ef41Sopenharmony_cistatic napi_value testGetVersion(napi_env env, napi_callback_info info) { 381cb0ef41Sopenharmony_ci uint32_t version; 391cb0ef41Sopenharmony_ci napi_value result; 401cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_get_version(env, &version)); 411cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_create_uint32(env, version, &result)); 421cb0ef41Sopenharmony_ci return result; 431cb0ef41Sopenharmony_ci} 441cb0ef41Sopenharmony_ci 451cb0ef41Sopenharmony_cistatic napi_value doInstanceOf(napi_env env, napi_callback_info info) { 461cb0ef41Sopenharmony_ci size_t argc = 2; 471cb0ef41Sopenharmony_ci napi_value args[2]; 481cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); 491cb0ef41Sopenharmony_ci 501cb0ef41Sopenharmony_ci bool instanceof; 511cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_instanceof(env, args[0], args[1], &instanceof)); 521cb0ef41Sopenharmony_ci 531cb0ef41Sopenharmony_ci napi_value result; 541cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_get_boolean(env, instanceof, &result)); 551cb0ef41Sopenharmony_ci 561cb0ef41Sopenharmony_ci return result; 571cb0ef41Sopenharmony_ci} 581cb0ef41Sopenharmony_ci 591cb0ef41Sopenharmony_cistatic napi_value getNull(napi_env env, napi_callback_info info) { 601cb0ef41Sopenharmony_ci napi_value result; 611cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_get_null(env, &result)); 621cb0ef41Sopenharmony_ci return result; 631cb0ef41Sopenharmony_ci} 641cb0ef41Sopenharmony_ci 651cb0ef41Sopenharmony_cistatic napi_value getUndefined(napi_env env, napi_callback_info info) { 661cb0ef41Sopenharmony_ci napi_value result; 671cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_get_undefined(env, &result)); 681cb0ef41Sopenharmony_ci return result; 691cb0ef41Sopenharmony_ci} 701cb0ef41Sopenharmony_ci 711cb0ef41Sopenharmony_cistatic napi_value createNapiError(napi_env env, napi_callback_info info) { 721cb0ef41Sopenharmony_ci napi_value value; 731cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_create_string_utf8(env, "xyz", 3, &value)); 741cb0ef41Sopenharmony_ci 751cb0ef41Sopenharmony_ci double double_value; 761cb0ef41Sopenharmony_ci napi_status status = napi_get_value_double(env, value, &double_value); 771cb0ef41Sopenharmony_ci 781cb0ef41Sopenharmony_ci NODE_API_ASSERT(env, status != napi_ok, "Failed to produce error condition"); 791cb0ef41Sopenharmony_ci 801cb0ef41Sopenharmony_ci const napi_extended_error_info *error_info = 0; 811cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_get_last_error_info(env, &error_info)); 821cb0ef41Sopenharmony_ci 831cb0ef41Sopenharmony_ci NODE_API_ASSERT(env, error_info->error_code == status, 841cb0ef41Sopenharmony_ci "Last error info code should match last status"); 851cb0ef41Sopenharmony_ci NODE_API_ASSERT(env, error_info->error_message, 861cb0ef41Sopenharmony_ci "Last error info message should not be null"); 871cb0ef41Sopenharmony_ci 881cb0ef41Sopenharmony_ci return NULL; 891cb0ef41Sopenharmony_ci} 901cb0ef41Sopenharmony_ci 911cb0ef41Sopenharmony_cistatic napi_value testNapiErrorCleanup(napi_env env, napi_callback_info info) { 921cb0ef41Sopenharmony_ci const napi_extended_error_info *error_info = 0; 931cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_get_last_error_info(env, &error_info)); 941cb0ef41Sopenharmony_ci 951cb0ef41Sopenharmony_ci napi_value result; 961cb0ef41Sopenharmony_ci bool is_ok = error_info->error_code == napi_ok; 971cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_get_boolean(env, is_ok, &result)); 981cb0ef41Sopenharmony_ci 991cb0ef41Sopenharmony_ci return result; 1001cb0ef41Sopenharmony_ci} 1011cb0ef41Sopenharmony_ci 1021cb0ef41Sopenharmony_cistatic napi_value testNapiTypeof(napi_env env, napi_callback_info info) { 1031cb0ef41Sopenharmony_ci size_t argc = 1; 1041cb0ef41Sopenharmony_ci napi_value args[1]; 1051cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); 1061cb0ef41Sopenharmony_ci 1071cb0ef41Sopenharmony_ci napi_valuetype argument_type; 1081cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_typeof(env, args[0], &argument_type)); 1091cb0ef41Sopenharmony_ci 1101cb0ef41Sopenharmony_ci napi_value result = NULL; 1111cb0ef41Sopenharmony_ci if (argument_type == napi_number) { 1121cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_create_string_utf8( 1131cb0ef41Sopenharmony_ci env, "number", NAPI_AUTO_LENGTH, &result)); 1141cb0ef41Sopenharmony_ci } else if (argument_type == napi_string) { 1151cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_create_string_utf8( 1161cb0ef41Sopenharmony_ci env, "string", NAPI_AUTO_LENGTH, &result)); 1171cb0ef41Sopenharmony_ci } else if (argument_type == napi_function) { 1181cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_create_string_utf8( 1191cb0ef41Sopenharmony_ci env, "function", NAPI_AUTO_LENGTH, &result)); 1201cb0ef41Sopenharmony_ci } else if (argument_type == napi_object) { 1211cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_create_string_utf8( 1221cb0ef41Sopenharmony_ci env, "object", NAPI_AUTO_LENGTH, &result)); 1231cb0ef41Sopenharmony_ci } else if (argument_type == napi_boolean) { 1241cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_create_string_utf8( 1251cb0ef41Sopenharmony_ci env, "boolean", NAPI_AUTO_LENGTH, &result)); 1261cb0ef41Sopenharmony_ci } else if (argument_type == napi_undefined) { 1271cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_create_string_utf8( 1281cb0ef41Sopenharmony_ci env, "undefined", NAPI_AUTO_LENGTH, &result)); 1291cb0ef41Sopenharmony_ci } else if (argument_type == napi_symbol) { 1301cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_create_string_utf8( 1311cb0ef41Sopenharmony_ci env, "symbol", NAPI_AUTO_LENGTH, &result)); 1321cb0ef41Sopenharmony_ci } else if (argument_type == napi_null) { 1331cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_create_string_utf8( 1341cb0ef41Sopenharmony_ci env, "null", NAPI_AUTO_LENGTH, &result)); 1351cb0ef41Sopenharmony_ci } 1361cb0ef41Sopenharmony_ci return result; 1371cb0ef41Sopenharmony_ci} 1381cb0ef41Sopenharmony_ci 1391cb0ef41Sopenharmony_cistatic bool deref_item_called = false; 1401cb0ef41Sopenharmony_cistatic void deref_item(napi_env env, void* data, void* hint) { 1411cb0ef41Sopenharmony_ci (void) hint; 1421cb0ef41Sopenharmony_ci 1431cb0ef41Sopenharmony_ci NODE_API_ASSERT_RETURN_VOID(env, data == &deref_item_called, 1441cb0ef41Sopenharmony_ci "Finalize callback was called with the correct pointer"); 1451cb0ef41Sopenharmony_ci 1461cb0ef41Sopenharmony_ci deref_item_called = true; 1471cb0ef41Sopenharmony_ci} 1481cb0ef41Sopenharmony_ci 1491cb0ef41Sopenharmony_cistatic napi_value deref_item_was_called(napi_env env, napi_callback_info info) { 1501cb0ef41Sopenharmony_ci napi_value it_was_called; 1511cb0ef41Sopenharmony_ci 1521cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_get_boolean(env, deref_item_called, &it_was_called)); 1531cb0ef41Sopenharmony_ci 1541cb0ef41Sopenharmony_ci return it_was_called; 1551cb0ef41Sopenharmony_ci} 1561cb0ef41Sopenharmony_ci 1571cb0ef41Sopenharmony_cistatic napi_value wrap_first_arg(napi_env env, 1581cb0ef41Sopenharmony_ci napi_callback_info info, 1591cb0ef41Sopenharmony_ci napi_finalize finalizer, 1601cb0ef41Sopenharmony_ci void* data) { 1611cb0ef41Sopenharmony_ci size_t argc = 1; 1621cb0ef41Sopenharmony_ci napi_value to_wrap; 1631cb0ef41Sopenharmony_ci 1641cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_get_cb_info(env, info, &argc, &to_wrap, NULL, NULL)); 1651cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_wrap(env, to_wrap, data, finalizer, NULL, NULL)); 1661cb0ef41Sopenharmony_ci 1671cb0ef41Sopenharmony_ci return to_wrap; 1681cb0ef41Sopenharmony_ci} 1691cb0ef41Sopenharmony_ci 1701cb0ef41Sopenharmony_cistatic napi_value wrap(napi_env env, napi_callback_info info) { 1711cb0ef41Sopenharmony_ci deref_item_called = false; 1721cb0ef41Sopenharmony_ci return wrap_first_arg(env, info, deref_item, &deref_item_called); 1731cb0ef41Sopenharmony_ci} 1741cb0ef41Sopenharmony_ci 1751cb0ef41Sopenharmony_cistatic napi_value unwrap(napi_env env, napi_callback_info info) { 1761cb0ef41Sopenharmony_ci size_t argc = 1; 1771cb0ef41Sopenharmony_ci napi_value wrapped; 1781cb0ef41Sopenharmony_ci void* data; 1791cb0ef41Sopenharmony_ci 1801cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_get_cb_info(env, info, &argc, &wrapped, NULL, NULL)); 1811cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_unwrap(env, wrapped, &data)); 1821cb0ef41Sopenharmony_ci 1831cb0ef41Sopenharmony_ci return NULL; 1841cb0ef41Sopenharmony_ci} 1851cb0ef41Sopenharmony_ci 1861cb0ef41Sopenharmony_cistatic napi_value remove_wrap(napi_env env, napi_callback_info info) { 1871cb0ef41Sopenharmony_ci size_t argc = 1; 1881cb0ef41Sopenharmony_ci napi_value wrapped; 1891cb0ef41Sopenharmony_ci void* data; 1901cb0ef41Sopenharmony_ci 1911cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_get_cb_info(env, info, &argc, &wrapped, NULL, NULL)); 1921cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_remove_wrap(env, wrapped, &data)); 1931cb0ef41Sopenharmony_ci 1941cb0ef41Sopenharmony_ci return NULL; 1951cb0ef41Sopenharmony_ci} 1961cb0ef41Sopenharmony_ci 1971cb0ef41Sopenharmony_cistatic bool finalize_called = false; 1981cb0ef41Sopenharmony_cistatic void test_finalize(napi_env env, void* data, void* hint) { 1991cb0ef41Sopenharmony_ci finalize_called = true; 2001cb0ef41Sopenharmony_ci} 2011cb0ef41Sopenharmony_ci 2021cb0ef41Sopenharmony_cistatic napi_value test_finalize_wrap(napi_env env, napi_callback_info info) { 2031cb0ef41Sopenharmony_ci return wrap_first_arg(env, info, test_finalize, NULL); 2041cb0ef41Sopenharmony_ci} 2051cb0ef41Sopenharmony_ci 2061cb0ef41Sopenharmony_cistatic napi_value finalize_was_called(napi_env env, napi_callback_info info) { 2071cb0ef41Sopenharmony_ci napi_value it_was_called; 2081cb0ef41Sopenharmony_ci 2091cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_get_boolean(env, finalize_called, &it_was_called)); 2101cb0ef41Sopenharmony_ci 2111cb0ef41Sopenharmony_ci return it_was_called; 2121cb0ef41Sopenharmony_ci} 2131cb0ef41Sopenharmony_ci 2141cb0ef41Sopenharmony_cistatic napi_value testAdjustExternalMemory(napi_env env, napi_callback_info info) { 2151cb0ef41Sopenharmony_ci napi_value result; 2161cb0ef41Sopenharmony_ci int64_t adjustedValue; 2171cb0ef41Sopenharmony_ci 2181cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_adjust_external_memory(env, 1, &adjustedValue)); 2191cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_create_double(env, (double)adjustedValue, &result)); 2201cb0ef41Sopenharmony_ci 2211cb0ef41Sopenharmony_ci return result; 2221cb0ef41Sopenharmony_ci} 2231cb0ef41Sopenharmony_ci 2241cb0ef41Sopenharmony_cistatic napi_value testNapiRun(napi_env env, napi_callback_info info) { 2251cb0ef41Sopenharmony_ci napi_value script, result; 2261cb0ef41Sopenharmony_ci size_t argc = 1; 2271cb0ef41Sopenharmony_ci 2281cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_get_cb_info(env, info, &argc, &script, NULL, NULL)); 2291cb0ef41Sopenharmony_ci 2301cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_run_script(env, script, &result)); 2311cb0ef41Sopenharmony_ci 2321cb0ef41Sopenharmony_ci return result; 2331cb0ef41Sopenharmony_ci} 2341cb0ef41Sopenharmony_ci 2351cb0ef41Sopenharmony_cistatic void finalizer_only_callback(napi_env env, void* data, void* hint) { 2361cb0ef41Sopenharmony_ci napi_ref js_cb_ref = data; 2371cb0ef41Sopenharmony_ci napi_value js_cb, undefined; 2381cb0ef41Sopenharmony_ci NODE_API_CALL_RETURN_VOID(env, napi_get_reference_value(env, js_cb_ref, &js_cb)); 2391cb0ef41Sopenharmony_ci NODE_API_CALL_RETURN_VOID(env, napi_get_undefined(env, &undefined)); 2401cb0ef41Sopenharmony_ci NODE_API_CALL_RETURN_VOID(env, 2411cb0ef41Sopenharmony_ci napi_call_function(env, undefined, js_cb, 0, NULL, NULL)); 2421cb0ef41Sopenharmony_ci NODE_API_CALL_RETURN_VOID(env, napi_delete_reference(env, js_cb_ref)); 2431cb0ef41Sopenharmony_ci} 2441cb0ef41Sopenharmony_ci 2451cb0ef41Sopenharmony_cistatic napi_value add_finalizer_only(napi_env env, napi_callback_info info) { 2461cb0ef41Sopenharmony_ci size_t argc = 2; 2471cb0ef41Sopenharmony_ci napi_value argv[2]; 2481cb0ef41Sopenharmony_ci napi_ref js_cb_ref; 2491cb0ef41Sopenharmony_ci 2501cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_get_cb_info(env, info, &argc, argv, NULL, NULL)); 2511cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_create_reference(env, argv[1], 1, &js_cb_ref)); 2521cb0ef41Sopenharmony_ci NODE_API_CALL(env, 2531cb0ef41Sopenharmony_ci napi_add_finalizer( 2541cb0ef41Sopenharmony_ci env, argv[0], js_cb_ref, finalizer_only_callback, NULL, NULL)); 2551cb0ef41Sopenharmony_ci return NULL; 2561cb0ef41Sopenharmony_ci} 2571cb0ef41Sopenharmony_ci 2581cb0ef41Sopenharmony_cistatic const char* env_cleanup_finalizer_messages[] = { 2591cb0ef41Sopenharmony_ci "simple wrap", 2601cb0ef41Sopenharmony_ci "wrap, removeWrap", 2611cb0ef41Sopenharmony_ci "first wrap", 2621cb0ef41Sopenharmony_ci "second wrap" 2631cb0ef41Sopenharmony_ci}; 2641cb0ef41Sopenharmony_ci 2651cb0ef41Sopenharmony_cistatic void cleanup_env_finalizer(napi_env env, void* data, void* hint) { 2661cb0ef41Sopenharmony_ci (void) env; 2671cb0ef41Sopenharmony_ci (void) hint; 2681cb0ef41Sopenharmony_ci 2691cb0ef41Sopenharmony_ci printf("finalize at env cleanup for %s\n", 2701cb0ef41Sopenharmony_ci env_cleanup_finalizer_messages[(uintptr_t)data]); 2711cb0ef41Sopenharmony_ci} 2721cb0ef41Sopenharmony_ci 2731cb0ef41Sopenharmony_cistatic napi_value env_cleanup_wrap(napi_env env, napi_callback_info info) { 2741cb0ef41Sopenharmony_ci size_t argc = 2; 2751cb0ef41Sopenharmony_ci napi_value argv[2]; 2761cb0ef41Sopenharmony_ci uint32_t value; 2771cb0ef41Sopenharmony_ci uintptr_t ptr_value; 2781cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_get_cb_info(env, info, &argc, argv, NULL, NULL)); 2791cb0ef41Sopenharmony_ci 2801cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_get_value_uint32(env, argv[1], &value)); 2811cb0ef41Sopenharmony_ci 2821cb0ef41Sopenharmony_ci ptr_value = value; 2831cb0ef41Sopenharmony_ci return wrap_first_arg(env, info, cleanup_env_finalizer, (void*)ptr_value); 2841cb0ef41Sopenharmony_ci} 2851cb0ef41Sopenharmony_ci 2861cb0ef41Sopenharmony_ciEXTERN_C_START 2871cb0ef41Sopenharmony_cinapi_value Init(napi_env env, napi_value exports) { 2881cb0ef41Sopenharmony_ci napi_property_descriptor descriptors[] = { 2891cb0ef41Sopenharmony_ci DECLARE_NODE_API_PROPERTY("testStrictEquals", testStrictEquals), 2901cb0ef41Sopenharmony_ci DECLARE_NODE_API_PROPERTY("testGetPrototype", testGetPrototype), 2911cb0ef41Sopenharmony_ci DECLARE_NODE_API_PROPERTY("testGetVersion", testGetVersion), 2921cb0ef41Sopenharmony_ci DECLARE_NODE_API_PROPERTY("testNapiRun", testNapiRun), 2931cb0ef41Sopenharmony_ci DECLARE_NODE_API_PROPERTY("doInstanceOf", doInstanceOf), 2941cb0ef41Sopenharmony_ci DECLARE_NODE_API_PROPERTY("getUndefined", getUndefined), 2951cb0ef41Sopenharmony_ci DECLARE_NODE_API_PROPERTY("getNull", getNull), 2961cb0ef41Sopenharmony_ci DECLARE_NODE_API_PROPERTY("createNapiError", createNapiError), 2971cb0ef41Sopenharmony_ci DECLARE_NODE_API_PROPERTY("testNapiErrorCleanup", testNapiErrorCleanup), 2981cb0ef41Sopenharmony_ci DECLARE_NODE_API_PROPERTY("testNapiTypeof", testNapiTypeof), 2991cb0ef41Sopenharmony_ci DECLARE_NODE_API_PROPERTY("wrap", wrap), 3001cb0ef41Sopenharmony_ci DECLARE_NODE_API_PROPERTY("envCleanupWrap", env_cleanup_wrap), 3011cb0ef41Sopenharmony_ci DECLARE_NODE_API_PROPERTY("unwrap", unwrap), 3021cb0ef41Sopenharmony_ci DECLARE_NODE_API_PROPERTY("removeWrap", remove_wrap), 3031cb0ef41Sopenharmony_ci DECLARE_NODE_API_PROPERTY("addFinalizerOnly", add_finalizer_only), 3041cb0ef41Sopenharmony_ci DECLARE_NODE_API_PROPERTY("testFinalizeWrap", test_finalize_wrap), 3051cb0ef41Sopenharmony_ci DECLARE_NODE_API_PROPERTY("finalizeWasCalled", finalize_was_called), 3061cb0ef41Sopenharmony_ci DECLARE_NODE_API_PROPERTY("derefItemWasCalled", deref_item_was_called), 3071cb0ef41Sopenharmony_ci DECLARE_NODE_API_PROPERTY("testAdjustExternalMemory", testAdjustExternalMemory) 3081cb0ef41Sopenharmony_ci }; 3091cb0ef41Sopenharmony_ci 3101cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_define_properties( 3111cb0ef41Sopenharmony_ci env, exports, sizeof(descriptors) / sizeof(*descriptors), descriptors)); 3121cb0ef41Sopenharmony_ci 3131cb0ef41Sopenharmony_ci return exports; 3141cb0ef41Sopenharmony_ci} 3151cb0ef41Sopenharmony_ciEXTERN_C_END 316