Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions src/JavaScriptContextBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,26 @@ void JavaScriptContextBase::populateModulesPath()
if(getenv("JSRUNTIME_MODULES_PATH"))
{
Comment thread
vjain008 marked this conversation as resolved.
std::cout<<"JSRUNTIME_MODULES_PATH variable is set"<<std::endl;
sModulesPath = std::string(getenv("JSRUNTIME_MODULES_PATH"));
return;
const char* envModulesPath = getenv("JSRUNTIME_MODULES_PATH");
if(envModulesPath)
{
sModulesPath = envModulesPath;
if (! sModulesPath.empty() && sModulesPath.back() != '/')
{
sModulesPath += '/';
}
}
}
else{
char* cwd = getcwd(nullptr,0);
std::string PWD=cwd;
Comment thread
vjain008 marked this conversation as resolved.
sModulesPath=PWD+"/modules/";
free(cwd);
Comment thread
vjain008 marked this conversation as resolved.
//Required for Plugin
if(PWD == "/")
{
PWD="/home/root";
Comment thread
vjain008 marked this conversation as resolved.
}
Comment thread
vjain008 marked this conversation as resolved.
sModulesPath=PWD+"/modules/";
Comment thread
vjain008 marked this conversation as resolved.
}
std::cout<<"Modules Path:"<<sModulesPath<<std::endl;
return;
Expand Down
18 changes: 9 additions & 9 deletions src/NativeJSLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ void NativeJSLogger::log(LogLevel level, const char* format, ...)

vethanlog(ethanLogLevel, "JsRuntime", nullptr, -1, newFormat, args);
}
#else

const char* levelStr = logLevelNames[level];
char buffer[512];
vsnprintf(buffer, sizeof(buffer), format, args);
printf("\n[%s] JsRuntime Thread-%d: %s\n", levelStr, threadId, buffer);

#endif //USE_ETHANLOG

else
#endif //USE_ETHANLOG
{
Comment thread
vjain008 marked this conversation as resolved.
const char* levelStr = logLevelNames[level];
char buffer[512];
vsnprintf(buffer, sizeof(buffer), format, args);
printf("\n[%s] JsRuntime Thread-%d: %s\n", levelStr, threadId, buffer);
}
va_end(args);
}
}
4 changes: 2 additions & 2 deletions src/NativeJSRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ void NativeJSRenderer::runApplicationInternal(ApplicationRequest& appRequest)
}
JavaScriptContext* context = (JavaScriptContext*)mContextMap[id].context;
context->setUrl(mContextMap[id].url);
if(context->getModuleSettings().enableJSDOM)
if(context->getModuleSettings().enableMiniJSDOM)
{
std::stringstream window;
window<<"window.location = {\"href\":\"" << url << "\"};";
Expand All @@ -378,7 +378,7 @@ void NativeJSRenderer::runApplicationInternal(ApplicationRequest& appRequest)
NativeJSLogger::log(INFO, "About to launch local app\n");
JavaScriptContext* context = (JavaScriptContext*)mContextMap[id].context;
context->setUrl(mContextMap[id].url);
if(context->getModuleSettings().enableJSDOM)
if(context->getModuleSettings().enableMiniJSDOM)
{
std::stringstream window;
window<<"window.location = {\"href\":\"file:/" << url << "\"};";
Expand Down
19 changes: 10 additions & 9 deletions src/jsc/JavaScriptContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,16 @@ void JavaScriptContext::loadAAMPJSBindingsLib()
if (nullptr == gAAMPJSBindings->PlayerLibHandle)
Comment thread
vjain008 marked this conversation as resolved.
{
static const char *aampJSBindingsLib = "libaampjsbindings.so";
// This is required for NativeJS Plugin
#if 0
static const char *jscLib = "libJavaScriptCore.so";
jscLibHandle = dlopen(jscLib, RTLD_NOW | RTLD_GLOBAL);
if (!jscLibHandle)
if(!getenv("ETHAN_LOGGING_PIPE"))
Comment thread
vjain008 marked this conversation as resolved.
{
std::cout<<"dlopen error for jsc library " << dlerror() << std::endl;
// This is required for NativeJS Plugin
static const char *jscLib = "libJavaScriptCore.so";
jscLibHandle = dlopen(jscLib, RTLD_NOW | RTLD_GLOBAL);
Comment thread
vjain008 marked this conversation as resolved.
if (!jscLibHandle)
{
std::cout<<"dlopen error for jsc library " << dlerror() << std::endl;
}
}
Comment thread
vjain008 marked this conversation as resolved.
Comment thread
vjain008 marked this conversation as resolved.
Comment thread
vjain008 marked this conversation as resolved.
#endif

void *aampJSBindingsLibHandle = dlopen(aampJSBindingsLib, RTLD_NOW | RTLD_GLOBAL);
if (aampJSBindingsLibHandle)
{
Expand All @@ -174,7 +174,8 @@ void JavaScriptContext::unloadAAMPJSBindingsLib()
if (nullptr != gAAMPJSBindings->PlayerLibHandle)
{
dlclose(gAAMPJSBindings->PlayerLibHandle);
//dlclose(jscLibHandle);
if(!getenv("ETHAN_LOGGING_PIPE"))
Comment thread
vjain008 marked this conversation as resolved.
Comment thread
vjain008 marked this conversation as resolved.
dlclose(jscLibHandle);
Comment thread
vjain008 marked this conversation as resolved.
Comment thread
vjain008 marked this conversation as resolved.
Comment thread
vjain008 marked this conversation as resolved.

Comment thread
vjain008 marked this conversation as resolved.
}
}
Expand Down