Skip to main content

script/dom/
pluginarray.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5use dom_struct::dom_struct;
6use js::context::JSContext;
7use script_bindings::reflector::{Reflector, reflect_dom_object};
8
9use crate::dom::bindings::codegen::Bindings::PluginArrayBinding::PluginArrayMethods;
10use crate::dom::bindings::root::DomRoot;
11use crate::dom::bindings::str::DOMString;
12use crate::dom::globalscope::GlobalScope;
13use crate::dom::plugin::Plugin;
14use crate::script_runtime::CanGc;
15
16#[dom_struct]
17pub(crate) struct PluginArray {
18    reflector_: Reflector,
19}
20
21impl PluginArray {
22    pub(crate) fn new_inherited() -> PluginArray {
23        PluginArray {
24            reflector_: Reflector::new(),
25        }
26    }
27
28    pub(crate) fn new(global: &GlobalScope, can_gc: CanGc) -> DomRoot<PluginArray> {
29        reflect_dom_object(Box::new(PluginArray::new_inherited()), global, can_gc)
30    }
31}
32
33impl PluginArrayMethods<crate::DomTypeHolder> for PluginArray {
34    /// <https://html.spec.whatwg.org/multipage/#dom-pluginarray-refresh>
35    fn Refresh(&self, _reload: bool) {}
36
37    /// <https://html.spec.whatwg.org/multipage/#dom-pluginarray-length>
38    fn Length(&self) -> u32 {
39        0
40    }
41
42    /// <https://html.spec.whatwg.org/multipage/#dom-pluginarray-item>
43    fn Item(&self, _index: u32) -> Option<DomRoot<Plugin>> {
44        None
45    }
46
47    /// <https://html.spec.whatwg.org/multipage/#dom-pluginarray-nameditem>
48    fn NamedItem(&self, _name: DOMString) -> Option<DomRoot<Plugin>> {
49        None
50    }
51
52    /// <https://html.spec.whatwg.org/multipage/#dom-pluginarray-item>
53    fn IndexedGetter(&self, _index: u32) -> Option<DomRoot<Plugin>> {
54        None
55    }
56
57    // check-tidy: no specs after this line
58    fn NamedGetter(&self, _name: DOMString) -> Option<DomRoot<Plugin>> {
59        None
60    }
61
62    /// <https://heycam.github.io/webidl/#dfn-supported-property-names>
63    fn SupportedPropertyNames(&self, _: &mut JSContext) -> Vec<DOMString> {
64        vec![]
65    }
66}