Skip to content

Remove dead code from webcore C++ bindings - #35052

Merged
Jarred-Sumner merged 2 commits into
mainfrom
claude/farm/09764849/dead-code-webcore-bindings
Jul 22, 2026
Merged

Remove dead code from webcore C++ bindings#35052
Jarred-Sumner merged 2 commits into
mainfrom
claude/farm/09764849/dead-code-webcore-bindings

Conversation

@robobun

@robobun robobun commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Removes 356 lines of unreferenced C++ from src/jsc/bindings/.

Deleted files

  • src/jsc/bindings/webcore/ServerTimingParser.{cpp,h} (117 lines): the only export, ServerTimingParser::parseServerTiming(), has no callers. ResourceTiming.cpp included the header but builds its PerformanceServerTiming entries from m_serverTiming directly without ever invoking the parser. Brought in alongside the PerformanceServerTiming stubs in Stub performance.markResourceTiming, add PerformanceResourceTiming, PerformanceServerTiming #15341 but never wired up.
  • src/jsc/bindings/webcore/HeaderFieldTokenizer.{cpp,h} (187 lines): the HeaderFieldTokenizer class is only instantiated by ServerTimingParser::parseServerTiming() (above). rg HeaderFieldTokenizer src/ build/debug/codegen/ returns nothing else.

Removed members and static functions

  • ServerTiming::setParameter() and the 1-arg / 3-arg ServerTiming constructors in webcore/ServerTiming.{h,cpp}: their only caller was parseServerTiming(). Only the 5-arg constructor used by isolatedCopy() remains.
  • resolverFunctionCallback in bindings.cpp: static, trivially returns jsUndefined(), zero references anywhere in the tree.
  • containsCORSUnsafeRequestHeaderBytes in webcore/HTTPParsers.cpp: static, its only call site is inside a commented-out block at line ~909. The build sets -Wno-unused-function, so this never produced a warning.

Also drops the now-dangling #include "ServerTimingParser.h" from ResourceTiming.cpp.

Verification

  • rg for each removed symbol across src/, src/codegen/, and build/debug/codegen/ returns only the definitions themselves (and the globbed cxx-sources.txt / NativeFilenameCPP type union, which regenerate).
  • bun bd builds clean.
  • bun bd test test/js/web/timers/performance-entries.test.ts test/js/web/timers/performance.test.js test/js/web/fetch/headers.test.ts passes (107 tests).

ServerTimingParser and HeaderFieldTokenizer were brought in from WebKit
alongside PerformanceServerTiming in #15341 but never wired up:
parseServerTiming() has no callers (ResourceTiming.cpp includes the
header but populates server timing from m_serverTiming directly), and
HeaderFieldTokenizer's only consumer is ServerTimingParser.

Also removes two unreferenced static functions that -Wno-unused-function
was hiding: resolverFunctionCallback in bindings.cpp and
containsCORSUnsafeRequestHeaderBytes in HTTPParsers.cpp (whose only call
site has been commented out).
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Changes

The change removes obsolete JSC and WebCore helper code, including Server-Timing parsing APIs and implementations, an unused resolver callback, a CORS header helper, and an unused include.

Obsolete helper cleanup

Layer / File(s) Summary
Remove Server-Timing parsing APIs
src/jsc/bindings/webcore/ServerTiming.h, src/jsc/bindings/webcore/ServerTiming.cpp, src/jsc/bindings/webcore/ServerTimingParser.*, src/jsc/bindings/webcore/HeaderFieldTokenizer.*, src/jsc/bindings/webcore/ResourceTiming.cpp
Removes Server-Timing parser and tokenizer implementations, simplifies ServerTiming to its full constructor, removes parameter mutation logic, and deletes the unused parser include.
Remove unused parsing helpers
src/jsc/bindings/bindings.cpp, src/jsc/bindings/webcore/HTTPParsers.cpp
Removes the unused resolver callback and CORS unsafe-header-byte scanning helper.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: removing dead C++ bindings code from webcore.
Description check ✅ Passed The description covers the PR scope and includes verification results, matching the template content despite different headings.

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

@robobun

robobun commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator Author
Updated 10:05 PM PT - Jul 21st, 2026

@robobun, your commit 06841ab is building: #77407

@robobun

robobun commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator Author

