mirror of
https://github.com/oven-sh/bun
synced 2026-02-13 12:29:07 +00:00
Run callback passed to napi_module_register after dlopen returns instead of during call (#20478)
This commit is contained in:
@@ -535,6 +535,15 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionDlopen, (JSC::JSGlobalObject * globalOb
|
||||
#endif
|
||||
|
||||
if (callCountAtStart != globalObject->napiModuleRegisterCallCount) {
|
||||
// Module self-registered via static constructor
|
||||
if (globalObject->m_pendingNapiModule) {
|
||||
// Execute the stored registration function now that dlopen has completed
|
||||
Napi::executePendingNapiModule(globalObject);
|
||||
|
||||
// Clear the pending module
|
||||
globalObject->m_pendingNapiModule = {};
|
||||
}
|
||||
|
||||
JSValue resultValue = globalObject->m_pendingNapiModuleAndExports[0].get();
|
||||
globalObject->napiModuleRegisterCallCount = 0;
|
||||
globalObject->m_pendingNapiModuleAndExports[0].clear();
|
||||
|
||||
Reference in New Issue
Block a user