Add TextDecoder polyfill with tests#138
Merged
CedricGuillemet merged 9 commits intoBabylonJS:mainfrom Feb 25, 2026
Merged
Conversation
- Add Polyfills/TextDecoder with CMakeLists.txt, public header, and implementation - Register JSRUNTIMEHOST_POLYFILL_TEXTDECODER option in root CMakeLists.txt - Add TextDecoder subdirectory to Polyfills/CMakeLists.txt - Initialize TextDecoder in Tests/UnitTests/Shared/Shared.cpp - Link TextDecoder in Tests/UnitTests/CMakeLists.txt - Add TextDecoder decode tests in Tests/UnitTests/Scripts/tests.ts Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a TextDecoder polyfill to the JsRuntimeHost polyfills set so GaussianSplatting can parse PLY / compressed PLY headers in environments lacking a native TextDecoder.
Changes:
- Introduce new
Polyfills/TextDecoderlibrary and CMake optionJSRUNTIMEHOST_POLYFILL_TEXTDECODER. - Register the polyfill in unit test runtime initialization.
- Add mocha tests covering basic
TextDecoder.decode()behavior forUint8ArrayandArrayBuffer.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/UnitTests/Shared/Shared.cpp | Initializes the new TextDecoder polyfill in the JS test runtime. |
| Tests/UnitTests/Scripts/tests.ts | Adds mocha coverage for basic TextDecoder.decode() usage. |
| Tests/UnitTests/CMakeLists.txt | Links UnitTests target against the new TextDecoder library. |
| Polyfills/TextDecoder/Source/TextDecoder.cpp | Implements the TextDecoder global and decode() in C++ via N-API. |
| Polyfills/TextDecoder/Include/Babylon/Polyfills/TextDecoder.h | Declares the polyfill Initialize entry point. |
| Polyfills/TextDecoder/CMakeLists.txt | Adds build target for the TextDecoder polyfill. |
| Polyfills/CMakeLists.txt | Adds conditional subdirectory inclusion for TextDecoder. |
| CMakeLists.txt | Adds JSRUNTIMEHOST_POLYFILL_TEXTDECODER option. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
bghgary
approved these changes
Feb 24, 2026
bghgary
reviewed
Feb 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Used by GaussianSplatting for parsing ply/compressed ply headers