incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [1/2] js commit: [CB-1020] DomStorage not 'mul8-able', added conditional to avoid patching localStorage when document.domain is available
Date Tue, 10 Jul 2012 17:31:13 GMT
Updated Branches:
  refs/heads/master ec1cc3e91 -> da5d00b8c


[CB-1020] DomStorage not 'mul8-able', added conditional to avoid patching localStorage when
document.domain is available


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/da5d00b8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/da5d00b8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/da5d00b8

Branch: refs/heads/master
Commit: da5d00b8c70465424ab3d05157e83483422755f5
Parents: 3c533e0
Author: purplecabbage <purplecabbage@gmail.com>
Authored: Tue Jul 10 10:25:43 2012 -0700
Committer: purplecabbage <purplecabbage@gmail.com>
Committed: Tue Jul 10 10:25:43 2012 -0700

----------------------------------------------------------------------
 lib/wp7/plugin/wp7/DOMStorage.js |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/da5d00b8/lib/wp7/plugin/wp7/DOMStorage.js
----------------------------------------------------------------------
diff --git a/lib/wp7/plugin/wp7/DOMStorage.js b/lib/wp7/plugin/wp7/DOMStorage.js
index 85d7acf..f37c8b8 100644
--- a/lib/wp7/plugin/wp7/DOMStorage.js
+++ b/lib/wp7/plugin/wp7/DOMStorage.js
@@ -1,4 +1,14 @@
-(function() {
+(function(win,doc) {
+
+var docDomain = null;
+try {
+    docDomain = doc.domain;
+} catch (err) {
+    //console.log("caught exception trying to access document.domain");
+}
+
+// conditionally patch the window.localStorage and window.sessionStorage objects 
+if (!docDomain || docDomain.length === 0) {
 
     var DOMStorage = function(type) {
         // default type is local
@@ -45,7 +55,8 @@
         },
 
     /*
-        The length attribute must return the number of key/value pairs currently present
in the list associated with the object.
+        The length attribute must return the number of key/value pairs currently present

+        in the list associated with the object.
     */
         getLength:function() {
             if(!this.keys) {
@@ -156,8 +167,8 @@
         value:new DOMStorage("sessionStorage")
     });
     window.sessionStorage.initialize();
+}
 
-
-})();
+})(window, document);
 
 module.exports = null;


Mime
View raw message