From 29f3c0354facfee8fec0c450fc3debc0cae7e446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Fri, 15 May 2026 22:18:46 -0700 Subject: [PATCH] Playground: use native fetch() polyfill from JsRuntimeHost Replaces the JS XMLHttpRequest-based fetch shim with the native fetch() polyfill that landed in JsRuntimeHost (PR #188). AppContext now calls Babylon::Polyfills::Fetch::Initialize(env) alongside the other polyfills, and Playground links the Fetch target. Removes Apps/Playground/Scripts/fetch_polyfill.js and its SCRIPTS / script loader entries. Bumps the JsRuntimeHost pin to pick up the native polyfill. NOTE: the JsRuntimeHost pin temporarily points at the PR #188 branch (bkaradzic-microsoft/JsRuntimeHost@1118799); switch it back to a BabylonJS/JsRuntimeHost commit once #188 merges. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Apps/Playground/Android/BabylonNative/CMakeLists.txt | 1 + Apps/Playground/CMakeLists.txt | 1 + Apps/Playground/Shared/AppContext.cpp | 2 ++ CMakeLists.txt | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Apps/Playground/Android/BabylonNative/CMakeLists.txt b/Apps/Playground/Android/BabylonNative/CMakeLists.txt index 3f1b5ee15..950e937a6 100644 --- a/Apps/Playground/Android/BabylonNative/CMakeLists.txt +++ b/Apps/Playground/Android/BabylonNative/CMakeLists.txt @@ -30,6 +30,7 @@ target_link_libraries(BabylonNativeJNI PRIVATE Blob PRIVATE Canvas PRIVATE Console + PRIVATE Fetch PRIVATE File PRIVATE GraphicsDevice PRIVATE NativeCamera diff --git a/Apps/Playground/CMakeLists.txt b/Apps/Playground/CMakeLists.txt index 90ddb81c8..2fdf39b82 100644 --- a/Apps/Playground/CMakeLists.txt +++ b/Apps/Playground/CMakeLists.txt @@ -156,6 +156,7 @@ target_link_libraries(Playground PRIVATE TextDecoder PRIVATE Window PRIVATE XMLHttpRequest + PRIVATE Fetch ${ADDITIONAL_LIBRARIES} ${BABYLON_NATIVE_PLAYGROUND_EXTENSION_LIBRARIES}) diff --git a/Apps/Playground/Shared/AppContext.cpp b/Apps/Playground/Shared/AppContext.cpp index 116aef80f..1c123e574 100644 --- a/Apps/Playground/Shared/AppContext.cpp +++ b/Apps/Playground/Shared/AppContext.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -186,6 +187,7 @@ AppContext::AppContext( Babylon::Polyfills::TextDecoder::Initialize(env); Babylon::Polyfills::XMLHttpRequest::Initialize(env); + Babylon::Polyfills::Fetch::Initialize(env); m_canvas.emplace(Babylon::Polyfills::Canvas::Initialize(env)); Babylon::Plugins::NativeTracing::Initialize(env); diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e4af3995..5ba7f9093 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,7 @@ FetchContent_Declare(ios-cmake EXCLUDE_FROM_ALL) FetchContent_Declare(JsRuntimeHost GIT_REPOSITORY https://github.com/BabylonJS/JsRuntimeHost.git - GIT_TAG c88625b6d61b55c4589f02408d03826e83199870) + GIT_TAG 99457c03625782c3eeac6609f632538c7c9445d0) FetchContent_Declare(metal-cpp GIT_REPOSITORY https://github.com/bkaradzic/metal-cpp.git GIT_TAG metal-cpp_26