WebXR Anchors module
Component: WebCore WebXR | 4f41023
Source/WebCore/Modules/webxr/WebXRAnchor.cpp
WebXR sessions render frames through WebXRSession::onFrame(), which pulls pose data produced by the UI-process platform coordinator (here, OpenXR). Anything needing the real XR runtime is proxied over IPC from PlatformXRSystemProxy in WebContent to PlatformXRSystem in the UI process.
This commit adds the WebXR Anchors module behind the WEBXR_ANCHORS compile flag and the WebXRAnchorsModuleEnabled setting. The new script-visible interfaces are XRAnchor and XRAnchorSet, along with XRFrame.createAnchor/trackedAnchors and XRHitTestResult.createAnchor. WebXRAnchorSpace reaches script only as XRAnchor.anchorSpace. New createAnchor/deleteAnchor IPC messages are served in the UI process by an OpenXRAnchorManager built on XR_EXT_spatial_entity, spatial anchors and XR_EXT_future. Pending creates resolve inside updateAnchors() on the frame loop. Pose and FloatQuaternion move into the PlatformXR namespace so they can be IPC parameters, and OpenXR extension enabling changes from per-module to enable-if-supported.
Significance
Page-controlled anchor creation, deletion and per-frame updates now drive state in a privileged process on OpenXR ports (GTK/WPE). Promises, identifiers, tracking states and JS wrapper lifetimes must stay consistent across two processes and across frames.
Audit directions
Start with the UI-process handlers in PlatformXRSystem and OpenXRAnchorManager. Check how they validate anchor identifiers and poses arriving from a compromised WebContent process: NaN or infinite values, non-normalized quaternions, deletion of unknown or already-deleted IDs, ID reuse, and deletion while a create is still pending. In the XrFuture lifecycle in processPendingCreates(), trace spatial-anchor handle ownership through ~OpenXRAnchorManager and cleanupSessionAndAssociatedResources(), especially for sessions that end with futures outstanding.
On the WebContent side, WebXRSession::updateAnchors, addPendingCreateAnchorPromise and shutdown() are the usual promise/wrapper UAF spots. XRAnchorSet is a read-only setlike, so the realistic concern is native-side add/remove/clear during updateAnchors() while script holds or iterates the set.
Two more areas need review:
- the new
Pose/FloatQuaternionserialization entries, for missing or changed decoder constraints, and the conversions betweenXrPosef,Poseand matrices (PoseToXrPosef,XrPosefToPose,poseFromTransform); - hit-test-seeded anchors, to confirm that the result's space, session and feature gating are still verified at creation time.