fix($injector): add workaround for fat-arrow stringification in Chrome v50/51

Closes #14487

Closes #14495
This commit is contained in:
Georgios Kalpakas
2016-04-22 14:32:27 +03:00
parent 0780666e41
commit 8dc1f8e00e
+5 -1
View File
@@ -71,7 +71,11 @@ var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
var $injectorMinErr = minErr('$injector');
function extractArgs(fn) {
var fnText = Function.prototype.toString.call(fn).replace(STRIP_COMMENTS, ''),
// Support: Chrome 50-51 only
// Creating a new string by adding `' '` at the end, to hack around some bug in Chrome v50/51
// (See https://github.com/angular/angular.js/issues/14487.)
// TODO (gkalpak): Remove workaround when Chrome v52 is released
var fnText = Function.prototype.toString.call(fn).replace(STRIP_COMMENTS, '') + ' ',
args = fnText.match(ARROW_ARG) || fnText.match(FN_ARGS);
return args;
}