Skip to content

feat(wintertc): migrate atob/btoa from boa_runtime#5418

Open
KaustubhOG wants to merge 1 commit into
boa-dev:mainfrom
KaustubhOG:feat/wintertc-migrate-base64
Open

feat(wintertc): migrate atob/btoa from boa_runtime#5418
KaustubhOG wants to merge 1 commit into
boa-dev:mainfrom
KaustubhOG:feat/wintertc-migrate-base64

Conversation

@KaustubhOG

Copy link
Copy Markdown
Contributor

This Pull Request is part of the TC55 migration tracked in #4988, and builds on the skeleton crate from #5105.

It moves the base64 module (atob and btoa) from boa_runtime into the dedicated boa_wintertc crate as the first migration step toward hosting the WinterTC TC55 Minimum Common Web API in its own crate.

It changes the following:

  • Moves the base64 module (mod.rs and tests.rs) into boa_wintertc. The implementation is unchanged; the only difference from the boa_runtime version is a short TC55 status note added to the module documentation.
  • Ports the test harness (TestAction and run_test_actions_with) into boa_wintertc so the migrated unit tests run unchanged. This harness will be reused by later migrations.
  • Adds dependencies to core/wintertc/Cargo.toml: the base64 dependency, plus indoc, textwrap, and futures-lite as dev dependencies.

Line counts (before and after, in both locations):

File boa_runtime (source) boa_wintertc before boa_wintertc after
base64/mod.rs 82 (unchanged) 23 (stub) 86
base64/tests.rs 154 (unchanged) 0 (did not exist) 154

The 4 extra lines in mod.rs are the TC55 status doc note; the code itself is identical. tests.rs is byte for byte the same.

Approach: boa_runtime keeps its own base64 module for now, so there is no behaviour change for existing users and no new cross-crate dependency is introduced in this PR. Wiring boa_runtime to re-export from boa_wintertc (and removing the duplicate) is intended as a follow up, once the dependency direction between the two crates is agreed.

Testing:

  • cargo test -p boa_wintertc: all six base64 unit tests pass, plus the crate doctest.
  • cargo clippy -p boa_wintertc --all-features --all-targets: clean, no warnings.
  • cargo fmt -p boa_wintertc -- --check: clean.
  • cargo test -p boa_runtime base64: still passes (source untouched).

Out of scope:

  • WPT is not run here: the WPT runner currently targets boa_runtime, so it does not yet exercise the boa_wintertc copy. That is covered automatically once the re-export follow up lands.
  • Test262 does not apply, as atob and btoa are Web APIs rather than ECMAScript.

@KaustubhOG KaustubhOG requested a review from a team as a code owner June 28, 2026 22:30
@github-actions github-actions Bot added Waiting On Review Waiting on reviews from the maintainers C-Dependencies Pull requests that update a dependency file C-Tests Issues and PRs related to the tests. and removed Waiting On Review Waiting on reviews from the maintainers labels Jun 28, 2026
@github-actions github-actions Bot added this to the v1.0.0 milestone Jun 28, 2026
@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown

Test262 conformance changes

Test result main count PR count difference
Total 53,125 53,125 0
Passed 51,072 51,072 0
Ignored 1,482 1,482 0
Failed 571 571 0
Panics 0 0 0
Conformance 96.14% 96.14% 0.00%

Tested main commit: 4f98f6446812f1c5923153f8c7e1beda3a891bfe
Tested PR commit: aebc641137349c83d1b4ad3a834d8daa540dfcad
Compare commits: 4f98f64...aebc641

@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.32%. Comparing base (6ddc2b4) to head (b6a01d5).
⚠️ Report is 985 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5418       +/-   ##
===========================================
+ Coverage   47.24%   60.32%   +13.07%     
===========================================
  Files         476      567       +91     
  Lines       46892    63163    +16271     
===========================================
+ Hits        22154    38102    +15948     
- Misses      24738    25061      +323     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jedel1043 jedel1043 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for the contribution!

This seems to be a direct clone from boa_runtime, so to avoid code churn I think we should prioritize migrating boa_runtime to use boa_wintertc's atob/btoa, and we should follow the same for the rest of the PRs. Can you integrate that change into this PR?

Move the base64 module (atob and btoa) into the boa_wintertc crate as
the first step of migrating the existing Web APIs into the dedicated
TC55 crate.

The implementation is moved unchanged; the only difference from the
boa_runtime version is a short TC55 status note added to the module
documentation.

boa_runtime now depends on boa_wintertc and consumes atob/btoa from it
rather than keeping a duplicate implementation: core/runtime/src/base64
is removed, boa_runtime::base64 becomes a re-export of
boa_wintertc::base64, and Base64Extension delegates to
boa_wintertc::base64::register. The public API of boa_runtime is
unchanged, and the base64 crate dependency is dropped from boa_runtime
since the module was its only user.

The test harness (TestAction and run_test_actions_with) is ported into
boa_wintertc so the migrated unit tests run unchanged. All six base64
unit tests pass.
@KaustubhOG KaustubhOG force-pushed the feat/wintertc-migrate-base64 branch from b6a01d5 to aebc641 Compare July 10, 2026 06:49
@github-actions github-actions Bot added Waiting On Review Waiting on reviews from the maintainers C-Runtime Issues and PRs related to Boa's runtime features labels Jul 10, 2026
@jedel1043

Copy link
Copy Markdown
Member

btw our pipeline is slightly blocked by #5427, so just wait a bit until we merge the PR

@KaustubhOG

Copy link
Copy Markdown
Contributor Author

btw our pipeline is slightly blocked by #5427, so just wait a bit until we merge the PR

yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-Dependencies Pull requests that update a dependency file C-Runtime Issues and PRs related to Boa's runtime features C-Tests Issues and PRs related to the tests. Waiting On Review Waiting on reviews from the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants