Skip to content

Commit

Permalink
Implemented syncronous mode in GM_xmlhttpRequest.
Browse files Browse the repository at this point in the history
  • Loading branch information
meh committed Jan 28, 2011
1 parent 92e3a5a commit e62beff
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions content/xmlhttprequester.js
Expand Up @@ -35,19 +35,13 @@ GM_xmlhttpRequester.prototype.contentStartRequest = function(details) {
case "https":
case "ftp":
var req = new this.chromeWindow.XMLHttpRequest();
GM_hitch(this, "chromeStartRequest", url, details, req)();
return GM_hitch(this, "chromeStartRequest", url, details, req)();
break;
default:
throw new Error("Disallowed scheme in URL: " + details.url);
}

GM_log("< GM_xmlhttpRequest.contentStartRequest");

return {
abort: function() {
req.abort();
}
};
};

// this function is intended to be called in chrome's security context, so
Expand All @@ -63,7 +57,7 @@ function(safeUrl, details, req) {

req.mozBackgroundRequest = !!details.mozBackgroundRequest;

req.open(details.method, safeUrl, true, details.user || "", details.password || "");
req.open(details.method, safeUrl, !details.synchronous, details.user || "", details.password || "");

if (details.overrideMimeType) {
req.overrideMimeType(details.overrideMimeType);
Expand All @@ -87,6 +81,8 @@ function(safeUrl, details, req) {
}

GM_log("< GM_xmlhttpRequest.chromeStartRequest");

return req;
};

// arranges for the specified 'event' on xmlhttprequest 'req' to call the
Expand Down

0 comments on commit e62beff

Please sign in to comment.