Permalink
Browse files

make xhr.open in _send synchronous

  • Loading branch information...
1 parent 2b11f10 commit c7021bcc7923db2e364c6d88330bb1201489c70a @pfn committed May 30, 2012
Showing with 4 additions and 12 deletions.
  1. +4 −12 modules/KeePassFox.jsm
View
@@ -341,19 +341,11 @@ KeePassFox.prototype = {
_send: function(request) {
let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
- xhr.open("POST", KEEPASS_HTTP_URL, true);
+ xhr.open("POST", KEEPASS_HTTP_URL, false);
xhr.setRequestHeader("Content-Type", "application/json");
- let running = true;
- try {
- let r = JSON.stringify(request);
- this.log("REQUEST: " + r);
- xhr.onabort = xhr.onerror = xhr.onload = function() running = false;
- xhr.send(r);
- }
- catch (e) { running = false; this.log("KeePassHttp: " + e); }
-
- while (running)
- Services.tm.currentThread.processNextEvent(true);
+ let r = JSON.stringify(request);
+ this.log("REQUEST: " + r);
+ xhr.send(r);
this.log("RESPONSE: " + xhr.status + " => " + xhr.responseText);
return [xhr.status, xhr.responseText, xhr.readyState];

0 comments on commit c7021bc

Please sign in to comment.