From: DongHyun Song Date: Mon, 26 Oct 2020 10:07:57 +0000 (+0900) Subject: Refactor suspend sequence X-Git-Tag: submit/tizen/20201027.083557^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4c869fc6fd8fd46090a6919ee53b69df7283f353;p=platform%2Fframework%2Fweb%2Fwrtjs.git 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 --- diff --git a/wrt_app/src/web_application.ts b/wrt_app/src/web_application.ts index 3795a2a2..5a572981 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() {