mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Add missing XRWebGLBinding constructor spec steps (#33731)
* Add missing XRWebGLBinding constructor spec steps Signed-off-by: Taym <haddadi.taym@gmail.com> * Update test expectation Signed-off-by: Taym <haddadi.taym@gmail.com> --------- Signed-off-by: Taym <haddadi.taym@gmail.com>
This commit is contained in:
parent
cde6931f4b
commit
2115267328
3 changed files with 26 additions and 6 deletions
|
@ -5,7 +5,7 @@
|
|||
// https://immersive-web.github.io/layers/#XRWebGLBindingtype
|
||||
[SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
|
||||
interface XRWebGLBinding {
|
||||
constructor(XRSession session, XRWebGLRenderingContext context);
|
||||
[Throws] constructor(XRSession session, XRWebGLRenderingContext context);
|
||||
|
||||
// readonly attribute double nativeProjectionScaleFactor;
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ use js::rust::HandleObject;
|
|||
|
||||
use crate::dom::bindings::codegen::Bindings::XRViewBinding::XREye;
|
||||
use crate::dom::bindings::codegen::Bindings::XRWebGLBindingBinding::XRWebGLBinding_Binding::XRWebGLBindingMethods;
|
||||
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContext_Binding::WebGLRenderingContextMethods;
|
||||
use crate::dom::bindings::codegen::Bindings::XRWebGLBindingBinding::{
|
||||
XRCubeLayerInit, XRCylinderLayerInit, XREquirectLayerInit, XRProjectionLayerInit,
|
||||
XRQuadLayerInit, XRTextureType,
|
||||
|
@ -69,14 +70,33 @@ impl XRWebGLBindingMethods for XRWebGLBinding {
|
|||
can_gc: CanGc,
|
||||
session: &XRSession,
|
||||
context: WebGLRenderingContextOrWebGL2RenderingContext,
|
||||
) -> DomRoot<XRWebGLBinding> {
|
||||
) -> Fallible<DomRoot<XRWebGLBinding>> {
|
||||
let context = match context {
|
||||
WebGLRenderingContextOrWebGL2RenderingContext::WebGLRenderingContext(ctx) => ctx,
|
||||
WebGLRenderingContextOrWebGL2RenderingContext::WebGL2RenderingContext(ctx) => {
|
||||
ctx.base_context()
|
||||
},
|
||||
};
|
||||
XRWebGLBinding::new(global, proto, session, &context, can_gc)
|
||||
// Step 2
|
||||
if session.is_ended() {
|
||||
return Err(Error::InvalidState);
|
||||
}
|
||||
|
||||
// step 3
|
||||
if context.IsContextLost() {
|
||||
return Err(Error::InvalidState);
|
||||
}
|
||||
|
||||
// Step 4
|
||||
if !session.is_immersive() {
|
||||
return Err(Error::InvalidState);
|
||||
};
|
||||
|
||||
// Step 5 throw an InvalidStateError If context’s XR compatible boolean is false.
|
||||
|
||||
Ok(XRWebGLBinding::new(
|
||||
global, proto, session, &context, can_gc,
|
||||
))
|
||||
}
|
||||
|
||||
/// <https://immersive-web.github.io/layers/#dom-xrwebglbinding-createprojectionlayer>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[xrWebGLBinding_constructor.https.html]
|
||||
expected: ERROR
|
||||
[Ensure that XRWebGLBinding's constructor throws appropriate errors using webgl2]
|
||||
expected: FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[Ensure that XRWebGLBinding's constructor throws appropriate errors using webgl]
|
||||
expected: FAIL
|
||||
|
||||
expected: TIMEOUT
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue