Nacre/vendor/servo-script/dom/fetch/fetchlaterresult.rs
astar76 0ecfd0f573 S031: root due timers in vendored servo-script (R5-01 SIGSEGV), crash-adblock regression smoke
fire_timer moved due timers into an unrooted Vec; a GC inside one callback swept
the functions of the timers still waiting. Heavy-web reruns and cargo test still pending.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-12 20:38:47 -06:00

55 lines
1.8 KiB
Rust

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use dom_struct::dom_struct;
use js::context::JSContext;
use script_bindings::reflector::{Reflector, reflect_dom_object};
use crate::dom::bindings::codegen::Bindings::FetchLaterResultBinding::FetchLaterResultMethods;
use crate::dom::bindings::reflector::DomGlobal;
use crate::dom::bindings::root::DomRoot;
use crate::dom::window::Window;
use crate::fetch::fetch::DeferredFetchRecordId;
/// <https://fetch.spec.whatwg.org/#fetchlaterresult>
#[dom_struct]
pub(crate) struct FetchLaterResult {
reflector_: Reflector,
/// <https://fetch.spec.whatwg.org/#fetchlaterresult-activated-getter-steps>
#[no_trace]
deferred_record_id: DeferredFetchRecordId,
}
impl FetchLaterResult {
fn new_inherited(deferred_record_id: DeferredFetchRecordId) -> FetchLaterResult {
FetchLaterResult {
reflector_: Reflector::new(),
deferred_record_id,
}
}
pub(crate) fn new(
cx: &mut JSContext,
window: &Window,
deferred_record_id: DeferredFetchRecordId,
) -> DomRoot<FetchLaterResult> {
reflect_dom_object(
cx,
Box::new(FetchLaterResult::new_inherited(deferred_record_id)),
window,
)
}
}
impl FetchLaterResultMethods<crate::DomTypeHolder> for FetchLaterResult {
/// <https://fetch.spec.whatwg.org/#dom-fetchlaterresult-activated>
fn Activated(&self) -> bool {
// The activated getter steps are to return the result of running this’s activated getter steps.
self.global()
.fetch_group()
.deferred_fetch_record_for_id(&self.deferred_record_id)
.activated_getter_steps()
}
}