[Pkg-mozext-commits] [greasemonkey] 01/30: Remove XMLHttpRequest sendAsBinary

David Prévot taffit at moszumanska.debian.org
Thu Nov 26 00:56:26 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository greasemonkey.

commit ec14aeb2da78a95a1cf79ae9b49711e68068cb5b
Author: janekptacijarabaci <janekptacijarabaci at seznam.cz>
Date:   Wed Sep 2 13:54:49 2015 +0200

    Remove XMLHttpRequest sendAsBinary
---
 modules/xmlhttprequester.js | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/xmlhttprequester.js b/modules/xmlhttprequester.js
index 28e443a..09c25bb 100644
--- a/modules/xmlhttprequester.js
+++ b/modules/xmlhttprequester.js
@@ -1,5 +1,6 @@
 var EXPORTED_SYMBOLS = ['GM_xmlhttpRequester'];
 
+Components.utils.importGlobalProperties(["Blob"]);
 Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
 Components.utils.import("chrome://greasemonkey-modules/content/util.js");
 
@@ -178,8 +179,13 @@ function(safeUrl, details, req) {
   }
 
   var body = details.data ? details.data : null;
-  if (details.binary) {
-    req.sendAsBinary(body);
+  if (details.binary && (body !== null)) {
+    var bodyLength = body.length;
+    var bodyData = new Uint8Array(bodyLength);
+    for (var i = 0; i < bodyLength; i++) {
+      bodyData[i] = body.charCodeAt(i) & 0xff;
+    }
+    req.send(new Blob([bodyData]));
   } else {
     req.send(body);
   }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/greasemonkey.git



More information about the Pkg-mozext-commits mailing list