You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use native fetch() polyfill from JsRuntimeHost in Playground (#1707)
Wires Babylon Native's Playground up to the **native `fetch()`
polyfill** that now lives in JsRuntimeHost
(BabylonJS/JsRuntimeHost#188), so playgrounds depending on `fetch` stop
hitting `ReferenceError: 'fetch' is not defined`.
This supersedes the original JS XMLHttpRequest-based shim approach:
rather than shipping a `fetch_polyfill.js` script, `fetch` is now
provided natively (built on the same `UrlLib` transport as
`XMLHttpRequest`), matching how File/FileReader landed in #1706.
**Changes:**
- `Apps/Playground/Shared/AppContext.cpp` - calls
`Babylon::Polyfills::Fetch::Initialize(env)` alongside the other
polyfills (right after `XMLHttpRequest`).
- `Apps/Playground/CMakeLists.txt` +
`Apps/Playground/Android/BabylonNative/CMakeLists.txt` - link the
`Fetch` target.
- `CMakeLists.txt` - bumps the JsRuntimeHost pin to pick up the native
polyfill.
> ✅ **Unblocked:** JsRuntimeHost#188 merged, and the pin now points at
`BabylonJS/JsRuntimeHost@a407a331` (the #188 merge commit) — no longer
the temporary fork branch. Rebased onto master (clean).
**Verified (Win32/Chakra):** `Playground` configures, builds and links
cleanly against the native polyfill, and at runtime `typeof fetch ===
"function"` (confirmed via a headless smoke check).
---
## Landing context
This PR is one of the **splits** from the proven CI-green combined
preview in draft PR #1702 (see
[#1702](#1702) for the
full intended end-state).
> The original split also included #1709 (ES2020+ -> ES2019
syntax-repair polyfill for Chakra), closed in favour of investigating
`@babel/standalone` properly (#1711).
### Landing order / status
**Tier 1 - parallel-reviewable, no source conflicts:**
1. ~~#1703 - ExternalTexture C4702 build fix~~ ✅ merged
2. ~~#1704 - config.json `reason` rewrites (5 entries)~~ ✅ merged
3. ~~#1705 - config.json `reason` rewrites (17 entries)~~ ✅ merged
**Tier 2 - sequential, each touches `Apps/Playground/CMakeLists.txt` +
`AppContext.cpp`:**
4. ~~#1706 - File/FileReader polyfill~~ ✅ merged (native JsRuntimeHost
bump)
5. **#1707 - native fetch polyfill (this PR)** - ✅ unblocked; pin
repointed to `BabylonJS/JsRuntimeHost@a407a331`; ready for review
6. #1708 - link AbortController + TextEncoder polyfills from
JsRuntimeHost
7. #1710 - Cubemap auto-expand polyfill (loaded after babylon.max.js)
### Reference policy reminder
Reference PNGs come from Babylon.js; never re-baked by BN. Combined
diff: **0 PNGs**.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments