From cc269d95ec7c93333935a55b8eb7633fcec86928 Mon Sep 17 00:00:00 2001 From: Trupthi BP Date: Tue, 3 Jun 2025 14:43:06 +0530 Subject: [PATCH 1/2] RDKEMW-4729:Add support for clearMeasures Reason for change: Added clearMeasures function in utils.js Test Procedure: build should be successful. Risks: low Priority: P2 --- utils/utils.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/utils/utils.js b/utils/utils.js index a37753e..915c3c8 100644 --- a/utils/utils.js +++ b/utils/utils.js @@ -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) @@ -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(); From 9162e1cc2b8c7a19c41a7420e19f05786df4899e Mon Sep 17 00:00:00 2001 From: Trupthi BP Date: Tue, 3 Jun 2025 16:46:44 +0530 Subject: [PATCH 2/2] RDKEMW-4729: Code cleanup for window change Reason for change: Cleaned up code by adding flags Test Procedure: build should be successful and plugins must work Risks: low Priority: P2 --- src/NativeJSRenderer.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/NativeJSRenderer.cpp b/src/NativeJSRenderer.cpp index 1ffa020..a6152e7 100644 --- a/src/NativeJSRenderer.cpp +++ b/src/NativeJSRenderer.cpp @@ -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); @@ -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();