Change hide() time for 'visibilitychange' callback 49/221749/5
authorDongHyun Song <dh81.song@samsung.com>
Tue, 7 Jan 2020 08:18:08 +0000 (17:18 +0900)
committerDongHyun Song <dh81.song@samsung.com>
Wed, 8 Jan 2020 03:52:13 +0000 (03:52 +0000)
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 <dh81.song@samsung.com>
wrt_app/src/web_application.js [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 38efdab..2c478d0
@@ -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));