| 3032 | if (!jsEntry.exceptionTracker) { |
| 3033 | return; |
| 3034 | } |
| 3035 | |
| 3036 | jsParameters.emplace_back(jsEntry.jsContext.ensureRetainedValue(std::move(jsParameter))); |
| 3037 | } |
| 3038 | |
| 3039 | JSFunctionCallContext callContext( |
| 3040 | jsEntry.jsContext, jsParameters.data(), jsParameters.size(), jsEntry.exceptionTracker); |
| 3041 | jsEntry.jsContext.callObjectProperty(moduleJsValue, functionName.toStringView(), callContext); |
| 3042 | } else { |
| 3043 | JSFunctionCallContext callContext(jsEntry.jsContext, nullptr, 0, jsEntry.exceptionTracker); |
| 3044 | jsEntry.jsContext.callObjectProperty(moduleJsValue, functionName.toStringView(), callContext); |
| 3045 | } |
| 3046 | }); |
| 3047 | } |
| 3048 | |
| 3049 | Error JavaScriptRuntime::onModuleLoadFailed(const Error& error, const ResourceId& resourceId) { |
| 3050 | return error.rethrow(STRING_FORMAT("Failed to load JS module '{}'", resourceId)); |
| 3051 | } |
| 3052 | |
| 3053 | void JavaScriptRuntime::initializeModuleLoader(JavaScriptEntryParameters& jsEntry) { |
| 3054 | loadJsModule(jsEntry.jsContext, STRING_LITERAL("valdi_core/src/Init"), true, nullptr, 0, jsEntry.exceptionTracker); |
| 3055 | if (!jsEntry.exceptionTracker) { |
| 3056 | return; |
| 3057 | } |
| 3058 | auto globalObjectResult = jsEntry.jsContext.getGlobalObject(jsEntry.exceptionTracker); |
| 3059 | if (!jsEntry.exceptionTracker) { |
| 3060 | return; |
| 3061 | } |
| 3062 | |
| 3063 | _moduleLoader = |
| 3064 | jsEntry.jsContext.getObjectProperty(globalObjectResult.get(), "moduleLoader", jsEntry.exceptionTracker); |
| 3065 | if (!jsEntry.exceptionTracker) { |
| 3066 | return; |
| 3067 | } |
| 3068 | _moduleLoader = jsEntry.jsContext.ensureRetainedValue(std::move(_moduleLoader)); |
| 3069 | |
| 3070 | auto longObject = jsEntry.jsContext.getObjectProperty(globalObjectResult.get(), "Long", jsEntry.exceptionTracker); |
| 3071 | if (!jsEntry.exceptionTracker) { |
| 3072 | return; |
| 3073 | } |
| 3074 | |
| 3075 | if (!jsEntry.jsContext.isValueFunction(longObject.get())) { |
| 3076 | jsEntry.exceptionTracker.onError(Error("Failed to resolve Long constructor")); |
| 3077 | return; |
| 3078 | } |
| 3079 | |
| 3080 | jsEntry.jsContext.setLongConstructor(longObject); |
| 3081 | } |
no test coverage detected