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]>
96 lines
3.4 KiB
Rust
96 lines
3.4 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::cell::DomRefCell;
|
|
use script_bindings::reflector::reflect_dom_object;
|
|
|
|
use crate::dom::bindings::callback::RootedCallback;
|
|
use crate::dom::bindings::codegen::Bindings::FileSystemDirectoryEntryBinding::{
|
|
FileSystemDirectoryEntryMethods, FileSystemFlags,
|
|
};
|
|
use crate::dom::bindings::codegen::Bindings::FileSystemEntryBinding::{
|
|
ErrorCallback, FileSystemEntryCallback,
|
|
};
|
|
use crate::dom::bindings::reflector::DomGlobal;
|
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
|
use crate::dom::bindings::str::USVString;
|
|
use crate::dom::filesystem::FileSystem;
|
|
use crate::dom::filesystemdirectoryreader::FileSystemDirectoryReader;
|
|
use crate::dom::filesystementry::FileSystemEntry;
|
|
use crate::dom::globalscope::GlobalScope;
|
|
|
|
#[dom_struct]
|
|
pub(crate) struct FileSystemDirectoryEntry {
|
|
filesystementry: FileSystemEntry,
|
|
children: DomRefCell<Vec<Dom<FileSystemEntry>>>,
|
|
}
|
|
|
|
impl FileSystemDirectoryEntry {
|
|
fn new_inherited(name: USVString, full_path: USVString) -> FileSystemDirectoryEntry {
|
|
FileSystemDirectoryEntry {
|
|
filesystementry: FileSystemEntry::new_inherited(name, full_path, false),
|
|
children: DomRefCell::new(Vec::new()),
|
|
}
|
|
}
|
|
|
|
pub(crate) fn new(
|
|
cx: &mut JSContext,
|
|
global: &GlobalScope,
|
|
name: USVString,
|
|
full_path: USVString,
|
|
) -> DomRoot<FileSystemDirectoryEntry> {
|
|
reflect_dom_object(
|
|
cx,
|
|
Box::new(FileSystemDirectoryEntry::new_inherited(name, full_path)),
|
|
global,
|
|
)
|
|
}
|
|
|
|
pub(crate) fn set_filesystem(&self, fs: &FileSystem) {
|
|
self.filesystementry.set_filesystem(fs);
|
|
}
|
|
|
|
pub(crate) fn push_child(&self, child: &FileSystemEntry) {
|
|
self.children.borrow_mut().push(Dom::from_ref(child));
|
|
}
|
|
|
|
pub(crate) fn children(&self) -> Vec<DomRoot<FileSystemEntry>> {
|
|
self.children
|
|
.borrow()
|
|
.iter()
|
|
.map(|child| DomRoot::from_ref(&**child))
|
|
.collect()
|
|
}
|
|
}
|
|
|
|
impl FileSystemDirectoryEntryMethods<crate::DomTypeHolder> for FileSystemDirectoryEntry {
|
|
/// <https://wicg.github.io/entries-api/#dom-filesystemdirectoryentry-createreader>
|
|
fn CreateReader(&self, cx: &mut JSContext) -> DomRoot<FileSystemDirectoryReader> {
|
|
FileSystemDirectoryReader::new(cx, &self.global(), self)
|
|
}
|
|
|
|
/// <https://wicg.github.io/entries-api/#dom-filesystemdirectoryentry-getfile>
|
|
fn GetFile(
|
|
&self,
|
|
_path: Option<Option<USVString>>,
|
|
_options: &FileSystemFlags,
|
|
_success_callback: Option<RootedCallback<FileSystemEntryCallback>>,
|
|
_error_callback: Option<RootedCallback<ErrorCallback>>,
|
|
) {
|
|
// TODO: Implement per spec 7.2. Need to hook embedder.
|
|
}
|
|
|
|
/// <https://wicg.github.io/entries-api/#dom-filesystemdirectoryentry-getdirectory>
|
|
fn GetDirectory(
|
|
&self,
|
|
_path: Option<Option<USVString>>,
|
|
_options: &FileSystemFlags,
|
|
_success_callback: Option<RootedCallback<FileSystemEntryCallback>>,
|
|
_error_callback: Option<RootedCallback<ErrorCallback>>,
|
|
) {
|
|
// TODO: Implement per spec 7.2. Need to hook embedder.
|
|
}
|
|
}
|