Title: [272492] trunk
Revision
272492
Author
[email protected]
Date
2021-02-08 08:17:03 -0800 (Mon, 08 Feb 2021)

Log Message

WebXRSystem::RequestSession with 'viewer' as a required feature should succeed
https://bugs.webkit.org/show_bug.cgi?id=221267

Patch by Imanol Fernandez <[email protected]> on 2021-02-08
Reviewed by Sergio Villar Senin.

LayoutTests/imported/w3c:

Mark xrSession_viewer_availability test as passing.

* web-platform-tests/webxr/xrSession_viewer_availability.https-expected.txt: Added.

Source/WebCore:

Tested by wpt/webxr/xrSession_viewer_availability.html

* Modules/webxr/WebXRSystem.cpp:
(WebCore::WebXRSystem::inlineSessionRequestIsAllowedForGlobalObject const):

LayoutTests:

Mark xrSession_viewer_availability test as passing.

* platform/wpe/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (272491 => 272492)


--- trunk/LayoutTests/ChangeLog	2021-02-08 16:14:32 UTC (rev 272491)
+++ trunk/LayoutTests/ChangeLog	2021-02-08 16:17:03 UTC (rev 272492)
@@ -1,3 +1,14 @@
+2021-02-08  Imanol Fernandez  <[email protected]>
+
+        WebXRSystem::RequestSession with 'viewer' as a required feature should succeed
+        https://bugs.webkit.org/show_bug.cgi?id=221267
+
+        Reviewed by Sergio Villar Senin.
+
+        Mark xrSession_viewer_availability test as passing.
+
+        * platform/wpe/TestExpectations:
+
 2021-02-08  Andres Gonzalez  <[email protected]>
 
         Add support for aria-sort change notifications.

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (272491 => 272492)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-02-08 16:14:32 UTC (rev 272491)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-02-08 16:17:03 UTC (rev 272492)
@@ -1,3 +1,14 @@
+2021-02-08  Imanol Fernandez  <[email protected]>
+
+        WebXRSystem::RequestSession with 'viewer' as a required feature should succeed
+        https://bugs.webkit.org/show_bug.cgi?id=221267
+
+        Reviewed by Sergio Villar Senin.
+
+        Mark xrSession_viewer_availability test as passing.
+
+        * web-platform-tests/webxr/xrSession_viewer_availability.https-expected.txt: Added.
+
 2021-02-06  Alex Christensen  <[email protected]>
 
         Non-special URLs should have an opaque origin

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/xrSession_viewer_availability.https-expected.txt (0 => 272492)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/xrSession_viewer_availability.https-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/xrSession_viewer_availability.https-expected.txt	2021-02-08 16:17:03 UTC (rev 272492)
@@ -0,0 +1,3 @@
+
+PASS Inline viewer support with no device
+

Modified: trunk/LayoutTests/platform/wpe/TestExpectations (272491 => 272492)


--- trunk/LayoutTests/platform/wpe/TestExpectations	2021-02-08 16:14:32 UTC (rev 272491)
+++ trunk/LayoutTests/platform/wpe/TestExpectations	2021-02-08 16:17:03 UTC (rev 272492)
@@ -641,6 +641,7 @@
 webkit.org/b/209859 imported/w3c/web-platform-tests/webxr/xrSession_features_deviceSupport.https.html [ Pass ]
 webkit.org/b/209859 imported/w3c/web-platform-tests/webxr/xrSession_requestAnimationFrame_callback_calls.https.html [ Pass ]
 webkit.org/b/209859 imported/w3c/web-platform-tests/webxr/xrSession_requestReferenceSpace.https.html [ Pass ]
+imported/w3c/web-platform-tests/webxr/xrSession_viewer_availability.https.html [ Pass ]
 webkit.org/b/209859 imported/w3c/web-platform-tests/webxr/ar-module/idlharness.https.window.html [ Pass ]
 webkit.org/b/209859 imported/w3c/web-platform-tests/webxr/ar-module/xrDevice_isSessionSupported_immersive-ar.https.html [ Pass ]
 webkit.org/b/209859 imported/w3c/web-platform-tests/webxr/xrWebGLLayer_constructor.https.html [ Pass ]

Modified: trunk/Source/WebCore/ChangeLog (272491 => 272492)


--- trunk/Source/WebCore/ChangeLog	2021-02-08 16:14:32 UTC (rev 272491)
+++ trunk/Source/WebCore/ChangeLog	2021-02-08 16:17:03 UTC (rev 272492)
@@ -1,5 +1,17 @@
 2021-02-08  Imanol Fernandez  <[email protected]>
 
+        WebXRSystem::RequestSession with 'viewer' as a required feature should succeed
+        https://bugs.webkit.org/show_bug.cgi?id=221267
+
+        Reviewed by Sergio Villar Senin.
+
+        Tested by wpt/webxr/xrSession_viewer_availability.html
+
+        * Modules/webxr/WebXRSystem.cpp:
+        (WebCore::WebXRSystem::inlineSessionRequestIsAllowedForGlobalObject const):
+
+2021-02-08  Imanol Fernandez  <[email protected]>
+
         Fix WebXRWebGLLayer m_isCompositionDisabled checks
         https://bugs.webkit.org/show_bug.cgi?id=221551
 

Modified: trunk/Source/WebCore/Modules/webxr/WebXRSystem.cpp (272491 => 272492)


--- trunk/Source/WebCore/Modules/webxr/WebXRSystem.cpp	2021-02-08 16:14:32 UTC (rev 272491)
+++ trunk/Source/WebCore/Modules/webxr/WebXRSystem.cpp	2021-02-08 16:17:03 UTC (rev 272492)
@@ -204,9 +204,20 @@
 // https://immersive-web.github.io/webxr/#inline-session-request-is-allowed
 bool WebXRSystem::inlineSessionRequestIsAllowedForGlobalObject(DOMWindow& globalObject, Document& document, const XRSessionInit& init) const
 {
-    // 1. If the session request contained any required features or optional features and the request was not made
+    auto isEmptyOrViewer = [&document](const JSFeaturesArray& features) {
+        if (features.isEmpty())
+            return true;
+        if (features.size() == 1) {
+            auto feature = parseEnumeration<XRReferenceSpaceType>(*document.globalObject(), features.first());
+            if (feature == XRReferenceSpaceType::Viewer)
+                return true;
+        }
+        return false;
+    };
+
+    // 1. If the session request contained any required features or optional features (besides 'viewer') and the request was not made
     //    while the global object has transient activation or when launching a web application, return false.
-    bool sessionRequestContainedAnyFeature = !init.optionalFeatures.isEmpty() || !init.requiredFeatures.isEmpty();
+    bool sessionRequestContainedAnyFeature = !isEmptyOrViewer(init.optionalFeatures) || !isEmptyOrViewer(init.requiredFeatures);
     if (sessionRequestContainedAnyFeature && !globalObject.hasTransientActivation() /* TODO: || !launching a web app */)
         return false;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to