Propagate CanGc from Document::new() (#33386)

* Add canGc as a parameter to autogenerated trait methods

Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com>

* Propagate CanGc from Document::new()

Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com>

---------

Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com>
This commit is contained in:
Andriy Sultanov 2024-09-09 23:38:01 +01:00 committed by GitHub
parent 10e5bb72d9
commit e5150dbda1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 704 additions and 393 deletions

View file

@ -28,6 +28,7 @@ use crate::dom::htmltitleelement::HTMLTitleElement;
use crate::dom::node::Node;
use crate::dom::text::Text;
use crate::dom::xmldocument::XMLDocument;
use crate::script_runtime::CanGc;
// https://dom.spec.whatwg.org/#domimplementation
#[dom_struct]
@ -74,6 +75,7 @@ impl DOMImplementationMethods for DOMImplementation {
maybe_namespace: Option<DOMString>,
qname: DOMString,
maybe_doctype: Option<&DocumentType>,
can_gc: CanGc,
) -> Fallible<DomRoot<XMLDocument>> {
let win = self.document.window();
let loader = DocumentLoader::new(&self.document.loader());
@ -108,7 +110,7 @@ impl DOMImplementationMethods for DOMImplementation {
});
match doc
.upcast::<Document>()
.CreateElementNS(maybe_namespace, qname, options)
.CreateElementNS(maybe_namespace, qname, options, can_gc)
{
Err(error) => return Err(error),
Ok(elem) => Some(elem),
@ -137,7 +139,7 @@ impl DOMImplementationMethods for DOMImplementation {
}
// https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument
fn CreateHTMLDocument(&self, title: Option<DOMString>) -> DomRoot<Document> {
fn CreateHTMLDocument(&self, title: Option<DOMString>, can_gc: CanGc) -> DomRoot<Document> {
let win = self.document.window();
let loader = DocumentLoader::new(&self.document.loader());
@ -157,6 +159,7 @@ impl DOMImplementationMethods for DOMImplementation {
None,
None,
Default::default(),
can_gc,
);
{