Changeset 48336 in webkit
- Timestamp:
- Sep 12, 2009 7:44:32 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 41 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSCallbackObject.h
r43372 r48336 67 67 virtual bool hasInstance(ExecState* exec, JSValue value, JSValue proto); 68 68 69 virtual void get PropertyNames(ExecState*, PropertyNameArray&);69 virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&); 70 70 71 71 virtual double toNumber(ExecState*) const; -
trunk/JavaScriptCore/API/JSCallbackObjectFunctions.h
r46598 r48336 374 374 375 375 template <class Base> 376 void JSCallbackObject<Base>::get PropertyNames(ExecState* exec, PropertyNameArray& propertyNames)376 void JSCallbackObject<Base>::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) 377 377 { 378 378 JSContextRef execRef = toRef(exec); … … 408 408 } 409 409 410 Base::get PropertyNames(exec, propertyNames);410 Base::getOwnPropertyNames(exec, propertyNames); 411 411 } 412 412 -
trunk/JavaScriptCore/ChangeLog
r48331 r48336 1 2009-09-12 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Maciej Stachowiak. 4 5 [ES5] Implement Object.keys 6 https://bugs.webkit.org/show_bug.cgi?id=29170 7 8 This patch basically requires two separate steps, the first is to split getPropertyNames 9 into two functions -- getOwnPropertyNames and getPropertyNames, basically making them behave 10 in the same way as getOwnPropertySlot and getPropertySlot. In essence getOwnPropertyNames 11 produces the list of properties on an object excluding its prototype chain and getPropertyNames 12 just iterates the the object and its prototype chain calling getOwnPropertyNames at each level. 13 14 * API/JSCallbackObject.h: 15 * API/JSCallbackObjectFunctions.h: 16 (JSC::::getOwnPropertyNames): 17 * JavaScriptCore.exp: 18 * debugger/DebuggerActivation.cpp: 19 (JSC::DebuggerActivation::getOwnPropertyNames): 20 * debugger/DebuggerActivation.h: 21 * runtime/CommonIdentifiers.h: 22 * runtime/JSArray.cpp: 23 (JSC::JSArray::getOwnPropertyNames): 24 * runtime/JSArray.h: 25 * runtime/JSByteArray.cpp: 26 (JSC::JSByteArray::getOwnPropertyNames): 27 * runtime/JSByteArray.h: 28 * runtime/JSNotAnObject.cpp: 29 (JSC::JSNotAnObject::getOwnPropertyNames): 30 * runtime/JSNotAnObject.h: 31 * runtime/JSObject.cpp: 32 (JSC::JSObject::getOwnPropertyNames): 33 * runtime/JSObject.h: 34 * runtime/JSVariableObject.cpp: 35 (JSC::JSVariableObject::getOwnPropertyNames): 36 * runtime/JSVariableObject.h: 37 * runtime/ObjectConstructor.cpp: 38 (JSC::ObjectConstructor::ObjectConstructor): 39 (JSC::objectConstructorKeys): 40 * runtime/RegExpMatchesArray.h: 41 (JSC::RegExpMatchesArray::getOwnPropertyNames): 42 * runtime/StringObject.cpp: 43 (JSC::StringObject::getOwnPropertyNames): 44 * runtime/StringObject.h: 45 * runtime/Structure.cpp: 46 (JSC::Structure::getOwnEnumerablePropertyNames): 47 (JSC::Structure::getEnumerablePropertyNames): 48 * runtime/Structure.h: 49 1 50 2009-09-11 Oliver Hunt <oliver@apple.com> 2 51 -
trunk/JavaScriptCore/JavaScriptCore.exp
r48270 r48336 114 114 __ZN3JSC12SmallStrings17createEmptyStringEPNS_12JSGlobalDataE 115 115 __ZN3JSC12StringObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE 116 __ZN3JSC12StringObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE117 116 __ZN3JSC12StringObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE 118 117 __ZN3JSC12StringObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE 118 __ZN3JSC12StringObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE 119 119 __ZN3JSC12StringObject24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE 120 120 __ZN3JSC12StringObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE … … 148 148 __ZN3JSC16JSVariableObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE 149 149 __ZN3JSC16JSVariableObject14symbolTableGetERKNS_10IdentifierERNS_18PropertyDescriptorE 150 __ZN3JSC16JSVariableObject1 6getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE150 __ZN3JSC16JSVariableObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE 151 151 __ZN3JSC16toUInt32SlowCaseEdRb 152 152 __ZN3JSC17BytecodeGenerator21setDumpsGeneratedCodeEb … … 251 251 __ZN3JSC8JSObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE 252 252 __ZN3JSC8JSObject18getPrimitiveNumberEPNS_9ExecStateERdRNS_7JSValueE 253 __ZN3JSC8JSObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE 253 254 __ZN3JSC8JSObject21getPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE 254 255 __ZN3JSC8JSObject22fillGetterPropertySlotERNS_12PropertySlotEPNS_7JSValueE -
trunk/JavaScriptCore/debugger/DebuggerActivation.cpp
r47022 r48336 72 72 } 73 73 74 void DebuggerActivation::get PropertyNames(ExecState* exec, PropertyNameArray& propertyNames)74 void DebuggerActivation::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) 75 75 { 76 76 m_activation->getPropertyNames(exec, propertyNames); -
trunk/JavaScriptCore/debugger/DebuggerActivation.h
r48331 r48336 43 43 virtual void putWithAttributes(ExecState*, const Identifier& propertyName, JSValue, unsigned attributes); 44 44 virtual bool deleteProperty(ExecState*, const Identifier& propertyName); 45 virtual void get PropertyNames(ExecState*, PropertyNameArray&);45 virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&); 46 46 virtual bool getPropertyAttributes(ExecState*, const Identifier& propertyName, unsigned& attributes) const; 47 47 virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction); -
trunk/JavaScriptCore/runtime/CommonIdentifiers.h
r47780 r48336 54 54 macro(isArray) \ 55 55 macro(isPrototypeOf) \ 56 macro(keys) \ 56 57 macro(length) \ 57 58 macro(message) \ -
trunk/JavaScriptCore/runtime/JSArray.cpp
r47780 r48336 465 465 } 466 466 467 void JSArray::get PropertyNames(ExecState* exec, PropertyNameArray& propertyNames)467 void JSArray::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) 468 468 { 469 469 // FIXME: Filling PropertyNameArray with an identifier for every integer … … 485 485 } 486 486 487 JSObject::get PropertyNames(exec, propertyNames);487 JSObject::getOwnPropertyNames(exec, propertyNames); 488 488 } 489 489 -
trunk/JavaScriptCore/runtime/JSArray.h
r48068 r48336 92 92 virtual bool deleteProperty(ExecState*, const Identifier& propertyName); 93 93 virtual bool deleteProperty(ExecState*, unsigned propertyName); 94 virtual void get PropertyNames(ExecState*, PropertyNameArray&);94 virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&); 95 95 virtual void markChildren(MarkStack&); 96 96 -
trunk/JavaScriptCore/runtime/JSByteArray.cpp
r47780 r48336 97 97 } 98 98 99 void JSByteArray::get PropertyNames(ExecState* exec, PropertyNameArray& propertyNames)99 void JSByteArray::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) 100 100 { 101 101 unsigned length = m_storage->length(); 102 102 for (unsigned i = 0; i < length; ++i) 103 103 propertyNames.add(Identifier::from(exec, i)); 104 JSObject::get PropertyNames(exec, propertyNames);104 JSObject::getOwnPropertyNames(exec, propertyNames); 105 105 } 106 106 -
trunk/JavaScriptCore/runtime/JSByteArray.h
r47780 r48336 83 83 virtual void put(JSC::ExecState*, unsigned propertyName, JSC::JSValue); 84 84 85 virtual void get PropertyNames(JSC::ExecState*, JSC::PropertyNameArray&);85 virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&); 86 86 87 87 virtual const ClassInfo* classInfo() const { return m_classInfo; } -
trunk/JavaScriptCore/runtime/JSNotAnObject.cpp
r47780 r48336 122 122 } 123 123 124 void JSNotAnObject::get PropertyNames(ExecState* exec, PropertyNameArray&)124 void JSNotAnObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray&) 125 125 { 126 126 ASSERT_UNUSED(exec, exec->hadException() && exec->exception() == m_exception); -
trunk/JavaScriptCore/runtime/JSNotAnObject.h
r47780 r48336 89 89 virtual bool deleteProperty(ExecState*, unsigned propertyName); 90 90 91 virtual void get PropertyNames(ExecState*, PropertyNameArray&);91 virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&); 92 92 93 93 JSNotAnObjectErrorStub* m_exception; -
trunk/JavaScriptCore/runtime/JSObject.cpp
r48068 r48336 428 428 } 429 429 430 void JSObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) 431 { 432 m_structure->getOwnEnumerablePropertyNames(exec, propertyNames, this); 433 } 434 430 435 bool JSObject::toBoolean(ExecState*) const 431 436 { -
trunk/JavaScriptCore/runtime/JSObject.h
r48331 r48336 124 124 125 125 virtual void getPropertyNames(ExecState*, PropertyNameArray&); 126 virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&); 126 127 127 128 virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType = NoPreference) const; -
trunk/JavaScriptCore/runtime/JSVariableObject.cpp
r47780 r48336 43 43 } 44 44 45 void JSVariableObject::get PropertyNames(ExecState* exec, PropertyNameArray& propertyNames)45 void JSVariableObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) 46 46 { 47 47 SymbolTable::const_iterator end = symbolTable().end(); … … 51 51 } 52 52 53 JSObject::get PropertyNames(exec, propertyNames);53 JSObject::getOwnPropertyNames(exec, propertyNames); 54 54 } 55 55 -
trunk/JavaScriptCore/runtime/JSVariableObject.h
r48331 r48336 50 50 51 51 virtual bool deleteProperty(ExecState*, const Identifier&); 52 virtual void get PropertyNames(ExecState*, PropertyNameArray&);52 virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&); 53 53 54 54 virtual bool isVariableObject() const; -
trunk/JavaScriptCore/runtime/ObjectConstructor.cpp
r47780 r48336 35 35 static JSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState*, JSObject*, JSValue, const ArgList&); 36 36 static JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState*, JSObject*, JSValue, const ArgList&); 37 static JSValue JSC_HOST_CALL objectConstructorKeys(ExecState*, JSObject*, JSValue, const ArgList&); 37 38 38 39 ObjectConstructor::ObjectConstructor(ExecState* exec, PassRefPtr<Structure> structure, ObjectPrototype* objectPrototype, Structure* prototypeFunctionStructure) … … 47 48 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().getPrototypeOf, objectConstructorGetPrototypeOf), DontEnum); 48 49 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().getOwnPropertyDescriptor, objectConstructorGetOwnPropertyDescriptor), DontEnum); 50 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().keys, objectConstructorKeys), DontEnum); 49 51 } 50 52 … … 117 119 } 118 120 121 JSValue JSC_HOST_CALL objectConstructorKeys(ExecState* exec, JSObject*, JSValue, const ArgList& args) 122 { 123 if (!args.at(0).isObject()) 124 return throwError(exec, TypeError, "Requested keys of a value that is not an object."); 125 PropertyNameArray properties(exec); 126 asObject(args.at(0))->getOwnPropertyNames(exec, properties); 127 JSArray* keys = constructEmptyArray(exec); 128 size_t numProperties = properties.size(); 129 for (size_t i = 0; i < numProperties; i++) 130 keys->push(exec, jsOwnedString(exec, properties[i].ustring())); 131 return keys; 132 } 133 119 134 } // namespace JSC -
trunk/JavaScriptCore/runtime/RegExpMatchesArray.h
r47780 r48336 80 80 } 81 81 82 virtual void get PropertyNames(ExecState* exec, PropertyNameArray& arr)82 virtual void getOwnPropertyNames(ExecState* exec, PropertyNameArray& arr) 83 83 { 84 84 if (lazyCreationData()) 85 85 fillArrayInstance(exec); 86 JSArray::get PropertyNames(exec, arr);86 JSArray::getOwnPropertyNames(exec, arr); 87 87 } 88 88 -
trunk/JavaScriptCore/runtime/StringObject.cpp
r48083 r48336 83 83 } 84 84 85 void StringObject::get PropertyNames(ExecState* exec, PropertyNameArray& propertyNames)85 void StringObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) 86 86 { 87 87 int size = internalValue()->value().size(); 88 88 for (int i = 0; i < size; ++i) 89 89 propertyNames.add(Identifier(exec, UString::from(i))); 90 return JSObject::get PropertyNames(exec, propertyNames);90 return JSObject::getOwnPropertyNames(exec, propertyNames); 91 91 } 92 92 -
trunk/JavaScriptCore/runtime/StringObject.h
r48083 r48336 40 40 virtual void put(ExecState* exec, const Identifier& propertyName, JSValue, PutPropertySlot&); 41 41 virtual bool deleteProperty(ExecState*, const Identifier& propertyName); 42 virtual void get PropertyNames(ExecState*, PropertyNameArray&);42 virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&); 43 43 44 44 virtual const ClassInfo* classInfo() const { return &info; } -
trunk/JavaScriptCore/runtime/Structure.cpp
r48264 r48336 274 274 } 275 275 276 void Structure::getOwnEnumerablePropertyNames(ExecState* exec, PropertyNameArray& propertyNames, JSObject* baseObject) 277 { 278 getEnumerableNamesFromPropertyTable(propertyNames); 279 getEnumerableNamesFromClassInfoTable(exec, baseObject->classInfo(), propertyNames); 280 } 281 276 282 void Structure::getEnumerablePropertyNames(ExecState* exec, PropertyNameArray& propertyNames, JSObject* baseObject) 277 283 { … … 286 292 } 287 293 288 getEnumerableNamesFromPropertyTable(propertyNames); 289 getEnumerableNamesFromClassInfoTable(exec, baseObject->classInfo(), propertyNames); 294 baseObject->getOwnPropertyNames(exec, propertyNames); 290 295 291 296 if (m_prototype.isObject()) { 292 297 propertyNames.setShouldCache(false); // No need for our prototypes to waste memory on caching, since they're not being enumerated directly. 293 asObject(m_prototype)->getPropertyNames(exec, propertyNames); 298 JSObject* prototype = asObject(m_prototype); 299 while(1) { 300 if (!prototype->structure()->typeInfo().hasDefaultGetPropertyNames()) { 301 prototype->getPropertyNames(exec, propertyNames); 302 break; 303 } 304 prototype->getOwnPropertyNames(exec, propertyNames); 305 JSValue nextProto = prototype->prototype(); 306 if (!nextProto.isObject()) 307 break; 308 prototype = asObject(nextProto); 309 } 294 310 } 295 311 -
trunk/JavaScriptCore/runtime/Structure.h
r48264 r48336 115 115 116 116 void getEnumerablePropertyNames(ExecState*, PropertyNameArray&, JSObject*); 117 void getOwnEnumerablePropertyNames(ExecState*, PropertyNameArray&, JSObject*); 117 118 118 119 bool hasGetterSetterProperties() const { return m_hasGetterSetterProperties; } -
trunk/JavaScriptGlue/ChangeLog
r48067 r48336 1 2009-09-12 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Maciej Stachowiak. 4 5 [ES5] Implement Object.keys 6 https://bugs.webkit.org/show_bug.cgi?id=29170 7 8 Switch over to getOwnPropertyNames instead of getPropertyNames. 9 10 * UserObjectImp.cpp: 11 (UserObjectImp::getOwnPropertyNames): 12 * UserObjectImp.h: 13 1 14 2009-09-02 Darin Adler <darin@apple.com> 2 15 -
trunk/JavaScriptGlue/UserObjectImp.cpp
r47022 r48336 95 95 96 96 97 void UserObjectImp::get PropertyNames(ExecState *exec, PropertyNameArray& propertyNames)97 void UserObjectImp::getOwnPropertyNames(ExecState *exec, PropertyNameArray& propertyNames) 98 98 { 99 99 JSUserObject* ptr = GetJSUserObject(); … … 110 110 } 111 111 } 112 JSObject::get PropertyNames(exec, propertyNames);112 JSObject::getOwnPropertyNames(exec, propertyNames); 113 113 } 114 114 -
trunk/JavaScriptGlue/UserObjectImp.h
r47022 r48336 45 45 virtual CallType getCallData(CallData&); 46 46 47 virtual void get PropertyNames(ExecState*, PropertyNameArray&);47 virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&); 48 48 49 49 virtual JSValue callAsFunction(ExecState *exec, JSObject *thisObj, const ArgList &args); -
trunk/LayoutTests/ChangeLog
r48334 r48336 1 2009-09-12 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Maciej Stachowiak. 4 5 [ES5] Implement Object.keys 6 https://bugs.webkit.org/show_bug.cgi?id=29170 7 8 Add tests for Object.keys(o), both standard usage and cross origin. 9 10 * fast/js/Object-keys-expected.txt: Added. 11 * fast/js/Object-keys.html: Added. 12 * fast/js/resources/Object-keys.js: Added. 13 * http/tests/security/cross-frame-access-enumeration-expected.txt: 14 * http/tests/security/cross-frame-access-enumeration.html: 15 1 16 2009-09-12 Sam Weinig <sam@webkit.org> 2 17 -
trunk/LayoutTests/http/tests/security/cross-frame-access-enumeration-expected.txt
r34142 r48336 1 CONSOLE MESSAGE: line 1: Unsafe JavaScript attempt to access frame with URL http://localhost:8000/security/resources/cross-frame-iframe-for-enumeration-test.html from frame with URL http://127.0.0.1:8000/security/cross-frame-access-enumeration.html. Domains, protocols and ports must match. 2 3 CONSOLE MESSAGE: line 1: Unsafe JavaScript attempt to access frame with URL http://localhost:8000/security/resources/cross-frame-iframe-for-enumeration-test.html from frame with URL http://127.0.0.1:8000/security/cross-frame-access-enumeration.html. Domains, protocols and ports must match. 4 5 CONSOLE MESSAGE: line 1: Unsafe JavaScript attempt to access frame with URL http://localhost:8000/security/resources/cross-frame-iframe-for-enumeration-test.html from frame with URL http://127.0.0.1:8000/security/cross-frame-access-enumeration.html. Domains, protocols and ports must match. 6 1 7 CONSOLE MESSAGE: line 1: Unsafe JavaScript attempt to access frame with URL http://localhost:8000/security/resources/cross-frame-iframe-for-enumeration-test.html from frame with URL http://127.0.0.1:8000/security/cross-frame-access-enumeration.html. Domains, protocols and ports must match. 2 8 … … 9 15 10 16 PASS: Cross frame access by enumerating the window object was denied. 17 PASS: Cross frame access by getting the keys of the window object was denied. 11 18 PASS: Cross frame access by enumerating the History object was denied. 19 PASS: Cross frame access by getting the keys of the History object was denied. 12 20 PASS: Cross frame access by enumerating the Location object was denied. 21 PASS: Cross frame access by getting the keys of the Location object was denied. 13 22 -
trunk/LayoutTests/http/tests/security/cross-frame-access-enumeration.html
r34142 r48336 46 46 log("PASS: Cross frame access by enumerating the window object was denied."); 47 47 48 var b_winKeys = Object.keys(b_win); 49 if (b_winKeys.indexOf("customWindowProperty") != -1) { 50 log("FAIL: Cross frame access by getting the keys of the window object was allowed."); 51 return; 52 } 53 log("PASS: Cross frame access by getting the keys of the window object was denied."); 54 48 55 // Test enumerating the History object 49 56 var b_win_history = b_win.history; … … 59 66 log("PASS: Cross frame access by enumerating the History object was denied."); 60 67 68 var b_winHistoryKeys = Object.keys(b_win_history); 69 if (b_winHistoryKeys.indexOf("customHistoryProperty") != -1) { 70 log("FAIL: Cross frame access by getting the keys of the History object was allowed."); 71 return; 72 } 73 log("PASS: Cross frame access by getting the keys of the History object was denied."); 74 61 75 // Test enumerating the Location object 62 76 var b_win_location = b_win.location; … … 71 85 } 72 86 log("PASS: Cross frame access by enumerating the Location object was denied."); 87 88 var b_winLocationKeys = Object.keys(b_win_location); 89 if (b_winLocationKeys.indexOf("customLocationProperty") != -1) { 90 log("FAIL: Cross frame access by getting the keys of the Location object was allowed."); 91 return; 92 } 93 log("PASS: Cross frame access by getting the keys of the Location object was denied."); 73 94 } 74 95 </script> -
trunk/WebCore/ChangeLog
r48334 r48336 1 2009-09-12 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Maciej Stachowiak. 4 5 [ES5] Implement Object.keys 6 https://bugs.webkit.org/show_bug.cgi?id=29170 7 8 Switch from getPropertyNames to getOwnPropertyNames, and provide custom 9 getPropertyNames to DOMWindow, DOMWindowShell and QuarantinedObjectWrapper 10 in order to ensure correct semantics are maintained. 11 12 Test: fast/js/Object-keys.html 13 14 * bindings/js/JSDOMWindowCustom.cpp: 15 (WebCore::JSDOMWindow::getOwnPropertyNames): 16 * bindings/js/JSDOMWindowShell.cpp: 17 (WebCore::JSDOMWindowShell::getOwnPropertyNames): 18 * bindings/js/JSDOMWindowShell.h: 19 * bindings/js/JSHistoryCustom.cpp: 20 (WebCore::JSHistory::getOwnPropertyNames): 21 * bindings/js/JSLocationCustom.cpp: 22 (WebCore::JSLocation::getOwnPropertyNames): 23 * bindings/js/JSQuarantinedObjectWrapper.cpp: 24 (WebCore::JSQuarantinedObjectWrapper::getPropertyNames): 25 (WebCore::JSQuarantinedObjectWrapper::getOwnPropertyNames): 26 * bindings/js/JSQuarantinedObjectWrapper.h: 27 * bindings/js/JSStorageCustom.cpp: 28 (WebCore::JSStorage::getOwnPropertyNames): 29 * bindings/scripts/CodeGeneratorJS.pm: 30 * bridge/runtime_object.cpp: 31 (JSC::RuntimeObjectImp::getPropertyNames): 32 (JSC::RuntimeObjectImp::getOwnPropertyNames): 33 * bridge/runtime_object.h: 34 1 35 2009-09-12 Sam Weinig <sam@webkit.org> 2 36 -
trunk/WebCore/bindings/js/JSDOMWindowCustom.cpp
r48270 r48336 473 473 } 474 474 475 void JSDOMWindow::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) 476 { 477 // Only allow the window to enumerated by frames in the same origin. 478 if (!allowsAccessFrom(exec)) 479 return; 480 Base::getOwnPropertyNames(exec, propertyNames); 481 } 482 475 483 bool JSDOMWindow::getPropertyAttributes(ExecState* exec, const Identifier& propertyName, unsigned& attributes) const 476 484 { -
trunk/WebCore/bindings/js/JSDOMWindowShell.cpp
r47780 r48336 114 114 } 115 115 116 void JSDOMWindowShell::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) 117 { 118 m_window->getOwnPropertyNames(exec, propertyNames); 119 } 120 116 121 bool JSDOMWindowShell::getPropertyAttributes(JSC::ExecState* exec, const Identifier& propertyName, unsigned& attributes) const 117 122 { -
trunk/WebCore/bindings/js/JSDOMWindowShell.h
r47780 r48336 73 73 virtual bool deleteProperty(JSC::ExecState*, const JSC::Identifier& propertyName); 74 74 virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&); 75 virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&); 75 76 virtual bool getPropertyAttributes(JSC::ExecState*, const JSC::Identifier& propertyName, unsigned& attributes) const; 76 77 virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction); -
trunk/WebCore/bindings/js/JSHistoryCustom.cpp
r47780 r48336 156 156 } 157 157 158 void JSHistory::get PropertyNames(ExecState* exec, PropertyNameArray& propertyNames)158 void JSHistory::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) 159 159 { 160 160 // Only allow the history object to enumerated by frames in the same origin. 161 161 if (!allowsAccessFromFrame(exec, impl()->frame())) 162 162 return; 163 Base::get PropertyNames(exec, propertyNames);163 Base::getOwnPropertyNames(exec, propertyNames); 164 164 } 165 165 -
trunk/WebCore/bindings/js/JSLocationCustom.cpp
r47780 r48336 175 175 } 176 176 177 void JSLocation::get PropertyNames(ExecState* exec, PropertyNameArray& propertyNames)177 void JSLocation::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) 178 178 { 179 179 // Only allow the location object to enumerated by frames in the same origin. 180 180 if (!allowsAccessFromFrame(exec, impl()->frame())) 181 181 return; 182 Base::get PropertyNames(exec, propertyNames);182 Base::getOwnPropertyNames(exec, propertyNames); 183 183 } 184 184 -
trunk/WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp
r47780 r48336 291 291 if (!allowsGetPropertyNames()) 292 292 return; 293 293 294 294 m_unwrappedObject->getPropertyNames(unwrappedExecState(), array); 295 295 } 296 296 297 void JSQuarantinedObjectWrapper::getOwnPropertyNames(ExecState*, PropertyNameArray& array) 298 { 299 if (!allowsGetPropertyNames()) 300 return; 301 302 m_unwrappedObject->getOwnPropertyNames(unwrappedExecState(), array); 303 } 304 297 305 } // namespace WebCore -
trunk/WebCore/bindings/js/JSQuarantinedObjectWrapper.h
r47780 r48336 71 71 72 72 virtual bool hasInstance(JSC::ExecState*, JSC::JSValue, JSC::JSValue proto); 73 73 74 74 virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&); 75 virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&); 75 76 76 77 virtual JSC::UString className() const { return m_unwrappedObject->className(); } -
trunk/WebCore/bindings/js/JSStorageCustom.cpp
r47020 r48336 65 65 } 66 66 67 void JSStorage::get PropertyNames(ExecState* exec, PropertyNameArray& propertyNames)67 void JSStorage::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) 68 68 { 69 69 unsigned length = m_impl->length(); … … 71 71 propertyNames.add(Identifier(exec, m_impl->key(i))); 72 72 73 Base::get PropertyNames(exec, propertyNames);73 Base::getOwnPropertyNames(exec, propertyNames); 74 74 } 75 75 -
trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm
r48266 r48336 626 626 push(@headerContent, " virtual bool deleteProperty(JSC::ExecState*, const JSC::Identifier&);\n") if $dataNode->extendedAttributes->{"CustomDeleteProperty"}; 627 627 628 # Custom getPropertyNames function 629 push(@headerContent, " virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&);\n") if ($dataNode->extendedAttributes->{"CustomGetPropertyNames"} || $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}); 628 # Custom getPropertyNames function exists on DOMWindow 629 push(@headerContent, " virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&);\n") if $interfaceName eq "DOMWindow"; 630 # Custom getOwnPropertyNames function 631 push(@headerContent, " virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&);\n") if ($dataNode->extendedAttributes->{"CustomGetPropertyNames"} || $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}); 630 632 631 633 # Custom getPropertyAttributes function … … 1487 1489 1488 1490 if (($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) && !$dataNode->extendedAttributes->{"CustomGetPropertyNames"}) { 1489 push(@implContent, "void ${className}::get PropertyNames(ExecState* exec, PropertyNameArray& propertyNames)\n");1491 push(@implContent, "void ${className}::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)\n"); 1490 1492 push(@implContent, "{\n"); 1491 1493 if ($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { … … 1493 1495 push(@implContent, " propertyNames.add(Identifier::from(exec, i));\n"); 1494 1496 } 1495 push(@implContent, " Base::get PropertyNames(exec, propertyNames);\n");1497 push(@implContent, " Base::getOwnPropertyNames(exec, propertyNames);\n"); 1496 1498 push(@implContent, "}\n\n"); 1497 1499 } -
trunk/WebCore/bridge/runtime_object.cpp
r47780 r48336 296 296 return; 297 297 } 298 298 299 299 instance->begin(); 300 300 instance->getPropertyNames(exec, propertyNames); … … 302 302 } 303 303 304 void RuntimeObjectImp::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) 305 { 306 getOwnPropertyNames(exec, propertyNames); 307 } 308 304 309 JSObject* RuntimeObjectImp::throwInvalidAccessError(ExecState* exec) 305 310 { -
trunk/WebCore/bridge/runtime_object.h
r47780 r48336 45 45 virtual CallType getCallData(CallData&); 46 46 virtual ConstructType getConstructData(ConstructData&); 47 47 48 48 virtual void getPropertyNames(ExecState*, PropertyNameArray&); 49 virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&); 49 50 50 51 virtual void invalidate();
Note: See TracChangeset
for help on using the changeset viewer.