From 61f77ffd5dea8200c9f33d6deb59f86c994539b7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Benoi=CC=82t=20Pin?= Date: Wed, 14 Aug 2013 12:08:11 +0200 Subject: [PATCH] =?utf8?q?Ajout=20d'une=20impl=C3=A9mentation=20alternativ?= =?utf8?q?e=20de=20XMLHttpRequest.sendAsBinary.=20L'upload=20javascript=20?= =?utf8?q?est=20op=C3=A9rationnel=20sur=20Chrome=20mais=20pas=20sur=20Safa?= =?utf8?q?ri=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- skins/ajax_scripts/sarissa.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/skins/ajax_scripts/sarissa.js b/skins/ajax_scripts/sarissa.js index 29621a1..880b23b 100644 --- a/skins/ajax_scripts/sarissa.js +++ b/skins/ajax_scripts/sarissa.js @@ -1066,3 +1066,23 @@ Sarissa.setRemoteJsonCallback = function(url, callback, callbackParam) { }; // EOF + +/*\ +|*| +|*| :: XMLHttpRequest.prototype.sendAsBinary() Polifyll :: +|*| +|*| https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#sendAsBinary() +|*| +\*/ + +if (!XMLHttpRequest.prototype.sendAsBinary) { + XMLHttpRequest.prototype.sendAsBinary = function (sData) { + var nBytes = sData.length, ui8Data = new Uint8Array(nBytes); + for (var nIdx = 0; nIdx < nBytes; nIdx++) { + ui8Data[nIdx] = sData.charCodeAt(nIdx) & 0xff; + } + /* send as ArrayBufferView...: */ + this.send(ui8Data); + /* ...or as ArrayBuffer (legacy)...: this.send(ui8Data.buffer); */ + }; +} -- 2.20.1