Changeset 9582 in webkit for trunk/JavaScriptCore/kjs/object.cpp


Ignore:
Timestamp:
Jul 3, 2005, 3:47:58 AM (20 years ago)
Author:
mjs
Message:

JavaScriptCore:

Original patch from Mark Rowe <[email protected]>, reviewed by me.
Fixes to patch by me, reviewed by John Sullivan.

Test cases added:

  • tests/mozilla/expected.html: Two tests newly pass.
  • bindings/objc/objc_runtime.h:
  • bindings/objc/objc_runtime.mm: (ObjcFallbackObjectImp::hasOwnProperty):
  • bindings/runtime_array.cpp: (RuntimeArrayImp::hasOwnProperty):
  • bindings/runtime_array.h:
  • bindings/runtime_object.cpp: (RuntimeObjectImp::hasOwnProperty):
  • bindings/runtime_object.h:
  • kjs/array_instance.h:
  • kjs/array_object.cpp: (ArrayInstanceImp::hasOwnProperty):
  • kjs/function.cpp: (KJS::FunctionImp::hasOwnProperty): (KJS::ActivationImp::hasOwnProperty):
  • kjs/function.h:
  • kjs/lookup.h:
  • kjs/object.cpp: (KJS::ObjectImp::hasProperty): (KJS::ObjectImp::hasOwnProperty):
  • kjs/object.h: (KJS::Object::hasOwnProperty):
  • kjs/object_object.cpp: (ObjectPrototypeImp::ObjectPrototypeImp): (ObjectProtoFuncImp::call):
  • kjs/object_object.h: (KJS::ObjectProtoFuncImp::):
  • kjs/string_object.cpp: (StringInstanceImp::hasOwnProperty):
  • kjs/string_object.h:

WebCore:

Original patch from Mark Rowe <[email protected]>, reviewed by me.
Fixes to patch by me, reviewed by John Sullivan.

Test cases added:

  • layout-tests/fast/js/has-own-property.html: Added - tests this change.
  • layout-tests/fast/js/eval-var-decl.html: Added - test depends on this change.
  • khtml/ecma/kjs_css.cpp: (KJS::DOMCSSStyleDeclaration::hasOwnProperty):
  • khtml/ecma/kjs_css.h:
  • khtml/ecma/kjs_dom.cpp: (KJS::DOMNodeList::hasOwnProperty): (KJS::DOMElement::tryGet): (KJS::DOMNamedNodeMap::hasOwnProperty):
  • khtml/ecma/kjs_dom.h:
  • khtml/ecma/kjs_html.cpp: (KJS::HTMLDocument::hasOwnProperty): (KJS::HTMLDocument::tryGet): (KJS::KJS::HTMLElement::hasOwnProperty): (KJS::KJS::HTMLCollection::hasOwnProperty):
  • khtml/ecma/kjs_html.h:
  • khtml/ecma/kjs_window.cpp: (KJS::Window::hasOwnProperty): (KJS::Konqueror::hasOwnProperty):
  • khtml/ecma/kjs_window.h:
File:
1 edited

Legend:

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

    r9526 r9582  
    283283bool ObjectImp::hasProperty(ExecState *exec, const Identifier &propertyName) const
    284284{
     285  if (hasOwnProperty(exec, propertyName))
     286    return true;
     287
     288  if (_proto->dispatchType() != ObjectType) {
     289    return false;
     290  }
     291
     292  // Look in the prototype
     293  return static_cast<ObjectImp *>(_proto)->hasProperty(exec, propertyName);
     294}
     295
     296bool ObjectImp::hasProperty(ExecState *exec, unsigned propertyName) const
     297{
     298    if (hasOwnProperty(exec, propertyName))
     299      return true;
     300
     301    if (_proto->dispatchType() != ObjectType) {
     302      return false;
     303    }
     304
     305    // Look in the prototype
     306    return static_cast<ObjectImp *>(_proto)->hasProperty(exec, propertyName);
     307}
     308
     309bool ObjectImp::hasOwnProperty(ExecState *exec, const Identifier &propertyName) const
     310{
    285311  if (_prop.get(propertyName))
    286312    return true;
     
    288314  // Look in the static hashtable of properties
    289315  if (findPropertyHashEntry(propertyName))
    290       return true;
     316    return true;
    291317
    292318  // non-standard netscape extension
     
    294320    return true;
    295321
    296   if (_proto->dispatchType() != ObjectType) {
    297     return false;
    298   }
    299 
    300   // Look in the prototype
    301   return static_cast<ObjectImp *>(_proto)->hasProperty(exec, propertyName);
    302 }
    303 
    304 bool ObjectImp::hasProperty(ExecState *exec, unsigned propertyName) const
    305 {
    306   return hasProperty(exec, Identifier::from(propertyName));
    307 }
     322  return false;
     323}
     324
     325bool ObjectImp::hasOwnProperty(ExecState *exec, unsigned propertyName) const
     326{
     327  return hasOwnProperty(exec, Identifier::from(propertyName));
     328}
     329
    308330
    309331// ECMA 8.6.2.5
Note: See TracChangeset for help on using the changeset viewer.