RESOLVED FIXED196744
RemoteObjectRegistry message receiver should be removed when WebPage::close is called instead of waiting until dealloc
https://bugs.webkit.org/show_bug.cgi?id=196744
Summary RemoteObjectRegistry message receiver should be removed when WebPage::close i...
Alex Christensen
Reported 2019-04-09 13:53:47 PDT
RemoteObjectRegistry message receiver should be removed when WebPage::close is called instead of waiting until dealloc
Attachments
Patch (9.18 KB, patch)
2019-04-09 14:04 PDT, Alex Christensen
no flags
Patch (12.08 KB, patch)
2019-04-09 18:53 PDT, Alex Christensen
no flags
Patch (11.86 KB, patch)
2019-04-10 10:53 PDT, Alex Christensen
no flags
Alex Christensen
Comment 1 2019-04-09 14:04:05 PDT
Chris Dumez
Comment 2 2019-04-09 14:52:24 PDT
Comment on attachment 367070 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=367070&action=review > Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:-354 > - WebKit::WebProcess::singleton().removeMessageReceiver(Messages::RemoteObjectRegistry::messageReceiverName(), _page->pageID()); What guarantees that WebPage::close() has been called or will be? To remove the message receiver?
Chris Dumez
Comment 3 2019-04-09 14:53:45 PDT
Comment on attachment 367070 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=367070&action=review >> Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:-354 >> - WebKit::WebProcess::singleton().removeMessageReceiver(Messages::RemoteObjectRegistry::messageReceiverName(), _page->pageID()); > > What guarantees that WebPage::close() has been called or will be? To remove the message receiver? I think ideally RemoteObjectRegistry would register / unregister itself, it would be less fragile.
Alex Christensen
Comment 4 2019-04-09 18:53:22 PDT
EWS Watchlist
Comment 5 2019-04-09 18:55:04 PDT
Attachment 367095 [details] did not pass style-queue: ERROR: Source/WebKit/Shared/API/Cocoa/RemoteObjectRegistry.mm:46: Code inside a namespace should not be indented. [whitespace/indent] [4] Total errors found: 1 in 10 files If any of these errors are false positives, please file a bug against check-webkit-style.
Chris Dumez
Comment 6 2019-04-09 19:23:25 PDT
Comment on attachment 367095 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=367095&action=review > Source/WebKit/Shared/API/Cocoa/RemoteObjectRegistry.mm:67 > + if (m_shouldUnregisterMessageHandler) { m_shouldUnregisterMessageHandler is a bit of a confusing name. It is not so much about saying we should unregister, it is about knowing if we're registered. I think we should change the name to something like: m_isRegisteredAsMessageReceiver. Alternatively, we could drop m_shouldUnregisterMessageHandler / m_messageReceiverID and replace them by a m_unregisterMessageReceiver WTF::Function data member. > Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:112 > + page.setRemoteObjectRegistry(*_remoteObjectRegistry); Why don't we do this in the RemoteObjectRegistry constructor instead? Seems safer.
Alex Christensen
Comment 7 2019-04-10 10:53:42 PDT
EWS Watchlist
Comment 8 2019-04-10 10:55:31 PDT
Attachment 367139 [details] did not pass style-queue: ERROR: Source/WebKit/Shared/API/Cocoa/RemoteObjectRegistry.mm:46: Code inside a namespace should not be indented. [whitespace/indent] [4] Total errors found: 1 in 10 files If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Commit Bot
Comment 9 2019-04-10 11:35:38 PDT
Comment on attachment 367139 [details] Patch Clearing flags on attachment: 367139 Committed r244139: <https://trac.webkit.org/changeset/244139>
WebKit Commit Bot
Comment 10 2019-04-10 11:35:39 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 11 2019-04-10 11:36:18 PDT
Darin Adler
Comment 12 2019-04-13 13:58:30 PDT
Comment on attachment 367139 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=367139&action=review > Tools/TestWebKitAPI/Tests/WebKitCocoa/BundleRetainPagePlugIn.mm:40 > + [browserContextController _remoteObjectRegistry]; What is this mysterious line of code? Calling it for side effects or something?
Alex Christensen
Comment 13 2019-04-15 11:02:56 PDT
Yes, calling it instantiates a _WKRemoteObjectRegistry associated with this page and would have caused an assertion in the test that uses this bundle class without this fix.
Darin Adler
Comment 14 2019-04-17 10:06:44 PDT
Could we write a comment to make it less mysterious. "Would have caused an assertion" is sort of a mechanical explanation. Would like a short, clear, higher level explanation ideally.
Alex Christensen
Comment 15 2019-04-17 10:41:51 PDT
Note You need to log in before you can comment on or make changes to this bug.