Extend StorageData flush on exit for wearable profiles 80/240480/5
authorSurya Kumar <surya.kumar7@samsung.com>
Thu, 6 Aug 2020 13:48:00 +0000 (19:18 +0530)
committerSurya Kumar <surya.kumar7@samsung.com>
Fri, 7 Aug 2020 09:04:49 +0000 (09:04 +0000)
If an app exits soon(<~5s) after making localStorage
modification, changes aren't committed. So, extend
TV's flush mechanisms on exit for wearable profiles
to commit storage changes. Fixes P200728-01131.

Change-Id: Icedbf7d90be6a4e2b461cdf9f78e7de2e357ef71
Signed-off-by: Surya Kumar <surya.kumar7@samsung.com>
wrt_app/src/web_application.js

index 1c7635c3db0d171f2583c7fa43d99f7d6bc6e924..0a862e9163bdbb96d2929fed2a4c1fe2289d8bdd 100755 (executable)
@@ -396,8 +396,13 @@ class WebApplication {
     }
     flushData() {
         console.log('WebApplication : FlushData');
-        if (wrt.tv) {
+        if (wrt.tv)
             wrt.tv.flushCookie();
+        if (wrt.tv ||
+            // P200728-01131: Unless flushStorageData is called StorageAreaImpl::CommitChanges()
+            // takes a lot of time leading to uncommited changes on exit on wearable
+            wrt.getPlatformType() === 'product_wearable' ||
+            wrt.getPlatformType() === 'wearable') {
             this.windowList.forEach((window) => window.webContents.session.flushStorageData());
         }
     }