From 9b42333e98a4284e9ca1005b5630eb94b22b3d4d Mon Sep 17 00:00:00 2001 From: David Snopek Date: Tue, 25 Jun 2024 08:47:54 -0500 Subject: [PATCH] [WebXR] Fix closure compiler mangling `XRSession.enabledFeatures` --- modules/webxr/native/library_godot_webxr.js | 3 ++- modules/webxr/native/webxr.externs.js | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/webxr/native/library_godot_webxr.js b/modules/webxr/native/library_godot_webxr.js index 031530a0477..581da4d56fd 100644 --- a/modules/webxr/native/library_godot_webxr.js +++ b/modules/webxr/native/library_godot_webxr.js @@ -320,7 +320,8 @@ const GodotWebXR = { // next reference space. window.setTimeout(function () { const reference_space_c_str = GodotRuntime.allocString(reference_space_type); - const enabled_features_c_str = GodotRuntime.allocString(Array.from(session.enabledFeatures).join(',')); + const enabled_features = 'enabledFeatures' in session ? Array.from(session.enabledFeatures) : []; + const enabled_features_c_str = GodotRuntime.allocString(enabled_features.join(',')); onstarted(reference_space_c_str, enabled_features_c_str); GodotRuntime.free(reference_space_c_str); GodotRuntime.free(enabled_features_c_str); diff --git a/modules/webxr/native/webxr.externs.js b/modules/webxr/native/webxr.externs.js index 35ad33fa933..80a7f8d2de9 100644 --- a/modules/webxr/native/webxr.externs.js +++ b/modules/webxr/native/webxr.externs.js @@ -77,6 +77,11 @@ XRSession.prototype.frameRate; */ XRSession.prototype.supportedFrameRates; +/** + * @type {Array} + */ +XRSession.prototype.enabledFeatures; + /** * @type {?function (Event)} */