Repository navigation
fix(polyfill,pixi): Intl without ICU data on Linux - #213
Merged
Merged
Conversation
The Linux runtime's V8 ships Intl.Segmenter without ICU's segmentation data: supportedLocalesOf() lists nothing and segment() crashes V8 (SIGSEGV). PixiJS splits every bitmap-font string with it, so the first label in any PixiJS app took the process down, whatever the renderer. The polyfill now removes a Segmenter that supports no locale, so libraries that feature-detect it fall back. canvas-pixi also resets PixiJS's grapheme splitter, which PixiJS picks when it loads, possibly before the polyfill runs.
Where V8 has no ICU data (the Linux runtime), Number#toLocaleString throws "Internal error. Icu error.". When it does, the polyfill replaces it with an en-US rendering: digit grouping, minimum/maximum fraction digits and percent, matching Intl's output for those.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
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.
The Linux runtime's V8 has no ICU data, which broke two common calls:
Intl.Segmenter. It exists but supports no locale, andsegment()crashes V8 outright (SIGSEGV). PixiJS splits every bitmap-font string with it, so the first label in any PixiJS app killed the process, on WebGL or WebGPU. The polyfill now removes aSegmenterthat supports no locale, so libraries that feature-detect it fall back. canvas-pixi also resets PixiJS's grapheme splitter, which PixiJS picks when it loads, possibly before the polyfill runs.Number#toLocaleString. It throws "Internal error. Icu error.". When it does, the polyfill replaces it with an en-US rendering: grouping, minimum/maximum fraction digits and percent. That matchesIntl's output for those options, compared against Node.canvas-chartjs already polyfills Intl for its own use on Linux; this covers every library. The underlying fix belongs in the Linux runtime (ship ICU data).
Testing
Linux: the
@pixi/3dexamples no longer crash at their first label, anddebug_thumbnails(which formats numbers) runs. The polyfill and canvas-pixi packages have no new type errors.