mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-31 23:42:52 +00:00
LibJS+LibWeb: Prevent double invocation of [[GetOwnProperty]]
The `[[GetOwnProperty]]` internal method invocation in `OrdinarySetWithOwnDescriptor` was being invocated again with the same parameters in the `[[DefineOwnProperty]]` internal method that is also later called in `OrdinarySetWithOwnDescriptor`. The `PlatformObject.[[DefineOwnProperty]]` has similair logic. This change adds an optional parameter to the `[[DefineOwnProperty]]` internal method so the results of the previous `[[GetOwnProperty]]` internal method invocation can be re-used.
This commit is contained in:
parent
641c549463
commit
69f96122b6
Notes:
github-actions[bot]
2024-11-02 11:27:54 +00:00
Author: https://github.com/yyny
Commit: 69f96122b6
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2114
20 changed files with 47 additions and 36 deletions
|
@ -82,11 +82,11 @@ ThrowCompletionOr<Optional<PropertyDescriptor>> ModuleNamespaceObject::internal_
|
|||
}
|
||||
|
||||
// 10.4.6.6 [[DefineOwnProperty]] ( P, Desc ), https://tc39.es/ecma262/#sec-module-namespace-exotic-objects-defineownproperty-p-desc
|
||||
ThrowCompletionOr<bool> ModuleNamespaceObject::internal_define_own_property(PropertyKey const& property_key, PropertyDescriptor const& descriptor)
|
||||
ThrowCompletionOr<bool> ModuleNamespaceObject::internal_define_own_property(PropertyKey const& property_key, PropertyDescriptor const& descriptor, Optional<PropertyDescriptor>* precomputed_get_own_property)
|
||||
{
|
||||
// 1. If Type(P) is Symbol, return ! OrdinaryDefineOwnProperty(O, P, Desc).
|
||||
if (property_key.is_symbol())
|
||||
return MUST(Object::internal_define_own_property(property_key, descriptor));
|
||||
return MUST(Object::internal_define_own_property(property_key, descriptor, precomputed_get_own_property));
|
||||
|
||||
// 2. Let current be ? O.[[GetOwnProperty]](P).
|
||||
auto current = TRY(internal_get_own_property(property_key));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue