Commit 25614ab6 authored by barraclough@apple.com's avatar barraclough@apple.com

https://bugs.webkit.org/show_bug.cgi?id=120052

Remove custom getOwnPropertyDescriptor for JSProxy

Reviewed by Geoff Garen.

GET_OWN_PROPERTY_DESCRIPTOR_IMPL runs afoul with JSProxy due to the workaround for JSDOMWindow's broken behavior.
Because the window object incorrectly searches the prototype chain in getOwnPropertySlot we check that the base
object matches, but in the case of JSProxy we can end up comparing the window object to the window shell & falsely
assuming this is a prototype property. Add toThis conversion to correctly identify proxied own access. I've kept
the original slotBase check as a fast case, and also so that direct access on JSDOMWindow still works.

* runtime/JSProxy.cpp:
    - Remove custom getOwnPropertyDescriptor implementation.
* runtime/PropertyDescriptor.h:
    - Modify own property access check to perform toThis conversion.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154334 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 64923f13
2013-08-20 Gavin Barraclough <barraclough@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=120052
Remove custom getOwnPropertyDescriptor for JSProxy
Reviewed by Geoff Garen.
GET_OWN_PROPERTY_DESCRIPTOR_IMPL runs afoul with JSProxy due to the workaround for JSDOMWindow's broken behavior.
Because the window object incorrectly searches the prototype chain in getOwnPropertySlot we check that the base
object matches, but in the case of JSProxy we can end up comparing the window object to the window shell & falsely
assuming this is a prototype property. Add toThis conversion to correctly identify proxied own access. I've kept
the original slotBase check as a fast case, and also so that direct access on JSDOMWindow still works.
* runtime/JSProxy.cpp:
- Remove custom getOwnPropertyDescriptor implementation.
* runtime/PropertyDescriptor.h:
- Modify own property access check to perform toThis conversion.
2013-08-20 Alex Christensen <achristensen@apple.com>
Use PlatformArchitecture to distinguish between 32-bit and 64-bit builds on Windows.
......
......@@ -82,11 +82,7 @@ bool JSProxy::getOwnPropertySlotByIndex(JSObject* object, ExecState* exec, unsig
return thisObject->target()->methodTable()->getOwnPropertySlotByIndex(thisObject->target(), exec, propertyName, slot);
}
bool JSProxy::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
{
JSProxy* thisObject = jsCast<JSProxy*>(object);
return thisObject->target()->methodTable()->getOwnPropertyDescriptor(thisObject->target(), exec, propertyName, descriptor);
}
GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSProxy)
void JSProxy::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
{
......
......@@ -92,7 +92,7 @@ bool ClassName::getOwnPropertyDescriptor(JSC::JSObject* object, JSC::ExecState*
if (!getOwnPropertySlot(object, exec, propertyName, slot)) \
return false; \
/* Workaround, JSDOMWindow::getOwnPropertySlot searches the prototype chain. :-( */ \
if (slot.slotBase() && slot.slotBase() != object) \
if (slot.slotBase() != object && slot.slotBase() && slot.slotBase()->methodTable()->toThis(slot.slotBase(), exec, NotStrictMode) != object) \
return false; \
if (slot.isGetter()) \
descriptor.setAccessorDescriptor(slot.getterSetter(), slot.attributes()); \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment