From: DongHyun Song Date: Tue, 7 Jan 2020 08:18:08 +0000 (+0900) Subject: Change hide() time for 'visibilitychange' callback X-Git-Tag: submit/tizen_5.5/20200115.085442~5^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1e706bba79c504097569b5688164353c0b60872c;p=platform%2Fframework%2Fweb%2Fwrtjs.git Change hide() time for 'visibilitychange' callback In window.hide(), 'visibilitychange' or 'webkitvisibilitychange' event is dispatched from Document::DidChangeVisibilityState(), which is triggered by RenderWidgetHostViewEfl::SetPageVisibility() In window.setEnable(), it try to request suspending to renderer thread, then it try to stop chromium resources even JavaScript context. Thus if hide() is called after setEnable(), it can defer application's 'visibilitchange' callback unexpectedly. Change-Id: Ibe89b79f8a01ca170db40af8a5792fe64e9bf4ba Signed-off-by: DongHyun Song --- diff --git a/wrt_app/src/web_application.js b/wrt_app/src/web_application.js old mode 100644 new mode 100755 index 38efdabd..2c478d08 --- a/wrt_app/src/web_application.js +++ b/wrt_app/src/web_application.js @@ -312,6 +312,7 @@ class WebApplication { console.log('WebApplication : suspend - Invalid event emitter'); } this.suspended = true; + this.windowList[this.windowList.length - 1].hide(); if (wrt.tv) { wrt.tv.flushCookie(); this.windowList.forEach((window) => window.webContents.session.flushStorageData()); @@ -327,13 +328,10 @@ class WebApplication { this.windowList.forEach((window) => window.setEnabled(false)); } } - this.windowList[this.windowList.length - 1].hide(); } resume() { console.log('WebApplication : resume'); - this.suspended = false; - if (this.addonEmitter) { console.log('WebApplication : resume - Found event emitter'); this.addonEmitter.emit('lcResume', this.mainWindow.id); @@ -343,7 +341,7 @@ class WebApplication { if (!this.firstRendered) { console.log('WebApplication : resume firstRendered is false'); - return; + return; } if (!this.backgroundRunnable()) { this.windowList.forEach((window) => window.setEnabled(true));