<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>80060</bug_id>
          
          <creation_ts>2012-03-01 15:26:21 -0800</creation_ts>
          <short_desc>hasOwnProperty works inconsistently between WebKit and Firefox</short_desc>
          <delta_ts>2012-03-03 14:38:09 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore JavaScript</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac (Intel)</rep_platform>
          <op_sys>OS X 10.7</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>49739</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Marc Silverman">silverma</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>barraclough</cc>
    
    <cc>silverma</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>568978</commentid>
    <comment_count>0</comment_count>
    <who name="Marc Silverman">silverma</who>
    <bug_when>2012-03-01 15:26:21 -0800</bug_when>
    <thetext>On WebKit nightly and the latest version of Chrome, the following shows two alerts.  On Firefox, it shows one alert.  Which is correct?
NOTE 1 in 15.2.4.5 Object.prototype.hasOwnProperty of the ECMAScript Language Spec says: &quot;this method does not consider objects in the prototype chain&quot;, I couldn&apos;t figure out if that&apos;s relevant.

ECMAScript Language Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf

----

&lt;p id=&quot;element&quot;&gt;Sample Text&lt;/p&gt;

&lt;SCRIPT type=&quot;text/javascript&quot;&gt;

var o = document.getElementById(&quot;element&quot;);

if(o.hasOwnProperty(&apos;style&apos;)) {
    alert(o.nodeName + &apos; has \&apos;style\&apos; as the direct property of the object.&apos;);
}
if(&apos;style&apos; in o) {
    alert(o.nodeName + &apos; has \&apos;style\&apos; as a property in the object\&apos;s prototype chain.&apos;);
}
&lt;/SCRIPT&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>569075</commentid>
    <comment_count>1</comment_count>
    <who name="Gavin Barraclough">barraclough</who>
    <bug_when>2012-03-01 16:57:09 -0800</bug_when>
    <thetext>I believe this is actually a WebIDL related bug, and that Firefox&apos;s behavior is correct.

I believe hasOwnProperty is working correctly on both browsers, and that it is actually the DOM that is different (in Safari, &apos;style&apos; is a property of the element, in Firefox it is presumably a property of the prototype).  If so, it is Firefox behaving correctly – I believe WebIDL specifies that such properties should be on the prototype.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>569937</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2012-03-02 14:19:17 -0800</bug_when>
    <thetext>&gt; property of the element, in Firefox it is presumably a property of the prototype

Which is a of course a general issue that has been reported before. Not sure what the best original is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>570174</commentid>
    <comment_count>3</comment_count>
    <who name="Marc Silverman">silverma</who>
    <bug_when>2012-03-03 14:38:09 -0800</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 49739 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>