title: getOwnPropertyNames ignores __proto__ on Firefox
body: <p><code>__proto__</code> is a property of <code>Object.prototype</code>:</p>
  
  <pre><code>Object.prototype.hasOwnProperty('__proto__'); // true
  </code></pre>
  
  <p>However, getOwnPropertyNames ignores it on Firefox:</p>
  
  <pre><code>Object.getOwnPropertyNames(Object.prototype).indexOf('__proto__'); // -1
  </code></pre>
  
  <p>It works on Chromium 43 and IE 11, tough.</p>
  
  <p>AFAIK, according to ECMAScript 5 spec, getOwnPropertyNames should list it:</p>
  
  <blockquote>
    <p><a href="http://www.ecma-international.org/ecma-262/5.1/#sec-15.2.3.4" rel="nofollow"><strong>15.2.3.4 - Object.getOwnPropertyNames ( O )</strong></a></p>
    
    <p>When the <strong>getOwnPropertyNames</strong> function is called, the following
    steps are taken:</p>
    
    <ol>
    <li>If <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-8" rel="nofollow">Type</a>(<em>O</em>) is not Object throw a <strong>TypeError</strong> exception.</li>
    <li>Let <em>array</em> be the result of creating a new object as if by the expression <code>new Array ()</code> where <code>Array</code> is the standard built-in
    constructor with that name.</li>
    <li>Let <em>n</em> be 0.</li>
    <li>For each named own property <em>P</em> of <em>O</em>
    <ol>
    <li>Let <em>name</em> be the String value that is the name of <em>P</em>.</li>
    <li>Call the [[DefineOwnProperty]] internal method of <em>array</em> with arguments <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-9.8" rel="nofollow">ToString</a>(<em>n</em>), the PropertyDescriptor {[[Value]]:
    <em>name</em>, [[Writable]]: <strong>true</strong>, [[Enumerable]]: <strong>true</strong>, [[Configurable]]: <strong>true</strong>}, and <strong>false</strong>.</li>
    <li>Increment <em>n</em> by 1.</li>
    </ol></li>
    <li>Return <em>array</em>.</li>
    </ol>
  </blockquote>
  
  <p><code>__proto__</code> is a named own property of <code>Object.prototype</code> (otherwise, <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-15.2.4.5" rel="nofollow">hasOwnProperty</a> would return false because <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-15.2.4.5" rel="nofollow">[[GetOwnProperty]]</a> would return undefined). Therefore, it should be listed by getOwnPropertyNames, shouldn't it?</p>
  
  <p>Should that be different in ECMAScript 6? The ES6 draft changes a few things indeed:</p>
  
  <blockquote>
    <p><a href="http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.getownpropertynames" rel="nofollow"><strong>19.1.2.7 - Object.getOwnPropertyNames ( O )</strong></a></p>
    
    <p>When the <strong>getOwnPropertyNames</strong> function is called, the following
    steps are taken:</p>
    
    <ol>
    <li>Return <a href="http://people.mozilla.org/~jorendorff/es6-draft.html#sec-getownpropertykeys" rel="nofollow">GetOwnPropertyKeys</a>(<em>O</em>, String).</li>
    </ol>
    
    <p><a href="http://people.mozilla.org/~jorendorff/es6-draft.html#sec-getownpropertykeys" rel="nofollow"><strong>19.1.2.8.1 - Runtime Semantics: GetOwnPropertyKeys ( O, Type
    )</strong></a></p>
    
    <p>The abstract operation GetOwnPropertyKeys is called with arguments <em>O</em>
    and <em>Type</em> where <em>O</em> is an Object and <em>Type</em> is one of the ECMAScript
    specification types String or Symbol. The following steps are taken:</p>
    
    <ol>
    <li>Let <em>obj</em> be <a href="http://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject" rel="nofollow">ToObject</a>(<em>O</em>).</li>
    <li><a href="http://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt" rel="nofollow">ReturnIfAbrupt</a>(<em>obj</em>).</li>
    <li>Let <em>keys</em> be <em>obj</em>.[OwnPropertyKeys].</li>
    <li><a href="http://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt" rel="nofollow">ReturnIfAbrupt</a>(<em>keys</em>).</li>
    <li>Let <em>nameList</em> be a new empty <a href="http://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type" rel="nofollow">List</a>.</li>
    <li>Repeat for each element <em>nextKey</em> of <em>keys</em> in <a href="http://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type" rel="nofollow">List</a> order,
    <ol>
    <li>If <a href="http://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values" rel="nofollow">Type</a>(<em>nextKey</em>) is <em>Type</em>, then
    <ol>
    <li>Append <em>nextKey</em> as the last element of <em>nameList</em>.</li>
    </ol></li>
    </ol></li>
    <li>Return <a href="http://people.mozilla.org/~jorendorff/es6-draft.html#sec-createarrayfromlist" rel="nofollow">CreateArrayFromList</a>(<em>nameList</em>).</li>
    </ol>
    
    <p><a href="http://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type" rel="nofollow"><strong>9.1.12 - [[OwnPropertyKeys]] ( )</strong></a></p>
    
    <p>When the [[OwnPropertyKeys]] internal method of <em>O</em> is called the
    following steps are taken:</p>
    
    <ol>
    <li>Let <em>keys</em> be a new empty <a href="http://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type" rel="nofollow">List</a>.</li>
    <li>For each own <a href="http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type" rel="nofollow">property key</a> <em>P</em> of <em>O</em> that is an integer index, in ascending numeric index order
    <ol>
    <li>Add <em>P</em> as the last element of <em>keys</em>.</li>
    </ol></li>
    <li>For each own <a href="http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type" rel="nofollow">property key</a> <em>P</em> of <em>O</em> that is a String but is not an integer index, in property creation order
    <ol>
    <li>Add <em>P</em> as the last element of <em>keys</em>.</li>
    </ol></li>
    <li>For each own <a href="http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type" rel="nofollow">property key</a> <em>P</em> of <em>O</em> that is a Symbol, in property creation order
    <ol>
    <li>Add <em>P</em> as the last element of <em>keys</em>.</li>
    </ol></li>
    <li>Return <em>keys</em>.</li>
    </ol>
  </blockquote>
  
  <p>[[OwnPropertyKeys]] should return a list which contains <code>"__proto__"</code>, and GetOwnPropertyKeys should return an array with <code>"__proto__"</code>, because its type should be String.</p>
  
  <p>And even in case it was Symbol instead of String (which doesn't make much sense), <a href="http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.getownpropertysymbols" rel="nofollow">getOwnPropertySymbols</a> should include <code>__proto__</code>, but it returns an empty array.</p>
  
  <p>Therefore, is it a bug, or what intricacy of the spec applies here?</p>