From 2a9a06be0a4e0105bc2ba1af71fc2de1bb3b73c6 Mon Sep 17 00:00:00 2001 From: liwei Date: Thu, 5 Dec 2019 21:56:24 +0800 Subject: [PATCH] [VD] Fix issue for app deeplink that page is not reload When amazon music app(3201710014874) is shown in FG, and press preview in amazon music, page is not reload, bcz WRT think request src is the same with original url. request src is "file:///index.html#!/deepLink", original url is "file:///index.html#!/main/home". Actually they are different, WRT should reload it. Change-Id: I7f7b5767c1a34b017f80d6babe8e58f760f967a1 Signed-off-by: liwei --- wrt_app/src/runtime.js | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) mode change 100755 => 100644 wrt_app/src/runtime.js diff --git a/wrt_app/src/runtime.js b/wrt_app/src/runtime.js old mode 100755 new mode 100644 index 14c51c5..c0a59ce --- a/wrt_app/src/runtime.js +++ b/wrt_app/src/runtime.js @@ -157,20 +157,25 @@ class Runtime { let reload = loadInfo.getReload() || _this.webApplication.isAlwaysReload; if (!reload) { + let originalUrl = _this.webApplication.mainWindow.getURL(); if (wrt.tv) { - console.log(`src = ${src}, app-control uri = ${_this.webApplication.mainWindow.getURL()}`); - const url = require('url'); - let appcontrolUrl = url.parse(src); - let originUrl = url.parse(_this.webApplication.mainWindow.getURL()); - if (appcontrolUrl.protocol !== originUrl.protocol || - appcontrolUrl.host !== originUrl.host || - appcontrolUrl.pathname !== originUrl.pathname) { - reload = true; - } - } else { - if (src != _this.webApplication.mainWindow.getURL()) { + console.log(`appcontrol src = ${src}, original url = ${originalUrl}`); + if (src && originalUrl) { + let appcontrolUrl = new URL(src); + let oldUrl = new URL(originalUrl); + if ('file:' !== appcontrolUrl.protocol && + (appcontrolUrl.protocol !== oldUrl.protocol || + appcontrolUrl.host !== oldUrl.host || + appcontrolUrl.pathname !== oldUrl.pathname)) { + reload = true; + } else if ('file:' === appcontrolUrl.protocol && (src !== originalUrl)) { + reload = true; + } + } else if (src !== originalUrl) { reload = true; } + } else if (src !== originalUrl) { + reload = true; } } // handle http://tizen.org/appcontrol/operation/main operation specially. -- 2.7.4