| Index: lib/typedItCollector.js | 
| =================================================================== | 
| --- a/lib/typedItCollector.js | 
| +++ b/lib/typedItCollector.js | 
| @@ -148,46 +148,28 @@ | 
| { | 
| if (!Prefs.domainOptIn || (domains.length == 0 && falsePositives.length == 0 && userCorrections.length == 0) || privateBrowsingEnabled()) | 
| return; | 
| - | 
| - let args = []; | 
| + | 
| + let postData = {}; | 
| let savedDomains = domains; | 
| let savedFalsePositives = falsePositives; | 
| let savedUserCorrections = userCorrections; | 
| if(domains.length > 0) | 
| { | 
| - args.push(domains.map(function(d) "domains[]=" + encodeURIComponent(d)).join("&")); | 
| + postData.domains = domains; | 
| 
 
Wladimir Palant
2012/09/21 14:40:25
Now we are using JSON but not its advantages - the
 
 | 
| domains = []; | 
| } | 
| if(falsePositives.length > 0) | 
| { | 
| - args.push( | 
| - falsePositives.map( | 
| - function(fp) | 
| - { | 
| - return "falsePositives[]=" + encodeURIComponent( | 
| - encodeURIComponent(fp[0]) + ((fp[1]) ? "&" + encodeURIComponent(fp[1]) : "") | 
| - ); | 
| - } | 
| - ).join("&") | 
| - ); | 
| + postData.falsePositives = falsePositives; | 
| falsePositives = []; | 
| } | 
| if(userCorrections.length > 0) | 
| { | 
| - args.push( | 
| - userCorrections.map( | 
| - function(uc) | 
| - { | 
| - return "userCorrections[]=" + encodeURIComponent( | 
| - encodeURIComponent(uc[0]) + ((uc[1]) ? "&" + encodeURIComponent(uc[1]) : "") | 
| - ); | 
| - } | 
| - ).join("&") | 
| - ); | 
| + postData.userCorrections = userCorrections; | 
| userCorrections = []; | 
| } | 
| - | 
| + | 
| let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest); | 
| request.open("POST", "http://typed.it/submitData"); | 
| request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); | 
| @@ -200,7 +182,7 @@ | 
| userCorrections = userCorrections.concat(savedUserCorrections); | 
| } | 
| }, false); | 
| - request.send(args.join("&")); | 
| + request.send("data=" + JSON.stringify(postData)); | 
| 
 
Wladimir Palant
2012/09/21 14:40:25
There is little point to send JSON data in pseudo-
 
 | 
| } | 
| function initWebUI(event) |