Changeset 53706 in webkit


Ignore:
Timestamp:
Jan 22, 2010 11:09:47 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-01-22 Kent Hansen <kent.hansen@nokia.com>

Reviewed by Darin Adler.

Object.getOwnPropertyDescriptor(window) returns descriptors for properties in the prototype chain
https://bugs.webkit.org/show_bug.cgi?id=33948

Even though prototype properties are proxied by JSDOMWindow::getOwnPropertySlot(),
that proxying should not be performed by JSDOMWindow::getOwnPropertyDescriptor().

This makes getOwnPropertyDescriptor() consistent with getOwnPropertyNames().

Test: fast/dom/Window/window-property-descriptors.html

  • bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::getOwnPropertyDescriptor):
Location:
trunk
Files:
5 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r53703 r53706  
     12010-01-22  Kent Hansen  <kent.hansen@nokia.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Object.getOwnPropertyDescriptor(window) returns descriptors for properties in the prototype chain
     6        https://bugs.webkit.org/show_bug.cgi?id=33948
     7
     8        Even though prototype properties are proxied by JSDOMWindow::getOwnPropertySlot(),
     9        that proxying should not be performed by JSDOMWindow::getOwnPropertyDescriptor().
     10
     11        This makes getOwnPropertyDescriptor() consistent with getOwnPropertyNames().
     12
     13        Test: fast/dom/Window/window-property-descriptors.html
     14
     15        * bindings/js/JSDOMWindowCustom.cpp:
     16        (WebCore::JSDOMWindow::getOwnPropertyDescriptor):
     17
    1182010-01-22  Girish Ramakrishnan  <girish@forwardbias.in>
    219
  • trunk/WebCore/bindings/js/JSDOMWindowCustom.cpp

    r53555 r53706  
    326326    }
    327327
    328     // We need this code here because otherwise JSDOMWindowBase will stop the search before we even get to the
    329     // prototype due to the blanket same origin (allowsAccessFrom) check at the end of getOwnPropertySlot.
    330     // Also, it's important to get the implementation straight out of the DOMWindow prototype regardless of
    331     // what prototype is actually set on this object.
    332     entry = JSDOMWindowPrototype::s_info.propHashTable(exec)->entry(exec, propertyName);
    333     if (entry) {
    334         if (entry->attributes() & Function) {
    335             if (entry->function() == jsDOMWindowPrototypeFunctionShowModalDialog) {
    336                 if (!DOMWindow::canShowModalDialog(impl()->frame())) {
    337                     descriptor.setUndefined();
    338                     return true;
    339                 }
    340             }
    341         }
    342     }
    343    
    344328    entry = JSDOMWindow::s_info.propHashTable(exec)->entry(exec, propertyName);
    345329    if (entry) {
     
    362346    }
    363347   
    364     // Do prototype lookup early so that functions and attributes in the prototype can have
    365     // precedence over the index and name getters. 
    366     JSValue proto = prototype();
    367     if (proto.isObject()) {
    368         if (asObject(proto)->getPropertyDescriptor(exec, propertyName, descriptor))
    369             return true;
    370     }
    371 
    372348    bool ok;
    373349    unsigned i = propertyName.toArrayIndex(&ok);
Note: See TracChangeset for help on using the changeset viewer.