fix(IE): make shim work with instrumented code

Closes #6944
This commit is contained in:
Justin DuJardin 2016-02-07 16:20:00 -08:00 committed by Misko Hevery
parent 90af4763d8
commit 7112d008d0
1 changed files with 1 additions and 1 deletions

View File

@ -3,7 +3,7 @@
if (!Object.hasOwnProperty('name')) { if (!Object.hasOwnProperty('name')) {
Object.defineProperty(Function.prototype, 'name', { Object.defineProperty(Function.prototype, 'name', {
get: function() { get: function() {
var matches = this.toString().match(/^\s*function\s*(\S*)\s*\(/); var matches = this.toString().match(/^\s*function\s*((?![0-9])[a-zA-Z0-9_$]*)\s*\(/);
var name = matches && matches.length > 1 ? matches[1] : ""; var name = matches && matches.length > 1 ? matches[1] : "";
// For better performance only parse once, and then cache the // For better performance only parse once, and then cache the
// result through a new accessor for repeated access. // result through a new accessor for repeated access.