Bug 302041

Summary: In JSWebAssemblyInstance.cpp, replace the blanket "using namespace Wasm" directive with specific using declarations
Product: WebKit Reporter: Vassili Bykov <v_bykov>
Component: JavaScriptCoreAssignee: Vassili Bykov <v_bykov>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Vassili Bykov
Reported 2025-11-05 14:36:45 PST
Because of the unified source build mechanism, the "using namespace Wasm" directive in the JSC namespace in JSWebAssemblyInstance.cpp can cause a random build failure if a source file that uses a name from JSC which is also defined in Wasm is included in the unified source following JSWebAssemblyInstance.cpp. One such name is InternalFunction. There is JSC::InternalFunction, and also JSC::Wasm::InternalFunction. JSC::InternalFunction is used by its unqualified name as a superclass of many classes in JSC. The "using namespace Wasm" directive in JSWebAssemblyInstance.cpp brings JSC::Wasm::InternalFunction into the namespace JSC as a second definition associated with that unqualified name. This duplicate definition is then present in any namespace JSC definition appearing after JSWebAssemblyInstance.cpp in the unified source. Any file included into the unified source afterwards that defines a subclass of InternalFunction will then fail with an ambiguous reference error. To avoid this fragility, JSWebAssemblyInstance.cpp should use specific using declarations for the Wasm names it needs.
Attachments
Radar WebKit Bug Importer
Comment 1 2025-11-05 14:36:51 PST
Vassili Bykov
Comment 2 2025-11-05 14:39:01 PST
EWS
Comment 3 2025-11-05 20:14:06 PST
Committed 302625@main (b17bfa757d0c): <https://commits.webkit.org/302625@main> Reviewed commits have been landed. Closing PR #53483 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.