Skip to main content

script/dom/
mimetypearray.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::MimeTypeArrayBinding::MimeTypeArrayMethods;
10use crate::dom::bindings::root::DomRoot;
11use crate::dom::bindings::str::DOMString;
12use crate::dom::globalscope::GlobalScope;
13use crate::dom::mimetype::MimeType;
14use crate::script_runtime::CanGc;
15
16#[dom_struct]
17pub(crate) struct MimeTypeArray {
18    reflector_: Reflector,
19}
20
21impl MimeTypeArray {
22    pub(crate) fn new_inherited() -> MimeTypeArray {
23        MimeTypeArray {
24            reflector_: Reflector::new(),
25        }
26    }
27
28    pub(crate) fn new(global: &GlobalScope, can_gc: CanGc) -> DomRoot<MimeTypeArray> {
29        reflect_dom_object(Box::new(MimeTypeArray::new_inherited()), global, can_gc)
30    }
31}
32
33impl MimeTypeArrayMethods<crate::DomTypeHolder> for MimeTypeArray {
34    /// <https://html.spec.whatwg.org/multipage/#dom-mimetypearray-length>
35    fn Length(&self) -> u32 {
36        0
37    }
38
39    /// <https://html.spec.whatwg.org/multipage/#dom-mimetypearray-item>
40    fn Item(&self, _index: u32) -> Option<DomRoot<MimeType>> {
41        None
42    }
43
44    /// <https://html.spec.whatwg.org/multipage/#dom-mimetypearray-nameditem>
45    fn NamedItem(&self, _name: DOMString) -> Option<DomRoot<MimeType>> {
46        None
47    }
48
49    /// <https://html.spec.whatwg.org/multipage/#dom-mimetypearray-item>
50    fn IndexedGetter(&self, _index: u32) -> Option<DomRoot<MimeType>> {
51        None
52    }
53
54    // check-tidy: no specs after this line
55    fn NamedGetter(&self, _name: DOMString) -> Option<DomRoot<MimeType>> {
56        None
57    }
58
59    /// <https://heycam.github.io/webidl/#dfn-supported-property-names>
60    fn SupportedPropertyNames(&self, _: &mut JSContext) -> Vec<DOMString> {
61        vec![]
62    }
63}