Changeset 99136 in webkit


Ignore:
Timestamp:
Nov 2, 2011 9:17:54 PM (12 years ago)
Author:
weinig@apple.com
Message:

Source/JavaScriptCore: Object.getOwnPropertyDescriptor() does not retrieve the getter/setter from a property on the window that has been overridden with a getter/setter
https://bugs.webkit.org/show_bug.cgi?id=71333

Reviewed by Gavin Barraclough.

Tested by fast/dom/getter-on-window-object2.html

  • runtime/PropertyDescriptor.cpp:

(JSC::PropertyDescriptor::setDescriptor):
The attributes returned from Structure::get do not include Getter or Setter, so
instead check if the value is a GetterSetter like we do elsewhere. If it is, update
the descriptor's attributes accordingly.

LayoutTests: Object.getOwnPropertyDescriptor() does not retrieve the getter/setter from a property on the window that has been overridden with a getter/setter/
https://bugs.webkit.org/show_bug.cgi?id=71333

Reviewed by Gavin Barraclough.

  • fast/dom/getter-on-window-object2-expected.txt:

Update for now correct results.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r99131 r99136  
     12011-11-02  Sam Weinig  <sam@webkit.org>
     2
     3        Object.getOwnPropertyDescriptor() does not retrieve the getter/setter from a property on the window that has been overridden with a getter/setter/
     4        https://bugs.webkit.org/show_bug.cgi?id=71333
     5
     6        Reviewed by Gavin Barraclough.
     7
     8        * fast/dom/getter-on-window-object2-expected.txt:
     9        Update for now correct results.
     10
    1112011-11-02  Erik Arvidsson  <arv@chromium.org>
    212
  • trunk/LayoutTests/fast/dom/getter-on-window-object2-expected.txt

    r99034 r99136  
    1313
    1414PASS window.y is 'window.y __getter__'
    15 FAIL typeof window.__lookupGetter__('y') should be function. Was undefined.
    16 FAIL typeof Object.getOwnPropertyDescriptor(window, 'y').get should be function. Was undefined.
     15PASS typeof window.__lookupGetter__('y') is 'function'
     16PASS typeof Object.getOwnPropertyDescriptor(window, 'y').get is 'function'
    1717
    1818PASS window.y is 'window.y __getter__'
    19 FAIL typeof window.__lookupGetter__('y') should be function. Was undefined.
    20 FAIL typeof Object.getOwnPropertyDescriptor(window, 'y').get should be function. Was undefined.
     19PASS typeof window.__lookupGetter__('y') is 'function'
     20PASS typeof Object.getOwnPropertyDescriptor(window, 'y').get is 'function'
    2121
    2222PASS window.z is undefined.
  • trunk/Source/JavaScriptCore/ChangeLog

    r99133 r99136  
     12011-11-02  Sam Weinig  <sam@webkit.org>
     2
     3        Object.getOwnPropertyDescriptor() does not retrieve the getter/setter from a property on the window that has been overridden with a getter/setter
     4        https://bugs.webkit.org/show_bug.cgi?id=71333
     5
     6        Reviewed by Gavin Barraclough.
     7
     8        Tested by fast/dom/getter-on-window-object2.html
     9
     10        * runtime/PropertyDescriptor.cpp:
     11        (JSC::PropertyDescriptor::setDescriptor):
     12        The attributes returned from Structure::get do not include Getter or Setter, so
     13        instead check if the value is a GetterSetter like we do elsewhere. If it is, update
     14        the descriptor's attributes accordingly.
     15
    1162011-11-02  Yuqiang Xian  <yuqiang.xian@intel.com>
    217
  • trunk/Source/JavaScriptCore/runtime/PropertyDescriptor.cpp

    r95901 r99136  
    8989    ASSERT(value);
    9090    m_attributes = attributes;
    91     if (attributes & (Getter | Setter)) {
     91    if (value.isGetterSetter()) {
    9292        GetterSetter* accessor = asGetterSetter(value);
     93
    9394        m_getter = accessor->getter();
     95        if (m_getter)
     96            m_attributes |= Getter;
     97
    9498        m_setter = accessor->setter();
     99        if (m_setter)
     100            m_attributes |= Setter;
     101
    95102        ASSERT(m_getter || m_setter);
    96103        m_seenAttributes = EnumerablePresent | ConfigurablePresent;
Note: See TracChangeset for help on using the changeset viewer.