No test/ changes: this is a pure dead-code removal with no behavior change, so there is no failing condition to regression-test. Verification is the debug build linking cleanly and the existing Performance/Headers suites passing (see PR body). This matches the prior dead-code sweeps (#35002, #34878, #34837), which also carried no test additions.

@claude claude 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.

LGTM — pure dead-code removal, all four symbols confirmed unreferenced. The inline nit about ServerTiming::setParameter is a valid "one more hop" cleanup but non-blocking.

Extended reasoning...

Overview

This PR deletes 323 lines of unreferenced C++ from src/jsc/bindings/: two whole files (ServerTimingParser.{cpp,h}, HeaderFieldTokenizer.{cpp,h}), two static functions (resolverFunctionCallback in bindings.cpp, containsCORSUnsafeRequestHeaderBytes in HTTPParsers.cpp), and one dangling #include in ResourceTiming.cpp. No behavior is changed — every removed symbol was already unreachable.

Verification

I independently confirmed each deletion via repo-wide grep:

  • resolverFunctionCallback: zero hits.
  • containsCORSUnsafeRequestHeaderBytes: only remaining hit is inside the commented-out block at HTTPParsers.cpp:909, matching the PR description.
  • HeaderFieldTokenizer, ServerTimingParser, parseServerTiming: zero hits anywhere in the tree (including build config — the C++ source list is glob-generated by scripts/build/codegen.ts, so no manual list needs updating).
  • RFC7230.h, previously included by HeaderFieldTokenizer.cpp, is still used by HTTPParsers.cpp and HTTPHeaderField.{h,cpp}, so it is not stranded.

Security risks

None. This deletes code that was never called; nothing on any live request path is touched.

Level of scrutiny

Low. Mechanical dead-code removal in vendored WebCore glue, with a stated bun bd clean build and passing performance/headers tests. The only thing that could go wrong is a stale reference from generated code or a hand-maintained source list, and both were checked.

Other factors

The bug-hunter nit is accurate: deleting parseServerTiming() also strands ServerTiming::setParameter() and the single-arg ServerTiming(String&&) ctor. That's a fair follow-on per the "delete dead code in the same PR that makes it dead" rule, but it doesn't affect correctness of what's here and can be folded in or done separately. Not a reason to hold the PR.

Comment thread src/jsc/bindings/webcore/ResourceTiming.cpp
ServerTiming::setParameter() and the 1-arg/3-arg ServerTiming constructors
were only ever called by ServerTimingParser::parseServerTiming(), which the
previous commit removed. Only the 5-arg constructor (used by isolatedCopy)
remains.

@claude claude 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.

LGTM — pure dead-code removal, and the follow-up commit cleaned up the stranded ServerTiming members flagged earlier.

What was reviewed:

  • Re-grepped src/ and repo root for every removed symbol (HeaderFieldTokenizer, ServerTimingParser, parseServerTiming, resolverFunctionCallback, containsCORSUnsafeRequestHeaderBytes, setParameter) — no remaining references outside the commented-out CORS block.
  • Confirmed no build-system file lists the deleted .cpp/.h by name (source list is glob-generated).
  • Checked RFC7230.h (previously included by HeaderFieldTokenizer.cpp) is still used by RFC7230.cpp, so not newly stranded.
Extended reasoning...

Overview

This PR deletes ~356 lines of unreferenced C++ from src/jsc/bindings/: four whole files (ServerTimingParser.{cpp,h}, HeaderFieldTokenizer.{cpp,h}), two static functions (resolverFunctionCallback in bindings.cpp, containsCORSUnsafeRequestHeaderBytes in HTTPParsers.cpp), one dangling #include, and — after my earlier feedback — the transitively-dead ServerTiming::setParameter() plus the 1-arg/3-arg ServerTiming constructors. Nothing is added or modified; every hunk is a deletion.

Security risks

None. All removed code was already unreachable at runtime: two file-local static functions with no call sites, a parser class only reachable via another deleted function, and struct members whose sole caller was that same deleted parser. Deleting dead code cannot change observable behavior. The only line touching security-adjacent semantics is containsCORSUnsafeRequestHeaderBytes, whose sole reference is inside a commented-out block in isCrossOriginSafeRequestHeader — that function unconditionally return true; both before and after this PR.

Level of scrutiny

Low. This is a mechanical dead-code sweep in the same shape as recently-merged #35002, #34878, and #34837. The correctness bar is "does anything still reference these symbols?" — I verified via repo-wide rg that nothing does (the one hit for containsCORSUnsafeRequestHeaderBytes is the commented-out call at HTTPParsers.cpp:909). No explicit build source list names the deleted files, so the glob-generated cxx-sources.txt/NativeFilenameCPP will regenerate cleanly. The PR body reports bun bd links and the Performance/Headers suites pass.

Other factors

My prior inline comment about stranded ServerTiming helpers was fully addressed in 06841ab (the author also caught the unused 3-arg ctor). I checked for further transitive stranding: RFC7230.h (formerly included by the deleted tokenizer) is still consumed by RFC7230.cpp, and the remaining 5-arg ServerTiming ctor is still used by both isolatedCopy() overloads. No new tests are expected for pure deletions with no behavior change, consistent with the cited precedent PRs.

@Jarred-Sumner
Jarred-Sumner merged commit 410abd3 into main Jul 22, 2026
50 of 52 checks passed
@Jarred-Sumner
Jarred-Sumner deleted the claude/farm/09764849/dead-code-webcore-bindings branch July 22, 2026 04:55
robobun added a commit that referenced this pull request Jul 24, 2026
Brings in #35002 (remove ~39k lines of dead Rust) and its follow-ups
(#35019, #35052, #35152, #35225, #35293, #35326). The binary-size
check compares against current main; this branch was 137 commits
behind, so it still carried the dead code main dropped and registered
as +630KB..+1.7MB on x64 while aarch64 linux showed -513KB/-601KB
(different dead-code elimination outcomes per target). This stack's
own native contribution is 19 files / +392 -45 lines; src/js is
net -977 lines (domain.ts +692 vs fast-utf8-stream.ts -856 etc).

Also: drop the hoisted pbkdf2 .bind handlers back to closures (review
nit), and take main's expectations.txt since #34741 audited the stale
ASAN entries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants