Skip to content

feat(builtins): implement JsWeakSet safe wrapper#4739

Merged
jedel1043 merged 5 commits intoboa-dev:mainfrom
KaustubhOG:feat/js-weak-set-wrapper
Feb 28, 2026
Merged

feat(builtins): implement JsWeakSet safe wrapper#4739
jedel1043 merged 5 commits intoboa-dev:mainfrom
KaustubhOG:feat/js-weak-set-wrapper

Conversation

@KaustubhOG
Copy link
Copy Markdown
Contributor

Implements JsWeakSet as a safe Rust wrapper around the ECMAScript WeakSet builtin, as part of #2098.

Changes

  • core/engine/src/object/builtins/jsweakset.rs — new JsWeakSet wrapper with all methods
  • core/engine/src/object/builtins/mod.rs — registered and re-exported JsWeakSet
  • examples/src/bin/jsweakset.rs — usage example

Methods implemented

  • new — creates an empty WeakSet
  • add — adds an object to the set
  • has — checks if an object exists
  • delete — removes an object
  • from_object — converts JsObject to JsWeakSet

Follows the same pattern as JsWeakMap (#4738) and JsSet.

Closes part of #2098

@KaustubhOG KaustubhOG requested a review from a team as a code owner February 26, 2026 10:56
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 26, 2026

Test262 conformance changes

Test result main count PR count difference
Total 52,862 52,862 0
Passed 49,504 49,505 +1
Ignored 2,262 2,261 -1
Failed 1,096 1,096 0
Panics 0 0 0
Conformance 93.65% 93.65% +0.00%
Fixed tests (1):
test/staging/sm/expressions/optional-chain-first-expression.js (previously Ignored)

Comment thread core/engine/src/object/builtins/jsweakset.rs Outdated
@jedel1043 jedel1043 added A-Enhancement New feature or request C-Builtins PRs and Issues related to builtins/intrinsics A-API Changes related to public APIs Waiting On Author Waiting on PR changes from the author labels Feb 27, 2026
Copy link
Copy Markdown
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

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

LGTM!

@jedel1043 jedel1043 removed the Waiting On Author Waiting on PR changes from the author label Feb 27, 2026
@KaustubhOG
Copy link
Copy Markdown
Contributor Author

LGTM!

hey i made some changes in #4724 as you suggested to me is it loooks fine

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 27, 2026

Codecov Report

❌ Patch coverage is 0% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.18%. Comparing base (6ddc2b4) to head (2c419a4).
⚠️ Report is 701 commits behind head on main.

Files with missing lines Patch % Lines
core/engine/src/object/builtins/jsweakset.rs 0.00% 28 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4739      +/-   ##
==========================================
+ Coverage   47.24%   57.18%   +9.93%     
==========================================
  Files         476      552      +76     
  Lines       46892    60494   +13602     
==========================================
+ Hits        22154    34591   +12437     
- Misses      24738    25903    +1165     

☔ View full report in Codecov by Sentry.
📢 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
Copy link
Copy Markdown
Member

Looks fine, just needs a cargo fmt run

@KaustubhOG
Copy link
Copy Markdown
Contributor Author

KaustubhOG commented Feb 27, 2026

Looks fine, just needs a cargo fmt run

Yup ,while solving the conflicts in Jsweakmap and and weakset ,Ithe web one we uses I think it didn't do the cargo fmt , let me do Manually

@jedel1043 jedel1043 enabled auto-merge February 27, 2026 23:54
@jedel1043 jedel1043 added this pull request to the merge queue Feb 27, 2026
Merged via the queue into boa-dev:main with commit a0a2bea Feb 28, 2026
19 checks passed
@KaustubhOG
Copy link
Copy Markdown
Contributor Author

@jedel1043 did the jsgeneratorfunction and the Asyncgenerator isn't checked on original pr #2098 is it currently outof scope(if they are in scope or not yet solved I think it can be fixed with the same process if i am not mistaken ,if that's the case I loved to raise pr for it), also thanks for quick guidence in this pr. I learned alot

akash-R-A-J pushed a commit to akash-R-A-J/boa that referenced this pull request Mar 1, 2026
Implements `JsWeakSet` as a safe Rust wrapper around the ECMAScript
`WeakSet` builtin, as part of boa-dev#2098.

## Changes
- `core/engine/src/object/builtins/jsweakset.rs` — new `JsWeakSet`
wrapper with all methods
- `core/engine/src/object/builtins/mod.rs` — registered and re-exported
`JsWeakSet`
- `examples/src/bin/jsweakset.rs` — usage example

## Methods implemented
- `new` — creates an empty WeakSet
- `add` — adds an object to the set
- `has` — checks if an object exists
- `delete` — removes an object
- `from_object` — converts `JsObject` to `JsWeakSet`

Follows the same pattern as `JsWeakMap` (boa-dev#4738) and `JsSet`.

Closes part of boa-dev#2098
ashddev pushed a commit to ashddev/boa that referenced this pull request Mar 2, 2026
Implements `JsWeakSet` as a safe Rust wrapper around the ECMAScript
`WeakSet` builtin, as part of boa-dev#2098.

## Changes
- `core/engine/src/object/builtins/jsweakset.rs` — new `JsWeakSet`
wrapper with all methods
- `core/engine/src/object/builtins/mod.rs` — registered and re-exported
`JsWeakSet`
- `examples/src/bin/jsweakset.rs` — usage example

## Methods implemented
- `new` — creates an empty WeakSet
- `add` — adds an object to the set
- `has` — checks if an object exists
- `delete` — removes an object
- `from_object` — converts `JsObject` to `JsWeakSet`

Follows the same pattern as `JsWeakMap` (boa-dev#4738) and `JsSet`.

Closes part of boa-dev#2098
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-API Changes related to public APIs A-Enhancement New feature or request C-Builtins PRs and Issues related to builtins/intrinsics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants