mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-19 07:22:21 +00:00
Revert "LibJS+LibWeb: Return Vector<PropertyKey> from…
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
internal_own_property_keys"
This reverts commit 5ee810f772
.
This commit is contained in:
parent
8cd9275416
commit
2903defcfc
Notes:
github-actions[bot]
2025-05-16 05:34:06 +00:00
Author: https://github.com/tcl3
Commit: 2903defcfc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4763
24 changed files with 155 additions and 134 deletions
|
@ -659,7 +659,7 @@ ThrowCompletionOr<bool> ProxyObject::internal_delete(PropertyKey const& property
|
|||
}
|
||||
|
||||
// 10.5.11 [[OwnPropertyKeys]] ( ), https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
|
||||
ThrowCompletionOr<Vector<PropertyKey>> ProxyObject::internal_own_property_keys() const
|
||||
ThrowCompletionOr<GC::RootVector<Value>> ProxyObject::internal_own_property_keys() const
|
||||
{
|
||||
LIMIT_PROXY_RECURSION_DEPTH();
|
||||
|
||||
|
@ -693,10 +693,6 @@ ThrowCompletionOr<Vector<PropertyKey>> ProxyObject::internal_own_property_keys()
|
|||
unique_keys.set(property_key, AK::HashSetExistingEntryBehavior::Keep);
|
||||
return {};
|
||||
}));
|
||||
Vector<PropertyKey> trap_result_property_keys;
|
||||
for (auto const& key : trap_result) {
|
||||
trap_result_property_keys.append(MUST(PropertyKey::from_value(vm, key)));
|
||||
}
|
||||
|
||||
// 9. If trapResult contains any duplicate entries, throw a TypeError exception.
|
||||
if (unique_keys.size() != trap_result.size())
|
||||
|
@ -712,72 +708,74 @@ ThrowCompletionOr<Vector<PropertyKey>> ProxyObject::internal_own_property_keys()
|
|||
// 13. Assert: targetKeys contains no duplicate entries.
|
||||
|
||||
// 14. Let targetConfigurableKeys be a new empty List.
|
||||
Vector<PropertyKey> target_configurable_keys;
|
||||
auto target_configurable_keys = GC::RootVector<Value> { heap() };
|
||||
|
||||
// 15. Let targetNonconfigurableKeys be a new empty List.
|
||||
Vector<PropertyKey> target_nonconfigurable_keys;
|
||||
auto target_nonconfigurable_keys = GC::RootVector<Value> { heap() };
|
||||
|
||||
// 16. For each element key of targetKeys, do
|
||||
for (auto& property_key : target_keys) {
|
||||
for (auto& key : target_keys) {
|
||||
auto property_key = MUST(PropertyKey::from_value(vm, key));
|
||||
|
||||
// a. Let desc be ? target.[[GetOwnProperty]](key).
|
||||
auto descriptor = TRY(m_target->internal_get_own_property(property_key));
|
||||
|
||||
// b. If desc is not undefined and desc.[[Configurable]] is false, then
|
||||
if (descriptor.has_value() && !*descriptor->configurable) {
|
||||
// i. Append key as an element of targetNonconfigurableKeys.
|
||||
target_nonconfigurable_keys.append(property_key);
|
||||
target_nonconfigurable_keys.append(key);
|
||||
}
|
||||
// c. Else,
|
||||
else {
|
||||
// i. Append key as an element of targetConfigurableKeys.
|
||||
target_configurable_keys.append(property_key);
|
||||
target_configurable_keys.append(key);
|
||||
}
|
||||
}
|
||||
|
||||
// 17. If extensibleTarget is true and targetNonconfigurableKeys is empty, then
|
||||
if (extensible_target && target_nonconfigurable_keys.is_empty()) {
|
||||
// a. Return trapResult.
|
||||
return { move(trap_result_property_keys) };
|
||||
return { move(trap_result) };
|
||||
}
|
||||
|
||||
// 18. Let uncheckedResultKeys be a List whose elements are the elements of trapResult.
|
||||
Vector<PropertyKey> unchecked_result_keys;
|
||||
unchecked_result_keys.extend(trap_result_property_keys);
|
||||
auto unchecked_result_keys = GC::RootVector<Value> { heap() };
|
||||
unchecked_result_keys.extend(trap_result);
|
||||
|
||||
// 19. For each element key of targetNonconfigurableKeys, do
|
||||
for (auto& property_key : target_nonconfigurable_keys) {
|
||||
for (auto& key : target_nonconfigurable_keys) {
|
||||
// a. If key is not an element of uncheckedResultKeys, throw a TypeError exception.
|
||||
if (!unchecked_result_keys.contains_slow(property_key))
|
||||
return vm.throw_completion<TypeError>(ErrorType::ProxyOwnPropertyKeysSkippedNonconfigurableProperty, property_key.to_string());
|
||||
if (!unchecked_result_keys.contains_slow(key))
|
||||
return vm.throw_completion<TypeError>(ErrorType::ProxyOwnPropertyKeysSkippedNonconfigurableProperty, key.to_string_without_side_effects());
|
||||
|
||||
// b. Remove key from uncheckedResultKeys.
|
||||
unchecked_result_keys.remove_first_matching([&](auto& value) {
|
||||
return value == property_key;
|
||||
return same_value(value, key);
|
||||
});
|
||||
}
|
||||
|
||||
// 20. If extensibleTarget is true, return trapResult.
|
||||
if (extensible_target)
|
||||
return { move(trap_result_property_keys) };
|
||||
return { move(trap_result) };
|
||||
|
||||
// 21. For each element key of targetConfigurableKeys, do
|
||||
for (auto& property_key : target_configurable_keys) {
|
||||
for (auto& key : target_configurable_keys) {
|
||||
// a. If key is not an element of uncheckedResultKeys, throw a TypeError exception.
|
||||
if (!unchecked_result_keys.contains_slow(property_key))
|
||||
return vm.throw_completion<TypeError>(ErrorType::ProxyOwnPropertyKeysNonExtensibleSkippedProperty, property_key.to_string());
|
||||
if (!unchecked_result_keys.contains_slow(key))
|
||||
return vm.throw_completion<TypeError>(ErrorType::ProxyOwnPropertyKeysNonExtensibleSkippedProperty, key.to_string_without_side_effects());
|
||||
|
||||
// b. Remove key from uncheckedResultKeys.
|
||||
unchecked_result_keys.remove_first_matching([&](auto& value) {
|
||||
return value == property_key;
|
||||
return same_value(value, key);
|
||||
});
|
||||
}
|
||||
|
||||
// 22. If uncheckedResultKeys is not empty, throw a TypeError exception.
|
||||
if (!unchecked_result_keys.is_empty())
|
||||
return vm.throw_completion<TypeError>(ErrorType::ProxyOwnPropertyKeysNonExtensibleNewProperty, unchecked_result_keys[0].to_string());
|
||||
return vm.throw_completion<TypeError>(ErrorType::ProxyOwnPropertyKeysNonExtensibleNewProperty, unchecked_result_keys[0].to_string_without_side_effects());
|
||||
|
||||
// 23. Return trapResult.
|
||||
return { move(trap_result_property_keys) };
|
||||
return { move(trap_result) };
|
||||
}
|
||||
|
||||
// 10.5.12 [[Call]] ( thisArgument, argumentsList ), https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-call-thisargument-argumentslist
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue