Skip to content
Closed
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
15 changes: 0 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ option(BUILD_JSRUNTIME_APP "BUILD_JSRUNTIME_APP" ON)
option(ENABLE_JSRUNTIME_SERVER "ENABLE_JSRUNTIME_SERVER" OFF)
option(BUILD_JSRUNTIME_CLIENT "BUILD_JSRUNTIME_CLIENT" OFF)
option(NATIVEJS_DEVELOPER_MODE "NATIVEJS_DEVELOPER_MODE" OFF)
option(ENABLE_JSRUNTIME_LAUNCHER "ENABLE_JSRUNTIME_LAUNCHER" OFF)

#can be jsc or node or v8 or quickjs
option(JSRUNTIME_ENGINE_NAME "JSRUNTIME_ENGINE_NAME" "jsc")
Expand Down Expand Up @@ -106,10 +105,6 @@ set(JSRUNTIME_APP_FILES
${JSRUNTIME_COMMON_SOURCE_DIRECTORY}/jsruntime.cpp
)

set(JSRUNTIME_LAUNCHER_FILES
${JSRUNTIME_COMMON_SOURCE_DIRECTORY}/JSRuntimeLauncher.cpp
)

if ( ENABLE_JSRUNTIME_SERVER )
add_definitions("-DENABLE_JSRUNTIME_SERVER")
add_definitions("-DWS_SERVER_PORT=9112")
Expand Down Expand Up @@ -180,16 +175,6 @@ if (BUILD_JSRUNTIME_CLIENT)
target_link_libraries(jsruntime_client ${JSRUNTIME_LIBRARY_LINK_DIRECTORIES} -lpthread)
endif (BUILD_JSRUNTIME_CLIENT)

if (ENABLE_JSRUNTIME_LAUNCHER)
message("Enabling build support for jsruntime launcher - widget")
add_executable(jsruntime_launcher ${JSRUNTIME_LAUNCHER_FILES})
add_dependencies(${JSRUNTIME_LIBRARY_NAME} ${JSRUNTIME_ENGINE_DEPENDENT_LIBRARY_NAME})
add_dependencies(jsruntime_launcher ${JSRUNTIME_LIBRARY_NAME} ${JSRUNTIME_ENGINE_DEPENDENT_LIBRARY_NAME} )
target_include_directories(jsruntime_launcher PRIVATE ${JSRUNTIME_INCLUDE_DIRECTORIES})
set_target_properties(jsruntime_launcher PROPERTIES OUTPUT_NAME "JSRuntimeLauncher")
target_link_libraries(jsruntime_launcher ${JSRUNTIME_LIBRARY_LINK_DIRECTORIES} -l${JSRUNTIME_LIBRARY_NAME} ${JSRUNTIME_LINK_LIBRARIES})
endif (ENABLE_JSRUNTIME_LAUNCHER)

set(UWEBSOCKETS_TARGET "Linux")
if (APPLE)
set(UWEBSOCKETS_TARGET "Darwin")
Expand Down
1 change: 1 addition & 0 deletions include/JavaScriptContextBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class JavaScriptContextBase:public IJavaScriptContext, public JavaScriptKeyListe
std::string getUrl();
virtual void onKeyPress(struct JavaScriptKeyDetails& details);
virtual void onKeyRelease(struct JavaScriptKeyDetails& details);
ModuleSettings getModuleSettings();
protected:
virtual void processKeyEvent(struct JavaScriptKeyDetails& details, bool keyPress) = 0;
virtual bool evaluateScript(const char* script, const char* name, const char *args, bool module=false) = 0;
Expand Down
249 changes: 0 additions & 249 deletions src/JSRuntimeLauncher.cpp

This file was deleted.

5 changes: 5 additions & 0 deletions src/JavaScriptContextBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,8 @@ void JavaScriptContextBase::onKeyRelease(struct JavaScriptKeyDetails& details)
{
processKeyEvent(details, false);
}

ModuleSettings JavaScriptContextBase::getModuleSettings()
{
return mModuleSettings;
}
28 changes: 15 additions & 13 deletions src/NativeJSRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,29 +326,31 @@ void NativeJSRenderer::runApplicationInternal(ApplicationRequest& appRequest)
return ;
}
JavaScriptContext* context = (JavaScriptContext*)mContextMap[id].context;
#if defined(ENABLE_JSRUNTIME_LAUNCHER)
std::stringstream window;
window<<"window.location = {\"href\":\"" << url << "\"};";
NativeJSLogger::log(INFO, "Adding the window location: %s to js file\n", window.str().c_str());
context->runScript(window.str().c_str(),true, url, nullptr, true);
#endif
if(context->getModuleSettings().enableJSDOM)
{
std::stringstream window;
window<<"window.location = {\"href\":\"" << url << "\"};";
NativeJSLogger::log(INFO, "Adding the window location: %s to js file\n", window.str().c_str());
context->runScript(window.str().c_str(),true, url, nullptr, true);
}
NativeJSLogger::log(INFO, "nativeJS application thunder execution url: %s, result: %d\n", url.c_str(), ret ? 1 : 0);
ret = context->runScript(chunk.contentsBuffer, true, url, nullptr, true);
NativeJSLogger::log(INFO, "nativeJS application execution result: %d\n", ret ? 1 : 0);
double duration = context->getExecutionDuration();
context->setAppdata(id, url);
context->setAppdata(id, url);
NativeJSLogger::log(INFO, "Execution duration(runApplicationDuration) for ID %d | URL %s : %.3f ms\n", id, url.c_str(), duration);
}
else
{
NativeJSLogger::log(INFO, "About to launch local app\n");
JavaScriptContext* context = (JavaScriptContext*)mContextMap[id].context;
#if defined(ENABLE_JSRUNTIME_LAUNCHER)
std::stringstream window;
window<<"window.location = {\"href\":\"file:/" << url << "\"};";
NativeJSLogger::log(INFO, "Adding the window location: %s to js file\n", window.str().c_str());
context->runScript(window.str().c_str(),true, url, nullptr, true);
#endif
if(context->getModuleSettings().enableJSDOM)
{
std::stringstream window;
window<<"window.location = {\"href\":\"file:/" << url << "\"};";
NativeJSLogger::log(INFO, "Adding the window location: %s to js file\n", window.str().c_str());
context->runScript(window.str().c_str(),true, url, nullptr, true);
}
NativeJSLogger::log(INFO, "Running test application: %s\n", url.c_str());
bool ret = context->runFile(url.c_str(), nullptr, true);
NativeJSLogger::log(INFO, "Test application execution result: %d\n", ret ? 1 : 0);
Expand Down
2 changes: 2 additions & 0 deletions src/jsc/JavaScriptContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include <iostream>
#include <signal.h>

#include <fstream>
#include <sstream>
#include <JavaScriptCore/JavaScript.h>
#include <JavaScriptContext.h>
#include <JavaScriptUtils.h>
Expand Down