Skip to content

Commit

Permalink
Add sendAsBinary() support to GM_xmlhttpRequest
Browse files Browse the repository at this point in the history
[#3 state:resolved]
  • Loading branch information
ocornu committed Mar 15, 2009
1 parent 9b049cb commit 9c7b574
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/chrome/content/xmlhttprequester.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,16 @@ GM_xmlhttpRequester.prototype.chromeStartRequest = function(safeUrl, details) {
}
}

req.send((details.data) ? details.data : null);
var body = details.data ? details.data : null;
if (details.binary) {
// no binary support?
if (!req.sendAsBinary)
throw new Error("Unavailable feature: " +
"this version of Firefox does not support sendAsBinary " +
"(you should consider upgrading to version 3, or posterior)");
req.sendAsBinary(body);
} else
req.send(body);
GM_log("< GM_xmlhttpRequest.chromeStartRequest");
}

Expand Down

0 comments on commit 9c7b574

Please sign in to comment.