script/dom/
fetchlaterresult.rs1use dom_struct::dom_struct;
6
7use crate::dom::bindings::codegen::Bindings::FetchLaterResultBinding::FetchLaterResultMethods;
8use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object};
9use crate::dom::bindings::root::DomRoot;
10use crate::dom::window::Window;
11use crate::fetch::DeferredFetchRecordId;
12use crate::script_runtime::CanGc;
13
14#[dom_struct]
16pub(crate) struct FetchLaterResult {
17 reflector_: Reflector,
18
19 #[no_trace]
21 deferred_record_id: DeferredFetchRecordId,
22}
23
24impl FetchLaterResult {
25 fn new_inherited(deferred_record_id: DeferredFetchRecordId) -> FetchLaterResult {
26 FetchLaterResult {
27 reflector_: Reflector::new(),
28 deferred_record_id,
29 }
30 }
31
32 pub(crate) fn new(
33 window: &Window,
34 deferred_record_id: DeferredFetchRecordId,
35 can_gc: CanGc,
36 ) -> DomRoot<FetchLaterResult> {
37 reflect_dom_object(
38 Box::new(FetchLaterResult::new_inherited(deferred_record_id)),
39 window,
40 can_gc,
41 )
42 }
43}
44
45impl FetchLaterResultMethods<crate::DomTypeHolder> for FetchLaterResult {
46 fn Activated(&self) -> bool {
48 self.global()
50 .deferred_fetch_record_for_id(&self.deferred_record_id)
51 .activated_getter_steps()
52 }
53}