Explorar o código

fix: addEventListener in navigator.xr seems to throw in some cases (#23805)

hybridherbst %!s(int64=3) %!d(string=hai) anos
pai
achega
0da9a14b61
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      examples/jsm/webxr/VRButton.js

+ 5 - 0
examples/jsm/webxr/VRButton.js

@@ -186,6 +186,11 @@ class VRButton {
 
 		if ( 'xr' in navigator ) {
 
+			// WebXRViewer (based on Firefox) has a bug where addEventListener 
+			// throws a silent exception and aborts execution entirely.
+			const isWebXRViewer = /WebXRViewer\//i.test( navigator.userAgent );
+			if( isWebXRViewer ) return;
+
 			navigator.xr.addEventListener( 'sessiongranted', () => {
 
 				VRButton.xrSessionIsGranted = true;