Nacre/vendor/servo-script/dom/fetch/fetchlaterresult.rs
astar76 1c078655e2 S022: MSE prototype on gst_mse (vendored script, script-bindings, servo-media*)
MediaSource, SourceBuffer, SourceBufferList over GStreamer's MSE library;
URL.createObjectURL(MediaSource); HTMLMediaElement attaches via mse://.
tests/smoke/mse.txt plays chunk-appended fMP4 and WebM.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-12 10:21:01 -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()
}
}