From: Erik Bernhardson Date: Mon, 25 Aug 2014 23:59:29 +0000 (-0700) Subject: mediawiki.debug: Fix crash in browsers without Function#bind X-Git-Tag: 1.31.0-rc.0~14257^2 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=5c651dbac8f1e48864a4c6f5658922e7e4e00e9c;p=lhc%2Fweb%2Fwiklou.git mediawiki.debug: Fix crash in browsers without Function#bind PhantomJS has a partial ECMAScript 5 implementation but it does not include Function.prototype.bind. Detect that and error gracefully instead of erroring out in the middle of a phantomjs qunit run. Change-Id: Ic06e08490e8f297fda479c4adaf9b2d8735f63ad --- diff --git a/resources/src/mediawiki/mediawiki.debug.profile.js b/resources/src/mediawiki/mediawiki.debug.profile.js index 64ec6c394a..b4d57732eb 100644 --- a/resources/src/mediawiki/mediawiki.debug.profile.js +++ b/resources/src/mediawiki/mediawiki.debug.profile.js @@ -70,10 +70,10 @@ * @param string tag to create * @return DOMElement */ - createSvgElement: document.createElementNS + createSvgElement: ( document.createElementNS && Function.prototype.bind ) ? document.createElementNS.bind( document, 'http://www.w3.org/2000/svg' ) // throw a error for browsers which does not support document.createElementNS (IE<8) - : function () { throw new Error( 'document.createElementNS not supported' ); }, + : function () { throw new Error( 'An ES5 compatible javascript engine is required for the profile visualization.' ); }, /** * @param DOMElement|undefined