Ignore:
Timestamp:
Mar 21, 2008, 7:36:34 PM (17 years ago)
Author:
[email protected]
Message:

Global properties that use LocalStorage are not correctly listed as enumerable.

Reviewed by Geoff Garen

The problem was caused by JSObject::getPropertyAttributes not being aware
of the JSVariableObject SymbolTable. The fix is to make getPropertyAttributes
virtual and override in JSVariableObject. This does not produce any performance
regression.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/JSVariableObject.cpp

    r31114 r31225  
    8585void JSVariableObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
    8686{
    87     SymbolTable::const_iterator::Keys end = symbolTable().end().keys();
    88     for (SymbolTable::const_iterator::Keys it = symbolTable().begin().keys(); it != end; ++it)
    89         propertyNames.add(Identifier(it->get()));
     87    SymbolTable::const_iterator end = symbolTable().end();
     88    for (SymbolTable::const_iterator it = symbolTable().begin(); it != end; ++it)
     89        if ((localStorage()[it->second].attributes & DontEnum) == 0)
     90            propertyNames.add(Identifier(it->first.get()));
     91   
     92    JSObject::getPropertyNames(exec, propertyNames);
     93}
    9094
    91     JSObject::getPropertyNames(exec, propertyNames);
     95bool JSVariableObject::getPropertyAttributes(const Identifier& propertyName, unsigned& attributes) const
     96{
     97    size_t index = symbolTable().get(propertyName.ustring().rep());
     98    if (index != missingSymbolMarker()) {
     99        attributes = localStorage()[index].attributes;
     100        return true;
     101    }
     102    return JSObject::getPropertyAttributes(propertyName, attributes);
    92103}
    93104
Note: See TracChangeset for help on using the changeset viewer.