From: liwei Date: Thu, 5 Dec 2019 13:56:24 +0000 (+0800) Subject: [VD] Fix issue for app deeplink that page is not reload X-Git-Tag: accepted/tizen/5.5/unified/20191213.064206^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2a9a06be0a4e0105bc2ba1af71fc2de1bb3b73c6;p=platform%2Fframework%2Fweb%2Fwrtjs.git [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 --- 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.