Nacre/vendor/servo-script/dom/filesystem/filesystem.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

51 lines
1.6 KiB
Rust

/* 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::FileSystemBinding::FileSystemMethods;
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::USVString;
use crate::dom::filesystemdirectoryentry::FileSystemDirectoryEntry;
use crate::dom::globalscope::GlobalScope;
#[dom_struct]
pub(crate) struct FileSystem {
reflector_: Reflector,
name: USVString,
root: Dom<FileSystemDirectoryEntry>,
}
impl FileSystem {
fn new_inherited(name: USVString, root: &FileSystemDirectoryEntry) -> FileSystem {
FileSystem {
reflector_: Reflector::new(),
name,
root: Dom::from_ref(root),
}
}
pub(crate) fn new(
cx: &mut JSContext,
global: &GlobalScope,
name: USVString,
root: &FileSystemDirectoryEntry,
) -> DomRoot<FileSystem> {
reflect_dom_object(cx, Box::new(FileSystem::new_inherited(name, root)), global)
}
}
impl FileSystemMethods<crate::DomTypeHolder> for FileSystem {
/// <https://wicg.github.io/entries-api/#dom-filesystem-name>
fn Name(&self) -> USVString {
self.name.clone()
}
/// <https://wicg.github.io/entries-api/#dom-filesystem-root>
fn Root(&self) -> DomRoot<FileSystemDirectoryEntry> {
DomRoot::from_ref(&self.root)
}
}