Bug 144875

Summary: WKWebView does not persist IndexedDB data after app close
Product: WebKit Reporter: Nolan Lawson <nolan>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: andersca, beidson, sam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: iOS 8.2   
Attachments:
Description Flags
Video demonstration none

Description Nolan Lawson 2015-05-11 11:07:20 PDT
Created attachment 252869 [details]
Video demonstration

Data saved in IndexedDB in a WKWebView does not appear to survive an app relaunch.

Video demonstration: https://nolanlawson.s3.amazonaws.com/www/apache/iphone_recording.webm

Steps to reproduce:

1. Install my "database filler" Cordova app: https://github.com/nolanlawson/database-filler
2. Follow the instructions to run the app using the WKWebView branch of Cordova
3. Open up the XCode project in platforms/ios
4. Run on a real device
5. Open up the app, add some data, count it to make sure items were added.
6. Double-press the home button to dismiss the app
7. Reopen it, count items

Expected: items that were saved in IndexedDB before are still there.

Actual: 0 items are found.

I'm not sure if this is a bug in WKWebView or in Cordova, but I suspect it's a WKWebView bug because I don't see any option to enable persistence or anything: https://developer.apple.com/library/ios/documentation/WebKit/Reference/WKPreferences_Ref/index.html

Note this is unrelated to issue 137760, which describes how WebSQL is completely disallowed in WKWebView.
Comment 1 Nolan Lawson 2015-05-11 11:08:47 PDT
Issue filed on Cordova in case this is a Cordova bug: https://issues.apache.org/jira/browse/CB-9008
Comment 2 Nolan Lawson 2015-05-11 11:18:33 PDT
Also, I tested this on an iPhone 5c (ME493LL/A) running iOS 8.3.
Comment 3 Nolan Lawson 2015-05-28 08:31:41 PDT
This turned out to be a bug in my Cordova configuration (see https://issues.apache.org/jira/browse/CB-9008?focusedCommentId=14563084&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14563084). Cordova's current WKWebView implementation uses a random port every time, meaning that data is lost between session.

Closing this issue!