PluginArray.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. JS_DECLARE_ALLOCATOR(PluginArray);
  13. public:
  14. virtual ~PluginArray() override;
  15. void refresh() const;
  16. size_t length() const;
  17. JS::GCPtr<Plugin> item(u32 index) const;
  18. JS::GCPtr<Plugin> named_item(FlyString const& name) const;
  19. private:
  20. PluginArray(JS::Realm&);
  21. virtual void initialize(JS::Realm&) override;
  22. // ^Bindings::LegacyPlatformObject
  23. virtual Vector<String> supported_property_names() const override;
  24. virtual WebIDL::ExceptionOr<JS::Value> item_value(size_t index) const override;
  25. virtual WebIDL::ExceptionOr<JS::Value> named_item_value(FlyString const& name) const override;
  26. virtual bool is_supported_property_index(u32) const override;
  27. virtual bool supports_indexed_properties() const override { return true; }
  28. virtual bool supports_named_properties() const override { return true; }
  29. virtual bool has_indexed_property_setter() const override { return false; }
  30. virtual bool has_named_property_setter() const override { return false; }
  31. virtual bool has_named_property_deleter() const override { return false; }
  32. virtual bool has_legacy_override_built_ins_interface_extended_attribute() const override { return false; }
  33. virtual bool has_legacy_unenumerable_named_properties_interface_extended_attribute() const override { return true; }
  34. virtual bool has_global_interface_extended_attribute() const override { return false; }
  35. virtual bool indexed_property_setter_has_identifier() const override { return false; }
  36. virtual bool named_property_setter_has_identifier() const override { return false; }
  37. virtual bool named_property_deleter_has_identifier() const override { return false; }
  38. };
  39. }