mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibJS: Add PropertyLookupPhase enum to distinguish Object [[Get]] calls
We can now tell the difference between an own property access and a subsequent (automatic) prototype chain access. This will be used to implement caching of prototype chain accesses.
This commit is contained in:
parent
3945e1a82a
commit
493a04d5fe
Notes:
sideshowbarker
2024-07-17 23:07:41 +09:00
Author: https://github.com/awesomekling
Commit: 493a04d5fe
Pull-request: https://github.com/SerenityOS/serenity/pull/24206
Reviewed-by: https://github.com/kennethmyhra
17 changed files with 34 additions and 28 deletions
|
@ -483,13 +483,13 @@ JS::ThrowCompletionOr<bool> Location::internal_define_own_property(JS::PropertyK
|
|||
}
|
||||
|
||||
// 7.10.5.7 [[Get]] ( P, Receiver ), https://html.spec.whatwg.org/multipage/history.html#location-get
|
||||
JS::ThrowCompletionOr<JS::Value> Location::internal_get(JS::PropertyKey const& property_key, JS::Value receiver, JS::CacheablePropertyMetadata* cacheable_metadata) const
|
||||
JS::ThrowCompletionOr<JS::Value> Location::internal_get(JS::PropertyKey const& property_key, JS::Value receiver, JS::CacheablePropertyMetadata* cacheable_metadata, PropertyLookupPhase phase) const
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
|
||||
// 1. If IsPlatformObjectSameOrigin(this) is true, then return ? OrdinaryGet(this, P, Receiver).
|
||||
if (HTML::is_platform_object_same_origin(*this))
|
||||
return JS::Object::internal_get(property_key, receiver, cacheable_metadata);
|
||||
return JS::Object::internal_get(property_key, receiver, cacheable_metadata, phase);
|
||||
|
||||
// 2. Return ? CrossOriginGet(this, P, Receiver).
|
||||
return HTML::cross_origin_get(vm, static_cast<JS::Object const&>(*this), property_key, receiver);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue