Skip to content

fix(web): make URLSearchParams.prototype.size configurable - #25762

Merged
Jarred-Sumner merged 1 commit into
oven-sh:mainfrom
darwin808:claude/fix-urlsearchparams-size-configurable
Jan 2, 2026
Merged

Jarred-Sumner merged 1 commit into
oven-sh:mainfrom
darwin808:claude/fix-urlsearchparams-size-configurable

Conversation

@darwin808

Copy link
Copy Markdown
Contributor

Summary

  • Make URLSearchParams.prototype.size configurable by removing the DontDelete attribute
  • This aligns with the Web IDL specification which specifies that getters should be configurable

Before

Object.getOwnPropertyDescriptor(URLSearchParams.prototype, 'size').configurable
// false

After

Object.getOwnPropertyDescriptor(URLSearchParams.prototype, 'size').configurable
// true

Test plan

  • Added test case verifying that size property is configurable and enumerable
  • Run: bun bd test test/js/web/html/URLSearchParams.test.ts -t "size property should be configurable"

Fixes #9251

Remove DontDelete attribute from the size property on URLSearchParams
prototype to make it configurable, matching the Web IDL specification.

Before: Object.getOwnPropertyDescriptor(URLSearchParams.prototype, 'size').configurable === false
After: Object.getOwnPropertyDescriptor(URLSearchParams.prototype, 'size').configurable === true

Fixes oven-sh#9251
@coderabbitai

coderabbitai Bot commented Dec 30, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Removes the DontDelete property attribute from URLSearchParams.prototype.size, changing the property attributes from CustomAccessor | ReadOnly | DontDelete to CustomAccessor | ReadOnly. This makes the property configurable. Adds test cases to verify the property descriptor's configurable and enumerable attributes.

Changes

Cohort / File(s) Change Summary
URLSearchParams bindings
src/bun.js/bindings/webcore/JSURLSearchParams.cpp
Removed DontDelete attribute from the size property in the prototype table, allowing the property to be configurable while maintaining CustomAccessor and ReadOnly attributes
URLSearchParams tests
test/js/web/html/URLSearchParams.test.ts
Added test cases verifying that URLSearchParams.prototype.size property descriptor has configurable and enumerable set to true

Suggested reviewers

  • taylordotfish

Pre-merge checks

✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title clearly and concisely describes the main change: making URLSearchParams.prototype.size configurable, which matches the core modification in the changeset.
Description check ✅ Passed The pull request description fully addresses the template with clear explanation of what the PR does and includes a test plan that verifies the implementation.
Linked Issues check ✅ Passed The pull request directly addresses issue #9251 by removing the DontDelete attribute from URLSearchParams.prototype.size, making the property configurable as required.
Out of Scope Changes check ✅ Passed All changes are within scope: the property attribute modification targets the specific issue, and test additions directly verify the fix without introducing unrelated modifications.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 604c83c and f2fbc87.

📒 Files selected for processing (2)
  • src/bun.js/bindings/webcore/JSURLSearchParams.cpp
  • test/js/web/html/URLSearchParams.test.ts
🧰 Additional context used
📓 Path-based instructions (4)
src/bun.js/bindings/**/*.cpp

📄 CodeRabbit inference engine (CLAUDE.md)

src/bun.js/bindings/**/*.cpp: Create classes in three parts in C++ when there is a public constructor: Foo (JSDestructibleObject), FooPrototype (JSNonFinalObject), and FooConstructor (InternalFunction)
Define properties using HashTableValue arrays in C++ JavaScript class bindings
Add iso subspaces for C++ classes with fields in JavaScript class bindings
Cache structures in ZigGlobalObject for JavaScript class bindings

Files:

  • src/bun.js/bindings/webcore/JSURLSearchParams.cpp
test/**/*.test.{ts,js,jsx,tsx,mjs,cjs}

📄 CodeRabbit inference engine (test/CLAUDE.md)

test/**/*.test.{ts,js,jsx,tsx,mjs,cjs}: Use bun:test with files that end in *.test.{ts,js,jsx,tsx,mjs,cjs}
Do not write flaky tests. Never wait for time to pass in tests; always wait for the condition to be met instead of using an arbitrary amount of time
Never use hardcoded port numbers in tests. Always use port: 0 to get a random port
Prefer concurrent tests over sequential tests using test.concurrent or describe.concurrent when multiple tests spawn processes or write files, unless it's very difficult to make them concurrent
When spawning Bun processes in tests, use bunExe and bunEnv from harness to ensure the same build of Bun is used and debug logging is silenced
Use -e flag for single-file tests when spawning Bun processes
Use tempDir() from harness to create temporary directories with files for multi-file tests instead of creating files manually
Prefer async/await over callbacks in tests
When callbacks must be used and it's just a single callback, use Promise.withResolvers to create a promise that can be resolved or rejected from a callback
Do not set a timeout on tests. Bun already has timeouts
Use Buffer.alloc(count, fill).toString() instead of 'A'.repeat(count) to create repetitive strings in tests, as ''.repeat is very slow in debug JavaScriptCore builds
Use describe blocks for grouping related tests
Always use await using or using to ensure proper resource cleanup in tests for APIs like Bun.listen, Bun.connect, Bun.spawn, Bun.serve, etc
Always check exit codes and test error scenarios in error tests
Use describe.each() for parameterized tests
Use toMatchSnapshot() for snapshot testing
Use beforeAll(), afterEach(), beforeEach() for setup/teardown in tests
Track resources (servers, clients) in arrays for cleanup in afterEach()

