From d1ee32b839346e4b996afd1df962a743932be142 Mon Sep 17 00:00:00 2001 From: Jacob Seidelin Date: Sat, 5 Sep 2009 13:51:28 +0200 Subject: binaryajax.js 0.1.7 found at https://gist.githubusercontent.com/ntulip/161492/raw/614f639c3f0c647320a0bae14a4707ba888c201c/BinaryJS --- binaryajax.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/binaryajax.js b/binaryajax.js index f674d9c..b721a9c 100644 --- a/binaryajax.js +++ b/binaryajax.js @@ -1,8 +1,8 @@ /* - * Binary Ajax 0.1.5 + * Binary Ajax 0.1.7 * Copyright (c) 2008 Jacob Seidelin, cupboy@gmail.com, http://blog.nihilogic.dk/ - * MIT License [http://www.opensource.org/licenses/mit-license.php] + * Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt] */ @@ -156,10 +156,10 @@ var BinaryAjax = (function() { if (typeof(oHTTP.onload) != "undefined") { oHTTP.onload = function() { - if (oHTTP.status == "200" || oHTTP.status == "206") { - this.binaryResponse = new BinaryFile(this.responseText, iDataOffset, iDataLen); - this.fileSize = iFileSize || this.getResponseHeader("Content-Length"); - fncCallback(this); + if (oHTTP.status == "200" || oHTTP.status == "206" || oHTTP.status == "0") { + oHTTP.binaryResponse = new BinaryFile(oHTTP.responseText, iDataOffset, iDataLen); + oHTTP.fileSize = iFileSize || oHTTP.getResponseHeader("Content-Length"); + fncCallback(oHTTP); } else { if (fncError) fncError(); } @@ -168,10 +168,14 @@ var BinaryAjax = (function() { } else { oHTTP.onreadystatechange = function() { if (oHTTP.readyState == 4) { - if (oHTTP.status == "200" || oHTTP.status == "206") { - this.binaryResponse = new BinaryFile(oHTTP.responseBody, iDataOffset, iDataLen); - this.fileSize = iFileSize || this.getResponseHeader("Content-Length"); - fncCallback(this); + if (oHTTP.status == "200" || oHTTP.status == "206" || oHTTP.status == "0") { + // IE6 craps if we try to extend the XHR object + var oRes = { + status : oHTTP.status, + binaryResponse : new BinaryFile(oHTTP.responseBody, iDataOffset, iDataLen), + fileSize : iFileSize || oHTTP.getResponseHeader("Content-Length") + }; + fncCallback(oRes); } else { if (fncError) fncError(); } -- cgit v1.2.3