From: Surya Kumar Date: Tue, 18 Feb 2020 13:33:05 +0000 (+0530) Subject: Defer showing window when appcontrol-reset is being done X-Git-Tag: submit/tizen_5.5/20200316.025242~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a4a4da6c20b97bb809b579b050c4dc07f5f3e7f1;p=platform%2Fframework%2Fweb%2Fwrtjs.git Defer showing window when appcontrol-reset is being done In Appcontrol-reload case, if window is shown before frame rendered, expired content is visible for a considerable time. Avoid it by showing the window only after frame has been rendered Reference: https://review.tizen.org/gerrit/182918 Change-Id: Icd4877727488e40ffe65f5699c0d3a49dc35a208 Signed-off-by: Surya Kumar --- diff --git a/wrt_app/src/runtime.js b/wrt_app/src/runtime.js index 52c61ac4..60fe3aa1 100755 --- a/wrt_app/src/runtime.js +++ b/wrt_app/src/runtime.js @@ -189,8 +189,7 @@ class Runtime { if (reload && appControl.getOperation() == 'http://tizen.org/appcontrol/operation/main') reload = false; if (reload) { - _this.webApplication.closeWindows(); - _this.webApplication.mainWindow.loadURL(src); + _this.webApplication.handleAppControlReload(src); } else { _this.webApplication.sendAppControlEvent(); } diff --git a/wrt_app/src/web_application.js b/wrt_app/src/web_application.js index 5cfafa0c..78e2a0f7 100755 --- a/wrt_app/src/web_application.js +++ b/wrt_app/src/web_application.js @@ -31,7 +31,6 @@ class WebApplication { this.pendingID = 0; this.pendingCallbacks = new Map(); this.windowList = []; - this.firstRendered = false; this.backgroundSupport = wrt.getBackgroundSupport(); this.debugPort = 0; this.inspectorSrc = ''; @@ -53,7 +52,6 @@ class WebApplication { this.defaultBackgroundColor = (wrt.tv || (wrt.getPlatformType() === "product_wearable") ? '#000' : '#FFF'); this.defaultTransparent = (wrt.tv ? true : false); - this.suspended = false; this.loadFinished = false; this.runningStatus = 'none'; this.addonEmitter = null; @@ -236,16 +234,8 @@ class WebApplication { detached: true }); } + this.initDisplayDelay(true); let self = this; - if (!wrt.showSplashScreen() && !wrt.tv) { - self.showTimer = setTimeout(() => { - if (!self.suspended) { - console.log('FrameRendered not obtained from engine. To show window, timer fired'); - self.mainWindow.emit('ready-to-show'); - } - }, 2000); - } - this.mainWindow.once('ready-to-show', function() { console.log('mainWindow ready-to-show'); if (self.showTimer) @@ -279,6 +269,30 @@ class WebApplication { self.addonEmitter.emit('contentDidFinishLoad', self.mainWindow.id); }); } + initDisplayDelay(firstLaunch) { + this.firstRendered = false; + this.suspended = false; + if (this.showTimer) + clearTimeout(this.showTimer); + let splashShown = firstLaunch && wrt.showSplashScreen(); + if (!splashShown && !wrt.tv) { + let self = this; + self.showTimer = setTimeout(() => { + if (!self.suspended) { + console.log('FrameRendered not obtained from engine. To show window, timer fired'); + self.mainWindow.emit('ready-to-show'); + } + }, 2000); + } + if (!firstLaunch && !this.backgroundRunnable() && this.mainWindow) + this.mainWindow.setEnabled(true); + } + handleAppControlReload(src) { + console.log('WebApplication : handleAppControlReload'); + this.closeWindows(); + this.initDisplayDelay(false); + this.mainWindow.loadURL(src); + } suspendByStatus() { if (this.preloadStatus === 'readyToShow' || this.preloadStatus === 'preload' ||