https://bugs.webkit.org/show_bug.cgi?id=75429
ThrowTypeError should be a singleton object
Reviewed by Sam Weinig.
Source/JavaScriptCore:
Per section 13.2.3 of the spec.
We could change setAccessorDescriptor to be able to share the global
GetterSetter object, rather than storing the accessor functions and
creating a new GetterSetter in defineProperty - but this won't be a
small change to PropertyDescriptors (and would probably mean making
GetterSetter objects immutable?) - so I'll leave that for another
patch.
- JavaScriptCore.exp:
- don't export setAccessorDescriptor
- runtime/Arguments.cpp:
(JSC::Arguments::createStrictModeCallerIfNecessary):
(JSC::Arguments::createStrictModeCalleeIfNecessary):
- call throwTypeErrorGetterSetter instead of createTypeErrorFunction
- runtime/Error.cpp:
- runtime/Error.h:
- remove createTypeErrorFunction
- runtime/JSFunction.cpp:
- runtime/JSFunction.h:
- remove unused createDescriptorForThrowingProperty
- runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::reset):
(JSC::JSGlobalObject::visitChildren):
- removed m_strictModeTypeErrorFunctionStructure.
- runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::internalFunctionStructure):
- removed m_strictModeTypeErrorFunctionStructure.
- runtime/PropertyDescriptor.cpp:
(JSC::PropertyDescriptor::setAccessorDescriptor):
- changed to take a GetterSetter
- runtime/PropertyDescriptor.h:
- changed to take a GetterSetter
LayoutTests:
Per section 13.2.3 of the spec.
- fast/js/basic-strict-mode-expected.txt:
- ThrowTypeError is a singleton, so cannot generate
property-specific error messages.
- fast/js/script-tests/strict-throw-type-error.js: Added.
- fast/js/strict-throw-type-error-expected.txt: Added.
- fast/js/strict-throw-type-error.html: Added.
- added test case that ThrowTypeError is a singleton