[z3-checkins] r25926 - z3/jsonserver/branch/merge/browser
reebalazs at codespeak.net
reebalazs at codespeak.net
Tue Apr 18 08:31:59 CEST 2006
Author: reebalazs
Date: Tue Apr 18 08:31:58 2006
New Revision: 25926
Modified:
z3/jsonserver/branch/merge/browser/json.js
z3/jsonserver/branch/merge/browser/xmlhttp.js
Log:
Critical: in XMLHttp change parameters and headers to Object from Array!
Because it is handled with for(xx in obj), they must be created
as Object. Problem is, that Sarissa puts extra functions in the
Array prototype, and these would come up in the iteration:
- causing an exception at setHeader,
- and snapping a &xxx=xxx...etc part to the end of the json
variable, causing a decode error on the server side.
The problem only instantiated (strangely) when we were logged
in as a plone user, in the kukitportlets demo.
Modified: z3/jsonserver/branch/merge/browser/json.js
==============================================================================
--- z3/jsonserver/branch/merge/browser/json.js (original)
+++ z3/jsonserver/branch/merge/browser/json.js Tue Apr 18 08:31:58 2006
@@ -164,7 +164,7 @@
JSONRPCMethod.prototype.postData = function(url, user, pass, data, timeout, callback) {
var xmlhttp = new XMLHttp(url);
- var header = new Array()
+ var header = new Object()
header["Content-Type"] = "application/json-rpc";
xmlhttp.setHeaders(header);
xmlhttp.user = user;
@@ -291,7 +291,7 @@
var v = [];
for(attr in o) {
if(o[attr] == null) v.push("\"" + attr + "\": null");
- else if(typeof o[attr] == "function"); // skip
+ else if(typeof(o[attr]) == "function"); // skip
else v.push(escapeJSONString(attr) + ": " + toJSON(o[attr]));
}
return "{" + v.join(", ") + "}";
Modified: z3/jsonserver/branch/merge/browser/xmlhttp.js
==============================================================================
--- z3/jsonserver/branch/merge/browser/xmlhttp.js (original)
+++ z3/jsonserver/branch/merge/browser/xmlhttp.js Tue Apr 18 08:31:58 2006
@@ -27,8 +27,8 @@
this.password = null;
this.timeout = null;
this.argString = "";
- this.parameters = new Array();
- this.headers = new Array();
+ this.parameters = new Object();
+ this.headers = new Object();
this.headers['Content-Type'] = 'application/x-www-form-urlencoded'
/* internal status flags */
More information about the z3-checkins
mailing list