Files:

  • test/js/web/html/URLSearchParams.test.ts
**/*.test.ts?(x)

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.test.ts?(x): Never use bun test directly - always use bun bd test to run tests with debug build changes
For single-file tests, prefer -e flag over tempDir
For multi-file tests, prefer tempDir and Bun.spawn over single-file tests
Use normalizeBunSnapshot to normalize snapshot output of tests
Never write tests that check for 'panic', 'uncaught exception', or similar strings in test output
Use tempDir from harness to create temporary directories - do not use tmpdirSync or fs.mkdtempSync
When spawning processes in tests, expect stdout before expecting exit code for more useful error messages on test failure
Do not write flaky tests - do not use setTimeout in tests; instead await the condition to be met
Verify tests fail with USE_SYSTEM_BUN=1 bun test <file> and pass with bun bd test <file> - tests are invalid if they pass with USE_SYSTEM_BUN=1
Test files must end with .test.ts or .test.tsx
Avoid shell commands like find or grep in tests - use Bun's Glob and built-in tools instead

Files:

  • test/js/web/html/URLSearchParams.test.ts
test/**/*.test.ts?(x)

📄 CodeRabbit inference engine (CLAUDE.md)

Always use port: 0 in tests - do not hardcode ports or use custom random port number functions

Files:

  • test/js/web/html/URLSearchParams.test.ts
🧠 Learnings (4)
📚 Learning: 2025-10-01T21:59:54.571Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 23169
File: src/bun.js/bindings/webcore/JSDOMConvertEnumeration.h:47-74
Timestamp: 2025-10-01T21:59:54.571Z
Learning: In the new bindings generator (bindgenv2) for `src/bun.js/bindings/webcore/JSDOMConvertEnumeration.h`, the context-aware enumeration conversion overloads intentionally use stricter validation (requiring `value.isString()` without ToString coercion), diverging from Web IDL semantics. This is a design decision documented in comments.

Applied to files:

  • src/bun.js/bindings/webcore/JSURLSearchParams.cpp
📚 Learning: 2025-12-16T00:21:32.179Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T00:21:32.179Z
Learning: Applies to src/bun.js/bindings/**/*.cpp : Define properties using HashTableValue arrays in C++ JavaScript class bindings

Applied to files:

  • src/bun.js/bindings/webcore/JSURLSearchParams.cpp
📚 Learning: 2025-09-05T18:44:43.223Z
Learnt from: markovejnovic
Repo: oven-sh/bun PR: 21728
File: src/bun.js/bindings/bindings.cpp:6429-6432
Timestamp: 2025-09-05T18:44:43.223Z
Learning: The JSC::JSMap::size() method in JavaScriptCore returns a value that can be represented as uint32_t, and the binding functions in src/bun.js/bindings/bindings.cpp correctly use uint32_t as the return type for JSC__JSMap__size. JavaScript Maps are practically limited to 2^32 - 1 elements.

Applied to files:

  • src/bun.js/bindings/webcore/JSURLSearchParams.cpp
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/test/v8/v8.test.ts : Add corresponding test cases to test/v8/v8.test.ts using checkSameOutput() function to compare Node.js and Bun output

Applied to files:

  • test/js/web/html/URLSearchParams.test.ts
🔇 Additional comments (1)
src/bun.js/bindings/webcore/JSURLSearchParams.cpp (1)

186-186: LGTM! Property is now configurable per Web IDL spec.

The removal of PropertyAttribute::DontDelete correctly makes the size property configurable and enumerable, aligning with Web IDL requirements for readonly attributes.

Note: The length property on line 185 retains DontDelete | DontEnum, making it non-configurable and non-enumerable. This difference appears intentional since size is the standard property while length is a Bun-specific extension.

⚠️ Observation: The file header (line 3) states "DO NOT MODIFY!" indicating this is generated code. If this file is typically auto-generated, you may need to update the source IDL definition or generator configuration to ensure this change persists across regenerations.

@Jarred-Sumner
Jarred-Sumner merged commit 27ff6aa into oven-sh:main Jan 2, 2026
53 of 55 checks passed
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.

URLSearchParams.prototype.size should be configurable

2 participants