cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [7/8] js commit: wp7/8 compatible version of DOMStorage
Date Wed, 07 Nov 2012 00:15:20 GMT
wp7/8 compatible version of DOMStorage


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

Branch: refs/heads/master
Commit: 203155245049062b7fb5b1e2618040edb28657cc
Parents: 10d6ebc
Author: sgrebnov <sergei.grebnov@gmail.com>
Authored: Tue Nov 6 02:09:32 2012 +0400
Committer: sgrebnov <sergei.grebnov@gmail.com>
Committed: Tue Nov 6 02:09:32 2012 +0400

----------------------------------------------------------------------
 lib/wp/plugin/wp/DOMStorage.js |   33 +++++++++++++++++++--------------
 1 files changed, 19 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/20315524/lib/wp/plugin/wp/DOMStorage.js
----------------------------------------------------------------------
diff --git a/lib/wp/plugin/wp/DOMStorage.js b/lib/wp/plugin/wp/DOMStorage.js
index b67ad40..67205b8 100644
--- a/lib/wp/plugin/wp/DOMStorage.js
+++ b/lib/wp/plugin/wp/DOMStorage.js
@@ -174,20 +174,25 @@ if (!docDomain || docDomain.length === 0) {
     };
 
     // initialize DOMStorage
-
-    Object.defineProperty( window, "localStorage", {
-        writable: false,
-        configurable: false,
-        value:new DOMStorage("localStorage")
-    });
-    window.localStorage.initialize();
-
-    Object.defineProperty( window, "sessionStorage", {
-        writable: false,
-        configurable: false,
-        value:new DOMStorage("sessionStorage")
-    });
-    window.sessionStorage.initialize();
+    
+    if (typeof window.localStorage === "undefined") {
+     
+        Object.defineProperty(window, "localStorage", {
+            writable: false,
+            configurable: false,
+            value: new DOMStorage("localStorage")
+        });
+        window.localStorage.initialize();
+    }
+
+    if (typeof window.sessionStorage === "undefined") {
+        Object.defineProperty(window, "sessionStorage", {
+            writable: false,
+            configurable: false,
+            value: new DOMStorage("sessionStorage")
+        });
+        window.sessionStorage.initialize();
+    }
 }
 
 })(window, document);


Mime
View raw message