Upgrading an iOS 5.1 app renders security errors in using UIWebView localStorage and WebSQL

Originator:shazron
Number:rdar://11081309 Date Originated:03/20/2012
Status:Open Resolved:
Product:iOS SDK Product Version:5.1
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:

Upgrading an iOS 5.1 app to a newer version breaks apps that use localStorage and WebSQL, there is an error in the console:

deny file-write-create /private/var/mobile/Applications/[GUID]

Steps to to reproduce:

In a UIWebView, create a new DB or use localStorage
Overwrite / update your app and open the same database or write to localStorage.

Expected Results:
We should see the data from the database and localStorage.

Actual Results:
Call to window.openDatabase fails with "SECURITY_ERR: DOM Exception 18"
Call to localStorage.setItem fails silently

Regression:

It appears that on an app upgrade in iOS 5.1, the app's GUID folder has been moved/renamed, BUT the Webkit keys in the plist in the apps' Library/Preferences/[CFBundleIdentifier].plist refer to the OLD GUID location

To fix, on an app upgrade when you change the GUID of the app folder, you should update the Webkit keys as well from the plist mentioned above.

Notes:

Discussion at these links below as well.
 
https://issues.apache.org/jira/browse/CB-347
https://issues.apache.org/jira/browse/CB-347?focusedCommentId=13233261&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13233261

Comments

Dupes

rdar://11081647 rdar://10296507 rdar://11105407 rdar://11063678


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!