bd15d142 by Adam Heath

Provide a function.bind shim, until phantomjs is updated.

1 parent fb3ecf8c
...@@ -423,6 +423,28 @@ module.exports = function (grunt) { ...@@ -423,6 +423,28 @@ module.exports = function (grunt) {
423 }); 423 });
424 var requireCallback = function requireCallback(mpConfigBase, withCoverage) { 424 var requireCallback = function requireCallback(mpConfigBase, withCoverage) {
425 /* global requirejs:false */ 425 /* global requirejs:false */
426 Function.prototype.bind = function bind() {
427 if (typeof this !== 'function') {
428 // closest thing possible to the ECMAScript 5
429 // internal IsCallable function
430 throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
431 }
432
433 var aArgs = Array.prototype.slice.call(arguments, 1),
434 fToBind = this,
435 fNOP = function() {},
436 fBound = function() {
437 return fToBind.apply(this, aArgs.concat(Array.prototype.slice.call(arguments)));
438 };
439
440 if (this.prototype) {
441 // Function.prototype doesn't have a prototype property
442 fNOP.prototype = this.prototype;
443 }
444 fBound.prototype = new fNOP();
445
446 return fBound;
447 };
426 requirejs.load = (function(oldLoad) { 448 requirejs.load = (function(oldLoad) {
427 return function (context, moduleName, url) { 449 return function (context, moduleName, url) {
428 //console.log('context=' + JSON.stringify(arguments), 'moduleName=' + moduleName, 'url=' + url); 450 //console.log('context=' + JSON.stringify(arguments), 'moduleName=' + moduleName, 'url=' + url);
......