Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (207858 => 207859)
--- trunk/Source/_javascript_Core/ChangeLog 2016-10-26 00:11:17 UTC (rev 207858)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-10-26 01:10:24 UTC (rev 207859)
@@ -1,3 +1,68 @@
+2016-10-25 Mark Lam <[email protected]>
+
+ 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.
+
+ * _javascript_Core.xcodeproj/project.pbxproj:
+ * runtime/GetterSetter.cpp:
+ (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/_javascript_Core/runtime/Reject.h.
+ (JSC::typeError):
+ (JSC::reject): Deleted.
+
2016-10-25 Filip Pizlo <[email protected]>
HeapTimer should not hardcode all of its subclasses and USE(CF) shouldn't be a bizarre special case
Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (207858 => 207859)
--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2016-10-26 00:11:17 UTC (rev 207858)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2016-10-26 01:10:24 UTC (rev 207859)
@@ -640,7 +640,7 @@
0FB7F39A15ED8E4600F167B2 /* IndexingHeaderInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB7F38E15ED8E3800F167B2 /* IndexingHeaderInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
0FB7F39B15ED8E4600F167B2 /* IndexingType.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB7F38F15ED8E3800F167B2 /* IndexingType.h */; settings = {ATTRIBUTES = (Private, ); }; };
0FB7F39C15ED8E4600F167B2 /* PropertyStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB7F39015ED8E3800F167B2 /* PropertyStorage.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 0FB7F39D15ED8E4600F167B2 /* Reject.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB7F39115ED8E3800F167B2 /* Reject.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 0FB7F39D15ED8E4600F167B2 /* TypeError.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB7F39115ED8E3800F167B2 /* TypeError.h */; settings = {ATTRIBUTES = (Private, ); }; };
0FB7F39E15ED8E4600F167B2 /* SparseArrayValueMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB7F39215ED8E3800F167B2 /* SparseArrayValueMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
0FBC0AE71496C7C400D4FBDD /* DFGExitProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FBC0AE41496C7C100D4FBDD /* DFGExitProfile.cpp */; };
0FBC0AE81496C7C700D4FBDD /* DFGExitProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FBC0AE51496C7C100D4FBDD /* DFGExitProfile.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -2984,7 +2984,7 @@
0FB7F38E15ED8E3800F167B2 /* IndexingHeaderInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexingHeaderInlines.h; sourceTree = "<group>"; };
0FB7F38F15ED8E3800F167B2 /* IndexingType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexingType.h; sourceTree = "<group>"; };
0FB7F39015ED8E3800F167B2 /* PropertyStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PropertyStorage.h; sourceTree = "<group>"; };
- 0FB7F39115ED8E3800F167B2 /* Reject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reject.h; sourceTree = "<group>"; };
+ 0FB7F39115ED8E3800F167B2 /* TypeError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypeError.h; sourceTree = "<group>"; };
0FB7F39215ED8E3800F167B2 /* SparseArrayValueMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SparseArrayValueMap.h; sourceTree = "<group>"; };
0FBC0AE41496C7C100D4FBDD /* DFGExitProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DFGExitProfile.cpp; sourceTree = "<group>"; };
0FBC0AE51496C7C100D4FBDD /* DFGExitProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DFGExitProfile.h; sourceTree = "<group>"; };
@@ -6350,7 +6350,7 @@
0F7C39FC1C8F659500480151 /* RegExpObjectInlines.h */,
BCD202BF0E1706A7002C7E82 /* RegExpPrototype.cpp */,
BCD202C00E1706A7002C7E82 /* RegExpPrototype.h */,
- 0FB7F39115ED8E3800F167B2 /* Reject.h */,
+ 0FB7F39115ED8E3800F167B2 /* TypeError.h */,
70B0A9D01A9B66200001306A /* RuntimeFlags.h */,
527773DD1AAF83AC00BDE7E8 /* RuntimeType.cpp */,
52C0611D1AA51E1B00B4ADBA /* RuntimeType.h */,
@@ -8545,7 +8545,7 @@
623A37EC1B87A7C000754209 /* RegisterMap.h in Headers */,
0FC314121814559100033232 /* RegisterSet.h in Headers */,
A57D23EE1891B5540031C7FA /* RegularExpression.h in Headers */,
- 0FB7F39D15ED8E4600F167B2 /* Reject.h in Headers */,
+ 0FB7F39D15ED8E4600F167B2 /* TypeError.h in Headers */,
A5BA15E8182340B300A82E69 /* RemoteInspector.h in Headers */,
A5BA15EA182340B400A82E69 /* RemoteInspectorConstants.h in Headers */,
A5BA15F0182345AF00A82E69 /* RemoteInspectionTarget.h in Headers */,
Modified: trunk/Source/_javascript_Core/runtime/GetterSetter.cpp (207858 => 207859)
--- trunk/Source/_javascript_Core/runtime/GetterSetter.cpp 2016-10-26 00:11:17 UTC (rev 207858)
+++ trunk/Source/_javascript_Core/runtime/GetterSetter.cpp 2016-10-26 01:10:24 UTC (rev 207859)
@@ -94,7 +94,7 @@
GetterSetter* getterSetterObj = jsCast<GetterSetter*>(getterSetter);
if (getterSetterObj->isSetterNull())
- return reject(exec, scope, ecmaMode == StrictMode, ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, ecmaMode == StrictMode, ASCIILiteral(ReadonlyPropertyWriteError));
JSObject* setter = getterSetterObj->setter();
Modified: trunk/Source/_javascript_Core/runtime/JSArray.cpp (207858 => 207859)
--- trunk/Source/_javascript_Core/runtime/JSArray.cpp 2016-10-26 00:11:17 UTC (rev 207858)
+++ trunk/Source/_javascript_Core/runtime/JSArray.cpp 2016-10-26 01:10:24 UTC (rev 207859)
@@ -33,7 +33,7 @@
#include "JSArrayInlines.h"
#include "JSCInlines.h"
#include "PropertyNameArray.h"
-#include "Reject.h"
+#include "TypeError.h"
#include <wtf/Assertions.h>
using namespace std;
@@ -133,18 +133,18 @@
// All paths through length definition call the default [[DefineOwnProperty]], hence:
// from ES5.1 8.12.9 7.a.
if (descriptor.configurablePresent() && descriptor.configurable())
- return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));
+ return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));
// from ES5.1 8.12.9 7.b.
if (descriptor.enumerablePresent() && descriptor.enumerable())
- return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));
+ return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));
// a. If the [[Value]] field of Desc is absent, then
// a.i. Return the result of calling the default [[DefineOwnProperty]] internal method (8.12.9) on A passing "length", Desc, and Throw as arguments.
if (descriptor.isAccessorDescriptor())
- return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
+ return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
// from ES5.1 8.12.9 10.a.
if (!array->isLengthWritable() && descriptor.writablePresent() && descriptor.writable())
- return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));
+ return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));
// This descriptor is either just making length read-only, or changing nothing!
if (!descriptor.value()) {
if (descriptor.writablePresent())
@@ -174,7 +174,7 @@
// f.i. Return the result of calling the default [[DefineOwnProperty]] internal method (8.12.9) on A passing "length", newLenDesc, and Throw as arguments.
// g. Reject if oldLenDesc.[[Writable]] is false.
if (!array->isLengthWritable())
- return reject(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyChangeError));
+ return typeError(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyChangeError));
// h. If newLenDesc.[[Writable]] is absent or has the value true, let newWritable be true.
// i. Else,
@@ -214,7 +214,7 @@
uint32_t index = optionalIndex.value();
// FIXME: Nothing prevents this from being called on a RuntimeArray, and the length function will always return 0 in that case.
if (index >= array->length() && !array->isLengthWritable())
- return reject(exec, scope, throwException, ASCIILiteral("Attempting to define numeric property on array with non-writable length property."));
+ return typeError(exec, scope, throwException, ASCIILiteral("Attempting to define numeric property on array with non-writable length property."));
// 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.
// d. Reject if succeeded is false.
// e. If index >= oldLen
@@ -409,7 +409,7 @@
if (SparseArrayValueMap* map = storage->m_sparseMap.get()) {
// Fail if the length is not writable.
if (map->lengthIsReadOnly())
- return reject(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyWriteError));
if (newLength < length) {
// Copy any keys we might be interested in into a vector.
@@ -434,7 +434,7 @@
ASSERT(it != map->notFound());
if (it->value.attributes & DontDelete) {
storage->setLength(index + 1);
- return reject(exec, scope, throwException, ASCIILiteral(UnableToDeletePropertyError));
+ return typeError(exec, scope, throwException, ASCIILiteral(UnableToDeletePropertyError));
}
map->remove(it);
}
Modified: trunk/Source/_javascript_Core/runtime/JSArrayBuffer.cpp (207858 => 207859)
--- trunk/Source/_javascript_Core/runtime/JSArrayBuffer.cpp 2016-10-26 00:11:17 UTC (rev 207858)
+++ trunk/Source/_javascript_Core/runtime/JSArrayBuffer.cpp 2016-10-26 01:10:24 UTC (rev 207859)
@@ -27,7 +27,7 @@
#include "JSArrayBuffer.h"
#include "JSCInlines.h"
-#include "Reject.h"
+#include "TypeError.h"
namespace JSC {
@@ -98,7 +98,7 @@
return ordinarySetSlow(exec, thisObject, propertyName, value, slot.thisValue(), slot.isStrictMode());
if (propertyName == vm.propertyNames->byteLength)
- return reject(exec, scope, slot.isStrictMode(), ASCIILiteral("Attempting to write to a read-only array buffer property."));
+ return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral("Attempting to write to a read-only array buffer property."));
return Base::put(thisObject, exec, propertyName, value, slot);
}
@@ -112,7 +112,7 @@
JSArrayBuffer* thisObject = jsCast<JSArrayBuffer*>(object);
if (propertyName == vm.propertyNames->byteLength)
- return reject(exec, scope, shouldThrow, ASCIILiteral("Attempting to define read-only array buffer property."));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral("Attempting to define read-only array buffer property."));
return Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow);
}
Modified: trunk/Source/_javascript_Core/runtime/JSArrayBufferView.cpp (207858 => 207859)
--- trunk/Source/_javascript_Core/runtime/JSArrayBufferView.cpp 2016-10-26 00:11:17 UTC (rev 207858)
+++ trunk/Source/_javascript_Core/runtime/JSArrayBufferView.cpp 2016-10-26 01:10:24 UTC (rev 207859)
@@ -28,7 +28,7 @@
#include "JSArrayBuffer.h"
#include "JSCInlines.h"
-#include "Reject.h"
+#include "TypeError.h"
namespace JSC {
Modified: trunk/Source/_javascript_Core/runtime/JSCJSValue.cpp (207858 => 207859)
--- trunk/Source/_javascript_Core/runtime/JSCJSValue.cpp 2016-10-26 00:11:17 UTC (rev 207858)
+++ trunk/Source/_javascript_Core/runtime/JSCJSValue.cpp 2016-10-26 01:10:24 UTC (rev 207859)
@@ -162,7 +162,7 @@
for (; !obj->structure()->hasReadOnlyOrGetterSetterPropertiesExcludingProto(); obj = asObject(prototype)) {
prototype = obj->getPrototypeDirect();
if (prototype.isNull())
- return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
}
}
@@ -171,7 +171,7 @@
PropertyOffset offset = obj->structure()->get(vm, propertyName, attributes);
if (offset != invalidOffset) {
if (attributes & ReadOnly)
- return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
JSValue gs = obj->getDirect(offset);
if (gs.isGetterSetter())
@@ -191,7 +191,7 @@
break;
}
- return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
}
bool JSValue::putToPrimitiveByIndex(ExecState* exec, unsigned propertyName, JSValue value, bool shouldThrow)
@@ -213,7 +213,7 @@
if (prototype->attemptToInterceptPutByIndexOnHoleForPrototype(exec, *this, propertyName, value, shouldThrow, putResult))
return putResult;
- return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
}
void JSValue::dump(PrintStream& out) const
Modified: trunk/Source/_javascript_Core/runtime/JSDataView.cpp (207858 => 207859)
--- trunk/Source/_javascript_Core/runtime/JSDataView.cpp 2016-10-26 00:11:17 UTC (rev 207858)
+++ trunk/Source/_javascript_Core/runtime/JSDataView.cpp 2016-10-26 01:10:24 UTC (rev 207859)
@@ -30,7 +30,7 @@
#include "DataView.h"
#include "Error.h"
#include "JSCInlines.h"
-#include "Reject.h"
+#include "TypeError.h"
namespace JSC {
@@ -126,7 +126,7 @@
if (propertyName == vm.propertyNames->byteLength
|| propertyName == vm.propertyNames->byteOffset)
- return reject(exec, scope, slot.isStrictMode(), ASCIILiteral("Attempting to write to read-only typed array property."));
+ return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral("Attempting to write to read-only typed array property."));
return Base::put(thisObject, exec, propertyName, value, slot);
}
@@ -140,7 +140,7 @@
JSDataView* thisObject = jsCast<JSDataView*>(object);
if (propertyName == vm.propertyNames->byteLength
|| propertyName == vm.propertyNames->byteOffset)
- return reject(exec, scope, shouldThrow, ASCIILiteral("Attempting to define read-only typed array property."));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral("Attempting to define read-only typed array property."));
return Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow);
}
Modified: trunk/Source/_javascript_Core/runtime/JSFunction.cpp (207858 => 207859)
--- trunk/Source/_javascript_Core/runtime/JSFunction.cpp 2016-10-26 00:11:17 UTC (rev 207858)
+++ trunk/Source/_javascript_Core/runtime/JSFunction.cpp 2016-10-26 01:10:24 UTC (rev 207859)
@@ -456,7 +456,7 @@
scope.release();
return Base::put(thisObject, exec, propertyName, value, slot);
}
- return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
}
thisObject->reifyLazyPropertyIfNeeded(vm, exec, propertyName);
scope.release();
@@ -537,15 +537,15 @@
}
if (descriptor.configurablePresent() && descriptor.configurable())
- return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));
+ return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));
if (descriptor.enumerablePresent() && descriptor.enumerable())
- return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));
+ return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));
if (descriptor.isAccessorDescriptor())
- return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
+ return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
if (descriptor.writablePresent() && descriptor.writable())
- return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));
+ return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));
if (!valueCheck)
- return reject(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyChangeError));
+ return typeError(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyChangeError));
return true;
}
Modified: trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewInlines.h (207858 => 207859)
--- trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewInlines.h 2016-10-26 00:11:17 UTC (rev 207858)
+++ trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewInlines.h 2016-10-26 01:10:24 UTC (rev 207859)
@@ -31,7 +31,7 @@
#include "ExceptionHelpers.h"
#include "JSArrayBuffer.h"
#include "JSGenericTypedArrayView.h"
-#include "Reject.h"
+#include "TypeError.h"
#include "TypedArrays.h"
namespace JSC {
@@ -366,13 +366,13 @@
if (parseIndex(propertyName)) {
if (descriptor.isAccessorDescriptor())
- return reject(exec, scope, shouldThrow, ASCIILiteral("Attempting to store accessor indexed property on a typed array."));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral("Attempting to store accessor indexed property on a typed array."));
if (descriptor.configurable())
- return reject(exec, scope, shouldThrow, ASCIILiteral("Attempting to configure non-configurable property."));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral("Attempting to configure non-configurable property."));
if (!descriptor.enumerable() || !descriptor.writable())
- return reject(exec, scope, shouldThrow, ASCIILiteral("Attempting to store non-enumerable or non-writable indexed property on a typed array."));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral("Attempting to store non-enumerable or non-writable indexed property on a typed array."));
if (descriptor.value()) {
PutPropertySlot unused(JSValue(thisObject), shouldThrow);
@@ -393,7 +393,7 @@
JSGenericTypedArrayView* thisObject = jsCast<JSGenericTypedArrayView*>(cell);
if (thisObject->isNeutered())
- return reject(exec, scope, true, ASCIILiteral(typedArrayBufferHasBeenDetachedErrorMessage));
+ return typeError(exec, scope, true, ASCIILiteral(typedArrayBufferHasBeenDetachedErrorMessage));
if (parseIndex(propertyName))
return false;
Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (207858 => 207859)
--- trunk/Source/_javascript_Core/runtime/JSObject.cpp 2016-10-26 00:11:17 UTC (rev 207858)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp 2016-10-26 01:10:24 UTC (rev 207859)
@@ -45,8 +45,8 @@
#include "PropertyNameArray.h"
#include "PrototypeMapInlines.h"
#include "ProxyObject.h"
-#include "Reject.h"
#include "SlotVisitorInlines.h"
+#include "TypeError.h"
#include <math.h>
#include <wtf/Assertions.h>
@@ -395,11 +395,11 @@
if (ownDescriptor.isDataDescriptor()) {
// 9.1.9.1-4-a If ownDesc.[[Writable]] is false, return false.
if (!ownDescriptor.writable())
- return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
// 9.1.9.1-4-b If Type(Receiver) is not Object, return false.
if (!receiver.isObject())
- return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
// In OrdinarySet, the receiver may not be the same to the object.
// So, we perform [[GetOwnProperty]] onto the receiver while we already perform [[GetOwnProperty]] onto the object.
@@ -414,11 +414,11 @@
if (existingDescriptorFound) {
// 9.1.9.1-4-d-i If IsAccessorDescriptor(existingDescriptor) is true, return false.
if (existingDescriptor.isAccessorDescriptor())
- return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
// 9.1.9.1-4-d-ii If existingDescriptor.[[Writable]] is false, return false.
if (!existingDescriptor.writable())
- return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
// 9.1.9.1-4-d-iii Let valueDesc be the PropertyDescriptor{[[Value]]: V}.
PropertyDescriptor valueDescriptor;
@@ -440,7 +440,7 @@
// 9.1.9.1-7 If setter is undefined, return false.
JSValue setter = ownDescriptor.setter();
if (!setter.isObject())
- return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
// 9.1.9.1-8 Perform ? Call(setter, Receiver, << V >>).
JSObject* setterObject = asObject(setter);
@@ -475,7 +475,7 @@
if (isValidOffset(offset)) {
if (attributes & ReadOnly) {
ASSERT(structure(vm)->prototypeChainMayInterceptStoreTo(vm, propertyName) || obj == this);
- return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
}
JSValue gs = obj->getDirect(offset);
@@ -520,7 +520,7 @@
ASSERT(!structure(vm)->prototypeChainMayInterceptStoreTo(vm, propertyName) || obj == this);
if (!putDirectInternal<PutModePut>(vm, propertyName, value, 0, slot))
- return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
return true;
}
@@ -1303,12 +1303,12 @@
RETURN_IF_EXCEPTION(scope, false);
if (!isExtensible)
- return reject(exec, scope, shouldThrowIfCantSet, ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, shouldThrowIfCantSet, ASCIILiteral(ReadonlyPropertyWriteError));
JSValue nextPrototype = prototype;
while (nextPrototype && nextPrototype.isObject()) {
if (nextPrototype == this)
- return reject(exec, scope, shouldThrowIfCantSet, ASCIILiteral("cyclic __proto__ value"));
+ return typeError(exec, scope, shouldThrowIfCantSet, ASCIILiteral("cyclic __proto__ value"));
// FIXME: The specification currently says we should check if the [[GetPrototypeOf]] internal method of nextPrototype
// is not the ordinary object internal method. However, we currently restrict this to Proxy objects as it would allow
// for cycles with certain HTML objects (WindowProxy, Location) otherwise.
@@ -2022,7 +2022,7 @@
if (result.isNewEntry) {
if (!isStructureExtensible()) {
map->remove(result.iterator);
- return reject(exec, scope, throwException, ASCIILiteral(NonExtensibleObjectPropertyDefineError));
+ return typeError(exec, scope, throwException, ASCIILiteral(NonExtensibleObjectPropertyDefineError));
}
// 4.a. If IsGenericDescriptor(Desc) or IsDataDescriptor(Desc) is true, then create an own data property
@@ -2058,10 +2058,10 @@
if (!current.configurable()) {
// 7.a. Reject, if the [[Configurable]] field of Desc is true.
if (descriptor.configurablePresent() && descriptor.configurable())
- return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));
+ return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));
// 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.
if (descriptor.enumerablePresent() && current.enumerable() != descriptor.enumerable())
- return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));
+ return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));
}
// 8. If IsGenericDescriptor(Desc) is true, then no further validation is required.
@@ -2070,7 +2070,7 @@
if (current.isDataDescriptor() != descriptor.isDataDescriptor()) {
// 9.a. Reject, if the [[Configurable]] field of current is false.
if (!current.configurable())
- return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
+ return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
// 9.b. If IsDataDescriptor(current) is true, then convert the property named P of object O from a
// data property to an accessor property. Preserve the existing values of the converted property's
// [[Configurable]] and [[Enumerable]] attributes and set the rest of the property's attributes to
@@ -2084,11 +2084,11 @@
if (!current.configurable() && !current.writable()) {
// 10.a.i. Reject, if the [[Writable]] field of current is false and the [[Writable]] field of Desc is true.
if (descriptor.writable())
- return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));
+ return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));
// 10.a.ii. If the [[Writable]] field of current is false, then
// 10.a.ii.1. Reject, if the [[Value]] field of Desc is present and SameValue(Desc.[[Value]], current.[[Value]]) is false.
if (descriptor.value() && !sameValue(exec, descriptor.value(), current.value()))
- return reject(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyChangeError));
+ return typeError(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyChangeError));
}
// 10.b. else, the [[Configurable]] field of current is true, so any change is acceptable.
} else {
@@ -2097,10 +2097,10 @@
if (!current.configurable()) {
// 11.i. Reject, if the [[Set]] field of Desc is present and SameValue(Desc.[[Set]], current.[[Set]]) is false.
if (descriptor.setterPresent() && descriptor.setter() != current.setter())
- return reject(exec, scope, throwException, ASCIILiteral("Attempting to change the setter of an unconfigurable property."));
+ return typeError(exec, scope, throwException, ASCIILiteral("Attempting to change the setter of an unconfigurable property."));
// 11.ii. Reject, if the [[Get]] field of Desc is present and SameValue(Desc.[[Get]], current.[[Get]]) is false.
if (descriptor.getterPresent() && descriptor.getter() != current.getter())
- return reject(exec, scope, throwException, ASCIILiteral("Attempting to change the getter of an unconfigurable property."));
+ return typeError(exec, scope, throwException, ASCIILiteral("Attempting to change the getter of an unconfigurable property."));
}
}
}
@@ -2267,7 +2267,7 @@
if (i >= length) {
// Prohibit growing the array if length is not writable.
if (map->lengthIsReadOnly() || !isStructureExtensible())
- return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
length = i + 1;
storage->setLength(length);
}
@@ -2404,9 +2404,9 @@
if (mode != PutDirectIndexLikePutDirect) {
// Prohibit growing the array if length is not writable.
if (map->lengthIsReadOnly())
- return reject(exec, scope, mode == PutDirectIndexShouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, mode == PutDirectIndexShouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
if (!isStructureExtensible())
- return reject(exec, scope, mode == PutDirectIndexShouldThrow, ASCIILiteral(NonExtensibleObjectPropertyDefineError));
+ return typeError(exec, scope, mode == PutDirectIndexShouldThrow, ASCIILiteral(NonExtensibleObjectPropertyDefineError));
}
length = i + 1;
storage->setLength(length);
@@ -2919,7 +2919,7 @@
// unless extensions are prevented!
// Step 2.a
if (!isExtensible)
- return reject(exec, scope, throwException, ASCIILiteral(NonExtensibleObjectPropertyDefineError));
+ return typeError(exec, scope, throwException, ASCIILiteral(NonExtensibleObjectPropertyDefineError));
if (!object)
return true;
// Step 2.c/d
@@ -2939,9 +2939,9 @@
// Filter out invalid changes
if (!current.configurable()) {
if (descriptor.configurable())
- return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));
+ return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));
if (descriptor.enumerablePresent() && descriptor.enumerable() != current.enumerable())
- return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));
+ return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));
}
// Step 6.
@@ -2958,7 +2958,7 @@
// Changing between a normal property or an accessor property
if (descriptor.isDataDescriptor() != current.isDataDescriptor()) {
if (!current.configurable())
- return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
+ return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
if (!object)
return true;
@@ -2972,10 +2972,10 @@
if (descriptor.isDataDescriptor()) {
if (!current.configurable()) {
if (!current.writable() && descriptor.writable())
- return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));
+ return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));
if (!current.writable()) {
if (descriptor.value() && !sameValue(exec, current.value(), descriptor.value()))
- return reject(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyChangeError));
+ return typeError(exec, scope, throwException, ASCIILiteral(ReadonlyPropertyChangeError));
}
}
if (current.attributesEqual(descriptor) && !descriptor.value())
@@ -2991,11 +2991,11 @@
ASSERT(descriptor.isAccessorDescriptor());
if (!current.configurable()) {
if (descriptor.setterPresent() && !(current.setterPresent() && JSValue::strictEqual(exec, current.setter(), descriptor.setter())))
- return reject(exec, scope, throwException, ASCIILiteral("Attempting to change the setter of an unconfigurable property."));
+ return typeError(exec, scope, throwException, ASCIILiteral("Attempting to change the setter of an unconfigurable property."));
if (descriptor.getterPresent() && !(current.getterPresent() && JSValue::strictEqual(exec, current.getter(), descriptor.getter())))
- return reject(exec, scope, throwException, ASCIILiteral("Attempting to change the getter of an unconfigurable property."));
+ return typeError(exec, scope, throwException, ASCIILiteral("Attempting to change the getter of an unconfigurable property."));
if (current.attributes() & CustomAccessor)
- return reject(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
+ return typeError(exec, scope, throwException, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
}
// Step 10/11.
Modified: trunk/Source/_javascript_Core/runtime/JSObjectInlines.h (207858 => 207859)
--- trunk/Source/_javascript_Core/runtime/JSObjectInlines.h 2016-10-26 00:11:17 UTC (rev 207858)
+++ trunk/Source/_javascript_Core/runtime/JSObjectInlines.h 2016-10-26 01:10:24 UTC (rev 207859)
@@ -178,7 +178,7 @@
if (thisObject->canPerformFastPutInline(exec, vm, propertyName)) {
ASSERT(!thisObject->structure(vm)->prototypeChainMayInterceptStoreTo(vm, propertyName));
if (!thisObject->putDirectInternal<PutModePut>(vm, propertyName, value, 0, slot))
- return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
return true;
}
Modified: trunk/Source/_javascript_Core/runtime/JSProxy.cpp (207858 => 207859)
--- trunk/Source/_javascript_Core/runtime/JSProxy.cpp 2016-10-26 00:11:17 UTC (rev 207858)
+++ trunk/Source/_javascript_Core/runtime/JSProxy.cpp 2016-10-26 01:10:24 UTC (rev 207859)
@@ -150,7 +150,7 @@
{
auto scope = DECLARE_THROW_SCOPE(exec->vm());
- return reject(exec, scope, shouldThrowIfCantSet, ASCIILiteral("Cannot set prototype of this object"));
+ return typeError(exec, scope, shouldThrowIfCantSet, ASCIILiteral("Cannot set prototype of this object"));
}
JSValue JSProxy::getPrototype(JSObject* object, ExecState* exec)
Modified: trunk/Source/_javascript_Core/runtime/Lookup.h (207858 => 207859)
--- trunk/Source/_javascript_Core/runtime/Lookup.h 2016-10-26 00:11:17 UTC (rev 207858)
+++ trunk/Source/_javascript_Core/runtime/Lookup.h 2016-10-26 01:10:24 UTC (rev 207859)
@@ -31,7 +31,7 @@
#include "LazyProperty.h"
#include "PropertySlot.h"
#include "PutPropertySlot.h"
-#include "Reject.h"
+#include "TypeError.h"
#include <wtf/Assertions.h>
namespace JSC {
@@ -265,11 +265,11 @@
thisObject->putDirect(vm, propertyName, value);
return true;
}
- return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
}
if (entry->attributes() & Accessor)
- return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
if (!(entry->attributes() & ReadOnly)) {
ASSERT_WITH_MESSAGE(!(entry->attributes() & DOMJITAttribute), "DOMJITAttribute supports readonly attributes currently.");
@@ -283,7 +283,7 @@
return result;
}
- return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
}
/**
Modified: trunk/Source/_javascript_Core/runtime/RegExpObject.cpp (207858 => 207859)
--- trunk/Source/_javascript_Core/runtime/RegExpObject.cpp 2016-10-26 00:11:17 UTC (rev 207858)
+++ trunk/Source/_javascript_Core/runtime/RegExpObject.cpp 2016-10-26 01:10:24 UTC (rev 207859)
@@ -107,16 +107,16 @@
if (propertyName == vm.propertyNames->lastIndex) {
RegExpObject* regExp = asRegExpObject(object);
if (descriptor.configurablePresent() && descriptor.configurable())
- return reject(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeConfigurabilityError));
if (descriptor.enumerablePresent() && descriptor.enumerable())
- return reject(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeEnumerabilityError));
if (descriptor.isAccessorDescriptor())
- return reject(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeAccessMechanismError));
if (!regExp->m_lastIndexIsWritable) {
if (descriptor.writablePresent() && descriptor.writable())
- return reject(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));
if (!sameValue(exec, regExp->getLastIndex(), descriptor.value()))
- return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyChangeError));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyChangeError));
return true;
}
if (descriptor.value())
Modified: trunk/Source/_javascript_Core/runtime/RegExpObject.h (207858 => 207859)
--- trunk/Source/_javascript_Core/runtime/RegExpObject.h 2016-10-26 00:11:17 UTC (rev 207858)
+++ trunk/Source/_javascript_Core/runtime/RegExpObject.h 2016-10-26 01:10:24 UTC (rev 207859)
@@ -22,8 +22,8 @@
#include "JSObject.h"
#include "RegExp.h"
-#include "Reject.h"
#include "ThrowScope.h"
+#include "TypeError.h"
namespace JSC {
@@ -64,7 +64,7 @@
return true;
}
- return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
}
JSValue getLastIndex() const
{
Deleted: trunk/Source/_javascript_Core/runtime/Reject.h (207858 => 207859)
--- trunk/Source/_javascript_Core/runtime/Reject.h 2016-10-26 00:11:17 UTC (rev 207858)
+++ trunk/Source/_javascript_Core/runtime/Reject.h 2016-10-26 01:10:24 UTC (rev 207859)
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2012, 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "CallFrame.h"
-#include "Error.h"
-
-namespace JSC {
-
-inline bool reject(ExecState* exec, ThrowScope& scope, bool throwException, ASCIILiteral message)
-{
- if (throwException)
- throwTypeError(exec, scope, message);
- return false;
-}
-
-} // namespace JSC
Modified: trunk/Source/_javascript_Core/runtime/SparseArrayValueMap.cpp (207858 => 207859)
--- trunk/Source/_javascript_Core/runtime/SparseArrayValueMap.cpp 2016-10-26 00:11:17 UTC (rev 207858)
+++ trunk/Source/_javascript_Core/runtime/SparseArrayValueMap.cpp 2016-10-26 01:10:24 UTC (rev 207859)
@@ -31,9 +31,9 @@
#include "JSObject.h"
#include "JSCInlines.h"
#include "PropertySlot.h"
-#include "Reject.h"
#include "SlotVisitor.h"
#include "Structure.h"
+#include "TypeError.h"
namespace JSC {
@@ -102,7 +102,7 @@
// extensible, this is not the right thing to have done - so remove again.
if (result.isNewEntry && !array->isStructureExtensible()) {
remove(result.iterator);
- return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
}
return entry.put(exec, array, this, value, shouldThrow);
@@ -125,10 +125,10 @@
// extensible, this is not the right thing to have done - so remove again.
if (result.isNewEntry) {
remove(result.iterator);
- return reject(exec, scope, shouldThrow, ASCIILiteral(NonExtensibleObjectPropertyDefineError));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral(NonExtensibleObjectPropertyDefineError));
}
if (entry.attributes & ReadOnly)
- return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
}
entry.attributes = attributes;
entry.set(vm, this, value);
@@ -160,7 +160,7 @@
if (!(attributes & Accessor)) {
if (attributes & ReadOnly)
- return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
set(vm, map, value);
return true;
Modified: trunk/Source/_javascript_Core/runtime/StringObject.cpp (207858 => 207859)
--- trunk/Source/_javascript_Core/runtime/StringObject.cpp 2016-10-26 00:11:17 UTC (rev 207858)
+++ trunk/Source/_javascript_Core/runtime/StringObject.cpp 2016-10-26 01:10:24 UTC (rev 207859)
@@ -71,7 +71,7 @@
return ordinarySetSlow(exec, thisObject, propertyName, value, slot.thisValue(), slot.isStrictMode());
if (propertyName == vm.propertyNames->length)
- return reject(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
if (Optional<uint32_t> index = parseIndex(propertyName))
return putByIndex(cell, exec, index.value(), value, slot.isStrictMode());
return JSObject::put(cell, exec, propertyName, value, slot);
@@ -84,7 +84,7 @@
StringObject* thisObject = jsCast<StringObject*>(cell);
if (thisObject->internalValue()->canGetIndex(propertyName))
- return reject(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
+ return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyWriteError));
return JSObject::putByIndex(cell, exec, propertyName, value, shouldThrow);
}
Copied: trunk/Source/_javascript_Core/runtime/TypeError.h (from rev 207858, trunk/Source/_javascript_Core/runtime/Reject.h) (0 => 207859)
--- trunk/Source/_javascript_Core/runtime/TypeError.h (rev 0)
+++ trunk/Source/_javascript_Core/runtime/TypeError.h 2016-10-26 01:10:24 UTC (rev 207859)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2012, 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "CallFrame.h"
+#include "Error.h"
+
+namespace JSC {
+
+inline bool typeError(ExecState* exec, ThrowScope& scope, bool throwException, ASCIILiteral message)
+{
+ if (throwException)
+ throwTypeError(exec, scope, message);
+ return false;
+}
+
+} // namespace JSC