From 4c869fc6fd8fd46090a6919ee53b69df7283f353 Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Mon, 26 Oct 2020 19:07:57 +0900 Subject: [PATCH] Refactor suspend sequence To guarantee unload* events, suspend() should be deffered after closing windows. Related patch: https://review.tizen.org/gerrit/246015/ https://review.tizen.org/gerrit/245417/ Change-Id: Id13a275b64e75f985e0115eee6771e3c29dd9cd9 Signed-off-by: DongHyun Song --- wrt_app/src/web_application.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wrt_app/src/web_application.ts b/wrt_app/src/web_application.ts index 3795a2a..5a57298 100644 --- a/wrt_app/src/web_application.ts +++ b/wrt_app/src/web_application.ts @@ -345,14 +345,14 @@ Then you can get profile log from the initial loading.`; } suspend() { - if (this.suspended) + if (this.suspended || this.inQuit) return; console.log('WebApplication : suspend'); addonManager.emit('lcSuspend', this.mainWindow.id); this.suspended = true; this.windowList[this.windowList.length - 1].hide(); this.flushData(); - if (!this.backgroundRunnable() || this.inQuit) { + if (!this.backgroundRunnable()) { if (!this.multitaskingSupport) { // FIXME : terminate app after visibilitychange event handling setTimeout(() => { @@ -383,6 +383,9 @@ Then you can get profile log from the initial loading.`; console.log('WebApplication : finalize'); this.flushData(); this.windowList.forEach((window) => window.removeAllListeners()); + this.inQuit = false; + if (!this.suspended) + this.suspend(); } quit() { @@ -398,8 +401,6 @@ Then you can get profile log from the initial loading.`; wrt.stopInspectorServer(); } this.inQuit = true; - if (!this.suspended) - this.suspend(); } private flushData() { -- 2.7.4