Changeset 31225 in webkit
- Timestamp:
- Mar 21, 2008 7:36:34 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r31216 r31225 1 2008-03-21 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Geoff Garen. 4 5 Global properties that use LocalStorage are not correctly listed as enumerable. 6 7 The problem was caused by JSObject::getPropertyAttributes not being aware 8 of the JSVariableObject SymbolTable. The fix is to make getPropertyAttributes 9 virtual and override in JSVariableObject. This does not produce any performance 10 regression. 11 12 * JavaScriptCore.exp: 13 * kjs/JSVariableObject.cpp: 14 (KJS::JSVariableObject::getPropertyNames): 15 (KJS::JSVariableObject::getPropertyAttributes): 16 * kjs/JSVariableObject.h: 17 * kjs/object.h: 18 1 19 2008-03-21 Arkadiusz Miskiewicz <arekm@maven.pl> 2 20 -
trunk/JavaScriptCore/JavaScriptCore.exp
r31208 r31225 230 230 __ZNK3KJS16JSVariableObject16isVariableObjectEv 231 231 __ZNK3KJS16JSVariableObject16saveLocalStorageERNS_15SavedPropertiesE 232 __ZNK3KJS16JSVariableObject21getPropertyAttributesERKNS_10IdentifierERj 232 233 __ZNK3KJS19InternalFunctionImp14implementsCallEv 233 234 __ZNK3KJS19InternalFunctionImp21implementsHasInstanceEv … … 256 257 __ZNK3KJS8JSObject14implementsCallEv 257 258 __ZNK3KJS8JSObject19implementsConstructEv 259 __ZNK3KJS8JSObject21getPropertyAttributesERKNS_10IdentifierERj 258 260 __ZNK3KJS8JSObject21implementsHasInstanceEv 259 261 __ZNK3KJS8JSObject3getEPNS_9ExecStateERKNS_10IdentifierE -
trunk/JavaScriptCore/kjs/JSVariableObject.cpp
r31114 r31225 85 85 void JSVariableObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) 86 86 { 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 } 90 94 91 JSObject::getPropertyNames(exec, propertyNames); 95 bool 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); 92 103 } 93 104 -
trunk/JavaScriptCore/kjs/JSVariableObject.h
r31114 r31225 38 38 class JSVariableObject : public JSObject { 39 39 public: 40 SymbolTable& symbolTable() { return *d->symbolTable; }41 LocalStorage& localStorage() { return d->localStorage; }40 SymbolTable& symbolTable() const { return *d->symbolTable; } 41 LocalStorage& localStorage() const { return d->localStorage; } 42 42 43 43 void saveLocalStorage(SavedProperties&) const; … … 53 53 virtual bool isVariableObject() const; 54 54 virtual bool isDynamicScope() const = 0; 55 56 virtual bool getPropertyAttributes(const Identifier& propertyName, unsigned& attributes) const; 55 57 56 58 protected: -
trunk/JavaScriptCore/kjs/object.h
r31114 r31225 404 404 virtual JSObject *toObject(ExecState *exec) const; 405 405 406 bool getPropertyAttributes(const Identifier& propertyName, unsigned& attributes) const;406 virtual bool getPropertyAttributes(const Identifier& propertyName, unsigned& attributes) const; 407 407 408 408 // WebCore uses this to make document.all and style.filter undetectable -
trunk/LayoutTests/ChangeLog
r31224 r31225 1 2008-03-21 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Geoff Garen. 4 5 Ensure we correctly report optimised variables as being 6 enumerable. 7 8 * fast/js/propertyIsEnumerable-expected.txt: 9 * fast/js/resources/propertyIsEnumerable.js: 10 1 11 2008-03-21 Sam Weinig <sam@webkit.org> 2 12 -
trunk/LayoutTests/fast/js/propertyIsEnumerable-expected.txt
r12001 r31225 7 7 PASS a.propertyIsEnumerable ('foo') is true 8 8 PASS a.propertyIsEnumerable ('non-existant') is false 9 PASS global.propertyIsEnumerable ('aVarDecl') is true 10 PASS global.propertyIsEnumerable ('aFunctionDecl') is true 11 PASS global.propertyIsEnumerable ('Math') is false 12 PASS global.propertyIsEnumerable ('NaN') is false 13 PASS global.propertyIsEnumerable ('undefined') is false 9 14 PASS successfullyParsed is true 10 15 -
trunk/LayoutTests/fast/js/resources/propertyIsEnumerable.js
r11995 r31225 6 6 a.foo='bar' 7 7 8 var aVarDecl; 9 function aFunctionDecl(){} 10 var global = this; 8 11 shouldBeFalse("a.propertyIsEnumerable('length')"); 9 12 shouldBeTrue("a.propertyIsEnumerable ('foo')"); 10 13 shouldBeFalse("a.propertyIsEnumerable ('non-existant')"); 11 14 15 shouldBeTrue("global.propertyIsEnumerable ('aVarDecl')"); 16 shouldBeTrue("global.propertyIsEnumerable ('aFunctionDecl')"); 17 shouldBeFalse("global.propertyIsEnumerable ('Math')"); 18 shouldBeFalse("global.propertyIsEnumerable ('NaN')"); 19 shouldBeFalse("global.propertyIsEnumerable ('undefined')"); 20 12 21 var successfullyParsed = true;
Note: See TracChangeset
for help on using the changeset viewer.