<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi,<div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>I’m trying to port JavaScriptCore to android and use it in my project. I have built the library successfully, but encountered some issues when running my project. I have no idea what to do. Could someone give me some suggestions?</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>1. The code runs extremely slow. I noticed that there’s only empty implementation of HeapTimer and CGActivityCallback by default. Will GC work without HeapTimer implementation? I tried to implement them with WTF::RunLoop::Timer, and it seems to be better. I’m no sure whether there are other unimplemented methods.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>2. The code frequently crashes (not always) at the line “<span style="font-family: Menlo; font-size: 9pt; background-color: rgb(255, 255, 255);" class="">RELEASE_ASSERT(!source.isNull());</span>” in the constructor of class FunctionExecutable. The stack is:</div><div class="">::WTFCrash() Assertions.cpp:337</div><div class="">JSC::FunctionExecutable::FunctionExecutable(JSC::VM&, JSC::SourceCode const&, JSC::UnlinkedFunctionExecutable*, unsigned int, unsigned int, unsigned int, unsigned int, JSC::Intrinsic) FunctionExecutable.cpp:48</div><div class="">JSC::FunctionExecutable::create(JSC::VM&, JSC::SourceCode const&, JSC::UnlinkedFunctionExecutable*, unsigned int, unsigned int, unsigned int, unsigned int, JSC::Intrinsic) FunctionExecutable.h:43</div><div class="">JSC::UnlinkedFunctionExecutable::link(JSC::VM&, JSC::SourceCode const&, std::optional<int>, JSC::Intrinsic) UnlinkedFunctionExecutable.cpp:162</div><div class="">JSC::CodeBlock::finishCreation(JSC::VM&, JSC::ScriptExecutable*, JSC::UnlinkedCodeBlock*, JSC::JSScope*) CodeBlock.cpp:1987</div><div class="">JSC::FunctionCodeBlock::create(JSC::VM*, JSC::FunctionExecutable*, JSC::UnlinkedFunctionCodeBlock*, JSC::JSScope*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, unsigned int) FunctionCodeBlock.h:55</div><div class="">JSC::ScriptExecutable::newCodeBlockFor(JSC::CodeSpecializationKind, JSC::JSFunction*, JSC::JSScope*, JSC::JSObject*&) ScriptExecutable.cpp:240</div><div class="">JSC::ScriptExecutable::prepareForExecutionImpl(JSC::VM&, JSC::JSFunction*, JSC::JSScope*, JSC::CodeSpecializationKind, JSC::CodeBlock*&) ScriptExecutable.cpp:319</div><div class="">JSC::JSObject* JSC::ScriptExecutable::prepareForExecution<JSC::FunctionExecutable>(JSC::VM&, JSC::JSFunction*, JSC::JSScope*, JSC::CodeSpecializationKind, JSC::CodeBlock*&) CodeBlock.h:1101</div><div class="">JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) Interpreter.cpp:935</div><div class="">JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) CallData.cpp:39</div><div class="">JSC::profiledCall(JSC::ExecState*, JSC::ProfilingReason, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) CallData.cpp:59</div><div class="">::JSObjectCallAsFunction(JSContextRef, JSObjectRef, JSObjectRef, size_t, const JSValueRef *, JSValueRef *) JSObjectRef.cpp:541</div><div class=""><br class=""></div><div class="">my code is as below which works well on mac and iOS:</div><div class=""><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">JSValueRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">loadModule(</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">JSContextRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> ctx, </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">JSObjectRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> function, </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">JSObjectRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> thisObject, </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">size_t</span><span style="font-variant-ligatures: no-common-ligatures" class=""> argumentCount, </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">const</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">JSValueRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> arguments[], </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">JSValueRef</span><span style="font-variant-ligatures: no-common-ligatures" class="">* exception)</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">{</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">JSStringRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> message = </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">nullptr</span><span style="font-variant-ligatures: no-common-ligatures" class="">;</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">do</span><span style="font-variant-ligatures: no-common-ligatures" class=""> {</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> ((argumentCount == </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">4</span><span style="font-variant-ligatures: no-common-ligatures" class=""> || argumentCount == </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">5</span><span style="font-variant-ligatures: no-common-ligatures" class="">) && </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">JSValueIsString</span><span style="font-variant-ligatures: no-common-ligatures" class="">(ctx, arguments[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span><span style="font-variant-ligatures: no-common-ligatures" class="">]))</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> {</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">std</span><span style="font-variant-ligatures: no-common-ligatures" class="">::</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">string</span><span style="font-variant-ligatures: no-common-ligatures" class=""> path = </span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">jsval_to_value</span><span style="font-variant-ligatures: no-common-ligatures" class=""><</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">std</span><span style="font-variant-ligatures: no-common-ligatures" class="">::</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">string</span><span style="font-variant-ligatures: no-common-ligatures" class="">>(ctx, arguments[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span><span style="font-variant-ligatures: no-common-ligatures" class="">]);</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">JSObjectRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> moduleObj = </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">JSValueToObject</span><span style="font-variant-ligatures: no-common-ligatures" class="">(ctx, arguments[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">3</span><span style="font-variant-ligatures: no-common-ligatures" class="">], exception);</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> (*exception)</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">break</span><span style="font-variant-ligatures: no-common-ligatures" class="">;</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">auto</span><span style="font-variant-ligatures: no-common-ligatures" class=""> body = </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">String</span><span style="font-variant-ligatures: no-common-ligatures" class="">::</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">stringWithContentsOfFile</span><span style="font-variant-ligatures: no-common-ligatures" class="">(path.</span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">c_str</span><span style="font-variant-ligatures: no-common-ligatures" class="">());</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> (!body)</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> {</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> message = </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">JSStringCreateWithUTF8CString</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">StringUtil</span><span style="font-variant-ligatures: no-common-ligatures" class="">::</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">Format</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"cannot load file %s"</span><span style="font-variant-ligatures: no-common-ligatures" class="">, path.</span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">c_str</span><span style="font-variant-ligatures: no-common-ligatures" class="">()).</span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">c_str</span><span style="font-variant-ligatures: no-common-ligatures" class="">());</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">break</span><span style="font-variant-ligatures: no-common-ligatures" class="">;</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> }</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> (body-></span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">length</span><span style="font-variant-ligatures: no-common-ligatures" class="">() == </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> {</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">nullptr</span><span style="font-variant-ligatures: no-common-ligatures" class="">;</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> }</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(62, 30, 129);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">JSStringRef</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> pathUrl = </span><span style="font-variant-ligatures: no-common-ligatures" class="">JSStringCreateWithUTF8CString</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(path.</span><span style="font-variant-ligatures: no-common-ligatures" class="">c_str</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">());</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">JSStringRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> bodyStr = </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">JSStringCreateWithUTF8CString</span><span style="font-variant-ligatures: no-common-ligatures" class="">(body-></span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">c_str</span><span style="font-variant-ligatures: no-common-ligatures" class="">());</span></div><p style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; min-height: 16px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">size_t</span><span style="font-variant-ligatures: no-common-ligatures" class=""> extraParams = </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span><span style="font-variant-ligatures: no-common-ligatures" class="">;</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">JSPropertyNameArrayRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> nameArr = </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">nullptr</span><span style="font-variant-ligatures: no-common-ligatures" class="">;</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">JSObjectRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> extra = </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">nullptr</span><span style="font-variant-ligatures: no-common-ligatures" class="">;</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> (argumentCount == </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">5</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> {</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> extra = </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">JSValueToObject</span><span style="font-variant-ligatures: no-common-ligatures" class="">(ctx, arguments[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">4</span><span style="font-variant-ligatures: no-common-ligatures" class="">], </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">nullptr</span><span style="font-variant-ligatures: no-common-ligatures" class="">);</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> (extra)</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> {</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> nameArr = </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">JSObjectCopyPropertyNames</span><span style="font-variant-ligatures: no-common-ligatures" class="">(ctx, extra);</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> extraParams = </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">JSPropertyNameArrayGetCount</span><span style="font-variant-ligatures: no-common-ligatures" class="">(nameArr);</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> }</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> }</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">JSValueRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> args[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">3</span><span style="font-variant-ligatures: no-common-ligatures" class=""> + extraParams];</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> args[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span><span style="font-variant-ligatures: no-common-ligatures" class="">] = arguments[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">1</span><span style="font-variant-ligatures: no-common-ligatures" class="">];</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> args[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">1</span><span style="font-variant-ligatures: no-common-ligatures" class="">] = arguments[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">2</span><span style="font-variant-ligatures: no-common-ligatures" class="">];</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> args[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">2</span><span style="font-variant-ligatures: no-common-ligatures" class="">] = arguments[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">3</span><span style="font-variant-ligatures: no-common-ligatures" class="">];</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">JSStringRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> params[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">3</span><span style="font-variant-ligatures: no-common-ligatures" class=""> + extraParams];</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(62, 30, 129);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> params[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">] = </span><span style="font-variant-ligatures: no-common-ligatures" class="">JSStringCreateWithUTF8CString</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"require"</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">);</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(62, 30, 129);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> params[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">1</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">] = </span><span style="font-variant-ligatures: no-common-ligatures" class="">JSStringCreateWithUTF8CString</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"exports"</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">);</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(62, 30, 129);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> params[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">2</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">] = </span><span style="font-variant-ligatures: no-common-ligatures" class="">JSStringCreateWithUTF8CString</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"module"</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">);</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> (extra && extraParams > </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> {</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">for</span><span style="font-variant-ligatures: no-common-ligatures" class=""> (</span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">int</span><span style="font-variant-ligatures: no-common-ligatures" class=""> i = </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span><span style="font-variant-ligatures: no-common-ligatures" class="">; i < extraParams; ++i)</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> {</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> params[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">3</span><span style="font-variant-ligatures: no-common-ligatures" class=""> + i] = </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">JSPropertyNameArrayGetNameAtIndex</span><span style="font-variant-ligatures: no-common-ligatures" class="">(nameArr, i);</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> args[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">3</span><span style="font-variant-ligatures: no-common-ligatures" class=""> + i] = </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">JSObjectGetProperty</span><span style="font-variant-ligatures: no-common-ligatures" class="">(ctx, extra, params[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">3</span><span style="font-variant-ligatures: no-common-ligatures" class=""> + i], </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">nullptr</span><span style="font-variant-ligatures: no-common-ligatures" class="">);</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> }</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> }</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">JSObjectRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> func = </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">JSObjectMakeFunction</span><span style="font-variant-ligatures: no-common-ligatures" class="">(ctx, </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">NULL</span><span style="font-variant-ligatures: no-common-ligatures" class="">, (</span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">unsigned</span><span style="font-variant-ligatures: no-common-ligatures" class="">)extraParams + </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">3</span><span style="font-variant-ligatures: no-common-ligatures" class="">, params, bodyStr, pathUrl, </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">1</span><span style="font-variant-ligatures: no-common-ligatures" class="">, exception);</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">JSStringRelease</span><span style="font-variant-ligatures: no-common-ligatures" class="">(pathUrl);</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">JSStringRelease</span><span style="font-variant-ligatures: no-common-ligatures" class="">(bodyStr);</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">JSStringRelease</span><span style="font-variant-ligatures: no-common-ligatures" class="">(params[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span><span style="font-variant-ligatures: no-common-ligatures" class="">]);</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">JSStringRelease</span><span style="font-variant-ligatures: no-common-ligatures" class="">(params[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">1</span><span style="font-variant-ligatures: no-common-ligatures" class="">]);</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">JSStringRelease</span><span style="font-variant-ligatures: no-common-ligatures" class="">(params[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">2</span><span style="font-variant-ligatures: no-common-ligatures" class="">]);</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> (nameArr)</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">JSPropertyNameArrayRelease</span><span style="font-variant-ligatures: no-common-ligatures" class="">(nameArr);</span></div><p style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; min-height: 16px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> (*exception) </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">break</span><span style="font-variant-ligatures: no-common-ligatures" class="">;</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">JSObjectCallAsFunction</span><span style="font-variant-ligatures: no-common-ligatures" class="">(ctx, func, moduleObj, extraParams + </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">3</span><span style="font-variant-ligatures: no-common-ligatures" class="">, args, exception);</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">nullptr</span><span style="font-variant-ligatures: no-common-ligatures" class="">;</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> }</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> } </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">while</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span><span style="font-variant-ligatures: no-common-ligatures" class="">);</span></div><p style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; min-height: 16px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> (!*exception)</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> {</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> (!message)</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(209, 47, 27);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> message = </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">JSStringCreateWithUTF8CString</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span><span style="font-variant-ligatures: no-common-ligatures" class="">"invalid arguments for loadModule"</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">);</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">JSValueRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> value = </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">JSValueMakeString</span><span style="font-variant-ligatures: no-common-ligatures" class="">(ctx, message);</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> *exception = </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">JSObjectMakeError</span><span style="font-variant-ligatures: no-common-ligatures" class="">(ctx, </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">1</span><span style="font-variant-ligatures: no-common-ligatures" class="">, &value, </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">nullptr</span><span style="font-variant-ligatures: no-common-ligatures" class="">);</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">JSStringRelease</span><span style="font-variant-ligatures: no-common-ligatures" class="">(message);</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> }</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(186, 45, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">return</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">nullptr</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">;</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div></div></body></html>