RESOLVED FIXED307347
[check-webkit-style] Fix false positive in safercpp/protected_getter_for_init checker
https://bugs.webkit.org/show_bug.cgi?id=307347
Summary [check-webkit-style] Fix false positive in safercpp/protected_getter_for_init...
David Kilzer (:ddkilzer)
Reported 2026-02-09 09:43:09 PST
The `check-webkit-style` script produces false positives for code like: ```cpp if (RefPtr document = viewportDocumentForFrame(protect(mainFrame()))) ``` Error message: ``` error: [safercpp/protected_getter_for_init] Do not use protect() for variable initialization. ``` This is a false positive because `protect(mainFrame())` is an argument to `viewportDocumentForFrame()`, not the direct initializer for `document`. The checker should only warn when `protect()`, `protectedFoo()`, or `checkedFoo()` functions are used as the direct initializer, not when they are nested inside other function calls.
Attachments
Radar WebKit Bug Importer
Comment 1 2026-02-09 09:43:16 PST
David Kilzer (:ddkilzer)
Comment 2 2026-02-09 11:15:53 PST
EWS
Comment 3 2026-02-09 16:42:43 PST
Committed 307125@main (d93063803637): <https://commits.webkit.org/307125@main> Reviewed commits have been landed. Closing PR #58222 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.