Bug 231659
Summary: | removeAllScriptMessageHandlers causes retain where removeScriptMessageHandlerForName does not | ||
---|---|---|---|
Product: | WebKit | Reporter: | Peter N Lewis <peter> |
Component: | WebKit API | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | Normal | CC: | achristensen, ggaren, webkit-bug-importer |
Priority: | P2 | Keywords: | InRadar |
Version: | Safari 15 | ||
Hardware: | Mac (Intel) | ||
OS: | macOS 11 |
Peter N Lewis
In my WKWebView controller, I use:
[i_webView.configuration.userContentController addScriptMessageHandler:self name:@"KeyboardMaestro"];
This creates a reference to the controller (self). The controller will not be dealloc'ed when the window is closed.
If in the willClose method I do:
[strongSelf1->i_webView.configuration.userContentController removeScriptMessageHandlerForName:@"KeyboardMaestro"];
The controller will dealloc normally.
However, if I instead fo:
[strongSelf1->i_webView.configuration.userContentController removeAllScriptMessageHandlers];
The controller does not dealloc, so a reference is retained.
Since removeAllScriptMessageHandlers should cover the case of removeScriptMessageHandlerForName:@"KeyboardMaestro" and more, this seems to be a bug.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/84450759>
Alex Christensen
*** This bug has been marked as a duplicate of bug 228271 ***