Skip to content

Commit 1c1b1e0

Browse files
committed
fix($injector): add workaround for fat-arrow stringification in Chrome v50
Closes angular#14487
1 parent 253cb8d commit 1c1b1e0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/auto/injector.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
7171
var $injectorMinErr = minErr('$injector');
7272

7373
function extractArgs(fn) {
74-
var fnText = Function.prototype.toString.call(fn).replace(STRIP_COMMENTS, ''),
74+
// Support: Chrome 50-51 only
75+
// Creating a new string by adding `' '` at the end, to hack around some bug in Chrome v50/51
76+
// (See https://github.com/angular/angular.js/issues/14487.)
77+
var fnText = Function.prototype.toString.call(fn).replace(STRIP_COMMENTS, '') + ' ',
7578
args = fnText.match(ARROW_ARG) || fnText.match(FN_ARGS);
7679
return args;
7780
}

0 commit comments

Comments
 (0)