WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
312296
WebKitTestRunner leaks WKTypeRef out-parameter value from WKBundlePagePostSynchronousMessageForTesting()
https://bugs.webkit.org/show_bug.cgi?id=312296
Summary
WebKitTestRunner leaks WKTypeRef out-parameter value from WKBundlePagePostSyn...
David Kilzer (:ddkilzer)
Reported
2026-04-14 12:00:55 PDT
Several functions in `InjectedBundle.cpp` leak the retained `WKTypeRef` returned via the out-parameter of `WKBundlePagePostSynchronousMessageForTesting()`. The out-parameter returns a +1 retained object (via `toAPILeakingRef()`), but these callers never adopt or release it. Two patterns are affected: 1. `shouldForceRepaint()` and `isPrinting()` pass the raw `WKTypeRef` to `booleanValue()` without ever releasing it, leaking an `API::Boolean` object (visible as `WKNSNumber` in leak reports). 2. `getBackgroundFetchIdentifier()`, `lastAddedBackgroundFetchIdentifier()`, `lastRemovedBackgroundFetchIdentifier()`, `lastUpdatedBackgroundFetchIdentifier()`, and `backgroundFetchState()` return `static_cast<WKStringRef>(result)` into a `WKRetainPtr<WKStringRef>`. The `WKRetainPtr` constructor retains the pointer again without adopting the existing +1, so the original ownership is never balanced. Other callers in the same file (`shouldProcessWorkQueue()`, `isGeolocationClientActive()`, `imageCountInGeneralPasteboard()`, `userMediaPermissionRequestCount()`) already use `adoptWK(result).get()` correctly.
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2026-04-14 12:09:29 PDT
<
rdar://problem/174764247
>
David Kilzer (:ddkilzer)
Comment 2
2026-04-14 12:12:17 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/62757
EWS
Comment 3
2026-04-15 21:39:16 PDT
Committed
311347@main
(112967a3c973): <
https://commits.webkit.org/311347@main
> Reviewed commits have been landed. Closing PR #62757 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug