Changeset 207859 in webkit


Ignore:
Timestamp:
Oct 25, 2016 6:10:24 PM (7 years ago)
Author:
mark.lam@apple.com
Message:

Rename the reject() helper function to something more meaningful.
https://bugs.webkit.org/show_bug.cgi?id=163549

Reviewed by Saam Barati.

We'll rename reject() to typeError(). The intuition behind this is that all the
clients that uses this function will return typeError(..., shouldThrow, ...).
In a sense, they are returning a "type" of TypeError (which happened to be the
value false). In addition, it may also throw a JS TypeError if the shouldThrow
parameter is true.

(JSC::callSetter):

  • runtime/JSArray.cpp:

(JSC::JSArray::defineOwnProperty):
(JSC::JSArray::setLengthWithArrayStorage):

  • runtime/JSArrayBuffer.cpp:

(JSC::JSArrayBuffer::put):
(JSC::JSArrayBuffer::defineOwnProperty):

  • runtime/JSArrayBufferView.cpp:
  • runtime/JSCJSValue.cpp:

(JSC::JSValue::putToPrimitive):
(JSC::JSValue::putToPrimitiveByIndex):

  • runtime/JSDataView.cpp:

(JSC::JSDataView::put):
(JSC::JSDataView::defineOwnProperty):

  • runtime/JSFunction.cpp:

(JSC::JSFunction::put):
(JSC::JSFunction::defineOwnProperty):

  • runtime/JSGenericTypedArrayViewInlines.h:

(JSC::JSGenericTypedArrayView<Adaptor>::defineOwnProperty):
(JSC::JSGenericTypedArrayView<Adaptor>::deleteProperty):

  • runtime/JSObject.cpp:

(JSC::ordinarySetSlow):
(JSC::JSObject::putInlineSlow):
(JSC::JSObject::setPrototypeWithCycleCheck):
(JSC::JSObject::defineOwnIndexedProperty):
(JSC::JSObject::putByIndexBeyondVectorLengthWithArrayStorage):
(JSC::JSObject::putDirectIndexBeyondVectorLengthWithArrayStorage):
(JSC::validateAndApplyPropertyDescriptor):

  • runtime/JSObjectInlines.h:

(JSC::JSObject::putInline):

  • runtime/JSProxy.cpp:

(JSC::JSProxy::setPrototype):

  • runtime/Lookup.h:

(JSC::putEntry):

  • runtime/RegExpObject.cpp:

(JSC::RegExpObject::defineOwnProperty):

  • runtime/RegExpObject.h:

(JSC::RegExpObject::setLastIndex):

  • runtime/Reject.h: Removed.
  • runtime/SparseArrayValueMap.cpp:

(JSC::SparseArrayValueMap::putEntry):
(JSC::SparseArrayValueMap::putDirect):
(JSC::SparseArrayEntry::put):

  • runtime/StringObject.cpp:

(JSC::StringObject::put):
(JSC::StringObject::putByIndex):

  • runtime/TypeError.h: Copied from Source/JavaScriptCore/runtime/Reject.h.

(JSC::typeError):
(JSC::reject): Deleted.

