From 06d9451551f2b3b212a2889ac6ed21baad572e6d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 10 Jul 2023 20:50:24 +0200 Subject: [PATCH] LibWeb: Don't cache property accesses on WindowProxy Since the underlying HTML::Window can change, caching property accesses on WindowProxy is not as simple as remembering the shape. Let's disable caching here for now. We can come back to it in the future when we have no low-hanging fruit left. :^) Fixes an assertion failure on https://twinings.co.uk/ --- .../expected/window-proxy-property-inline-cache.txt | 2 ++ .../input/window-proxy-property-inline-cache.html | 13 +++++++++++++ Userland/Libraries/LibWeb/HTML/WindowProxy.cpp | 4 ++-- 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 Tests/LibWeb/Text/expected/window-proxy-property-inline-cache.txt create mode 100644 Tests/LibWeb/Text/input/window-proxy-property-inline-cache.html diff --git a/Tests/LibWeb/Text/expected/window-proxy-property-inline-cache.txt b/Tests/LibWeb/Text/expected/window-proxy-property-inline-cache.txt new file mode 100644 index 00000000000..370fd29745e --- /dev/null +++ b/Tests/LibWeb/Text/expected/window-proxy-property-inline-cache.txt @@ -0,0 +1,2 @@ +123 +undefined diff --git a/Tests/LibWeb/Text/input/window-proxy-property-inline-cache.html b/Tests/LibWeb/Text/input/window-proxy-property-inline-cache.html new file mode 100644 index 00000000000..af005f95615 --- /dev/null +++ b/Tests/LibWeb/Text/input/window-proxy-property-inline-cache.html @@ -0,0 +1,13 @@ + + diff --git a/Userland/Libraries/LibWeb/HTML/WindowProxy.cpp b/Userland/Libraries/LibWeb/HTML/WindowProxy.cpp index 7cf010ece5e..4554c0157aa 100644 --- a/Userland/Libraries/LibWeb/HTML/WindowProxy.cpp +++ b/Userland/Libraries/LibWeb/HTML/WindowProxy.cpp @@ -144,7 +144,7 @@ JS::ThrowCompletionOr WindowProxy::internal_define_own_property(JS::Proper } // 7.4.7 [[Get]] ( P, Receiver ), https://html.spec.whatwg.org/multipage/window-object.html#windowproxy-get -JS::ThrowCompletionOr WindowProxy::internal_get(JS::PropertyKey const& property_key, JS::Value receiver, JS::CacheablePropertyMetadata* cacheable_metadata) const +JS::ThrowCompletionOr WindowProxy::internal_get(JS::PropertyKey const& property_key, JS::Value receiver, JS::CacheablePropertyMetadata*) const { auto& vm = this->vm(); @@ -156,7 +156,7 @@ JS::ThrowCompletionOr WindowProxy::internal_get(JS::PropertyKey const // 3. If IsPlatformObjectSameOrigin(W) is true, then return ? OrdinaryGet(this, P, Receiver). // NOTE: this is passed rather than W as OrdinaryGet and CrossOriginGet will invoke the [[GetOwnProperty]] internal method. if (is_platform_object_same_origin(*m_window)) - return JS::Object::internal_get(property_key, receiver, cacheable_metadata); + return JS::Object::internal_get(property_key, receiver); // 4. Return ? CrossOriginGet(this, P, Receiver). // NOTE: this is passed rather than W as OrdinaryGet and CrossOriginGet will invoke the [[GetOwnProperty]] internal method.