Skip to content

Merge js-string-builtins into wasm-3.0 #1943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 74 commits into
base: wasm-3.0
Choose a base branch
from

Conversation

eqrion
Copy link
Contributor

@eqrion eqrion commented Jun 25, 2025

There are no substantive open issues on the js-string-builtins repo right now, this has shipped in two browsers now (Chrome and Firefox), and so I'd like to start the process of merging this into the spec. I originally based this off the wasm-3.0 branch, so that's what I'm basing this PR onto.

From my read of the process document, js-string-builtins needs to be phase 5 before merging into the spec repo. So I've filed an agenda item for advancing js-string-builtins to phase 5 here. I think we could start review of this before then to catch any potential issues that may need to be discussed with the WG. If not, I'll just leave this here until after the next WG meeting.

cc' @rossberg @Ms2ger as editors.

dtig and others added 30 commits August 9, 2023 15:39
  * Adopts builtin modules approach
  * Adds section of polyfilling
  * Adds section on feature detection
  * Adds cast/test builtins
  * Adds future extension ideas for
    - binding memory
    - utf8/wtf8
    - evolving the type signatures
  - Eliminate usage of 'builtin module' in description. This is not essential to the proposal and
    causes confusion around a similarly named JS proposal, which had different goals.
  - Clarify some minor points.
  - Make JS-API changes to WebIDL comprehensive.
  - Reword feature detection section to actually propose change to WebAssembly.validate method
  - Function builtin behaviors is defined using 'create a host function'
  - Clarify behavior around monkey patching using standard language
  - Clarify edge cases around nullability
  - Clarify edge cases around unsigned/signed integers
  - Restrict 'substring' behavior to normal cases
  - Use wasm helpers for when wasm instructions are needed
The existing WTF-8 operation in this proposal violated one of the goals of the
proposal: "don't create substantial new functionality" by introducing WTF-8
transcoding support to the web platform without prior precedent. The WTF-8
operation is removed because of this.

The naming for WTF-16 operations is reworked to refer to 'charCodes' instead
as that is what the JS String interface uses.

We could support UTF-8 transcoding by referring to the TextEncoder/TextDecoder
interfaces, so this commit adds support for that.
Explain that users should validate modules that deliberately produce link errors to test for support for particular builtins.
This commit adds a basic suite of tests for the js-string-builtins.

This is done by defining a polyfill module matching the overview,
and then comparing the host provided builtins against the polyfill
on representative inputs.
- Syntax highlighting
- Added links
- Code font
- Consistency
- Grammer fixes
@rossberg
Copy link
Member

I'll let @Ms2ger review thia, since it only touches the JS specs.

@rossberg rossberg requested a review from Ms2ger June 26, 2025 06:54
@Ms2ger
Copy link
Collaborator

Ms2ger commented Jun 26, 2025

Thanks - no obvious issues jump out at me while skimming; I'll try to take a slightly more thorough look by next week.

Should the tests still be marked as tentative?

@eqrion
Copy link
Contributor Author

eqrion commented Jun 26, 2025

Good catch, updated.

Sign up for free to 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.