Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: rename XR to XRSystem #25738

Merged
merged 1 commit into from Feb 24, 2020
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

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
  • Loading branch information
jsjoeio committed Feb 23, 2020
commit 30f474312ff9beb2b407fc35f1a93d65c8bbeaae
@@ -140,7 +140,7 @@ DOMInterfaces = {
'inRealms': ['WatchAdvertisements'],
},

'XR': {
'XRSystem': {
'inRealms': ['SupportsSessionMode', 'RequestSession'],
},

@@ -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;
@@ -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
@@ -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;
};
@@ -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;
@@ -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()
@@ -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

@@ -13863,7 +13863,7 @@
]
],
"interfaces.html": [
"bb6adbde0b3452e6ea8f1db44941a08dbe236774",
"163ab416b1627e07347b83aa210712364182343a",
[
null,
{}
@@ -263,7 +263,6 @@
"XMLHttpRequestEventTarget",
"XMLHttpRequestUpload",
"XMLSerializer",
"XR",
"XRFrame",
"XRInputSource",
"XRInputSourceArray",
@@ -275,6 +274,7 @@
"XRSession",
"XRSessionEvent",
"XRSpace",
"XRSystem",
"XRView",
"XRViewerPose",
"XRViewport",
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.