Skip WebXR startup probe when xr-spatial-tracking is disallowed#8964
Skip WebXR startup probe when xr-spatial-tracking is disallowed#8964mvaligursky wants to merge 1 commit into
Conversation
Build size reportThis PR changes the size of the minified bundles.
|
|
Didn't we close my fix for this previously? |
|
@Maksims — this PR revisits the approach from #7029, which you closed with this concern:
I've dug into this and I don't think that breakage actually occurs. I think the concern conflates two distinct mechanisms: 1. Permissions Policy ( 2. Permission grant (the user-facing "Allow" prompt) — a separate mechanism, evaluated at So for the overwhelming majority of PlayCanvas apps (top-level pages), The gate only returns Two refinements over #7029 worth noting:
Happy to be corrected if there's a browser quirk I'm missing here — but based on the spec and the default References:
|
Suppresses the
[Violation] Permissions policy violation: xr-spatial-tracking is not allowed in this documentconsole warning that appears on startup for every app — even ones that never use XR.Why:
AppBasealways creates anXrManager(viapc.Application), and its constructor unconditionally probes WebXR by callingnavigator.xr.isSessionSupported()for inline/VR/AR. When the document's permissions policy disallowsxr-spatial-tracking(e.g. the app runs in an iframe withoutallow="xr-spatial-tracking"), the browser blocks that call and logs a policy violation — regardless of whether the project uses XR.Changes:
devicechangelistener) on a new privateXrManager._allowsSpatialTracking()check.navigator.xrexists butdocument.featurePolicydoes not) we cannot tell, so we proceed as before — avoiding a regression on those platforms.Debug.warn(debug builds only) explaining the cause and how to fix it (iframeallowattribute /Permissions-Policyheader).No public API changes.