mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Start marking functions that can transitively trigger a GC (#33144)
* Mark JS reflector wrappers as CanGc. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Propagate CanGc from reflect_dom_object_with_proto. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Mark DOM constructors as GC operations. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
9a1051c917
commit
60ef6bc461
140 changed files with 1336 additions and 304 deletions
|
@ -35,6 +35,7 @@ use crate::dom::node::{Node, ShadowIncluding, UnbindContext};
|
|||
use crate::dom::selection::Selection;
|
||||
use crate::dom::text::Text;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct Range {
|
||||
|
@ -71,9 +72,13 @@ impl Range {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new_with_doc(document: &Document, proto: Option<HandleObject>) -> DomRoot<Range> {
|
||||
pub fn new_with_doc(
|
||||
document: &Document,
|
||||
proto: Option<HandleObject>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Range> {
|
||||
let root = document.upcast();
|
||||
Range::new_with_proto(document, proto, root, 0, root, 0)
|
||||
Range::new_with_proto(document, proto, root, 0, root, 0, can_gc)
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
|
@ -90,6 +95,7 @@ impl Range {
|
|||
start_offset,
|
||||
end_container,
|
||||
end_offset,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -100,6 +106,7 @@ impl Range {
|
|||
start_offset: u32,
|
||||
end_container: &Node,
|
||||
end_offset: u32,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Range> {
|
||||
let range = reflect_dom_object_with_proto(
|
||||
Box::new(Range::new_inherited(
|
||||
|
@ -110,6 +117,7 @@ impl Range {
|
|||
)),
|
||||
document.window(),
|
||||
proto,
|
||||
can_gc,
|
||||
);
|
||||
start_container.ranges().push(WeakRef::new(&range));
|
||||
if start_container != end_container {
|
||||
|
@ -120,9 +128,13 @@ impl Range {
|
|||
|
||||
/// <https://dom.spec.whatwg.org/#dom-range>
|
||||
#[allow(non_snake_case)]
|
||||
pub fn Constructor(window: &Window, proto: Option<HandleObject>) -> Fallible<DomRoot<Range>> {
|
||||
pub fn Constructor(
|
||||
window: &Window,
|
||||
proto: Option<HandleObject>,
|
||||
can_gc: CanGc,
|
||||
) -> Fallible<DomRoot<Range>> {
|
||||
let document = window.Document();
|
||||
Ok(Range::new_with_doc(&document, proto))
|
||||
Ok(Range::new_with_doc(&document, proto, can_gc))
|
||||
}
|
||||
|
||||
/// <https://dom.spec.whatwg.org/#contained>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue