diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2009-09-30 06:37:33 (GMT) |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2009-09-30 06:37:33 (GMT) |
commit | 828b776f0a9ff84288e6be1bbbdb91448ca1bd4d (patch) | |
tree | ce4419b9c72a9a53c3ad3de9568b9cc89f9cf0bf /src/3rdparty/webkit/JavaScriptCore/runtime/JSString.cpp | |
parent | 3c3745c29d9fbae98b55a88b5ebccb0b29b4eed5 (diff) | |
parent | b83ea4276a242893c01586a5f1a2d62d54369cfa (diff) | |
download | Qt-828b776f0a9ff84288e6be1bbbdb91448ca1bd4d.zip Qt-828b776f0a9ff84288e6be1bbbdb91448ca1bd4d.tar.gz Qt-828b776f0a9ff84288e6be1bbbdb91448ca1bd4d.tar.bz2 |
Merge branch '4.6' of git@scm.dev.troll.no:qt/qt into 4.6
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore/runtime/JSString.cpp')
-rw-r--r-- | src/3rdparty/webkit/JavaScriptCore/runtime/JSString.cpp | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSString.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSString.cpp index e1fc66d..91ddaeb 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSString.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSString.cpp @@ -103,30 +103,42 @@ bool JSString::getOwnPropertySlot(ExecState* exec, const Identifier& propertyNam return true; } -bool JSString::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot) -{ - // The semantics here are really getPropertySlot, not getOwnPropertySlot. - // This function should only be called by JSValue::get. - if (getStringPropertySlot(exec, propertyName, slot)) - return true; - return JSString::getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot); -} - -bool JSString::getStringPropertyAttributes(ExecState* exec, const Identifier& propertyName, unsigned& attributes) const +bool JSString::getStringPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { if (propertyName == exec->propertyNames().length) { - attributes = DontEnum | DontDelete | ReadOnly; + descriptor.setDescriptor(jsNumber(exec, m_value.size()), DontEnum | DontDelete | ReadOnly); return true; } + bool isStrictUInt32; unsigned i = propertyName.toStrictUInt32(&isStrictUInt32); if (isStrictUInt32 && i < static_cast<unsigned>(m_value.size())) { - attributes = DontDelete | ReadOnly; + descriptor.setDescriptor(jsSingleCharacterSubstring(exec, m_value, i), DontDelete | ReadOnly); return true; } + return false; } +bool JSString::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + if (getStringPropertyDescriptor(exec, propertyName, descriptor)) + return true; + if (propertyName != exec->propertyNames().underscoreProto) + return false; + descriptor.setDescriptor(exec->lexicalGlobalObject()->stringPrototype(), DontEnum); + return true; +} + +bool JSString::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot) +{ + // The semantics here are really getPropertySlot, not getOwnPropertySlot. + // This function should only be called by JSValue::get. + if (getStringPropertySlot(exec, propertyName, slot)) + return true; + return JSString::getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot); +} + JSString* jsString(JSGlobalData* globalData, const UString& s) { int size = s.size(); |