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
10 changes: 7 additions & 3 deletions src/NativeJSRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,12 @@ void NativeJSRenderer::runApplicationInternal(ApplicationRequest& appRequest)
return ;
}
JavaScriptContext* context = (JavaScriptContext*)mContextMap[id].context;
std::stringstream window;
#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
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);
Expand All @@ -341,11 +343,13 @@ void NativeJSRenderer::runApplicationInternal(ApplicationRequest& appRequest)
{
NativeJSLogger::log(INFO, "About to launch local app\n");
JavaScriptContext* context = (JavaScriptContext*)mContextMap[id].context;
std::stringstream window;
#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);
NativeJSLogger::log(INFO, "Running test application: %s\n", url);
#endif
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);
double duration = context->getExecutionDuration();
Expand Down
20 changes: 15 additions & 5 deletions utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ class Performance

clearMarks()
{
for (var key in entries)
for (var key in this.entries)
{
entries[key] = null;
delete entries[key];
this.entries[key] = null;
delete this.entries[key];
}
entries = {}
this.entries = {}
}

getEntriesByName(name)
Expand All @@ -117,6 +117,16 @@ class Performance
now()
{
return Date.now();
}
}
clearMeasures()
{
for (var key in this.entries)
{
this.entries[key] = null;
delete this.entries[key];
}
this.entries = {}
}

}
performance = new Performance();