TL/DR: Upon "Develop" menu action (say "Start JavaScript Debugging"), do not call inspectorController, but rather evaluate "InspectorFrontendAPI.startDebugging" in the front-end page. I prepared a fix for WebKit in https://bugs.webkit.org/show_bug.cgi?id=62985, but I need your help with WebKit2 implementation. Background: I'm currently working on eliminating unnecessary methods from InspectorController.h: bool profilerEnabled(); void enableProfiler(); void startUserInitiatedProfiling(); bool isRecordingUserInitiatedProfile() const; void stopUserInitiatedProfiling(); void disableProfiler(); void showAndEnableDebugger(); bool debuggerEnabled(); void disableDebugger(); void startTimelineProfiler(); void stopTimelineProfiler(); bool timelineProfilerEnabled(); void showConsole(); WebCore does not use them, pretty much all of these are used from WebKit's support for "Develop" menu. Today, enabling debugging goes all the way: [EXISTING CONTROL FLOW] Action handler -> (via WebCore API above) -> InspectorController -> InspectorDebuggerAgent -> (via Inspector protocol) -> Front-end As a result, it looks like inspector backend has two client: 1) actual front-end and 2) develop menu implementation. Hence, we have methods such as "debuggerWasEnabled" in the protocol and "showAndEnableDebugger" in InspectorController that make sure things are in sync. It would be more straightforward if we could make "Develop" menu actions implementation talk to the backend via the front-end. I.e. [PROPOSED CONTROL FLOW] Action handler -> Open Front-end, then -> (via Frontend API) -> Front-end -> (make all calls against backend as the front-end would have) As a result - everything goes over single channel - backend and front-end are talking to each other only, there is no need to sync "Develop" menu state with the front-end via the backend - all methods above + some weird methods from the protocol vanish
Created attachment 116072 [details] Patch
Comment on attachment 116072 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=116072&action=review > Source/WebKit2/WebProcess/WebPage/WebInspector.cpp:164 > + if (m_frontendClient) { Prefer early return.
Committed r100914: <http://trac.webkit.org/changeset/100914>
Comment on attachment 116072 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=116072&action=review > Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp:-53 > ASSERT(inspectorPage); > if (!inspectorPage) > return; > - > - inspectorPage->corePage()->inspectorController()->setInspectorFrontendClient(adoptPtr(new WebInspectorFrontendClient(m_page, inspectorPage))); The rest of this method can be emptied.
At least the early return. The assert should stay.