Skip to content

Instantly share code, notes, and snippets.

@bmatusiak bmatusiak/apf-bug.fixed.js
Last active Dec 16, 2015

Embed
What would you like to do?
/**
* Compatibility layer for Webkit based browsers.
* @private
*/
apf.runWebkit = function(){
if (XMLHttpRequest.prototype.sendAsBinary === undefined) {
if (window.ArrayBuffer) {
/**
* Binary support for Chrome 7+ which implements [ECMA-262] typed arrays
*
* For more information, see <http://www.khronos.org/registry/typedarray/specs/latest/>.
*/
XMLHttpRequest.prototype.sendAsBinary = function(string) {
var bytes = Array.prototype.map.call(string, function(c) {
return c.charCodeAt(0) & 0xff;
});
this.send(new Uint8Array(bytes));
};
}
}
/**
* Compatibility layer for Webkit based browsers.
* @private
*/
apf.runWebkit = function(){
if (XMLHttpRequest.prototype.sendAsBinary === undefined) {
if (window.ArrayBuffer) {
/**
* Binary support for Chrome 7+ which implements [ECMA-262] typed arrays
*
* For more information, see <http://www.khronos.org/registry/typedarray/specs/latest/>.
*/
XMLHttpRequest.prototype.sendAsBinary = function(string) {
var bytes = Array.prototype.map.call(string, function(c) {
return c.charCodeAt(0) & 0xff;
});
this.send(new Uint8Array(bytes).buffer);
};
}
}
@bmatusiak

This comment has been minimized.

Copy link
Owner Author

commented Apr 10, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.