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