Remove dead code from the WebCore bindings, IDL converters, and Rust FFI wrappers
Removes 1,501 lines of code nothing references (the one modified line is the tail of a macro list), across the WebCore/JSC C++ bindings, a few Rust FFI wrapper crates, and stale hawk.toml overrides. No behavior change: everything removed was either never compiled into anything, never instantiated, or written and never read.
How the candidates were found
- Rust: the cross-crate
hawkanalysis configured inhawk.toml(release profile unioned over the 11 shipped targets) run against current main. Almost all of its 1218dead_publicfindings sit in files that one of the open dead-code PRs already touches; those were left alone, and the remainder was re-checked withrg(hawk only analyzes the release profile, so e.g.ntstatus::ACCESS_DENIED, which has a debug-only reader, was kept). - C++: per-header pass over the bindings files not touched by any open dead-code PR, looking for the things the earlier linker-based sweep (#37454) cannot see: declarations without definitions, header-only templates and specializations nothing instantiates, enumerators, macros, and preprocessor branches that can never be taken. Every candidate was checked with
rgacrosssrc/,packages/,scripts/,test/and freshly regeneratedbuild/debug/codegen/, and symbol by symbol against the diffs of the open PRs that touch the same files (no overlap;JSDOMConvert.his also touched by #37062, on a different include line). src/js/was scanned as well and is clean (oxlint's unused checks keep it that way); nothing from there is in this PR.
Removed
ENABLE(BINDING_INTEGRITY) scaffolding in 19 generated-style bindings (536 lines)
JSAbortController, JSAbortSignal, JSBroadcastChannel, JSCloseEvent, JSCustomEvent, JSDOMFormData, JSDOMURL, JSMessageChannel, JSMessageEvent, JSMessagePort, JSPerformanceMark, JSPerformanceObserver, JSPerformanceObserverEntryList, JSPerformanceServerTiming, JSPerformanceTiming, JSTextEncoder, JSWebSocket, JSWorker, JSSubtleCrypto (.cpp). The RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer) these blocks exist for has been commented out since the files were imported, so the file-scope block only declared an unused _ZTV... vtable symbol and the if constexpr (std::is_polymorphic_v<T>) body in toJSNewlyCreated was empty after preprocessing (its only remaining statement sits under PLATFORM(WIN), which is never true in a BUILDING_JSCONLY__ build). JSURLPattern.cpp still performs the check and is untouched; JSFetchHeaders.cpp / JSPerformance.cpp have the same blocks but are claimed by open PRs.
IDL conversion layer (webcore/JSDOMConvert*.h)
JSDOMConvertPromise.h(whole file) and its include inJSSubtleCrypto.cpp: everytoJS<IDLPromise<...>>call there passes avoid-returning functor, whichJSDOMConvertBase.hshort-circuits without instantiating the converter;Converter<IDLPromise>had no callers. Cascade:DOMPromise::create(),promise()and the constructor inJSDOMPromise.h(only the staticwhenPromiseIsSettledremains in use).JSDOMConvertNull.h(whole file) and its includes inJSDOMConvert.h/JSDOMConvertUnion.h: no union namesIDLNull, andConditionalConverter<.., IDLNull, false>never touches the converter.Converter/JSConverterforIDLFloatandIDLUnrestrictedFloat(codegen only emits the double variants),JSConverter<IDLByteString>,JSConverter<IDLObject>,JSConverter<IDLAtomStringAdaptor<T>>, bothIDLRequiresExistingAtomStringAdaptor<T>converters, bothIDLCallbackInterface<T>converters,JSConverter<IDLCallbackFunction<T>>and the two-argumentConverter<IDLCallbackFunction<T>>::convertoverload (the one live caller,JSPerformanceObserver.cpp, uses the global-object overload), theUncachedString/OwnedStringoverloads of the DOMString / USVString converters (nothing constructs those adaptors), andVariadicConverter<IDLAny>/VariadicConverter<IDLInterface<T>>(their consumer,convertVariadicArguments, lives in a header nothing includes).CastedThisErrorBehavior::ReturnEarly(JSDOMCastThisValue.h).
Other JSC / WebCore binding helpers
WTF::EnumTraits<HTTPHeaderName>(98 lines) andEnumTraits<ExceptionCode>:EnumTraits<E>::valuesis only consumed byEnumeratedArray,OptionSetandisZeroBasedContiguousEnum, none of which is used with either enum.ExceptionOr<T&>(never instantiated), theisolatedCopy(ExceptionOr<void>&&)/isolatedCopy(Exception&&)free functions (crossThreadCopyuses the member),ExceptionOr::m_wasReleased,Exception::extra().- Opaque roots: the
ImplType*/ImplType&forwarding overloads ofaddWebCoreOpaqueRoot, all threecontainsWebCoreOpaqueRootoverloads, thenullptr_tconstructor, and theroot(MessagePort*)/root(CryptoKey*)functions only those overloads could reach (plus the includes / forward declarations that existed for them). The one live user,JSAbortController, passes aWebCoreOpaqueRootvalue. BunCommonStrings.h:ConnectionWasClosed,OperationFailed,OperationTimedOut,ec,ed25519,rsa,rsaPss,jwkDsa,jwkG,systemError,x25519(each one expands to aLazyProperty, accessor, initializer and GC visit; thehttp*entries are reached via token pasting and stay).EventLoopTask(Function<void()>&&)(every construction site passes aFunction<void(ScriptExecutionContext&)>),m_bakeGetAsyncLocalStorage(initialized and visited, never read) and a duplicateLazyPropertyOfGlobalObjectalias inBakeAdditionsToGlobalObject.h.- Enumerators nothing names: six of
TaskSource(onlyPostedMessageQueue/WebSocketare used), eight ofEventListener::Type(JSEventListeneris the only subclass). - Branches that can never be taken:
#if 1 ... #elseinCryptoAlgorithmRSA_PSSOpenSSL.cpp,#if ENABLE(OFFSCREEN_CANVAS)/#if ENABLE(MEDIA_SOURCE)includes of headers that do not exist in this tree (JSEventTargetCustom.cpp,JSDOMURL.cpp). - Declarations with no definition:
CryptoKeyOKP::platformExportSpki/platformExportPkcs8,SecretKeyJobCtx::result(),KeyPairJobCtx::deinit(), and the never-definedtemplate<typename Visitor> visitChildrendeclarations next toDECLARE_VISIT_CHILDRENinJSNodePerformanceHooksHistogram.handJSX509Certificate.h. - Unreferenced accessors / fields / macros:
JSNodePerformanceHooksHistogram::histogram()(+ a commented-out declaration),NodeVMSourceTextModule::cachedExecutable(),Worker::isOnline(),OnLoadResult::wasMockand its one store,JSOneShotDirectSink::m_asUint8Arrayand its one store (the flag reaches JS throughstartOptions),expectedEnumerationValues<BufferEncodingType>(noIDLEnumeration<BufferEncodingType>anywhere),G_FALSE/G_TRUEinSecretsLinux.cpp,BUN_WRAP_FWD_VOIDinworkaround-missing-symbols.cpp.
Rust
bun_mimalloc_sys:Heap::malloc/calloc/reallocand themi_heap_calloc/mi_heap_reallocimports only they used (callers go through the rawmi_heap_*functions with a*mut Heap;MimallocArenadeliberately never hands out a&Heap).bun_libdeflate_sys:Compressor::destroy/Decompressor::destroy(the RAII wrappers free directly).bun_uws_sys:App::run,App::listenand theuws_app_run/uws_app_listenimports behind them (the server listens throughlisten_with_config),uws_app_listen_config_t::new, and a duplicateNewAppalias inApp.rs(the live one is inlib.rs).bun_css:DeclarationContext::Keyframes, and the emptygenerated_color_conversionsmarker module whoseuseno longer exists.
hawk.toml: 13 overrides for mysql::status_flags::StatusFlag::* variants that #37229 deleted; hawk now reports them as unknown_item. (The six bun_platform ones in the same state are removed by #37328.)
Verification
bun bd(full debug/ASAN build) passes with the removals;bun bd test test/internal/source-lints/passes. (The branch briefly carried a source lint pinning the removed symbols; it was dropped in 791ffe9, so the PR is now the removals only.)bun bd testpasses ontest/js/web/abort/abort.test.ts,workers/{message-channel,message-event,performance-observer-leak}.test.ts,encoding/text-encoder.test.js,html/FormData.test.ts,url/url.test.ts,broadcastchannel/broadcast-channel.test.ts,crypto/web-crypto.test.ts,streams/streams.test.js,test/js/node/perf_hooks/perf_hooks.test.ts,test/js/bun/perf_hooks/histogram.test.ts,test/js/node/crypto/x509.test.ts,test/js/node/zlib/zlib.test.js,test/js/bun/test/mock/mock-module.test.ts, and on everything intest/js/web/websocket/websocket.test.js,test/js/node/crypto/crypto.key-objects.test.ts,test/js/bun/css/color.test.tsandtest/js/web/workers/worker.test.tsexcept for tests that need the public internet or that spawn subprocesses and time out at their 5 s budget on this (heavily loaded) machine; the sevenworker.test.tsterminate() tests fail identically on a debug build withsrc/jscreset tomain, and the other timeouts hit a different subset on every run.- Rust:
cargo checkof the touched crates passes; the removed items had no readers in anycfg(hawk unions all 11 targets, and thergchecks are cfg-agnostic), so the per-targetcargo checkpass is left to CI.
Left alone on purpose (follow-ups, not in this diff)
WorkerMessagingProxy::isOnline()is now unreferenced, but that header is touched by #37332 on the neighbouring lines.StringAdaptors.h(UncachedString/OwnedString) has no remaining construction sites, butIDLTypes.h(claimed by an open PR) still names the types.- The
TextCodec::encodeside of the text codecs (~700 lines acrossTextCodecCJK/TextCodecSingleByte/TextCodecUserDefined/UnencodableHandling.h) is only reachable fromTextEncoding::encodeForURLParsing, which has no callers;TextEncoding.h/.cppare claimed by #37332, so this should go in one piece once that lands. DOMPromise/JSDOMPromise.cppas a whole become dead once #37062 removesDeferredPromise::whenSettled.- hawk also flags
bun_install::read_without_launch(the shell-side.bunxfast path, whose caller was not carried over in the Rust port), a handful ofbun_jschelpers added four days ago in 9d519e8ca9 (JSPromisesettle_task/resolve_task,VM::has_termination_request,LoopHandle::accepting_work/ref_keep_alive/unref_keep_alive,job.rsaccessors), andbun_sys::ErrorCase::LeakFdOnFail; these look like API surface still settling rather than leftovers, so they are not touched here.