#include "third_party/blink/renderer/platform/wtf/text/string_utf8_adaptor.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
+#if BUILDFLAG(IS_TIZEN_TV)
+#include "third_party/blink/public/platform/web_application_type.h"
+#include "third_party/blink/renderer/core/dom/static_node_list.h"
+#endif
+
namespace blink {
namespace {
Settings* settings = frame_->GetSettings();
LocalDOMWindow* window = frame_->DomWindow();
+#if BUILDFLAG(IS_TIZEN_TV)
+ if (IsHbbTV() && frame_->IsMainFrame()) {
+ StaticElementList* script_elements =
+ frame_->GetDocument()->QuerySelectorAll(WebString("script"));
+ if (!script_elements || !script_elements->length()) {
+ LOG(INFO) << "There is no <script>, v8 is not initialized.";
+ if (settings && !settings->GetForceMainWorldInitialization()) {
+ LOG(INFO) << "Forcing v8 initialization for hbbtv is enabled.";
+ // Forcibly instantiate WindowProxy.
+ window->GetScriptController().WindowProxy(DOMWrapperWorld::MainWorld());
+ }
+ }
+ }
+#endif
if (settings && settings->GetForceMainWorldInitialization()) {
// Forcibly instantiate WindowProxy, even if script is disabled.
window->GetScriptController().WindowProxy(DOMWrapperWorld::MainWorld());