Bug 144875 - WKWebView does not persist IndexedDB data after app close
Summary: WKWebView does not persist IndexedDB data after app close
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified iOS 8.2
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2015-05-11 11:07 PDT by Nolan Lawson
Modified: 2015-05-28 08:32 PDT (History)
3 users (show)

See Also:

Video demonstration (2.89 MB, video/webm)
2015-05-11 11:07 PDT, Nolan Lawson
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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!