refactor: rename XR to XRSystem

chore: fix formatting
refactor: change filename and ref to xrsystem
refactor: change filename XRSystem.webidl
refactor: update crate in navigator
refactor: use XRSystem instead of XR in navigator
refactor: update Bindings.conf
refactor: use XRSystemMethods

fix: update assertions for XRSystem

fix: update manifest json
This commit is contained in:
JavaScript Joe 2020-02-11 20:52:40 -08:00
parent ada95b9878
commit 30f474312f
9 changed files with 30 additions and 44 deletions

View file

@ -140,7 +140,7 @@ DOMInterfaces = {
'inRealms': ['WatchAdvertisements'],
},
'XR': {
'XRSystem': {
'inRealms': ['SupportsSessionMode', 'RequestSession'],
},

View file

@ -573,7 +573,6 @@ pub mod xmlhttprequest;
pub mod xmlhttprequesteventtarget;
pub mod xmlhttprequestupload;
pub mod xmlserializer;
pub mod xr;
pub mod xrframe;
pub mod xrinputsource;
pub mod xrinputsourcearray;
@ -586,6 +585,7 @@ pub mod xrrigidtransform;
pub mod xrsession;
pub mod xrsessionevent;
pub mod xrspace;
pub mod xrsystem;
pub mod xrtest;
pub mod xrview;
pub mod xrviewerpose;

View file

@ -20,7 +20,7 @@ use crate::dom::pluginarray::PluginArray;
use crate::dom::promise::Promise;
use crate::dom::serviceworkercontainer::ServiceWorkerContainer;
use crate::dom::window::Window;
use crate::dom::xr::XR;
use crate::dom::xrsystem::XRSystem;
use crate::realms::InRealm;
use dom_struct::dom_struct;
use std::rc::Rc;
@ -32,7 +32,7 @@ pub struct Navigator {
plugins: MutNullableDom<PluginArray>,
mime_types: MutNullableDom<MimeTypeArray>,
service_worker: MutNullableDom<ServiceWorkerContainer>,
xr: MutNullableDom<XR>,
xr: MutNullableDom<XRSystem>,
mediadevices: MutNullableDom<MediaDevices>,
gamepads: MutNullableDom<GamepadList>,
permissions: MutNullableDom<Permissions>,
@ -183,8 +183,8 @@ impl NavigatorMethods for Navigator {
}
/// https://immersive-web.github.io/webxr/#dom-navigator-xr
fn Xr(&self) -> DomRoot<XR> {
self.xr.or_init(|| XR::new(&self.global()))
fn Xr(&self) -> DomRoot<XRSystem> {
self.xr.or_init(|| XRSystem::new(&self.global()))
}
/// https://w3c.github.io/mediacapture-main/#dom-navigator-mediadevices

View file

@ -2,9 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://immersive-web.github.io/webxr/#xr-interface
// https://immersive-web.github.io/webxr/#xrsystem-interface
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]
interface XR: EventTarget {
interface XRSystem: EventTarget {
// Methods
Promise<boolean> isSessionSupported(XRSessionMode mode);
Promise<XRSession> requestSession(XRSessionMode mode, optional XRSessionInit parameters = {});
@ -15,7 +15,7 @@ interface XR: EventTarget {
[SecureContext]
partial interface Navigator {
[SameObject, Pref="dom.webxr.enabled"] readonly attribute XR xr;
[SameObject, Pref="dom.webxr.enabled"] readonly attribute XRSystem xr;
};
enum XRSessionMode {
@ -29,7 +29,7 @@ dictionary XRSessionInit {
sequence<any> optionalFeatures;
};
partial interface XR {
partial interface XRSystem {
// https://github.com/immersive-web/webxr-test-api/
[SameObject, Pref="dom.webxr.test"] readonly attribute XRTest test;
};

View file

@ -7,7 +7,6 @@ use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorBinding::NavigatorMethods;
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods;
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
use crate::dom::bindings::codegen::Bindings::XRBinding::XRSessionMode;
use crate::dom::bindings::codegen::Bindings::XRReferenceSpaceBinding::XRReferenceSpaceType;
use crate::dom::bindings::codegen::Bindings::XRRenderStateBinding::XRRenderStateInit;
use crate::dom::bindings::codegen::Bindings::XRRenderStateBinding::XRRenderStateMethods;
@ -16,6 +15,7 @@ use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XREnvironmentBlen
use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XRFrameRequestCallback;
use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XRSessionMethods;
use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XRVisibilityState;
use crate::dom::bindings::codegen::Bindings::XRSystemBinding::XRSessionMode;
use crate::dom::bindings::codegen::Bindings::XRWebGLLayerBinding::XRWebGLLayerMethods;
use crate::dom::bindings::error::{Error, ErrorResult};
use crate::dom::bindings::inheritance::Castable;

View file

@ -4,9 +4,9 @@
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::VRDisplayBinding::VRDisplayMethods;
use crate::dom::bindings::codegen::Bindings::XRBinding;
use crate::dom::bindings::codegen::Bindings::XRBinding::XRSessionInit;
use crate::dom::bindings::codegen::Bindings::XRBinding::{XRMethods, XRSessionMode};
use crate::dom::bindings::codegen::Bindings::XRSystemBinding;
use crate::dom::bindings::codegen::Bindings::XRSystemBinding::XRSessionInit;
use crate::dom::bindings::codegen::Bindings::XRSystemBinding::{XRSessionMode, XRSystemMethods};
use crate::dom::bindings::conversions::{ConversionResult, FromJSValConvertible};
use crate::dom::bindings::error::Error;
use crate::dom::bindings::inheritance::Castable;
@ -38,7 +38,7 @@ use webvr_traits::{WebVRGamepadData, WebVRGamepadEvent, WebVRGamepadState};
use webxr_api::{Error as XRError, Frame, Session, SessionInit, SessionMode};
#[dom_struct]
pub struct XR {
pub struct XRSystem {
eventtarget: EventTarget,
displays: DomRefCell<Vec<Dom<VRDisplay>>>,
gamepads: DomRefCell<Vec<Dom<Gamepad>>>,
@ -48,9 +48,9 @@ pub struct XR {
test: MutNullableDom<XRTest>,
}
impl XR {
fn new_inherited() -> XR {
XR {
impl XRSystem {
fn new_inherited() -> XRSystem {
XRSystem {
eventtarget: EventTarget::new_inherited(),
displays: DomRefCell::new(Vec::new()),
gamepads: DomRefCell::new(Vec::new()),
@ -61,8 +61,12 @@ impl XR {
}
}
pub fn new(global: &GlobalScope) -> DomRoot<XR> {
let root = reflect_dom_object(Box::new(XR::new_inherited()), global, XRBinding::Wrap);
pub fn new(global: &GlobalScope) -> DomRoot<XRSystem> {
let root = reflect_dom_object(
Box::new(XRSystem::new_inherited()),
global,
XRSystemBinding::Wrap,
);
root.register();
root
}
@ -96,7 +100,7 @@ impl XR {
}
}
impl Drop for XR {
impl Drop for XRSystem {
fn drop(&mut self) {
self.unregister();
}
@ -112,7 +116,7 @@ impl Into<SessionMode> for XRSessionMode {
}
}
impl XRMethods for XR {
impl XRSystemMethods for XRSystem {
/// https://immersive-web.github.io/webxr/#dom-xr-issessionsupported
fn IsSessionSupported(&self, mode: XRSessionMode) -> Rc<Promise> {
// XXXManishearth this should select an XR device first
@ -267,7 +271,7 @@ impl XRMethods for XR {
}
}
impl XR {
impl XRSystem {
fn session_obtained(
&self,
response: Result<Session, XRError>,
@ -442,7 +446,7 @@ impl XR {
}
// Gamepad
impl XR {
impl XRSystem {
fn find_gamepad(&self, gamepad_id: u32) -> Option<DomRoot<Gamepad>> {
self.gamepads
.borrow()

View file

@ -131,27 +131,9 @@
[XRSystem interface: operation isSessionSupported(XRSessionMode)]
expected: FAIL
[XRSystem interface: existence and properties of interface prototype object]
expected: FAIL
[XRSystem interface: existence and properties of interface object]
expected: FAIL
[XRSystem interface object name]
expected: FAIL
[XRSystem interface: attribute ondevicechange]
expected: FAIL
[XRSystem interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
[XRSystem interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL
[XRSystem interface object length]
expected: FAIL
[XRSystem interface: operation requestSession(XRSessionMode, XRSessionInit)]
expected: FAIL

View file

@ -13863,7 +13863,7 @@
]
],
"interfaces.html": [
"bb6adbde0b3452e6ea8f1db44941a08dbe236774",
"163ab416b1627e07347b83aa210712364182343a",
[
null,
{}

View file

@ -263,7 +263,6 @@ test_interfaces([
"XMLHttpRequestEventTarget",
"XMLHttpRequestUpload",
"XMLSerializer",
"XR",
"XRFrame",
"XRInputSource",
"XRInputSourceArray",
@ -275,6 +274,7 @@ test_interfaces([
"XRSession",
"XRSessionEvent",
"XRSpace",
"XRSystem",
"XRView",
"XRViewerPose",
"XRViewport",