[Migration][WRTJS][vd][bugfix] change url compare code. 93/217393/1
authorYONGMAN SON <yman.son@samsung.com>
Mon, 11 Nov 2019 07:28:50 +0000 (16:28 +0900)
committerYONGMAN SON <yman.son@samsung.com>
Mon, 11 Nov 2019 07:28:50 +0000 (16:28 +0900)
url : https://review.tizen.org/gerrit/#/c/platform/framework/web/wrtjs/+/216442/

If the page url doesn't change, don't need to reload.
But it's being reloaded by a bug.

src = http://d2ehepluhe2jv7.cloudfront.net
_this.webApplication.mainWindow.getURL() = http://d2ehepluhe2jv7.cloudfront.net/#/
(Compare the loaded url with the url to be loaded.
 Some special characters make the url different.)

Change-Id: I985f7511da5ee861a3edfc321d4ed18aa67dcaad
Signed-off-by: YONGMAN SON <yman.son@samsung.com>
wrt_app/src/runtime.js [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index 6130fcd..19d245b
@@ -34,6 +34,7 @@ class Runtime {
         this.sandbox = [];
         this.webContents = null;
         this.addonPkgs = [];
+        this.isTVProfile = (wrt.getPlatformType() === 'product_tv');
 
         var _this = this;
         app.on('before-quit', function(event) {
@@ -148,8 +149,21 @@ class Runtime {
 
                     let reload = loadInfo.getReload() || _this.webApplication.isAlwaysReload;
                     if (!reload) {
-                        if (src != _this.webApplication.mainWindow.getURL())
-                            reload = true;
+                        if (_this.isTVProfile) {
+                            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()) {
+                                reload = true;
+                            }
+                        }
                     }
                     // handle http://tizen.org/appcontrol/operation/main operation specially.
                     // only menu-screen app can send launch request with main operation.