From dbff26bce05d404027ef5bbfd85fb5995e4726bc Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Sun, 28 May 2023 22:43:55 -0400 Subject: Support arbitrary protos when wrapping DOM objects with constructors. --- components/script/dom/htmlaudioelement.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'components/script/dom/htmlaudioelement.rs') diff --git a/components/script/dom/htmlaudioelement.rs b/components/script/dom/htmlaudioelement.rs index db8f1877a6d..661f882944a 100644 --- a/components/script/dom/htmlaudioelement.rs +++ b/components/script/dom/htmlaudioelement.rs @@ -15,6 +15,7 @@ use crate::dom::node::Node; use crate::dom::window::Window; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix, QualName}; +use js::rust::HandleObject; #[dom_struct] pub struct HTMLAudioElement { @@ -37,24 +38,27 @@ impl HTMLAudioElement { local_name: LocalName, prefix: Option, document: &Document, + proto: Option, ) -> DomRoot { - Node::reflect_node( + Node::reflect_node_with_proto( Box::new(HTMLAudioElement::new_inherited( local_name, prefix, document, )), document, + proto, ) } // https://html.spec.whatwg.org/multipage/#dom-audio #[allow(non_snake_case)] - pub fn Audio(window: &Window, src: Option) -> Fallible> { + pub fn Audio(window: &Window, proto: Option, src: Option) -> Fallible> { let element = Element::create( QualName::new(None, ns!(html), local_name!("audio")), None, &window.Document(), ElementCreator::ScriptCreated, CustomElementCreationMode::Synchronous, + proto, ); let audio = DomRoot::downcast::(element).unwrap(); -- cgit v1.2.3