diff --git a/src/init/bootstrapper.cc b/src/init/bootstrapper.cc index a43bc1cba6..996b872878 100644 --- a/src/init/bootstrapper.cc +++ b/src/init/bootstrapper.cc @@ -642,11 +642,14 @@ Handle Genesis::GetThrowTypeErrorIntrinsic() { Handle function = factory()->NewFunction(args); function->shared().DontAdaptArguments(); - // %ThrowTypeError% must not have a name property. - if (JSReceiver::DeleteProperty(function, factory()->name_string()) - .IsNothing()) { - DCHECK(false); - } + // %ThrowTypeError% must have a name property with an empty string value. Per + // spec, ThrowTypeError's name is non-configurable, unlike ordinary functions' + // name property. To redefine it to be non-configurable, use + // SetOwnPropertyIgnoreAttributes. + JSObject::SetOwnPropertyIgnoreAttributes( + function, factory()->name_string(), factory()->empty_string(), + static_cast(DONT_ENUM | DONT_DELETE | READ_ONLY)) + .Assert(); // length needs to be non configurable. Handle value(Smi::FromInt(function->length()), isolate()); diff --git a/test/mjsunit/es6/throw-type-error-function-restrictions.js b/test/mjsunit/es6/throw-type-error-function-restrictions.js index 7f67747f29..75f5566f87 100644 --- a/test/mjsunit/es6/throw-type-error-function-restrictions.js +++ b/test/mjsunit/es6/throw-type-error-function-restrictions.js @@ -5,8 +5,11 @@ var throwTypeErrorFunction = Object.getOwnPropertyDescriptor(Function.prototype, 'arguments').get; -assertFalse( - Object.prototype.hasOwnProperty.call(throwTypeErrorFunction, 'name')); +var nameDesc = + Object.getOwnPropertyDescriptor(throwTypeErrorFunction, 'name'); +assertFalse(nameDesc.configurable, 'configurable'); +assertFalse(nameDesc.enumerable, 'enumerable'); +assertFalse(nameDesc.writable, 'writable'); assertThrows(function() { 'use strict'; throwTypeErrorFunction.name = 'foo'; diff --git a/test/test262/test262.status b/test/test262/test262.status index 1a822ec098..6fd6859611 100644 --- a/test/test262/test262.status +++ b/test/test262/test262.status @@ -502,9 +502,6 @@ 'intl402/Intl/getCanonicalLocales/unicode-ext-canonicalize-yes-to-true': [FAIL], 'intl402/Intl/getCanonicalLocales/unicode-ext-key-with-digit': [FAIL], - # https://bugs.chromium.org/p/v8/issues/detail?id=9646 - 'built-ins/ThrowTypeError/name': [FAIL], - # https://bugs.chromium.org/p/v8/issues/detail?id=9742 'intl402/Locale/getters': [FAIL],