Summary: | [GTK] Assertion failure in Inspector::RemoteInspector::setRemoteInspectorClient when disposing WebKitWebContext | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Michael Catanzaro <mcatanzaro> | ||||
Component: | WebKitGTK | Assignee: | Nobody <webkit-unassigned> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | bburg, berto, bugs-noreply, buildbot, cgarcia, gustavo, joepeck, keith_miller, mark.lam, mcatanzaro, msaboff, saam | ||||
Priority: | P2 | ||||||
Version: | Other | ||||||
Hardware: | PC | ||||||
OS: | Linux | ||||||
Attachments: |
|
Description
Michael Catanzaro
2017-05-03 20:57:20 PDT
So the problem is pretty simple. In WebKitWebContext.cpp, in the destructor of WebKitAutomationClient: ~WebKitAutomationClient() { Inspector::RemoteInspector::singleton().setRemoteInspectorClient(nullptr); } This is problematic because (a) RemoteInspector::setRemoteInspectorClient asserts that its argument is nonnull, and (b) it also asserts that it has never been called before. I'm actually confused why this does not cause Epiphany to crash on start. A new WebKitAutomationClient is constructed whenever constructing a WebKitWebContext. The WebKitAutomationClient constructor calls Inspector::RemoteInspector::singleton().setRemoteInspectorClient(this). Note that's on the singleton instance of the Inspector::RemoteInspector. That happens *every* time a WebKitWebContext is created, so the creation of a second WebKitWebContext will trigger a second call to RemoteInspector::setRemoteInspectorClient, which we have previously established can only be called once (because there is no way to ever unset RemoteInspector::m_client). And Epiphany always creates two WebKitWebContexts: the default WebKitWebContext (created by WebKit) and its own EphyWebContext. I must be missing something important, because no such crash is occurring on startup. I don't understand why. Oh I get it, Epiphany actually does not create the default web context, because WebKit creates it lazily on-demand, and Epiphany just never uses it. I remember now previously being chided for using the default web context in Epiphany. That's fixed, and that's why it doesn't crash on start. So I think we broke use of multiple WebKitWebContexts within the same UI process. Do we not have any tests for this, or did we just not notice because our debug bot is always red? Yes, we have a client per WebProcessPool, but the RemoteInspector is a singleton and only allows one client. The asserts are indeed wrong, it's perfectly valid to set nullptr client, and both Cocoa and GTK+ implementations do that when the client is destroyed. One possible solution could be to allow setting more than one client, but I think we shouldn't allow to have automation enabled in more than one WebProcessPool at the same time. Created attachment 309029 [details]
Patch
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API Committed r216243: <http://trac.webkit.org/changeset/216243> |