diff options
author | Josh Matthews <josh@joshmatthews.net> | 2023-05-28 22:43:55 -0400 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2023-05-28 23:23:12 -0400 |
commit | dbff26bce05d404027ef5bbfd85fb5995e4726bc (patch) | |
tree | 6ebb631eef396c2f387fe8269b0d59bde0dccae2 /components/script/dom/mediametadata.rs | |
parent | d9600ff50f3c1bdd8c44e2dfc15a18416d80cb82 (diff) | |
download | servo-dbff26bce05d404027ef5bbfd85fb5995e4726bc.tar.gz servo-dbff26bce05d404027ef5bbfd85fb5995e4726bc.zip |
Support arbitrary protos when wrapping DOM objects with constructors.
Diffstat (limited to 'components/script/dom/mediametadata.rs')
-rw-r--r-- | components/script/dom/mediametadata.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/components/script/dom/mediametadata.rs b/components/script/dom/mediametadata.rs index 3abe0a1a20c..24f9a31120c 100644 --- a/components/script/dom/mediametadata.rs +++ b/components/script/dom/mediametadata.rs @@ -6,12 +6,13 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::MediaMetadataBinding::MediaMetadataInit; use crate::dom::bindings::codegen::Bindings::MediaMetadataBinding::MediaMetadataMethods; use crate::dom::bindings::error::Fallible; -use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::reflector::{reflect_dom_object2, Reflector}; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::mediasession::MediaSession; use crate::dom::window::Window; use dom_struct::dom_struct; +use js::rust::HandleObject; #[dom_struct] pub struct MediaMetadata { @@ -34,16 +35,21 @@ impl MediaMetadata { } pub fn new(global: &Window, init: &MediaMetadataInit) -> DomRoot<MediaMetadata> { - reflect_dom_object(Box::new(MediaMetadata::new_inherited(init)), global) + Self::new_with_proto(global, None, init) + } + + fn new_with_proto(global: &Window, proto: Option<HandleObject>, init: &MediaMetadataInit) -> DomRoot<MediaMetadata> { + reflect_dom_object2(Box::new(MediaMetadata::new_inherited(init)), global, proto) } /// https://w3c.github.io/mediasession/#dom-mediametadata-mediametadata #[allow(non_snake_case)] pub fn Constructor( window: &Window, + proto: Option<HandleObject>, init: &MediaMetadataInit, ) -> Fallible<DomRoot<MediaMetadata>> { - Ok(MediaMetadata::new(window, init)) + Ok(MediaMetadata::new_with_proto(window, proto, init)) } fn queue_update_metadata_algorithm(&self) { |