Return <anonymous> for functions that have no actual words between keyword and (
- Also fixes a potential catastrophic backtracking if someone has severely damaged their own `toString` during test execution.
This commit is contained in:
@@ -255,8 +255,8 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
return func.name;
|
return func.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
var matches = func.toString().match(/^\s*function\s*(\w*)\s*\(/) ||
|
var matches = func.toString().match(/^\s*function\s*(\w+)\s*\(/) ||
|
||||||
func.toString().match(/^\s*\[object\s*(\w*)Constructor\]/);
|
func.toString().match(/^\s*\[object\s*(\w+)Constructor\]/);
|
||||||
|
|
||||||
return matches ? matches[1] : '<anonymous>';
|
return matches ? matches[1] : '<anonymous>';
|
||||||
};
|
};
|
||||||
|
|||||||
+2
-2
@@ -121,8 +121,8 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
return func.name;
|
return func.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
var matches = func.toString().match(/^\s*function\s*(\w*)\s*\(/) ||
|
var matches = func.toString().match(/^\s*function\s*(\w+)\s*\(/) ||
|
||||||
func.toString().match(/^\s*\[object\s*(\w*)Constructor\]/);
|
func.toString().match(/^\s*\[object\s*(\w+)Constructor\]/);
|
||||||
|
|
||||||
return matches ? matches[1] : '<anonymous>';
|
return matches ? matches[1] : '<anonymous>';
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user