PluginArray.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) 2023, Luke Wilde <lukew@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/Bindings/LegacyPlatformObject.h>
  8. namespace Web::HTML {
  9. // https://html.spec.whatwg.org/multipage/system-state.html#pluginarray
  10. class PluginArray : public Bindings::LegacyPlatformObject {
  11. WEB_PLATFORM_OBJECT(PluginArray, Bindings::LegacyPlatformObject);
  12. public:
  13. virtual ~PluginArray() override;
  14. void refresh() const;
  15. size_t length() const;
  16. JS::GCPtr<Plugin> item(u32 index) const;
  17. JS::GCPtr<Plugin> named_item(String const& name) const;
  18. private:
  19. PluginArray(JS::Realm&);
  20. virtual void initialize(JS::Realm&) override;
  21. // ^Bindings::LegacyPlatformObject
  22. virtual Vector<DeprecatedString> supported_property_names() const override;
  23. virtual WebIDL::ExceptionOr<JS::Value> item_value(size_t index) const override;
  24. virtual WebIDL::ExceptionOr<JS::Value> named_item_value(DeprecatedFlyString const& name) const override;
  25. virtual bool is_supported_property_index(u32) const override;
  26. virtual bool supports_indexed_properties() const override { return true; }
  27. virtual bool supports_named_properties() const override { return true; }
  28. virtual bool has_indexed_property_setter() const override { return false; }
  29. virtual bool has_named_property_setter() const override { return false; }
  30. virtual bool has_named_property_deleter() const override { return false; }
  31. virtual bool has_legacy_override_built_ins_interface_extended_attribute() const override { return false; }
  32. virtual bool has_legacy_unenumerable_named_properties_interface_extended_attribute() const override { return true; }
  33. virtual bool has_global_interface_extended_attribute() const override { return false; }
  34. virtual bool indexed_property_setter_has_identifier() const override { return false; }
  35. virtual bool named_property_setter_has_identifier() const override { return false; }
  36. virtual bool named_property_deleter_has_identifier() const override { return false; }
  37. };
  38. }