Location:
trunk/Source/JavaScriptCore
Files:
18 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r207855 r207859  
     12016-10-25  Mark Lam  <mark.lam@apple.com>
     2
     3        Rename the reject() helper function to something more meaningful.
     4        https://bugs.webkit.org/show_bug.cgi?id=163549
     5
     6        Reviewed by Saam Barati.
     7
     8        We'll rename reject() to typeError().  The intuition behind this is that all the
     9        clients that uses this function will return typeError(..., shouldThrow, ...).
     10        In a sense, they are returning a "type" of TypeError (which happened to be the
     11        value false).  In addition, it may also throw a JS TypeError if the shouldThrow
     12        parameter is true.
     13
     14        * JavaScriptCore.xcodeproj/project.pbxproj:
     15        * runtime/GetterSetter.cpp:
     16        (JSC::callSetter):
     17        * runtime/JSArray.cpp:
     18        (JSC::JSArray::defineOwnProperty):
     19        (JSC::JSArray::setLengthWithArrayStorage):
     20        * runtime/JSArrayBuffer.cpp:
     21        (JSC::JSArrayBuffer::put):
     22        (JSC::JSArrayBuffer::defineOwnProperty):
     23        * runtime/JSArrayBufferView.cpp:
     24        * runtime/JSCJSValue.cpp:
     25        (JSC::JSValue::putToPrimitive):
     26        (JSC::JSValue::putToPrimitiveByIndex):
     27        * runtime/JSDataView.cpp:
     28        (JSC::JSDataView::put):
     29        (JSC::JSDataView::defineOwnProperty):
     30        * runtime/JSFunction.cpp:
     31        (JSC::JSFunction::put):
     32        (JSC::JSFunction::defineOwnProperty):
     33        * runtime/JSGenericTypedArrayViewInlines.h:
     34        (JSC::JSGenericTypedArrayView<Adaptor>::defineOwnProperty):
     35        (JSC::JSGenericTypedArrayView<Adaptor>::deleteProperty):
     36        * runtime/JSObject.cpp:
     37        (JSC::ordinarySetSlow):
     38        (JSC::JSObject::putInlineSlow):
     39        (JSC::JSObject::setPrototypeWithCycleCheck):
     40        (JSC::JSObject::defineOwnIndexedProperty):
     41        (JSC::JSObject::putByIndexBeyondVectorLengthWithArrayStorage):
     42        (JSC::JSObject::putDirectIndexBeyondVectorLengthWithArrayStorage):
     43        (JSC::validateAndApplyPropertyDescriptor):
     44        * runtime/JSObjectInlines.h:
     45        (JSC::JSObject::putInline):
     46        * runtime/JSProxy.cpp:
     47        (JSC::JSProxy::setPrototype):
     48        * runtime/Lookup.h:
     49        (JSC::putEntry):
     50        * runtime/RegExpObject.cpp:
     51        (JSC::RegExpObject::defineOwnProperty):
     52        * runtime/RegExpObject.h:
     53        (JSC::RegExpObject::setLastIndex):
     54        * runtime/Reject.h: Removed.
     55        * runtime/SparseArrayValueMap.cpp:
     56        (JSC::SparseArrayValueMap::putEntry):
     57        (JSC::SparseArrayValueMap::putDirect):
     58        (JSC::SparseArrayEntry::put):
     59        * runtime/StringObject.cpp:
     60        (JSC::StringObject::put):
     61        (JSC::StringObject::putByIndex):
     62        * runtime/TypeError.h: Copied from Source/JavaScriptCore/runtime/Reject.h.
     63        (JSC::typeError):
     64        (JSC::reject): Deleted.
     65
    1662016-10-25  Filip Pizlo  <fpizlo@apple.com>
    267
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r207787 r207859  
    641641                0FB7F39B15ED8E4600F167B2 /* IndexingType.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB7F38F15ED8E3800F167B2 /* IndexingType.h */; settings = {ATTRIBUTES = (Private, ); }; };
    642642                0FB7F39C15ED8E4600F167B2 /* PropertyStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB7F39015ED8E3800F167B2 /* PropertyStorage.h */; settings = {ATTRIBUTES = (Private, ); }; };
    643                 0FB7F39D15ED8E4600F167B2 /* Reject.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB7F39115ED8E3800F167B2 /* Reject.h */; settings = {ATTRIBUTES = (Private, ); }; };
     643                0FB7F39D15ED8E4600F167B2 /* TypeError.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB7F39115ED8E3800F167B2 /* TypeError.h */; settings = {ATTRIBUTES = (Private, ); }; };
    644644                0FB7F39E15ED8E4600F167B2 /* SparseArrayValueMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB7F39215ED8E3800F167B2 /* SparseArrayValueMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
    645645                0FBC0AE71496C7C400D4FBDD /* DFGExitProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FBC0AE41496C7C100D4FBDD /* DFGExitProfile.cpp */; };
     
    29852985                0FB7F38F15ED8E3800F167B2 /* IndexingType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexingType.h; sourceTree = "<group>"; };
    29862986                0FB7F39015ED8E3800F167B2 /* PropertyStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PropertyStorage.h; sourceTree = "<group>"; };
    2987                 0FB7F39115ED8E3800F167B2 /* Reject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reject.h; sourceTree = "<group>"; };
     2987                0FB7F39115ED8E3800F167B2 /* TypeError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypeError.h; sourceTree = "<group>"; };
    29882988                0FB7F39215ED8E3800F167B2 /* SparseArrayValueMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SparseArrayValueMap.h; sourceTree = "<group>"; };
    29892989                0FBC0AE41496C7C100D4FBDD /* DFGExitProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DFGExitProfile.cpp; sourceTree = "<group>"; };
     
    63516351                                BCD202BF0E1706A7002C7E82 /* RegExpPrototype.cpp */,
    63526352                                BCD202C00E1706A7002C7E82 /* RegExpPrototype.h */,
    6353                                 0FB7F39115ED8E3800F167B2 /* Reject.h */,
     6353                                0FB7F39115ED8E3800F167B2 /* TypeError.h */,
    63546354                                70B0A9D01A9B66200001306A /* RuntimeFlags.h */,
    63556355                                527773DD1AAF83AC00BDE7E8 /* RuntimeType.cpp */,
     
    85468546                                0FC314121814559100033232 /* RegisterSet.h in Headers */,
    85478547                                A57D23EE1891B5540031C7FA /* RegularExpression.h in Headers */,
    8548                                 0FB7F39D15ED8E4600F167B2 /* Reject.h in Headers */,
     8548                                0FB7F39D15ED8E4600F167B2 /* TypeError.h in Headers */,
    85498549                                A5BA15E8182340B300A82E69 /* RemoteInspector.h in Headers */,
    85508550                                A5BA15EA182340B400A82E69 /* RemoteInspectorConstants.h in Headers */,
  • trunk/Source/JavaScriptCore/runtime/GetterSetter.cpp

    r207411 r207859  
    9595
    9696    if (getterSetterObj->isSetterNull())
    97         return reject(exec, scope, ecmaMode == StrictMode, ASCIILiteral(ReadonlyPropertyWriteError));
     97        return typeError(exec, scope, ecmaMode == StrictMode, ASCIILiteral(ReadonlyPropertyWriteError));
    9898
    9999    JSObject* setter = getterSetterObj->setter();
  • trunk/Source/JavaScriptCore/runtime/JSArray.cpp

    r207411 r207859  
    3434#include "JSCInlines.h"
    3535#include "PropertyNameArray.h"
    36 #include "Reject.h"
     36#include "TypeError.h"
    3737#include <wtf/Assertions.h>
    3838
     
    134134        // from ES5.1 8.12.9 7.a.
    135135        if (descriptor.configurablePresent() && descriptor.configurable())
    136             return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));
     136            return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));
    137137        // from ES5.1 8.12.9 7.b.
    138138        if (descriptor.enumerablePresent() && descriptor.enumerable())
    139             return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));
     139            return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));
    140140
    141141        // a. If the [[Value]] field of Desc is absent, then
    142142        // a.i. Return the result of calling the default [[DefineOwnProperty]] internal method (8.12.9) on A passing "length", Desc, and Throw as arguments.
    143143        if (descriptor.isAccessorDescriptor())
    144             return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
     144            return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
    145145        // from ES5.1 8.12.9 10.a.
    146146        if (!array->isLengthWritable() && descriptor.writablePresent() && descriptor.writable())
    147             return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));
     147            return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));
    148148        // This descriptor is either just making length read-only, or changing nothing!
    149149        if (!descriptor.value()) {
     
    175175        // g. Reject if oldLenDesc.[[Writable]] is false.
    176176        if (!array->isLengthWritable())
    177             return reject(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyChangeError));
     177            return typeError(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyChangeError));
    178178       
    179179        // h. If newLenDesc.[[Writable]] is absent or has the value true, let newWritable be true.
     
    215215        // FIXME: Nothing prevents this from being called on a RuntimeArray, and the length function will always return 0 in that case.
    216216        if (index >= array->length() && !array->isLengthWritable())
    217             return reject(exec, scope, throwException, ASCIILiteral("Attempting to define numeric property on array with non-writable length property."));
     217            return typeError(exec, scope, throwException, ASCIILiteral("Attempting to define numeric property on array with non-writable length property."));
    218218        // c. Let succeeded be the result of calling the default [[DefineOwnProperty]] internal method (8.12.9) on A passing P, Desc, and false as arguments.
    219219        // d. Reject if succeeded is false.
     
    410410        // Fail if the length is not writable.
    411411        if (map->lengthIsReadOnly())
    412             return reject(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyWriteError));
     412            return typeError(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyWriteError));
    413413
    414414        if (newLength < length) {
     
    435435                    if (it->value.attributes & DontDelete) {
    436436                        storage->setLength(index + 1);
    437                         return reject(exec, scope, throwException, ASCIILiteral(UnableToDeletePropertyError));
     437                        return typeError(exec, scope, throwException, ASCIILiteral(UnableToDeletePropertyError));
    438438                    }
    439439                    map->remove(it);
  • trunk/Source/JavaScriptCore/runtime/JSArrayBuffer.cpp

    r207411 r207859  
    2828
    2929#include "JSCInlines.h"
    30 #include "Reject.h"
     30#include "TypeError.h"
    3131
    3232namespace JSC {
     
    9999   
    100100    if (propertyName == vm.propertyNames->byteLength)
    101         return reject(exec, scope, slot.isStrictMode(), ASCIILiteral("Attempting to write to a read-only array buffer property."));
     101        return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral("Attempting to write to a read-only array buffer property."));
    102102   
    103103    return Base::put(thisObject, exec, propertyName, value, slot);
     
    113113   
    114114    if (propertyName == vm.propertyNames->byteLength)
    115         return reject(exec, scope, shouldThrow, ASCIILiteral("Attempting to define read-only array buffer property."));
     115        return typeError(exec, scope, shouldThrow, ASCIILiteral("Attempting to define read-only array buffer property."));
    116116   
    117117    return Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow);
  • trunk/Source/JavaScriptCore/runtime/JSArrayBufferView.cpp

    r207715 r207859  
    2929#include "JSArrayBuffer.h"
    3030#include "JSCInlines.h"
    31 #include "Reject.h"
     31#include "TypeError.h"
    3232
    3333namespace JSC {
  • trunk/Source/JavaScriptCore/runtime/JSCJSValue.cpp

    r207411 r207859  
    163163            prototype = obj->getPrototypeDirect();
    164164            if (prototype.isNull())
    165                 return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
     165                return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
    166166        }
    167167    }
     
    172172        if (offset != invalidOffset) {
    173173            if (attributes & ReadOnly)
    174                 return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
     174                return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
    175175
    176176            JSValue gs = obj->getDirect(offset);
     
    192192    }
    193193   
    194     return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
     194    return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
    195195}
    196196
     
    214214        return putResult;
    215215   
    216     return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
     216    return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
    217217}
    218218
  • trunk/Source/JavaScriptCore/runtime/JSDataView.cpp

    r207411 r207859  
    3131#include "Error.h"
    3232#include "JSCInlines.h"
    33 #include "Reject.h"
     33#include "TypeError.h"
    3434
    3535namespace JSC {
     
    127127    if (propertyName == vm.propertyNames->byteLength
    128128        || propertyName == vm.propertyNames->byteOffset)
    129         return reject(exec, scope, slot.isStrictMode(), ASCIILiteral("Attempting to write to read-only typed array property."));
     129        return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral("Attempting to write to read-only typed array property."));
    130130
    131131    return Base::put(thisObject, exec, propertyName, value, slot);
     
    141141    if (propertyName == vm.propertyNames->byteLength
    142142        || propertyName == vm.propertyNames->byteOffset)
    143         return reject(exec, scope, shouldThrow, ASCIILiteral("Attempting to define read-only typed array property."));
     143        return typeError(exec, scope, shouldThrow, ASCIILiteral("Attempting to define read-only typed array property."));
    144144
    145145    return Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow);
  • trunk/Source/JavaScriptCore/runtime/JSFunction.cpp

    r207461 r207859  
    457457            return Base::put(thisObject, exec, propertyName, value, slot);
    458458        }
    459         return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
     459        return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
    460460    }
    461461    thisObject->reifyLazyPropertyIfNeeded(vm, exec, propertyName);
     
    538538     
    539539    if (descriptor.configurablePresent() && descriptor.configurable())
    540         return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));
     540        return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));
    541541    if (descriptor.enumerablePresent() && descriptor.enumerable())
    542         return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));
     542        return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));
    543543    if (descriptor.isAccessorDescriptor())
    544         return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
     544        return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
    545545    if (descriptor.writablePresent() && descriptor.writable())
    546         return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));
     546        return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));
    547547    if (!valueCheck)
    548         return reject(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyChangeError));
     548        return typeError(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyChangeError));
    549549    return true;
    550550}
  • trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h

    r207411 r207859  
    3232#include "JSArrayBuffer.h"
    3333#include "JSGenericTypedArrayView.h"
    34 #include "Reject.h"
     34#include "TypeError.h"
    3535#include "TypedArrays.h"
    3636
     
    367367    if (parseIndex(propertyName)) {
    368368        if (descriptor.isAccessorDescriptor())
    369             return reject(exec, scope, shouldThrow, ASCIILiteral("Attempting to store accessor indexed property on a typed array."));
     369            return typeError(exec, scope, shouldThrow, ASCIILiteral("Attempting to store accessor indexed property on a typed array."));
    370370
    371371        if (descriptor.configurable())
    372             return reject(exec, scope, shouldThrow, ASCIILiteral("Attempting to configure non-configurable property."));
     372            return typeError(exec, scope, shouldThrow, ASCIILiteral("Attempting to configure non-configurable property."));
    373373
    374374        if (!descriptor.enumerable() || !descriptor.writable())
    375             return reject(exec, scope, shouldThrow, ASCIILiteral("Attempting to store non-enumerable or non-writable indexed property on a typed array."));
     375            return typeError(exec, scope, shouldThrow, ASCIILiteral("Attempting to store non-enumerable or non-writable indexed property on a typed array."));
    376376
    377377        if (descriptor.value()) {
     
    394394
    395395    if (thisObject->isNeutered())
    396         return reject(exec, scope, true, ASCIILiteral(typedArrayBufferHasBeenDetachedErrorMessage));
     396        return typeError(exec, scope, true, ASCIILiteral(typedArrayBufferHasBeenDetachedErrorMessage));
    397397
    398398    if (parseIndex(propertyName))
  • trunk/Source/JavaScriptCore/runtime/JSObject.cpp

    r207411 r207859  
    4646#include "PrototypeMapInlines.h"
    4747#include "ProxyObject.h"
    48 #include "Reject.h"
    4948#include "SlotVisitorInlines.h"
     49#include "TypeError.h"
    5050#include <math.h>
    5151#include <wtf/Assertions.h>
     
    396396        // 9.1.9.1-4-a If ownDesc.[[Writable]] is false, return false.
    397397        if (!ownDescriptor.writable())
    398             return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
     398            return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
    399399
    400400        // 9.1.9.1-4-b If Type(Receiver) is not Object, return false.
    401401        if (!receiver.isObject())
    402             return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
     402            return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
    403403
    404404        // In OrdinarySet, the receiver may not be the same to the object.
     
    415415            // 9.1.9.1-4-d-i If IsAccessorDescriptor(existingDescriptor) is true, return false.
    416416            if (existingDescriptor.isAccessorDescriptor())
    417                 return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
     417                return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
    418418
    419419            // 9.1.9.1-4-d-ii If existingDescriptor.[[Writable]] is false, return false.
    420420            if (!existingDescriptor.writable())
    421                 return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
     421                return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
    422422
    423423            // 9.1.9.1-4-d-iii Let valueDesc be the PropertyDescriptor{[[Value]]: V}.
     
    441441    JSValue setter = ownDescriptor.setter();
    442442    if (!setter.isObject())
    443         return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
     443        return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
    444444
    445445    // 9.1.9.1-8 Perform ? Call(setter, Receiver, << V >>).
     
    476476            if (attributes & ReadOnly) {
    477477                ASSERT(structure(vm)->prototypeChainMayInterceptStoreTo(vm, propertyName) || obj == this);
    478                 return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
     478                return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
    479479            }
    480480
     
    521521    ASSERT(!structure(vm)->prototypeChainMayInterceptStoreTo(vm, propertyName) || obj == this);
    522522    if (!putDirectInternal<PutModePut>(vm, propertyName, value, 0, slot))
    523         return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
     523        return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
    524524    return true;
    525525}
     
    13041304
    13051305    if (!isExtensible)
    1306         return reject(exec, scope, shouldThrowIfCantSet, ASCIILiteral(ReadonlyPropertyWriteError));
     1306        return typeError(exec, scope, shouldThrowIfCantSet, ASCIILiteral(ReadonlyPropertyWriteError));
    13071307
    13081308    JSValue nextPrototype = prototype;
    13091309    while (nextPrototype && nextPrototype.isObject()) {
    13101310        if (nextPrototype == this)
    1311             return reject(exec, scope, shouldThrowIfCantSet, ASCIILiteral("cyclic __proto__ value"));
     1311            return typeError(exec, scope, shouldThrowIfCantSet, ASCIILiteral("cyclic __proto__ value"));
    13121312        // FIXME: The specification currently says we should check if the [[GetPrototypeOf]] internal method of nextPrototype
    13131313        // is not the ordinary object internal method. However, we currently restrict this to Proxy objects as it would allow
     
    20232023        if (!isStructureExtensible()) {
    20242024            map->remove(result.iterator);
    2025             return reject(exec, scope, throwException, ASCIILiteral(NonExtensibleObjectPropertyDefineError));
     2025            return typeError(exec, scope, throwException, ASCIILiteral(NonExtensibleObjectPropertyDefineError));
    20262026        }
    20272027
     
    20592059        // 7.a. Reject, if the [[Configurable]] field of Desc is true.
    20602060        if (descriptor.configurablePresent() && descriptor.configurable())
    2061             return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));
     2061            return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));
    20622062        // 7.b. Reject, if the [[Enumerable]] field of Desc is present and the [[Enumerable]] fields of current and Desc are the Boolean negation of each other.
    20632063        if (descriptor.enumerablePresent() && current.enumerable() != descriptor.enumerable())
    2064             return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));
     2064            return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));
    20652065    }
    20662066
     
    20712071            // 9.a. Reject, if the [[Configurable]] field of current is false.
    20722072            if (!current.configurable())
    2073                 return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
     2073                return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
    20742074            // 9.b. If IsDataDescriptor(current) is true, then convert the property named P of object O from a
    20752075            // data property to an accessor property. Preserve the existing values of the converted property's
     
    20852085                // 10.a.i. Reject, if the [[Writable]] field of current is false and the [[Writable]] field of Desc is true.
    20862086                if (descriptor.writable())
    2087                     return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));
     2087                    return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));
    20882088                // 10.a.ii. If the [[Writable]] field of current is false, then
    20892089                // 10.a.ii.1. Reject, if the [[Value]] field of Desc is present and SameValue(Desc.[[Value]], current.[[Value]]) is false.
    20902090                if (descriptor.value() && !sameValue(exec, descriptor.value(), current.value()))
    2091                     return reject(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyChangeError));
     2091                    return typeError(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyChangeError));
    20922092            }
    20932093            // 10.b. else, the [[Configurable]] field of current is true, so any change is acceptable.
     
    20982098                // 11.i. Reject, if the [[Set]] field of Desc is present and SameValue(Desc.[[Set]], current.[[Set]]) is false.
    20992099                if (descriptor.setterPresent() && descriptor.setter() != current.setter())
    2100                     return reject(exec, scope, throwException, ASCIILiteral("Attempting to change the setter of an unconfigurable property."));
     2100                    return typeError(exec, scope, throwException, ASCIILiteral("Attempting to change the setter of an unconfigurable property."));
    21012101                // 11.ii. Reject, if the [[Get]] field of Desc is present and SameValue(Desc.[[Get]], current.[[Get]]) is false.
    21022102                if (descriptor.getterPresent() && descriptor.getter() != current.getter())
    2103                     return reject(exec, scope, throwException, ASCIILiteral("Attempting to change the getter of an unconfigurable property."));
     2103                    return typeError(exec, scope, throwException, ASCIILiteral("Attempting to change the getter of an unconfigurable property."));
    21042104            }
    21052105        }
     
    22682268        // Prohibit growing the array if length is not writable.
    22692269        if (map->lengthIsReadOnly() || !isStructureExtensible())
    2270             return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
     2270            return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
    22712271        length = i + 1;
    22722272        storage->setLength(length);
     
    24052405            // Prohibit growing the array if length is not writable.
    24062406            if (map->lengthIsReadOnly())
    2407                 return reject(exec, scope, mode == PutDirectIndexShouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
     2407                return typeError(exec, scope, mode == PutDirectIndexShouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
    24082408            if (!isStructureExtensible())
    2409                 return reject(exec, scope, mode == PutDirectIndexShouldThrow, ASCIILiteral(NonExtensibleObjectPropertyDefineError));
     2409                return typeError(exec, scope, mode == PutDirectIndexShouldThrow, ASCIILiteral(NonExtensibleObjectPropertyDefineError));
    24102410        }
    24112411        length = i + 1;
     
    29202920        // Step 2.a
    29212921        if (!isExtensible)
    2922             return reject(exec, scope, throwException, ASCIILiteral(NonExtensibleObjectPropertyDefineError));
     2922            return typeError(exec, scope, throwException, ASCIILiteral(NonExtensibleObjectPropertyDefineError));
    29232923        if (!object)
    29242924            return true;
     
    29402940    if (!current.configurable()) {
    29412941        if (descriptor.configurable())
    2942             return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));
     2942            return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));
    29432943        if (descriptor.enumerablePresent() && descriptor.enumerable() != current.enumerable())
    2944             return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));
     2944            return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));
    29452945    }
    29462946   
     
    29592959    if (descriptor.isDataDescriptor() != current.isDataDescriptor()) {
    29602960        if (!current.configurable())
    2961             return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
     2961            return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
    29622962
    29632963        if (!object)
     
    29732973        if (!current.configurable()) {
    29742974            if (!current.writable() && descriptor.writable())
    2975                 return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));
     2975                return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));
    29762976            if (!current.writable()) {
    29772977                if (descriptor.value() && !sameValue(exec, current.value(), descriptor.value()))
    2978                     return reject(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyChangeError));
     2978                    return typeError(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyChangeError));
    29792979            }
    29802980        }
     
    29922992    if (!current.configurable()) {
    29932993        if (descriptor.setterPresent() && !(current.setterPresent() && JSValue::strictEqual(exec, current.setter(), descriptor.setter())))
    2994             return reject(exec, scope, throwException, ASCIILiteral("Attempting to change the setter of an unconfigurable property."));
     2994            return typeError(exec, scope, throwException, ASCIILiteral("Attempting to change the setter of an unconfigurable property."));
    29952995        if (descriptor.getterPresent() && !(current.getterPresent() && JSValue::strictEqual(exec, current.getter(), descriptor.getter())))
    2996             return reject(exec, scope, throwException, ASCIILiteral("Attempting to change the getter of an unconfigurable property."));
     2996            return typeError(exec, scope, throwException, ASCIILiteral("Attempting to change the getter of an unconfigurable property."));
    29972997        if (current.attributes() & CustomAccessor)
    2998             return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
     2998            return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
    29992999    }
    30003000
  • trunk/Source/JavaScriptCore/runtime/JSObjectInlines.h

    r207411 r207859  
    179179        ASSERT(!thisObject->structure(vm)->prototypeChainMayInterceptStoreTo(vm, propertyName));
    180180        if (!thisObject->putDirectInternal<PutModePut>(vm, propertyName, value, 0, slot))
    181             return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
     181            return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
    182182        return true;
    183183    }
  • trunk/Source/JavaScriptCore/runtime/JSProxy.cpp

    r207411 r207859  
    151151    auto scope = DECLARE_THROW_SCOPE(exec->vm());
    152152
    153     return reject(exec, scope, shouldThrowIfCantSet, ASCIILiteral("Cannot set prototype of this object"));
     153    return typeError(exec, scope, shouldThrowIfCantSet, ASCIILiteral("Cannot set prototype of this object"));
    154154}
    155155
  • trunk/Source/JavaScriptCore/runtime/Lookup.h

    r207411 r207859  
    3232#include "PropertySlot.h"
    3333#include "PutPropertySlot.h"
    34 #include "Reject.h"
     34#include "TypeError.h"
    3535#include <wtf/Assertions.h>
    3636
     
    266266            return true;
    267267        }
    268         return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
     268        return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
    269269    }
    270270
    271271    if (entry->attributes() & Accessor)
    272         return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
     272        return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
    273273
    274274    if (!(entry->attributes() & ReadOnly)) {
     
    284284    }
    285285
    286     return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
     286    return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
    287287}
    288288
  • trunk/Source/JavaScriptCore/runtime/RegExpObject.cpp

    r207411 r207859  
    108108        RegExpObject* regExp = asRegExpObject(object);
    109109        if (descriptor.configurablePresent() && descriptor.configurable())
    110             return reject(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));
     110            return typeError(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));
    111111        if (descriptor.enumerablePresent() && descriptor.enumerable())
    112             return reject(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));
     112            return typeError(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));
    113113        if (descriptor.isAccessorDescriptor())
    114             return reject(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
     114            return typeError(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
    115115        if (!regExp->m_lastIndexIsWritable) {
    116116            if (descriptor.writablePresent() && descriptor.writable())
    117                 return reject(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));
     117                return typeError(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));
    118118            if (!sameValue(exec, regExp->getLastIndex(), descriptor.value()))
    119                 return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyChangeError));
     119                return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyChangeError));
    120120            return true;
    121121        }
  • trunk/Source/JavaScriptCore/runtime/RegExpObject.h

    r207411 r207859  
    2323#include "JSObject.h"
    2424#include "RegExp.h"
    25 #include "Reject.h"
    2625#include "ThrowScope.h"
     26#include "TypeError.h"
    2727
    2828namespace JSC {
     
    6565        }
    6666
    67         return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
     67        return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
    6868    }
    6969    JSValue getLastIndex() const
  • trunk/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp

    r207411 r207859  
    3232#include "JSCInlines.h"
    3333#include "PropertySlot.h"
    34 #include "Reject.h"
    3534#include "SlotVisitor.h"
    3635#include "Structure.h"
     36#include "TypeError.h"
    3737
    3838namespace JSC {
     
    103103    if (result.isNewEntry && !array->isStructureExtensible()) {
    104104        remove(result.iterator);
    105         return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
     105        return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
    106106    }
    107107   
     
    126126        if (result.isNewEntry) {
    127127            remove(result.iterator);
    128             return reject(exec, scope, shouldThrow, ASCIILiteral(NonExtensibleObjectPropertyDefineError));
     128            return typeError(exec, scope, shouldThrow, ASCIILiteral(NonExtensibleObjectPropertyDefineError));
    129129        }
    130130        if (entry.attributes & ReadOnly)
    131             return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
     131            return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
    132132    }
    133133    entry.attributes = attributes;
     
    161161    if (!(attributes & Accessor)) {
    162162        if (attributes & ReadOnly)
    163             return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
     163            return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
    164164
    165165        set(vm, map, value);
  • trunk/Source/JavaScriptCore/runtime/StringObject.cpp

    r207411 r207859  
    7272
    7373    if (propertyName == vm.propertyNames->length)
    74         return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
     74        return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
    7575    if (Optional<uint32_t> index = parseIndex(propertyName))
    7676        return putByIndex(cell, exec, index.value(), value, slot.isStrictMode());
     
    8585    StringObject* thisObject = jsCast<StringObject*>(cell);
    8686    if (thisObject->internalValue()->canGetIndex(propertyName))
    87         return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
     87        return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
    8888    return JSObject::putByIndex(cell, exec, propertyName, value, shouldThrow);
    8989}
  • trunk/Source/JavaScriptCore/runtime/TypeError.h

    r207858 r207859  
    3131namespace JSC {
    3232
    33 inline bool reject(ExecState* exec, ThrowScope& scope, bool throwException, ASCIILiteral message)
     33inline bool typeError(ExecState* exec, ThrowScope& scope, bool throwException, ASCIILiteral message)
    3434{
    3535    if (throwException)
Note: See TracChangeset for help on using the changeset viewer.