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; |
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)); |
} |
function initWebUI(event) |