From: liwei Date: Wed, 10 Jun 2020 01:58:53 +0000 (+0800) Subject: [VD] Flush cookie / local storage in finalize X-Git-Tag: submit/tizen_5.5/20200625.010053~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d74855aa5fbf008a57a87af84fe4bc8a8d0b7022;p=platform%2Fframework%2Fweb%2Fwrtjs.git [VD] Flush cookie / local storage in finalize When app call tizen.application.exit() directly, WRT will get "before_quit" firstly, then set webapplciaton to null(_this.webApplication = null;), then when WRT get "suspend" event, bcz webapplication is null, WRT will not flush cookie / local storage. Change-Id: I7d6ab667824d450763d58a1b7938a1dffc21be38 Signed-off-by: liwei --- diff --git a/wrt_app/src/web_application.js b/wrt_app/src/web_application.js index 042d6b82..d5a3da47 100755 --- a/wrt_app/src/web_application.js +++ b/wrt_app/src/web_application.js @@ -328,10 +328,7 @@ class WebApplication { } this.suspended = true; this.windowList[this.windowList.length - 1].hide(); - if (wrt.tv) { - wrt.tv.flushCookie(); - this.windowList.forEach((window) => window.webContents.session.flushStorageData()); - } + flushData(); if (!this.backgroundRunnable()) { if (!this.multitaskingSupport) { // FIXME : terminate app after visibilitychange event handling @@ -369,6 +366,7 @@ class WebApplication { this.inspectorSrc = ''; wrt.tv.cancelDialogs(this.mainWindow.webContents); } + flushData(); if (this.debugPort) { console.log('stop inspector server'); this.debugPort = 0; @@ -387,6 +385,13 @@ class WebApplication { console.log('WebApplication : quit - Invalid event emitter'); } } + flushData() { + console.log('WebApplication : FlushData'); + if (wrt.tv) { + wrt.tv.flushCookie(); + this.windowList.forEach((window) => window.webContents.session.flushStorageData()); + } + } sendAppControlEvent() { const kAppControlEventScript = '(function(){' +