Trying to remove all message handlers from a WKUserContentController using removeAllScriptMessageHandlers() doesn't seem to be working. There is not an API to view all message handlers from a WKUserContentController, but I have noticed that trying to remove all of them using removeAllScriptMessageHandlers() doesn't release those handlers, as by adding them, the WKUserContentController seems to retain them. This I can reproduce 100% of the time. And in comparison, using removeScriptMessageHandler(forName:) seems to be working fine, and the message handlers gets released. Having a removeAllScriptMessageHandlers() is specially helpful when, like in my case, you have many different message handlers, with different names. If necessary I can provide with a small working prototype to test it. Cheers.
Created attachment 434252 [details] Patch
Committed r280325 (239972@main): <https://commits.webkit.org/239972@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 434252 [details].
<rdar://problem/81137245>
*** Bug 231659 has been marked as a duplicate of this bug. ***