Changeset 196676 in webkit


Ignore:
Timestamp:
Feb 16, 2016 5:37:56 PM (8 years ago)
Author:
barraclough@apple.com
Message:

JSDOMWindow::getOwnPropertySlot should not search photo chain
https://bugs.webkit.org/show_bug.cgi?id=154102

Reviewed by Chris Dumez.

Should only return *own* properties.

Source/JavaScriptCore:

  • runtime/JSObject.cpp:

(JSC::JSObject::getOwnPropertyDescriptor):

  • remove hack/special-case for DOMWindow; we no longer need this.

Source/WebCore:

  • bindings/js/JSDOMWindowCustom.cpp:

(WebCore::jsDOMWindowGetOwnPropertySlotNamedItemGetter):

LayoutTests:

  • fast/dom/Window/es52-globals-expected.txt:
  • http/tests/security/window-named-valueOf-expected.txt:
  • imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt:
    • update test results.
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r196675 r196676  
     12016-02-16  Gavin Barraclough  <barraclough@apple.com>
     2
     3        JSDOMWindow::getOwnPropertySlot should not search photo chain
     4        https://bugs.webkit.org/show_bug.cgi?id=154102
     5
     6        Reviewed by Chris Dumez.
     7
     8        Should only return *own* properties.
     9
     10        * fast/dom/Window/es52-globals-expected.txt:
     11        * http/tests/security/window-named-valueOf-expected.txt:
     12        * imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt:
     13            - update test results.
     14
    1152016-02-16  Keith Miller  <keith_miller@apple.com>
    216
  • trunk/LayoutTests/fast/dom/Window/es52-globals-expected.txt

    r121376 r196676  
    11PASS window.hasOwnProperty("Element") is true
    22PASS window.hasOwnProperty("x") is true
    3 FAIL window.hasOwnProperty("y") should be false. Was true.
     3PASS window.hasOwnProperty("y") is false
    44PASS window.hasOwnProperty("f") is true
    55PASS window.hasOwnProperty("div") is true
  • trunk/LayoutTests/http/tests/security/window-named-valueOf-expected.txt

    r178527 r196676  
     1CONSOLE MESSAGE: line 1: Blocked a frame with origin "null" from accessing a frame with origin "http://localhost:8080".  The frame requesting access has a protocol of "data", the frame being accessed has a protocol of "http". Protocols must match.
     2
    13CONSOLE MESSAGE: line 1: Blocked a frame with origin "null" from accessing a frame with origin "http://localhost:8080".  The frame requesting access has a protocol of "data", the frame being accessed has a protocol of "http". Protocols must match.
    24
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt

    r196673 r196676  
    40854085PASS Window interface: window must inherit property "sessionStorage" with the proper type (123)
    40864086PASS Window interface: window must inherit property "localStorage" with the proper type (124)
    4087 FAIL EventTarget interface: window must inherit property "addEventListener" with the proper type (0) assert_inherits: property "addEventListener" found on object expected in prototype chain
    4088 FAIL EventTarget interface: calling addEventListener(DOMString,EventListener,boolean) on window with too few arguments must throw TypeError assert_inherits: property "addEventListener" found on object expected in prototype chain
    4089 FAIL EventTarget interface: window must inherit property "removeEventListener" with the proper type (1) assert_inherits: property "removeEventListener" found on object expected in prototype chain
    4090 FAIL EventTarget interface: calling removeEventListener(DOMString,EventListener,boolean) on window with too few arguments must throw TypeError assert_inherits: property "removeEventListener" found on object expected in prototype chain
    4091 FAIL EventTarget interface: window must inherit property "dispatchEvent" with the proper type (2) assert_inherits: property "dispatchEvent" found on object expected in prototype chain
    4092 FAIL EventTarget interface: calling dispatchEvent(Event) on window with too few arguments must throw TypeError assert_inherits: property "dispatchEvent" found on object expected in prototype chain
     4087PASS EventTarget interface: window must inherit property "addEventListener" with the proper type (0)
     4088FAIL EventTarget interface: calling addEventListener(DOMString,EventListener,boolean) on window with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
     4089    [native code]
     4090}" did not throw
     4091PASS EventTarget interface: window must inherit property "removeEventListener" with the proper type (1)
     4092FAIL EventTarget interface: calling removeEventListener(DOMString,EventListener,boolean) on window with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
     4093    [native code]
     4094}" did not throw
     4095PASS EventTarget interface: window must inherit property "dispatchEvent" with the proper type (2)
     4096PASS EventTarget interface: calling dispatchEvent(Event) on window with too few arguments must throw TypeError
    40934097PASS BarProp interface: existence and properties of interface object
    40944098PASS BarProp interface object length
  • trunk/Source/JavaScriptCore/ChangeLog

    r196675 r196676  
     12016-02-16  Gavin Barraclough  <barraclough@apple.com>
     2
     3        JSDOMWindow::getOwnPropertySlot should not search photo chain
     4        https://bugs.webkit.org/show_bug.cgi?id=154102
     5
     6        Reviewed by Chris Dumez.
     7
     8        Should only return *own* properties.
     9
     10        * runtime/JSObject.cpp:
     11        (JSC::JSObject::getOwnPropertyDescriptor):
     12            - remove hack/special-case for DOMWindow; we no longer need this.
     13
    1142016-02-16  Keith Miller  <keith_miller@apple.com>
    215
  • trunk/Source/JavaScriptCore/runtime/JSObject.cpp

    r196648 r196676  
    25532553        return false;
    25542554
    2555     // JSDOMWindow::getOwnPropertySlot() may return attributes from the prototype chain but getOwnPropertyDescriptor()
    2556     // should only work for 'own' properties so we exit early if we detect that the property is not an own property.
    2557     if (slot.slotBase() != this && slot.slotBase()) {
    2558         auto* proxy = jsDynamicCast<JSProxy*>(this);
    2559         // In the case of DOMWindow, |this| may be a JSDOMWindowShell so we also need to check the shell's target Window.
    2560         if (!proxy || proxy->target() != slot.slotBase())
    2561             return false;
    2562     }
    2563 
    25642555    if (slot.isAccessor())
    25652556        descriptor.setAccessorDescriptor(slot.getterSetter(), slot.attributes());
  • trunk/Source/WebCore/ChangeLog

    r196674 r196676  
     12016-02-16  Gavin Barraclough  <barraclough@apple.com>
     2
     3        JSDOMWindow::getOwnPropertySlot should not search photo chain
     4        https://bugs.webkit.org/show_bug.cgi?id=154102
     5
     6        Reviewed by Chris Dumez.
     7
     8        Should only return *own* properties.
     9
     10        * bindings/js/JSDOMWindowCustom.cpp:
     11        (WebCore::jsDOMWindowGetOwnPropertySlotNamedItemGetter):
     12
    1132016-02-16  Alex Christensen  <achristensen@webkit.org>
    214
  • trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp

    r196648 r196676  
    193193static bool jsDOMWindowGetOwnPropertySlotNamedItemGetter(JSDOMWindow* thisObject, Frame& frame, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
    194194{
    195     // FIXME: If the property is present on the prototype we should 'return false;', not
    196     // return the property. This is supposed to be an 'own' access.
    197195    JSValue proto = thisObject->prototype();
    198     if (proto.isObject() && asObject(proto)->getPropertySlot(exec, propertyName, slot))
    199         return true;
     196    if (proto.isObject() && asObject(proto)->hasProperty(exec, propertyName))
     197        return false;
    200198
    201199    // Check for child frames by name before built-in properties to match Mozilla. This does
Note: See TracChangeset for help on using the changeset viewer.