You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2012/04/13 01:25:21 UTC

[5/6] git commit: cleanup console.logs, fixed XHR to local files, tested in jQM

cleanup console.logs, fixed XHR to local files, tested in jQM


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

Branch: refs/heads/master
Commit: 61718ae468cfc6b7c8e1d2ec0d6a0b129095f0d2
Parents: a5a0770
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Tue Apr 10 18:19:33 2012 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Tue Apr 10 18:19:33 2012 -0700

----------------------------------------------------------------------
 lib/wp7/platform.js            |    6 +++---
 lib/wp7/plugin/wp7/XHRPatch.js |   20 ++++----------------
 2 files changed, 7 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/61718ae4/lib/wp7/platform.js
----------------------------------------------------------------------
diff --git a/lib/wp7/platform.js b/lib/wp7/platform.js
index 4a89e27..09c51c5 100644
--- a/lib/wp7/platform.js
+++ b/lib/wp7/platform.js
@@ -1,9 +1,11 @@
 var cordova = require('cordova'),
       exec = require('cordova/exec');
 
-// specifically require the following patches
+// specifically require the following patches :
+
 // localStorage+SessionStorage APIs
 require("cordova/plugin/wp7/DOMStorage");
+
 // Fix XHR calls to local file-system
 require("cordova/plugin/wp7/XHRPatch");
 
@@ -12,8 +14,6 @@ module.exports = {
     id: "wp7",
     initialize:function() {
 
-    console.log("window.CordovaMediaonStatus = " + window.CordovaMediaonStatus);
-    console.log("window.localStorage = " + window.localStorage);
 
 
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/61718ae4/lib/wp7/plugin/wp7/XHRPatch.js
----------------------------------------------------------------------
diff --git a/lib/wp7/plugin/wp7/XHRPatch.js b/lib/wp7/plugin/wp7/XHRPatch.js
index 2133c93..e6a1441 100644
--- a/lib/wp7/plugin/wp7/XHRPatch.js
+++ b/lib/wp7/plugin/wp7/XHRPatch.js
@@ -39,7 +39,6 @@ if (!docDomain || docDomain.length == 0) {
 	    withCredentials: false,
 	    _requestHeaders: null,
 	    open: function (reqType, uri, isAsync, user, password) {
-	        console.log("XMLHttpRequest.open ::: " + uri);
 
 	        if (uri && uri.indexOf("http") == 0) {
 	            if (!this.wrappedXHR) {
@@ -142,16 +141,10 @@ if (!docDomain || docDomain.length == 0) {
 	    onResult: function (res) {
 	        this.status = 200;
 	        this.responseText = res;
-
-	        Object.defineProperty(this, "responseXML", { get: function () {
-	            var parser = new DOMParser();
-	            return parser.parseFromString(this.responseText, "text/xml");
-	        }
-	        });
+	        this.responseXML = res;
 	        this.changeReadyState(this.DONE);
 	    },
 	    onError: function (err) {
-	        console.log("Wrapped XHR received Error from FileAPI :: " + err);
 	        this.status = 404;
 	        this.changeReadyState(this.DONE);
 	    },
@@ -172,28 +165,23 @@ if (!docDomain || docDomain.length == 0) {
 	            var alias = this;
 
 	            function fail(evt) {
-	                console.log("fail :: " + JSON.stringify(evt));
-
 	                alias.onError(evt.code);
 	            }
 
 	            function gotFile(file) {
-	                console.log("got file");
 	                var reader = new FileReader();
-	                reader.onloadend = function (evt) {
-	                    console.log("Read as text");
-	                    alias.onResult(evt.target.result);
+	                reader.onloadend = function (evt) 
+	                {
+	                    alias.onResult.apply(alias,[evt.target.result]);
 	                };
 	                reader.readAsText(file);
 	            }
 
 	            function gotEntry(entry) {
-	                console.log("got entry");
 	                entry.file(gotFile, fail);
 	            }
 
 	            function gotFS(fs) {
-	                console.log("got filesystem");
 	                fs.root.getFile(alias._url, null, gotEntry, fail);
 	            }