script/dom/geolocation/
geolocationpositionerror.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 script_bindings::codegen::GenericBindings::GeolocationPositionErrorBinding::GeolocationPositionErrorMethods;
7use script_bindings::reflector::Reflector;
8use script_bindings::root::DomRoot;
9use script_bindings::script_runtime::CanGc;
10use script_bindings::str::DOMString;
11
12use crate::dom::bindings::codegen::DomTypeHolder::DomTypeHolder;
13use crate::dom::bindings::reflector::reflect_dom_object;
14use crate::dom::globalscope::GlobalScope;
15
16#[dom_struct]
17pub struct GeolocationPositionError {
18    reflector_: Reflector,
19    code: u16,
20    message: DOMString,
21}
22
23impl GeolocationPositionError {
24    fn new_inherited(code: u16, message: DOMString) -> Self {
25        GeolocationPositionError {
26            reflector_: Reflector::new(),
27            code,
28            message,
29        }
30    }
31
32    #[expect(unused)]
33    pub(crate) fn new(
34        global: &GlobalScope,
35        code: u16,
36        message: DOMString,
37        can_gc: CanGc,
38    ) -> DomRoot<Self> {
39        reflect_dom_object(Box::new(Self::new_inherited(code, message)), global, can_gc)
40    }
41}
42
43impl GeolocationPositionErrorMethods<DomTypeHolder> for GeolocationPositionError {
44    fn Code(&self) -> u16 {
45        self.code
46    }
47
48    fn Message(&self) -> DOMString {
49        self.message.clone()
50    }
51}