You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by he...@apache.org on 2012/06/27 20:33:51 UTC

[4/20] ios commit: Fixes CB-914 - Deactivate CDVLocalStorage (Backup/Restore, safari web preferences update)

Fixes CB-914 - Deactivate CDVLocalStorage (Backup/Restore, safari web preferences update)


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/d320e36a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/d320e36a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/d320e36a

Branch: refs/heads/master
Commit: d320e36a81352d9c21c166eae0da1152528b86b8
Parents: c5a4d48
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon Jun 25 15:56:26 2012 -0700
Committer: hermwong <he...@gmail.com>
Committed: Wed Jun 27 11:32:10 2012 -0700

----------------------------------------------------------------------
 Cordova-based Application/Cordova.plist |    2 ++
 CordovaLib/Classes/CDVViewController.m  |   13 +++++++++++--
 CordovaLib/CordovaLibApp/Cordova.plist  |    2 ++
 guides/Cordova Settings File.md         |    4 ++++
 guides/Cordova Upgrade Guide.md         |    5 +++++
 5 files changed, 24 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/d320e36a/Cordova-based Application/Cordova.plist
----------------------------------------------------------------------
diff --git a/Cordova-based Application/Cordova.plist b/Cordova-based Application/Cordova.plist
index 771caac..7d1fbdf 100644
--- a/Cordova-based Application/Cordova.plist	
+++ b/Cordova-based Application/Cordova.plist	
@@ -40,6 +40,8 @@
 	<false/>
 	<key>OpenAllWhitelistURLsInWebView</key>
 	<false/>
+	<key>BackupWebStorage</key>
+	<true/>
 	<key>ExternalHosts</key>
 	<array/>
 	<key>Plugins</key>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/d320e36a/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index 4c36587..2b78291 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -171,7 +171,14 @@
     
     //// Fix the iOS 5.1 SECURITY_ERR bug (CB-347), this must be before the webView is instantiated ////
 
-    [CDVLocalStorage __verifyAndFixDatabaseLocations];
+    BOOL backupWebStorage = YES;  // default value
+    if ([self.settings objectForKey:@"BackupWebStorage"]) {
+        backupWebStorage = [(NSNumber*)[settings objectForKey:@"BackupWebStorage"] boolValue];
+    }
+    
+    if (backupWebStorage) {
+        [CDVLocalStorage __verifyAndFixDatabaseLocations];
+    }
     
     //// Instantiate the WebView ///////////////
 
@@ -200,7 +207,9 @@
     /*
      * Fire up CDVLocalStorage to work-around iOS 5.1 WebKit storage limitations
      */
-    [self.commandDelegate registerPlugin:[[[CDVLocalStorage alloc] initWithWebView:self.webView] autorelease] withClassName:NSStringFromClass([CDVLocalStorage class])];
+    if (backupWebStorage) {
+        [self.commandDelegate registerPlugin:[[[CDVLocalStorage alloc] initWithWebView:self.webView] autorelease] withClassName:NSStringFromClass([CDVLocalStorage class])];
+    }
     
     /*
      * This is for iOS 4.x, where you can allow inline <video> and <audio>, and also autoplay them

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/d320e36a/CordovaLib/CordovaLibApp/Cordova.plist
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLibApp/Cordova.plist b/CordovaLib/CordovaLibApp/Cordova.plist
index 771caac..7d1fbdf 100644
--- a/CordovaLib/CordovaLibApp/Cordova.plist
+++ b/CordovaLib/CordovaLibApp/Cordova.plist
@@ -40,6 +40,8 @@
 	<false/>
 	<key>OpenAllWhitelistURLsInWebView</key>
 	<false/>
+	<key>BackupWebStorage</key>
+	<true/>
 	<key>ExternalHosts</key>
 	<array/>
 	<key>Plugins</key>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/d320e36a/guides/Cordova Settings File.md
----------------------------------------------------------------------
diff --git a/guides/Cordova Settings File.md b/guides/Cordova Settings File.md
index 69a4f2a..3c0ebc0 100644
--- a/guides/Cordova Settings File.md	
+++ b/guides/Cordova Settings File.md	
@@ -43,3 +43,7 @@ The **Cordova.plist settings file** controls various settings of Cordova. This i
 	h. **AllowInlineMediaPlayback (boolean, defaults to NO)** - set to YES to allow inline HTML5 media playback, also, the video element in the HTML document must also include the webkit-playsinline attribute
 	
 	i. **OpenAllWhitelistURLsInWebView (boolean, defaults to NO)** - set to YES to open all white-listed URLs in the main WebView
+
+	j. **BackupWebStorage (boolean, defaults to YES)** - set to NO to prevent the backup of localStorage and WebSQL databases to the Documents/Backups folder. This was a fix for this [Apple bug](http://phonegap.com/2012/04/18/ios-5-1-and-the-embedded-uiwebview-with-cordova/)
+
+

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/d320e36a/guides/Cordova Upgrade Guide.md
----------------------------------------------------------------------
diff --git a/guides/Cordova Upgrade Guide.md b/guides/Cordova Upgrade Guide.md
index 5b64efd..33df4d7 100644
--- a/guides/Cordova Upgrade Guide.md	
+++ b/guides/Cordova Upgrade Guide.md	
@@ -42,6 +42,11 @@ This document is for developers who need to upgrade their Cordova-based projects
 3. **Copy** the **www/cordova-1.9.0.js** file from the new project into your **www** folder, and delete your **www/cordova-1.8.x.js** file
 4. **Update** the Cordova script reference in your **www/index.html** file (and any other files that contain the script reference) to point to the new **cordova-1.9.0.js** file
 
+**Note:**
+
+1.9.0 supports the new **"BackupWebStorage"** boolean setting in Cordova.plist. By default, this setting is turned on, set it to "false" to turn it off - especially for iOS 6 - see [Release Notes - Safari and UIKit Section](https://developer.apple.com/library/prerelease/ios/#releasenotes/General/RN-iOSSDK-6_0/_index.html)
+
+
 ## Upgrading Cordova 1.7.0 projects to 1.8.x ##
 
 1. **Install** Cordova 1.8.0