Bug 231956 - WebKit Objective-C classes should use weak delegates
Summary: WebKit Objective-C classes should use weak delegates
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-10-19 08:38 PDT by David Kilzer (:ddkilzer)
Modified: 2021-10-20 11:56 PDT (History)
3 users (show)

See Also:


Attachments
Patch v1 (3.59 KB, patch)
2021-10-19 08:42 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Patch v2 (fix typo in title) (3.59 KB, patch)
2021-10-19 10:29 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2021-10-19 08:38:50 PDT
WebKit Objective-C classes should use weak delegates.

Found by doing a search for delegate properties using `assign` in WebKit:

    $ find Source/WebKit -name \*.h -exec grep -l 'assign.*delegate' {} \;

Note that 3 out of the 4 fixes are just documenting that the `_delegate` instance variable is already held using WeakObjCPtr<>.

The fourth change actually makes the `delegate` property weak.
Comment 1 Radar WebKit Bug Importer 2021-10-19 08:39:03 PDT
<rdar://problem/84416233>
Comment 2 David Kilzer (:ddkilzer) 2021-10-19 08:42:11 PDT
Created attachment 441730 [details]
Patch v1
Comment 3 David Kilzer (:ddkilzer) 2021-10-19 10:29:52 PDT
Created attachment 441753 [details]
Patch v2 (fix typo in title)
Comment 4 Brent Fulgham 2021-10-19 14:44:44 PDT
Comment on attachment 441753 [details]
Patch v2 (fix typo in title)

r=me
Comment 5 David Kilzer (:ddkilzer) 2021-10-20 11:52:57 PDT
Comment on attachment 441753 [details]
Patch v2 (fix typo in title)

Marking cq+ because I'm not sure if the ios bot will ever "fail" to allow a retry, and the ios-wk2 and api-ios bots are 8-24 hours behind.

In the "worst case", this patch would change a flakey crashing test to a flakey failing test, so only test expectations would need to be updated (and maybe a new bug filed for the non-crashing flakiness).
Comment 6 EWS 2021-10-20 11:56:46 PDT
Committed r284558 (243300@main): <https://commits.webkit.org/243300@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 441753 [details].