summaryrefslogtreecommitdiffstats
path: root/dom/vr
diff options
context:
space:
mode:
Diffstat (limited to 'dom/vr')
-rw-r--r--dom/vr/XRSystem.cpp54
-rw-r--r--dom/vr/XRSystem.h2
-rw-r--r--dom/vr/test/reftest/reftest.list6
3 files changed, 18 insertions, 44 deletions
diff --git a/dom/vr/XRSystem.cpp b/dom/vr/XRSystem.cpp
index 09b9e07476..2dd66e41f4 100644
--- a/dom/vr/XRSystem.cpp
+++ b/dom/vr/XRSystem.cpp
@@ -122,8 +122,8 @@ already_AddRefed<Promise> XRSystem::IsSessionSupported(XRSessionMode aMode,
}
already_AddRefed<Promise> XRSystem::RequestSession(
- JSContext* aCx, XRSessionMode aMode, const XRSessionInit& aOptions,
- CallerType aCallerType, ErrorResult& aRv) {
+ XRSessionMode aMode, const XRSessionInit& aOptions, CallerType aCallerType,
+ ErrorResult& aRv) {
nsCOMPtr<nsIGlobalObject> global = GetParentObject();
NS_ENSURE_TRUE(global, nullptr);
@@ -166,49 +166,25 @@ already_AddRefed<Promise> XRSystem::RequestSession(
requiredReferenceSpaceTypes.AppendElement(XRReferenceSpaceType::Local);
}
- BindingCallContext callCx(aCx, "XRSystem.requestSession");
-
if (aOptions.mRequiredFeatures.WasPassed()) {
- const Sequence<JS::Value>& arr = (aOptions.mRequiredFeatures.Value());
- for (const JS::Value& val : arr) {
- if (!val.isNull() && !val.isUndefined()) {
- bool bFound = false;
- JS::Rooted<JS::Value> v(aCx, val);
- int index = 0;
- if (FindEnumStringIndex<false>(
- callCx, v, XRReferenceSpaceTypeValues::strings,
- "XRReferenceSpaceType", "Argument 2 of XR.requestSession",
- &index)) {
- if (index >= 0) {
- requiredReferenceSpaceTypes.AppendElement(
- static_cast<XRReferenceSpaceType>(index));
- bFound = true;
- }
- }
- if (!bFound) {
- promise->MaybeRejectWithNotSupportedError(
- "A required feature for the XRSession is not available.");
- return promise.forget();
- }
+ for (const nsString& val : aOptions.mRequiredFeatures.Value()) {
+ Maybe<XRReferenceSpaceType> type =
+ StringToEnum<XRReferenceSpaceType>(val);
+ if (type.isNothing()) {
+ promise->MaybeRejectWithNotSupportedError(
+ "A required feature for the XRSession is not available.");
+ return promise.forget();
}
+ requiredReferenceSpaceTypes.AppendElement(type.value());
}
}
if (aOptions.mOptionalFeatures.WasPassed()) {
- const Sequence<JS::Value>& arr = (aOptions.mOptionalFeatures.Value());
- for (const JS::Value& val : arr) {
- if (!val.isNull() && !val.isUndefined()) {
- JS::Rooted<JS::Value> v(aCx, val);
- int index = 0;
- if (FindEnumStringIndex<false>(
- callCx, v, XRReferenceSpaceTypeValues::strings,
- "XRReferenceSpaceType", "Argument 2 of XR.requestSession",
- &index)) {
- if (index >= 0) {
- optionalReferenceSpaceTypes.AppendElement(
- static_cast<XRReferenceSpaceType>(index));
- }
- }
+ for (const nsString& val : aOptions.mOptionalFeatures.Value()) {
+ Maybe<XRReferenceSpaceType> type =
+ StringToEnum<XRReferenceSpaceType>(val);
+ if (type.isSome()) {
+ optionalReferenceSpaceTypes.AppendElement(type.value());
}
}
}
diff --git a/dom/vr/XRSystem.h b/dom/vr/XRSystem.h
index 2a49dfb68f..860098e30c 100644
--- a/dom/vr/XRSystem.h
+++ b/dom/vr/XRSystem.h
@@ -120,7 +120,7 @@ class XRSystem final : public DOMEventTargetHelper,
// WebIDL Members
already_AddRefed<Promise> IsSessionSupported(XRSessionMode aMode,
ErrorResult& aRv);
- already_AddRefed<Promise> RequestSession(JSContext* aCx, XRSessionMode aMode,
+ already_AddRefed<Promise> RequestSession(XRSessionMode aMode,
const XRSessionInit& aOptions,
CallerType aCallerType,
ErrorResult& aRv);
diff --git a/dom/vr/test/reftest/reftest.list b/dom/vr/test/reftest/reftest.list
index c1ca292c71..ac012495cb 100644
--- a/dom/vr/test/reftest/reftest.list
+++ b/dom/vr/test/reftest/reftest.list
@@ -2,9 +2,7 @@
# Please confirm there is no other VR display connected. Otherwise, VRPuppetDisplay can't be attached.
defaults pref(dom.vr.enabled,true) pref(dom.vr.puppet.enabled,true) pref(dom.vr.test.enabled,true) pref(dom.vr.require-gesture,false) pref(dom.vr.puppet.submitframe,1) pref(dom.vr.display.rafMaxDuration,200) pref(dom.vr.display.enumerate.interval,0) pref(dom.vr.controller.enumerate.interval,0)
# WebVR Tests have been disabled as refactoring of gfxVRPuppet is landing. Dependencies for re-enabling these are tracked by meta bug 1555185.
-# VR SubmitFrame is only implemented for D3D11.1 and MacOSX now.
-# Our Windows 7 test machines don't support D3D11.1, so we run these tests on Windows 8+ only.
-# skip-if((!winWidget&&release_or_beta)||Android||gtkWidget||!layersGPUAccelerated) == draw_rect.html wrapper.html?draw_rect.png
+# skip-if((!winWidget&&release_or_beta)||Android||gtkWidget) == draw_rect.html wrapper.html?draw_rect.png
# On MacOSX platform, getting different color interpolation result.
# For lower resolution Mac hardware, we need to adjust it to fuzzy-if(cocoaWidget,0-1,0-1200).
-# fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)||cocoaWidget,0-1,0-600) skip-if((!winWidget&&release_or_beta)||Android||gtkWidget||!layersGPUAccelerated) == change_size.html wrapper.html?change_size.png
+# fuzzy-if(winWidget||cocoaWidget,0-1,0-600) skip-if((!winWidget&&release_or_beta)||Android||gtkWidget) == change_size.html wrapper.html?change_size.png