Ignore:
Timestamp:
Jan 3, 2012, 1:05:46 PM (13 years ago)
Author:
[email protected]
Message:

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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSFunction.cpp

    r103728 r103958  
    115115}
    116116
    117 void createDescriptorForThrowingProperty(ExecState* exec, PropertyDescriptor& descriptor, const char* message)
    118 {
    119     JSValue thrower = createTypeErrorFunction(exec, message);
    120     descriptor.setAccessorDescriptor(thrower, thrower, DontEnum | DontDelete | Getter | Setter);
    121 }
    122 
    123117const UString& JSFunction::name(ExecState* exec)
    124118{
Note: See TracChangeset for help on using the changeset viewer.