diff --git a/browserid/static/dialog/dialog.js b/browserid/static/dialog/dialog.js index ac0019d157f8092d7aec3ac45cbc1d80780b8c13..238dcc7cb1339b88a8b6da58531a93b319c407ac 100644 --- a/browserid/static/dialog/dialog.js +++ b/browserid/static/dialog/dialog.js @@ -49,6 +49,7 @@ steal.plugins( 'crypto-api', 'channel', 'storage', + 'browserid-extensions', 'browserid-network', 'browserid-errors', 'browserid-wait') // 3rd party script's (like jQueryUI), in resources folder diff --git a/browserid/static/dialog/resources/browserid-extensions.js b/browserid/static/dialog/resources/browserid-extensions.js new file mode 100644 index 0000000000000000000000000000000000000000..baf2bdc1e5b2d27d3cd73d826fc4baa0b4597bbb --- /dev/null +++ b/browserid/static/dialog/resources/browserid-extensions.js @@ -0,0 +1,23 @@ +if (!Function.prototype.bind) { + + Function.prototype.bind = function (oThis) { + + if (typeof this !== "function") // closest thing possible to the ECMAScript 5 internal IsCallable function + throw new TypeError("Function.prototype.bind - what is trying to be fBound is not callable"); + + var aArgs = Array.prototype.slice.call(arguments, 1), + fToBind = this, + fNOP = function () {}, + fBound = function () { + return fToBind.apply(this instanceof fNOP ? this : oThis || window, aArgs.concat(Array.prototype.slice.call(arguments))); + }; + + fNOP.prototype = this.prototype; + fBound.prototype = new fNOP(); + + return fBound; + + }; + +} +