[WRTjs]Check window when emit related event 17/277717/1 accepted/tizen/unified/20220714.135306 submit/tizen/20220713.160022
authorChunling Ye <chunling.ye@samsung.com>
Tue, 12 Jul 2022 09:52:03 +0000 (17:52 +0800)
committerChunling Ye <chunling.ye@samsung.com>
Tue, 12 Jul 2022 09:56:00 +0000 (17:56 +0800)
For Epop, if miss any configuration in TV, the app will
terminate itself quickly, then 'quit->load-finish' will
happen, so check window before emit event to avoid exception.

Reference:
https://review.tizen.org/gerrit/#/c/platform/framework/web/wrtjs/+/268326/

Change-Id: Ic7168d3a41c1c4cd3f31477259666c8f3b80a797
Signed-off-by: Chunling Ye <chunling.ye@samsung.com>
wrt_app/src/web_application.ts

index 4c025c7..ff110c6 100644 (file)
@@ -226,8 +226,11 @@ export class WebApplication {
     });
 
     this.mainWindow.webContents.on('did-finish-load', () => {
-      console.log('webContents did-finish-load');
+      console.log(`webContents did-finish-load, window length is ${this.windowList.length}`);
       this.loadFinished = true;
+
+      if (!this.windowList.length)
+        return;
       if (this.splashShown)
         this.hideSplashScreen('complete');