Fix issue of Cannot read property 'hide' of undefined 75/205475/5
authorliwei <wei90727.li@samsung.com>
Mon, 6 May 2019 11:14:59 +0000 (19:14 +0800)
committerliwei <wei90727.li@samsung.com>
Wed, 8 May 2019 12:27:03 +0000 (20:27 +0800)
Launch an app, press return key, then issue will happen
(TypeError: Cannot read property 'hide' of undefined).

Reason: after press return key, WRT native side will recieve
"tizen://exit",then atom::Browser::Get()->Quit() will be called,
then JS side will receive window close event, then window will
be removed from window list, and suspend() on JS side will also
be called, then it try to hide window, but now there is no window
in window list, then issue happen.

Change-Id: I930f83dbbda2093304f2797656b9a6418460a822
Signed-off-by: liwei <wei90727.li@samsung.com>
wrt_app/src/web_application.js

index 71b1e13..a07fb97 100755 (executable)
@@ -204,6 +204,10 @@ class WebApplication {
     }
     suspend() {
         console.log('WebApplication : suspend');
+        if (this.isTerminating) {
+            console.log('App has been terminated; return');
+            return;
+        }
         let windows = BrowserWindow.getAllWindows();
         if (!this.multitaskingSupport) {
             console.log('multitasking is not supported; quitting app')