Skip to content

Add TextDecoder polyfill with tests - #138

Merged
CedricGuillemet merged 9 commits into
BabylonJS:mainfrom
CedricGuillemet:TextDecoder
Feb 25, 2026
Merged

Add TextDecoder polyfill with tests#138
CedricGuillemet merged 9 commits into
BabylonJS:mainfrom
CedricGuillemet:TextDecoder

Conversation

@CedricGuillemet

Copy link
Copy Markdown
Collaborator

Used by GaussianSplatting for parsing ply/compressed ply headers

CedricGuillemetand others added 2 commits February 24, 2026 16:16
- 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>
CopilotAI review requested due to automatic review settings February 24, 2026 15:24

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/TextDecoder library and CMake option JSRUNTIMEHOST_POLYFILL_TEXTDECODER.
  • Register the polyfill in unit test runtime initialization.
  • Add mocha tests covering basic TextDecoder.decode() behavior for Uint8Array and ArrayBuffer.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
Tests/UnitTests/Shared/Shared.cppInitializes the new TextDecoder polyfill in the JS test runtime.
Tests/UnitTests/Scripts/tests.tsAdds mocha coverage for basic TextDecoder.decode() usage.
Tests/UnitTests/CMakeLists.txtLinks UnitTests target against the new TextDecoder library.
Polyfills/TextDecoder/Source/TextDecoder.cppImplements the TextDecoder global and decode() in C++ via N-API.
Polyfills/TextDecoder/Include/Babylon/Polyfills/TextDecoder.hDeclares the polyfill Initialize entry point.
Polyfills/TextDecoder/CMakeLists.txtAdds build target for the TextDecoder polyfill.
Polyfills/CMakeLists.txtAdds conditional subdirectory inclusion for TextDecoder.
CMakeLists.txtAdds JSRUNTIMEHOST_POLYFILL_TEXTDECODER option.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadPolyfills/TextDecoder/Source/TextDecoder.cpp
Comment threadPolyfills/TextDecoder/Source/TextDecoder.cpp Outdated
Comment threadPolyfills/TextDecoder/Source/TextDecoder.cpp
Comment threadPolyfills/TextDecoder/Source/TextDecoder.cpp Outdated
Comment threadTests/UnitTests/Scripts/tests.ts
Comment threadPolyfills/TextDecoder/Source/TextDecoder.cpp Outdated
Comment threadPolyfills/TextDecoder/Source/TextDecoder.cpp Outdated
Comment threadPolyfills/TextDecoder/Source/TextDecoder.cpp Outdated
Comment threadTests/UnitTests/Scripts/tests.ts
@CedricGuillemet
CedricGuillemet merged commit fe50276 into BabylonJS:mainFeb 25, 2026
19 checks passed
Comment threadPolyfills/TextDecoder/Source/TextDecoder.cpp
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@CedricGuillemet@bghgary