playcanvas / engine

JavaScript game engine built on WebGL, WebGPU, WebXR and glTF
https://playcanvas.com
MIT License
9.31k stars 1.32k forks source link

Permissions policy violation: xr-spatial-tracking #6692

Open LeXXik opened 2 weeks ago

LeXXik commented 2 weeks ago

If the document doesn't allow to use WebXR Device API, then a DOM exception is thrown:

image

Details: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy/xr-spatial-tracking

Maksims commented 2 weeks ago

Where do you get this error?

LeXXik commented 2 weeks ago

Where do you get this error?

Windows Chrome? Maybe an iframe? Not sure what you are asking. Its a self-hosted environment. Noticed the error mentioned in our team and decided to add here. I can get the details if you clarify.

LeXXik commented 2 weeks ago

Repro: app.zip

npm install
node app.js
localhost:3000/printer

Additional details: https://www.w3.org/TR/permissions-policy-1/#document-policies

Maksims commented 2 weeks ago

WebXR is allowed only in HTTPS.

mvaligursky commented 2 weeks ago

That's the same requirement as WebGPU .. needs to be https. I'll close this but please reopen if this is still a problem.

LeXXik commented 2 weeks ago

Please, reopen. The issue is not about HTTPS protocol. The issue is that the engine is trying to use WebXR Device API on a webpage that does not allow it, resulting in a permissions violation exception.

Changed the repro app, added local certs so https can be used. app.zip

https://localhost:3000/printer
willeastcott commented 2 weeks ago

Is this really something for the engine to handle? If you're going to host a WebXR app, then you're going to have to correctly configure your server.

LeXXik commented 2 weeks ago

The exception is thrown for a default blank application. The engine is using WebXR Device API regardless if the app is going to use WebXR or not. We don't use WebXR in any of our games, but still noticed the exception.

willeastcott commented 2 weeks ago

Interesting. What's your take on this, @Maksims?