Regression(r238330): A lot of WebInspector tests are crashing on the bots
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Nov 2018 09:13:49 +0000 (09:13 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Nov 2018 09:13:49 +0000 (09:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191814

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2018-11-19
Reviewed by Ryosuke Niwa.

Expose the expected connection type from the UIProcess into the WebProcess.
When there is a local inspector connection to the UIProcess expose it as
a local frontend channel to the inspector controllers in the Page.

* UIProcess/WebPageInspectorTargetAgent.h:
* UIProcess/WebPageInspectorTargetAgent.cpp:
(WebKit::WebPageInspectorTargetAgent::frontendChannel):
An additional FrontendChannel class is not needed, just use self.

(WebKit::WebPageInspectorTargetAgent::WebPageInspectorTargetAgent):
(WebKit::WebPageInspectorTargetAgent::connectionType const):
(WebKit::WebPageInspectorTargetAgent::sendMessageToFrontend):
Expose the channel to targets as local if there is a local frontend
in the UIProcess.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238370 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/WebPageInspectorTargetAgent.cpp
Source/WebKit/UIProcess/WebPageInspectorTargetAgent.h

index 67b071f..d79c41f 100644 (file)
@@ -1,3 +1,25 @@
+2018-11-19  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Regression(r238330): A lot of WebInspector tests are crashing on the bots
+        https://bugs.webkit.org/show_bug.cgi?id=191814
+
+        Reviewed by Ryosuke Niwa.
+
+        Expose the expected connection type from the UIProcess into the WebProcess.
+        When there is a local inspector connection to the UIProcess expose it as
+        a local frontend channel to the inspector controllers in the Page.
+
+        * UIProcess/WebPageInspectorTargetAgent.h:
+        * UIProcess/WebPageInspectorTargetAgent.cpp:
+        (WebKit::WebPageInspectorTargetAgent::frontendChannel):
+        An additional FrontendChannel class is not needed, just use self.
+
+        (WebKit::WebPageInspectorTargetAgent::WebPageInspectorTargetAgent):
+        (WebKit::WebPageInspectorTargetAgent::connectionType const):
+        (WebKit::WebPageInspectorTargetAgent::sendMessageToFrontend):
+        Expose the channel to targets as local if there is a local frontend
+        in the UIProcess.
+
 2018-11-18  Joseph Pecoraro  <pecoraro@apple.com>
 
         Regression(r238330) ProcessSwap.WebInspector API test is a flaky crash in debug
index 5fe99c5..4cfc390 100644 (file)
 
 namespace WebKit {
 
-class StubFrontendChannel final : public Inspector::FrontendChannel {
-    ConnectionType connectionType() const final { return Inspector::FrontendChannel::ConnectionType::Remote; }
-    void sendMessageToFrontend(const String&) final { }
-};
-
 WebPageInspectorTargetAgent::WebPageInspectorTargetAgent(Inspector::FrontendRouter& frontendRouter, Inspector::BackendDispatcher& backendDispatcher)
     : Inspector::InspectorTargetAgent(frontendRouter, backendDispatcher)
+    , m_router(frontendRouter)
 {
 }
 
 Inspector::FrontendChannel& WebPageInspectorTargetAgent::frontendChannel()
 {
-    if (!m_frontendChannel)
-        m_frontendChannel = std::make_unique<StubFrontendChannel>();
-    return *m_frontendChannel.get();
+    return *this;
+}
+
+Inspector::FrontendChannel::ConnectionType WebPageInspectorTargetAgent::connectionType() const
+{
+    return m_router.hasLocalFrontend() ? Inspector::FrontendChannel::ConnectionType::Local : Inspector::FrontendChannel::ConnectionType::Remote;
+}
+
+void WebPageInspectorTargetAgent::sendMessageToFrontend(const String&)
+{
+    // Intentionally ignored, this channel is not actually used to send messages.
+    ASSERT_NOT_REACHED();
 }
 
 } // namespace WebKit
index 38de928..8dd6ccd 100644 (file)
 
 namespace WebKit {
 
-class WebPageInspectorTargetAgent final : public Inspector::InspectorTargetAgent {
+class WebPageInspectorTargetAgent final : public Inspector::InspectorTargetAgent, public Inspector::FrontendChannel {
 public:
     WebPageInspectorTargetAgent(Inspector::FrontendRouter&, Inspector::BackendDispatcher&);
     virtual ~WebPageInspectorTargetAgent() = default;
 
 private:
+    // Inspector::InspectorTargetAgent
     Inspector::FrontendChannel& frontendChannel() final;
 
-    std::unique_ptr<Inspector::FrontendChannel> m_frontendChannel;
+    // Inspector::FrontendChannel
+    Inspector::FrontendChannel::ConnectionType connectionType() const final;
+    void sendMessageToFrontend(const String&) final;
+
+    Inspector::FrontendRouter& m_router;
 };
 
 } // namespace WebKit