diff options
Diffstat (limited to 'Source/JavaScriptCore/runtime/StringObject.cpp')
-rw-r--r-- | Source/JavaScriptCore/runtime/StringObject.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/Source/JavaScriptCore/runtime/StringObject.cpp b/Source/JavaScriptCore/runtime/StringObject.cpp index b5aa3f72d..440a60942 100644 --- a/Source/JavaScriptCore/runtime/StringObject.cpp +++ b/Source/JavaScriptCore/runtime/StringObject.cpp @@ -23,14 +23,14 @@ #include "Error.h" #include "JSGlobalObject.h" -#include "JSCInlines.h" +#include "Operations.h" #include "PropertyNameArray.h" namespace JSC { STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(StringObject); -const ClassInfo StringObject::s_info = { "String", &JSWrapperObject::s_info, 0, CREATE_METHOD_TABLE(StringObject) }; +const ClassInfo StringObject::s_info = { "String", &JSWrapperObject::s_info, 0, 0, CREATE_METHOD_TABLE(StringObject) }; StringObject::StringObject(VM& vm, Structure* structure) : JSWrapperObject(vm, structure) @@ -93,7 +93,7 @@ bool StringObject::defineOwnProperty(JSObject* object, ExecState* exec, Property } if (descriptor.configurablePresent() && descriptor.configurable()) { if (throwException) - exec->vm().throwException(exec, createTypeError(exec, ASCIILiteral("Attempting to change configurable attribute of unconfigurable property."))); + exec->vm().throwException(exec, createTypeError(exec, ASCIILiteral("Attempting to configurable attribute of unconfigurable property."))); return false; } if (descriptor.enumerablePresent() && descriptor.enumerable()) { @@ -128,8 +128,9 @@ bool StringObject::deleteProperty(JSCell* cell, ExecState* exec, PropertyName pr StringObject* thisObject = jsCast<StringObject*>(cell); if (propertyName == exec->propertyNames().length) return false; - Optional<uint32_t> index = parseIndex(propertyName); - if (index && thisObject->internalValue()->canGetIndex(index.value())) { + unsigned i = propertyName.asIndex(); + if (thisObject->internalValue()->canGetIndex(i)) { + ASSERT(i != PropertyName::NotAnIndex); // No need for an explicit check, the above test would always fail! return false; } return JSObject::deleteProperty(thisObject, exec, propertyName); @@ -146,12 +147,10 @@ bool StringObject::deletePropertyByIndex(JSCell* cell, ExecState* exec, unsigned void StringObject::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) { StringObject* thisObject = jsCast<StringObject*>(object); - if (propertyNames.includeStringProperties()) { - int size = thisObject->internalValue()->length(); - for (int i = 0; i < size; ++i) - propertyNames.add(Identifier::from(exec, i)); - } - if (mode.includeDontEnumProperties()) + int size = thisObject->internalValue()->length(); + for (int i = 0; i < size; ++i) + propertyNames.add(Identifier::from(exec, i)); + if (mode == IncludeDontEnumProperties) propertyNames.add(exec->propertyNames().length); return JSObject::getOwnPropertyNames(thisObject, exec, propertyNames, mode); } |