LibJS: Fix this_value in native setters and getters
This fixes getting values from double proxies: var p = new Proxy(new Proxy([], {}), {}); p.length
This commit is contained in:
parent
9d1fd403af
commit
f102b56345
Notes:
sideshowbarker
2024-07-18 11:39:12 +09:00
Author: https://github.com/davidot Commit: https://github.com/SerenityOS/serenity/commit/f102b563455 Pull-request: https://github.com/SerenityOS/serenity/pull/8191
1 changed files with 3 additions and 5 deletions
|
@ -278,7 +278,7 @@ Value Object::get_own_property(const PropertyName& property_name, Value receiver
|
|||
if (value_here.is_accessor())
|
||||
return value_here.as_accessor().call_getter(receiver);
|
||||
if (value_here.is_native_property())
|
||||
return call_native_property_getter(value_here.as_native_property(), receiver);
|
||||
return call_native_property_getter(value_here.as_native_property(), this);
|
||||
}
|
||||
return value_here;
|
||||
}
|
||||
|
@ -937,9 +937,7 @@ bool Object::put_by_index(u32 property_index, Value value)
|
|||
return true;
|
||||
}
|
||||
if (value_here.value.is_native_property()) {
|
||||
// FIXME: Why doesn't put_by_index() receive the receiver value from put()?!
|
||||
auto receiver = this;
|
||||
call_native_property_setter(value_here.value.as_native_property(), receiver, value);
|
||||
call_native_property_setter(value_here.value.as_native_property(), this, value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -976,7 +974,7 @@ bool Object::put(const PropertyName& property_name, Value value, Value receiver)
|
|||
return true;
|
||||
}
|
||||
if (value_here.is_native_property()) {
|
||||
call_native_property_setter(value_here.as_native_property(), receiver, value);
|
||||
call_native_property_setter(value_here.as_native_property(), this, value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue