1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:17:45 +00:00

LibJS+LibWeb: Devirtualize may_interfere_with_indexed_property_access()

This commit is contained in:
iliadsh 2023-11-09 07:29:52 +00:00 committed by Andreas Kling
parent 7f501d4d8a
commit 89da731aa6
29 changed files with 51 additions and 61 deletions

View file

@ -12,7 +12,7 @@
namespace Web::Bindings {
LegacyPlatformObject::LegacyPlatformObject(JS::Realm& realm)
: PlatformObject(realm)
: PlatformObject(realm, MayInterfereWithIndexedPropertyAccess::Yes)
{
}

View file

@ -29,8 +29,6 @@ public:
virtual JS::ThrowCompletionOr<bool> internal_prevent_extensions() override;
virtual JS::ThrowCompletionOr<JS::MarkedVector<JS::Value>> internal_own_property_keys() const override;
virtual bool may_interfere_with_indexed_property_access() const final { return true; }
enum class IgnoreNamedProps {
No,
Yes,

View file

@ -11,13 +11,13 @@
namespace Web::Bindings {
PlatformObject::PlatformObject(JS::Realm& realm)
: JS::Object(realm, nullptr)
PlatformObject::PlatformObject(JS::Realm& realm, MayInterfereWithIndexedPropertyAccess may_interfere_with_indexed_property_access)
: JS::Object(realm, nullptr, may_interfere_with_indexed_property_access)
{
}
PlatformObject::PlatformObject(JS::Object& prototype)
: JS::Object(ConstructWithPrototypeTag::Tag, prototype)
PlatformObject::PlatformObject(JS::Object& prototype, MayInterfereWithIndexedPropertyAccess may_interfere_with_indexed_property_access)
: JS::Object(ConstructWithPrototypeTag::Tag, prototype, may_interfere_with_indexed_property_access)
{
}

View file

@ -40,8 +40,8 @@ public:
[[nodiscard]] virtual bool implements_interface(DeprecatedString const&) const { return false; }
protected:
explicit PlatformObject(JS::Realm&);
explicit PlatformObject(JS::Object& prototype);
explicit PlatformObject(JS::Realm&, MayInterfereWithIndexedPropertyAccess = MayInterfereWithIndexedPropertyAccess::No);
explicit PlatformObject(JS::Object& prototype, MayInterfereWithIndexedPropertyAccess = MayInterfereWithIndexedPropertyAccess::No);
};
}

View file

@ -38,8 +38,8 @@
namespace Web::DOM {
EventTarget::EventTarget(JS::Realm& realm)
: PlatformObject(realm)
EventTarget::EventTarget(JS::Realm& realm, MayInterfereWithIndexedPropertyAccess may_interfere_with_indexed_property_access)
: PlatformObject(realm, may_interfere_with_indexed_property_access)
{
}

View file

@ -59,7 +59,7 @@ public:
bool has_event_listeners() const;
protected:
explicit EventTarget(JS::Realm&);
explicit EventTarget(JS::Realm&, MayInterfereWithIndexedPropertyAccess = MayInterfereWithIndexedPropertyAccess::No);
void element_event_handler_attribute_changed(FlyString const& local_name, Optional<String> const& value);

View file

@ -14,7 +14,7 @@
namespace Web::HTML {
AudioTrackList::AudioTrackList(JS::Realm& realm)
: DOM::EventTarget(realm)
: DOM::EventTarget(realm, MayInterfereWithIndexedPropertyAccess::Yes)
, m_audio_tracks(realm.heap())
{
}

View file

@ -51,8 +51,6 @@ private:
virtual void initialize(JS::Realm&) override;
virtual JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> internal_get_own_property(JS::PropertyKey const& property_name) const override;
virtual bool may_interfere_with_indexed_property_access() const final { return true; }
JS::MarkedVector<JS::NonnullGCPtr<AudioTrack>> m_audio_tracks;
};

View file

@ -24,7 +24,7 @@ namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/history.html#the-location-interface
Location::Location(JS::Realm& realm)
: PlatformObject(realm)
: PlatformObject(realm, MayInterfereWithIndexedPropertyAccess::Yes)
{
}

View file

@ -64,8 +64,6 @@ public:
virtual JS::ThrowCompletionOr<bool> internal_delete(JS::PropertyKey const&) override;
virtual JS::ThrowCompletionOr<JS::MarkedVector<JS::Value>> internal_own_property_keys() const override;
virtual bool may_interfere_with_indexed_property_access() const final { return true; }
HTML::CrossOriginPropertyDescriptorMap const& cross_origin_property_descriptor_map() const { return m_cross_origin_property_descriptor_map; }
HTML::CrossOriginPropertyDescriptorMap& cross_origin_property_descriptor_map() { return m_cross_origin_property_descriptor_map; }

View file

@ -14,7 +14,7 @@
namespace Web::HTML {
VideoTrackList::VideoTrackList(JS::Realm& realm)
: DOM::EventTarget(realm)
: DOM::EventTarget(realm, MayInterfereWithIndexedPropertyAccess::Yes)
, m_video_tracks(realm.heap())
{
}

View file

@ -44,8 +44,6 @@ private:
virtual void initialize(JS::Realm&) override;
virtual JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> internal_get_own_property(JS::PropertyKey const& property_name) const override;
virtual bool may_interfere_with_indexed_property_access() const final { return true; }
JS::MarkedVector<JS::NonnullGCPtr<VideoTrack>> m_video_tracks;
};

View file

@ -22,7 +22,7 @@ namespace Web::HTML {
// 7.4 The WindowProxy exotic object, https://html.spec.whatwg.org/multipage/window-object.html#the-windowproxy-exotic-object
WindowProxy::WindowProxy(JS::Realm& realm)
: JS::Object(realm, nullptr)
: JS::Object(realm, nullptr, MayInterfereWithIndexedPropertyAccess::Yes)
{
}

View file

@ -31,8 +31,6 @@ public:
virtual JS::ThrowCompletionOr<bool> internal_delete(JS::PropertyKey const&) override;
virtual JS::ThrowCompletionOr<JS::MarkedVector<JS::Value>> internal_own_property_keys() const override;
virtual bool may_interfere_with_indexed_property_access() const final { return true; }
JS::GCPtr<Window> window() const { return m_window; }
void set_window(JS::NonnullGCPtr<Window>);