Changeset 207859 in webkit
- Timestamp:
- Oct 25, 2016 6:10:24 PM (7 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 18 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r207855 r207859 1 2016-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 1 66 2016-10-25 Filip Pizlo <fpizlo@apple.com> 2 67 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r207787 r207859 641 641 0FB7F39B15ED8E4600F167B2 /* IndexingType.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB7F38F15ED8E3800F167B2 /* IndexingType.h */; settings = {ATTRIBUTES = (Private, ); }; }; 642 642 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, ); }; }; 644 644 0FB7F39E15ED8E4600F167B2 /* SparseArrayValueMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB7F39215ED8E3800F167B2 /* SparseArrayValueMap.h */; settings = {ATTRIBUTES = (Private, ); }; }; 645 645 0FBC0AE71496C7C400D4FBDD /* DFGExitProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FBC0AE41496C7C100D4FBDD /* DFGExitProfile.cpp */; }; … … 2985 2985 0FB7F38F15ED8E3800F167B2 /* IndexingType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexingType.h; sourceTree = "<group>"; }; 2986 2986 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>"; }; 2988 2988 0FB7F39215ED8E3800F167B2 /* SparseArrayValueMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SparseArrayValueMap.h; sourceTree = "<group>"; }; 2989 2989 0FBC0AE41496C7C100D4FBDD /* DFGExitProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DFGExitProfile.cpp; sourceTree = "<group>"; }; … … 6351 6351 BCD202BF0E1706A7002C7E82 /* RegExpPrototype.cpp */, 6352 6352 BCD202C00E1706A7002C7E82 /* RegExpPrototype.h */, 6353 0FB7F39115ED8E3800F167B2 /* Reject.h */,6353 0FB7F39115ED8E3800F167B2 /* TypeError.h */, 6354 6354 70B0A9D01A9B66200001306A /* RuntimeFlags.h */, 6355 6355 527773DD1AAF83AC00BDE7E8 /* RuntimeType.cpp */, … … 8546 8546 0FC314121814559100033232 /* RegisterSet.h in Headers */, 8547 8547 A57D23EE1891B5540031C7FA /* RegularExpression.h in Headers */, 8548 0FB7F39D15ED8E4600F167B2 /* Reject.h in Headers */,8548 0FB7F39D15ED8E4600F167B2 /* TypeError.h in Headers */, 8549 8549 A5BA15E8182340B300A82E69 /* RemoteInspector.h in Headers */, 8550 8550 A5BA15EA182340B400A82E69 /* RemoteInspectorConstants.h in Headers */, -
trunk/Source/JavaScriptCore/runtime/GetterSetter.cpp
r207411 r207859 95 95 96 96 if (getterSetterObj->isSetterNull()) 97 return reject(exec, scope, ecmaMode == StrictMode, ASCIILiteral(ReadonlyPropertyWriteError));97 return typeError(exec, scope, ecmaMode == StrictMode, ASCIILiteral(ReadonlyPropertyWriteError)); 98 98 99 99 JSObject* setter = getterSetterObj->setter(); -
trunk/Source/JavaScriptCore/runtime/JSArray.cpp
r207411 r207859 34 34 #include "JSCInlines.h" 35 35 #include "PropertyNameArray.h" 36 #include " Reject.h"36 #include "TypeError.h" 37 37 #include <wtf/Assertions.h> 38 38 … … 134 134 // from ES5.1 8.12.9 7.a. 135 135 if (descriptor.configurablePresent() && descriptor.configurable()) 136 return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));136 return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError)); 137 137 // from ES5.1 8.12.9 7.b. 138 138 if (descriptor.enumerablePresent() && descriptor.enumerable()) 139 return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));139 return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError)); 140 140 141 141 // a. If the [[Value]] field of Desc is absent, then 142 142 // a.i. Return the result of calling the default [[DefineOwnProperty]] internal method (8.12.9) on A passing "length", Desc, and Throw as arguments. 143 143 if (descriptor.isAccessorDescriptor()) 144 return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));144 return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError)); 145 145 // from ES5.1 8.12.9 10.a. 146 146 if (!array->isLengthWritable() && descriptor.writablePresent() && descriptor.writable()) 147 return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));147 return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError)); 148 148 // This descriptor is either just making length read-only, or changing nothing! 149 149 if (!descriptor.value()) { … … 175 175 // g. Reject if oldLenDesc.[[Writable]] is false. 176 176 if (!array->isLengthWritable()) 177 return reject(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyChangeError));177 return typeError(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyChangeError)); 178 178 179 179 // h. If newLenDesc.[[Writable]] is absent or has the value true, let newWritable be true. … … 215 215 // FIXME: Nothing prevents this from being called on a RuntimeArray, and the length function will always return 0 in that case. 216 216 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.")); 218 218 // 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. 219 219 // d. Reject if succeeded is false. … … 410 410 // Fail if the length is not writable. 411 411 if (map->lengthIsReadOnly()) 412 return reject(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyWriteError));412 return typeError(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyWriteError)); 413 413 414 414 if (newLength < length) { … … 435 435 if (it->value.attributes & DontDelete) { 436 436 storage->setLength(index + 1); 437 return reject(exec, scope, throwException, ASCIILiteral(UnableToDeletePropertyError));437 return typeError(exec, scope, throwException, ASCIILiteral(UnableToDeletePropertyError)); 438 438 } 439 439 map->remove(it); -
trunk/Source/JavaScriptCore/runtime/JSArrayBuffer.cpp
r207411 r207859 28 28 29 29 #include "JSCInlines.h" 30 #include " Reject.h"30 #include "TypeError.h" 31 31 32 32 namespace JSC { … … 99 99 100 100 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.")); 102 102 103 103 return Base::put(thisObject, exec, propertyName, value, slot); … … 113 113 114 114 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.")); 116 116 117 117 return Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow); -
trunk/Source/JavaScriptCore/runtime/JSArrayBufferView.cpp
r207715 r207859 29 29 #include "JSArrayBuffer.h" 30 30 #include "JSCInlines.h" 31 #include " Reject.h"31 #include "TypeError.h" 32 32 33 33 namespace JSC { -
trunk/Source/JavaScriptCore/runtime/JSCJSValue.cpp
r207411 r207859 163 163 prototype = obj->getPrototypeDirect(); 164 164 if (prototype.isNull()) 165 return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));165 return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError)); 166 166 } 167 167 } … … 172 172 if (offset != invalidOffset) { 173 173 if (attributes & ReadOnly) 174 return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));174 return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError)); 175 175 176 176 JSValue gs = obj->getDirect(offset); … … 192 192 } 193 193 194 return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));194 return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError)); 195 195 } 196 196 … … 214 214 return putResult; 215 215 216 return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));216 return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError)); 217 217 } 218 218 -
trunk/Source/JavaScriptCore/runtime/JSDataView.cpp
r207411 r207859 31 31 #include "Error.h" 32 32 #include "JSCInlines.h" 33 #include " Reject.h"33 #include "TypeError.h" 34 34 35 35 namespace JSC { … … 127 127 if (propertyName == vm.propertyNames->byteLength 128 128 || 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.")); 130 130 131 131 return Base::put(thisObject, exec, propertyName, value, slot); … … 141 141 if (propertyName == vm.propertyNames->byteLength 142 142 || 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.")); 144 144 145 145 return Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow); -
trunk/Source/JavaScriptCore/runtime/JSFunction.cpp
r207461 r207859 457 457 return Base::put(thisObject, exec, propertyName, value, slot); 458 458 } 459 return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));459 return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError)); 460 460 } 461 461 thisObject->reifyLazyPropertyIfNeeded(vm, exec, propertyName); … … 538 538 539 539 if (descriptor.configurablePresent() && descriptor.configurable()) 540 return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));540 return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError)); 541 541 if (descriptor.enumerablePresent() && descriptor.enumerable()) 542 return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));542 return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError)); 543 543 if (descriptor.isAccessorDescriptor()) 544 return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));544 return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError)); 545 545 if (descriptor.writablePresent() && descriptor.writable()) 546 return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));546 return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError)); 547 547 if (!valueCheck) 548 return reject(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyChangeError));548 return typeError(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyChangeError)); 549 549 return true; 550 550 } -
trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h
r207411 r207859 32 32 #include "JSArrayBuffer.h" 33 33 #include "JSGenericTypedArrayView.h" 34 #include " Reject.h"34 #include "TypeError.h" 35 35 #include "TypedArrays.h" 36 36 … … 367 367 if (parseIndex(propertyName)) { 368 368 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.")); 370 370 371 371 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.")); 373 373 374 374 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.")); 376 376 377 377 if (descriptor.value()) { … … 394 394 395 395 if (thisObject->isNeutered()) 396 return reject(exec, scope, true, ASCIILiteral(typedArrayBufferHasBeenDetachedErrorMessage));396 return typeError(exec, scope, true, ASCIILiteral(typedArrayBufferHasBeenDetachedErrorMessage)); 397 397 398 398 if (parseIndex(propertyName)) -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r207411 r207859 46 46 #include "PrototypeMapInlines.h" 47 47 #include "ProxyObject.h" 48 #include "Reject.h"49 48 #include "SlotVisitorInlines.h" 49 #include "TypeError.h" 50 50 #include <math.h> 51 51 #include <wtf/Assertions.h> … … 396 396 // 9.1.9.1-4-a If ownDesc.[[Writable]] is false, return false. 397 397 if (!ownDescriptor.writable()) 398 return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));398 return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError)); 399 399 400 400 // 9.1.9.1-4-b If Type(Receiver) is not Object, return false. 401 401 if (!receiver.isObject()) 402 return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));402 return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError)); 403 403 404 404 // In OrdinarySet, the receiver may not be the same to the object. … … 415 415 // 9.1.9.1-4-d-i If IsAccessorDescriptor(existingDescriptor) is true, return false. 416 416 if (existingDescriptor.isAccessorDescriptor()) 417 return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));417 return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError)); 418 418 419 419 // 9.1.9.1-4-d-ii If existingDescriptor.[[Writable]] is false, return false. 420 420 if (!existingDescriptor.writable()) 421 return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));421 return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError)); 422 422 423 423 // 9.1.9.1-4-d-iii Let valueDesc be the PropertyDescriptor{[[Value]]: V}. … … 441 441 JSValue setter = ownDescriptor.setter(); 442 442 if (!setter.isObject()) 443 return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));443 return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError)); 444 444 445 445 // 9.1.9.1-8 Perform ? Call(setter, Receiver, << V >>). … … 476 476 if (attributes & ReadOnly) { 477 477 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)); 479 479 } 480 480 … … 521 521 ASSERT(!structure(vm)->prototypeChainMayInterceptStoreTo(vm, propertyName) || obj == this); 522 522 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)); 524 524 return true; 525 525 } … … 1304 1304 1305 1305 if (!isExtensible) 1306 return reject(exec, scope, shouldThrowIfCantSet, ASCIILiteral(ReadonlyPropertyWriteError));1306 return typeError(exec, scope, shouldThrowIfCantSet, ASCIILiteral(ReadonlyPropertyWriteError)); 1307 1307 1308 1308 JSValue nextPrototype = prototype; 1309 1309 while (nextPrototype && nextPrototype.isObject()) { 1310 1310 if (nextPrototype == this) 1311 return reject(exec, scope, shouldThrowIfCantSet, ASCIILiteral("cyclic __proto__ value"));1311 return typeError(exec, scope, shouldThrowIfCantSet, ASCIILiteral("cyclic __proto__ value")); 1312 1312 // FIXME: The specification currently says we should check if the [[GetPrototypeOf]] internal method of nextPrototype 1313 1313 // is not the ordinary object internal method. However, we currently restrict this to Proxy objects as it would allow … … 2023 2023 if (!isStructureExtensible()) { 2024 2024 map->remove(result.iterator); 2025 return reject(exec, scope, throwException, ASCIILiteral(NonExtensibleObjectPropertyDefineError));2025 return typeError(exec, scope, throwException, ASCIILiteral(NonExtensibleObjectPropertyDefineError)); 2026 2026 } 2027 2027 … … 2059 2059 // 7.a. Reject, if the [[Configurable]] field of Desc is true. 2060 2060 if (descriptor.configurablePresent() && descriptor.configurable()) 2061 return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));2061 return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError)); 2062 2062 // 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. 2063 2063 if (descriptor.enumerablePresent() && current.enumerable() != descriptor.enumerable()) 2064 return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));2064 return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError)); 2065 2065 } 2066 2066 … … 2071 2071 // 9.a. Reject, if the [[Configurable]] field of current is false. 2072 2072 if (!current.configurable()) 2073 return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));2073 return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError)); 2074 2074 // 9.b. If IsDataDescriptor(current) is true, then convert the property named P of object O from a 2075 2075 // data property to an accessor property. Preserve the existing values of the converted property's … … 2085 2085 // 10.a.i. Reject, if the [[Writable]] field of current is false and the [[Writable]] field of Desc is true. 2086 2086 if (descriptor.writable()) 2087 return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));2087 return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError)); 2088 2088 // 10.a.ii. If the [[Writable]] field of current is false, then 2089 2089 // 10.a.ii.1. Reject, if the [[Value]] field of Desc is present and SameValue(Desc.[[Value]], current.[[Value]]) is false. 2090 2090 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)); 2092 2092 } 2093 2093 // 10.b. else, the [[Configurable]] field of current is true, so any change is acceptable. … … 2098 2098 // 11.i. Reject, if the [[Set]] field of Desc is present and SameValue(Desc.[[Set]], current.[[Set]]) is false. 2099 2099 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.")); 2101 2101 // 11.ii. Reject, if the [[Get]] field of Desc is present and SameValue(Desc.[[Get]], current.[[Get]]) is false. 2102 2102 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.")); 2104 2104 } 2105 2105 } … … 2268 2268 // Prohibit growing the array if length is not writable. 2269 2269 if (map->lengthIsReadOnly() || !isStructureExtensible()) 2270 return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));2270 return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError)); 2271 2271 length = i + 1; 2272 2272 storage->setLength(length); … … 2405 2405 // Prohibit growing the array if length is not writable. 2406 2406 if (map->lengthIsReadOnly()) 2407 return reject(exec, scope, mode == PutDirectIndexShouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));2407 return typeError(exec, scope, mode == PutDirectIndexShouldThrow, ASCIILiteral(ReadonlyPropertyWriteError)); 2408 2408 if (!isStructureExtensible()) 2409 return reject(exec, scope, mode == PutDirectIndexShouldThrow, ASCIILiteral(NonExtensibleObjectPropertyDefineError));2409 return typeError(exec, scope, mode == PutDirectIndexShouldThrow, ASCIILiteral(NonExtensibleObjectPropertyDefineError)); 2410 2410 } 2411 2411 length = i + 1; … … 2920 2920 // Step 2.a 2921 2921 if (!isExtensible) 2922 return reject(exec, scope, throwException, ASCIILiteral(NonExtensibleObjectPropertyDefineError));2922 return typeError(exec, scope, throwException, ASCIILiteral(NonExtensibleObjectPropertyDefineError)); 2923 2923 if (!object) 2924 2924 return true; … … 2940 2940 if (!current.configurable()) { 2941 2941 if (descriptor.configurable()) 2942 return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));2942 return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError)); 2943 2943 if (descriptor.enumerablePresent() && descriptor.enumerable() != current.enumerable()) 2944 return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));2944 return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError)); 2945 2945 } 2946 2946 … … 2959 2959 if (descriptor.isDataDescriptor() != current.isDataDescriptor()) { 2960 2960 if (!current.configurable()) 2961 return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));2961 return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError)); 2962 2962 2963 2963 if (!object) … … 2973 2973 if (!current.configurable()) { 2974 2974 if (!current.writable() && descriptor.writable()) 2975 return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));2975 return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError)); 2976 2976 if (!current.writable()) { 2977 2977 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)); 2979 2979 } 2980 2980 } … … 2992 2992 if (!current.configurable()) { 2993 2993 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.")); 2995 2995 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.")); 2997 2997 if (current.attributes() & CustomAccessor) 2998 return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));2998 return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError)); 2999 2999 } 3000 3000 -
trunk/Source/JavaScriptCore/runtime/JSObjectInlines.h
r207411 r207859 179 179 ASSERT(!thisObject->structure(vm)->prototypeChainMayInterceptStoreTo(vm, propertyName)); 180 180 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)); 182 182 return true; 183 183 } -
trunk/Source/JavaScriptCore/runtime/JSProxy.cpp
r207411 r207859 151 151 auto scope = DECLARE_THROW_SCOPE(exec->vm()); 152 152 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")); 154 154 } 155 155 -
trunk/Source/JavaScriptCore/runtime/Lookup.h
r207411 r207859 32 32 #include "PropertySlot.h" 33 33 #include "PutPropertySlot.h" 34 #include " Reject.h"34 #include "TypeError.h" 35 35 #include <wtf/Assertions.h> 36 36 … … 266 266 return true; 267 267 } 268 return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));268 return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError)); 269 269 } 270 270 271 271 if (entry->attributes() & Accessor) 272 return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));272 return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError)); 273 273 274 274 if (!(entry->attributes() & ReadOnly)) { … … 284 284 } 285 285 286 return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));286 return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError)); 287 287 } 288 288 -
trunk/Source/JavaScriptCore/runtime/RegExpObject.cpp
r207411 r207859 108 108 RegExpObject* regExp = asRegExpObject(object); 109 109 if (descriptor.configurablePresent() && descriptor.configurable()) 110 return reject(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));110 return typeError(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError)); 111 111 if (descriptor.enumerablePresent() && descriptor.enumerable()) 112 return reject(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));112 return typeError(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError)); 113 113 if (descriptor.isAccessorDescriptor()) 114 return reject(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));114 return typeError(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError)); 115 115 if (!regExp->m_lastIndexIsWritable) { 116 116 if (descriptor.writablePresent() && descriptor.writable()) 117 return reject(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));117 return typeError(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError)); 118 118 if (!sameValue(exec, regExp->getLastIndex(), descriptor.value())) 119 return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyChangeError));119 return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyChangeError)); 120 120 return true; 121 121 } -
trunk/Source/JavaScriptCore/runtime/RegExpObject.h
r207411 r207859 23 23 #include "JSObject.h" 24 24 #include "RegExp.h" 25 #include "Reject.h"26 25 #include "ThrowScope.h" 26 #include "TypeError.h" 27 27 28 28 namespace JSC { … … 65 65 } 66 66 67 return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));67 return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError)); 68 68 } 69 69 JSValue getLastIndex() const -
trunk/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp
r207411 r207859 32 32 #include "JSCInlines.h" 33 33 #include "PropertySlot.h" 34 #include "Reject.h"35 34 #include "SlotVisitor.h" 36 35 #include "Structure.h" 36 #include "TypeError.h" 37 37 38 38 namespace JSC { … … 103 103 if (result.isNewEntry && !array->isStructureExtensible()) { 104 104 remove(result.iterator); 105 return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));105 return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError)); 106 106 } 107 107 … … 126 126 if (result.isNewEntry) { 127 127 remove(result.iterator); 128 return reject(exec, scope, shouldThrow, ASCIILiteral(NonExtensibleObjectPropertyDefineError));128 return typeError(exec, scope, shouldThrow, ASCIILiteral(NonExtensibleObjectPropertyDefineError)); 129 129 } 130 130 if (entry.attributes & ReadOnly) 131 return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));131 return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError)); 132 132 } 133 133 entry.attributes = attributes; … … 161 161 if (!(attributes & Accessor)) { 162 162 if (attributes & ReadOnly) 163 return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));163 return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError)); 164 164 165 165 set(vm, map, value); -
trunk/Source/JavaScriptCore/runtime/StringObject.cpp
r207411 r207859 72 72 73 73 if (propertyName == vm.propertyNames->length) 74 return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));74 return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError)); 75 75 if (Optional<uint32_t> index = parseIndex(propertyName)) 76 76 return putByIndex(cell, exec, index.value(), value, slot.isStrictMode()); … … 85 85 StringObject* thisObject = jsCast<StringObject*>(cell); 86 86 if (thisObject->internalValue()->canGetIndex(propertyName)) 87 return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));87 return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError)); 88 88 return JSObject::putByIndex(cell, exec, propertyName, value, shouldThrow); 89 89 } -
trunk/Source/JavaScriptCore/runtime/TypeError.h
r207858 r207859 31 31 namespace JSC { 32 32 33 inline bool reject(ExecState* exec, ThrowScope& scope, bool throwException, ASCIILiteral message)33 inline bool typeError(ExecState* exec, ThrowScope& scope, bool throwException, ASCIILiteral message) 34 34 { 35 35 if (throwException)
Note: See TracChangeset
for help on using the changeset viewer.