Bug 1276082 - Get self-hosted function name only from global functions. r=h4writer

This commit is contained in:
Tooru Fujisawa 2016-06-02 01:19:27 +09:00
parent 028104646a
commit 5bad0908f5
2 changed files with 9 additions and 1 deletions

View File

@ -0,0 +1,5 @@
function f() {
(function() {}).bind()(/x/);
}
f();
f();

View File

@ -3185,7 +3185,10 @@ js::IsSelfHostedFunctionWithName(JSFunction* fun, JSAtom* name)
JSAtom*
js::GetSelfHostedFunctionName(JSFunction* fun)
{
return &fun->getExtendedSlot(LAZY_FUNCTION_NAME_SLOT).toString()->asAtom();
Value name = fun->getExtendedSlot(LAZY_FUNCTION_NAME_SLOT);
if (!name.isString())
return nullptr;
return &name.toString()->asAtom();
}
static_assert(JSString::MAX_LENGTH <= INT32_MAX,