aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/xrwebglbinding.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2023-05-28 22:43:55 -0400
committerJosh Matthews <josh@joshmatthews.net>2023-05-28 23:23:12 -0400
commitdbff26bce05d404027ef5bbfd85fb5995e4726bc (patch)
tree6ebb631eef396c2f387fe8269b0d59bde0dccae2 /components/script/dom/xrwebglbinding.rs
parentd9600ff50f3c1bdd8c44e2dfc15a18416d80cb82 (diff)
downloadservo-dbff26bce05d404027ef5bbfd85fb5995e4726bc.tar.gz
servo-dbff26bce05d404027ef5bbfd85fb5995e4726bc.zip
Support arbitrary protos when wrapping DOM objects with constructors.
Diffstat (limited to 'components/script/dom/xrwebglbinding.rs')
-rw-r--r--components/script/dom/xrwebglbinding.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/components/script/dom/xrwebglbinding.rs b/components/script/dom/xrwebglbinding.rs
index 64ea31e0bce..fb64c92d7e6 100644
--- a/components/script/dom/xrwebglbinding.rs
+++ b/components/script/dom/xrwebglbinding.rs
@@ -13,7 +13,7 @@ use crate::dom::bindings::codegen::Bindings::XRWebGLBindingBinding::XRWebGLBindi
use crate::dom::bindings::codegen::UnionTypes::WebGLRenderingContextOrWebGL2RenderingContext;
use crate::dom::bindings::error::Error;
use crate::dom::bindings::error::Fallible;
-use crate::dom::bindings::reflector::reflect_dom_object;
+use crate::dom::bindings::reflector::reflect_dom_object2;
use crate::dom::bindings::reflector::Reflector;
use crate::dom::bindings::root::Dom;
use crate::dom::bindings::root::DomRoot;
@@ -30,6 +30,7 @@ use crate::dom::xrsession::XRSession;
use crate::dom::xrview::XRView;
use crate::dom::xrwebglsubimage::XRWebGLSubImage;
use dom_struct::dom_struct;
+use js::rust::HandleObject;
#[dom_struct]
pub struct XRWebGLBinding {
@@ -47,20 +48,23 @@ impl XRWebGLBinding {
}
}
- pub fn new(
+ fn new(
global: &Window,
+ proto: Option<HandleObject>,
session: &XRSession,
context: &WebGLRenderingContext,
) -> DomRoot<XRWebGLBinding> {
- reflect_dom_object(
+ reflect_dom_object2(
Box::new(XRWebGLBinding::new_inherited(session, context)),
global,
+ proto,
)
}
#[allow(non_snake_case)]
pub fn Constructor(
global: &Window,
+ proto: Option<HandleObject>,
session: &XRSession,
context: WebGLRenderingContextOrWebGL2RenderingContext,
) -> DomRoot<XRWebGLBinding> {
@@ -70,7 +74,7 @@ impl XRWebGLBinding {
ctx.base_context()
},
};
- XRWebGLBinding::new(global, session, &context)
+ XRWebGLBinding::new(global, proto, session, &context)
}
}