Bug 313900

Summary: [WebKitLegacy] Eliminate WK_BUILD_FOR_TESTING by refactoring to Objective-C class method SPI
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: WebKit Misc.Assignee: David Kilzer (:ddkilzer) <ddkilzer>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 217960    
Bug Blocks:    

David Kilzer (:ddkilzer)
Reported 2026-05-02 07:55:18 PDT
WebKitLegacy.framework uses the `WK_BUILD_FOR_TESTING` mechanism to conditionally export `TestWebPreferencesCacheModelForMainBundle()` for TestWebKitAPI. This is the only testing symbol exported from WebKitLegacy, and its sole consumer is the `WebKitLegacy.CacheModelForMainBundle` API test. The mechanism prevents TestWebKitAPI from linking to WebKitLegacy.framework in Production builds because the testing symbol is not exported in the Production configuration. It is also overly complex for one symbol, involving six coordinated pieces: the `WK_BUILD_FOR_TESTING` xcconfig variable, the `-DENABLE_BUILD_FOR_TESTING` compiler flag, the `#if ENABLE(BUILD_FOR_TESTING)` guard in `WebPreferences.mm`, the `-extra-private-header TestingFunctions.h` TAPI flag, the `WebKit.Testing.exp` export symbol list, and a conditional block in the "Generate Export Files" build phase script.
Attachments
Radar WebKit Bug Importer
Comment 1 2026-05-02 07:55:26 PDT
David Kilzer (:ddkilzer)
Comment 2 2026-05-02 08:01:09 PDT
*** Bug 313841 has been marked as a duplicate of this bug. ***
David Kilzer (:ddkilzer)
Comment 3 2026-05-02 08:03:39 PDT
EWS
Comment 4 2026-05-04 13:55:24 PDT
Committed 312551@main (029c5391653d): <https://commits.webkit.org/312551@main> Reviewed commits have been landed. Closing PR #64106 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.