Changeset 238330 in webkit


Ignore:
Timestamp:
Nov 16, 2018 5:28:41 PM (5 years ago)
Author:
Joseph Pecoraro
Message:

Web Inspector: Keep Web Inspector window alive across process swaps (PSON) (Local Inspector)
https://bugs.webkit.org/show_bug.cgi?id=191740
<rdar://problem/45470897>

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

  • inspector/InspectorFrontendChannel.h:

Expose EnumTraits for ConnectionType for WebKit IPC messages.

Source/WebInspectorUI:

  • UserInterface/Protocol/Connection.js:

(InspectorBackend.Connection.prototype._dispatchResponse):
Hide the TargetAgent does not exist message. This is necessary so that WebKitLegacy
tests don't include this line in output each test.

  • UserInterface/Test.html:
  • UserInterface/Test/Test.js:

(WI.loaded):
(WI.resetMainExecutionContext):
(WI.performOneTimeFrontendInitializationsUsingTarget):
Behave more like Main.js and initialize a MultiplexingBackendTarget when the
TargetAgent is available.

  • UserInterface/Protocol/InspectorBackend.js:

(InspectorBackendClass.prototype.runAfterPendingDispatches):
Use the main target, a.k.a. the page connection. The backend target's
messages don't have any responses, so this was effectively not waiting
at all.

Source/WebKit:

When a web page asks to open a local Web Inspector, that inspector
will now connect in the UIProcess (WebPageProxy / WebPageInspectorController)
instead of the WebContentProcess (WebKit::WebInspector / InspectorController).

Previously a WebInspectorProxy was re-created every time the WebPageProxy's
WebPage / WebProcess was changed, effectively closing the Web Inspector
frontend when the WebPage was swapped or crashed.

This change keeps the WebInspectorProxy alive as long as the WebPageProxy
is alive. During process swaps, or process crashes, the WebInspectorProxy
is reset when the page is reset and updated when the page's WebProcess
changes. Since WebInspectorProxy owns the Web Inspector view / window
the Web Inspector window can be kept alive across (and attached state)
across WebPage / WebProcess changes.

Previously the WebContentProcess's WebKit::WebInspector was the Local
FrontendChannel for the WebCore::InspectorController. This can't
outlive the single WebContentProcess.

This change makes the UIProcesses' WebInspectorProxy the Local FrontendChannel
for the WebKit::WebPageInspectorController. Given the WebInspectorProxy
now stays alive alongside the WebPageProxy this will live across process changes.
This means that the WebInspectorUI process must send its backend messages to
the WebInspectorProxy -> WebPageInspectorController now instead of the
old path WebInspector -> WebCore::InspectorController.

A direct IPC connection is still maintained between the WebContentProcess's
WebKit::WebInspector and the InspectorProcess's WebInspectorUI. Previously
this connection was established by WebKit::WebInspector vending an
IPC::Attachment to the WebInspectorUI process. This patch inverts that
relationship, because the WebInspectorUI process now lives across multiple
WebContentProcess changes. The WebInspectorUI now vends the IPC::Attachment
to the WebContentProcess each time the process changes. This way they can both
still communicate through normal Messages::WebInspector/WebInspectorUI
messages and everything behaves as previously expected.

  • Scripts/webkit/messages.py:

Header for Inspector::FrontendChannel::ConnectionType.

  • WebProcess/WebCoreSupport/WebInspectorClient.cpp:

(WebKit::WebInspectorClient::openLocalFrontend):

  • WebProcess/WebPage/WebInspector.cpp:

(WebKit::WebInspector::openLocalInspectorFrontend):
(WebKit::WebInspector::setFrontendConnection):
(WebKit::WebInspector::closeFrontendConnection):
(WebKit::WebInspector::close):
(WebKit::WebInspector::openFrontendConnection): Deleted.
(WebKit::WebInspector::sendMessageToBackend): Deleted.
(WebKit::WebInspector::sendMessageToFrontend): Deleted.
On the WebProcess side we ask the UIProcess to open a local frontend and now
receive instead of vend an IPC connection to the WebInspectorUI process.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::finishAttachingToWebProcess):
(WebKit::WebPageProxy::close):
(WebKit::WebPageProxy::resetState):
Keep the WebInspectorProxy alive alongside the WebPageProxy.
Update it as processes / states change.

  • UIProcess/WebInspectorProxy.h:
  • UIProcess/WebInspectorProxy.messages.in:
  • UIProcess/WebInspectorProxy.cpp:

(WebKit::WebInspectorProxy::openLocalInspectorFrontend):
(WebKit::WebInspectorProxy::createInspectorPage): Deleted.
(WebKit::WebInspectorProxy::sendMessageToFrontend):
(WebKit::WebInspectorProxy::closeFrontendPageAndWindow):
Open and close a local frontend by being the FrontendChannel on the UIProcess side.

(WebKit::WebInspectorProxy::sendMessageToBackend):
Dispatch WebInspectorUI backend messages to the UIProcess's InspectorController
now that the InspectorController is here instead of in the WebProcess.

(WebKit::WebInspectorProxy::setFrontendConnection):
Transfer the WebProcess <-> InspectorProcess IPC connection through us
because we are the one link between them when processes change.

(WebKit::WebInspectorProxy::invalidate):
(WebKit::WebInspectorProxy::frontendLoaded):
Be safer and handle inspectedPage being potentially null.

  • WebProcess/WebPage/WebPageInspectorTargetController.cpp:

(WebKit::WebPageInspectorTargetController::connectInspector):

  • WebProcess/WebPage/WebPageInspectorTargetController.h:
  • WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp:

(WebKit::WebPageInspectorTargetFrontendChannel::create):
(WebKit::WebPageInspectorTargetFrontendChannel::WebPageInspectorTargetFrontendChannel):

  • WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.h:
  • UIProcess/InspectorTargetProxy.cpp:

(WebKit::InspectorTargetProxy::connect):
Proxy the ConnectionType received on the UIProcess side to the WebProcess side
when connecting to sub-targets.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::connectInspector):
(WebKit::WebPage::setHasLocalInspectorFrontend): Deleted.

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in:
  • UIProcess/WebPageProxy.h:

(WebKit::WebPageProxy::hasLocalInspectorFrontend const): Deleted.
(WebKit::WebPageProxy::setHasLocalInspectorFrontend): Deleted.

  • UIProcess/WebPageProxy.messages.in:
  • UIProcess/WebProcessPool.cpp:

(WebKit::WebProcessPool::processForNavigationInternal):
Eliminate the hasLocalInspectorFrontend state that was only used
to disable PSON. PSON no longer needs to be disabled for this reason.

  • WebProcess/WebPage/WebInspector.h:
  • WebProcess/WebPage/WebInspector.messages.in:
  • WebProcess/WebPage/WebInspectorUI.cpp:

(WebKit::WebInspectorUI::establishConnection):
(WebKit::WebInspectorUI::updateConnection):
(WebKit::WebInspectorUI::closeWindow):
(WebKit::WebInspectorUI::sendMessageToBackend):

  • WebProcess/WebPage/WebInspectorUI.h:
  • WebProcess/WebPage/WebInspectorUI.messages.in:

Vend an IPC connection on demand to the WebProcess side.

LayoutTests:

  • inspector/unit-tests/target-manager-expected.txt:
  • inspector/unit-tests/target-manager.html:

Update test to pass in both a MultiplexingBackendTarget and DirectBackendTarget world.

Location:
trunk
Files:
34 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r238307 r238330  
     12018-11-16  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Keep Web Inspector window alive across process swaps (PSON) (Local Inspector)
     4        https://bugs.webkit.org/show_bug.cgi?id=191740
     5        <rdar://problem/45470897>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * inspector/unit-tests/target-manager-expected.txt:
     10        * inspector/unit-tests/target-manager.html:
     11        Update test to pass in both a MultiplexingBackendTarget and DirectBackendTarget world.
     12
    1132018-11-16  Jeremy Jones  <jeremyj@apple.com>
    214
  • trunk/LayoutTests/inspector/unit-tests/target-manager-expected.txt

    r225244 r238330  
    77PASS: Target list should always contain the main target.
    88PASS: Main target should have an ExecutionContext.
    9 PASS: Main target should have the global RuntimeAgent.
     9PASS: Main target should have the page target's RuntimeAgent.
    1010Target - Symbol(page) - Page
    1111
  • trunk/LayoutTests/inspector/unit-tests/target-manager.html

    r238192 r238330  
    3131            InspectorTest.expectEqual([...WI.targets][0], WI.mainTarget, "Target list should always contain the main target.");
    3232            InspectorTest.expectNotNull(WI.mainTarget.executionContext, "Main target should have an ExecutionContext.");
    33             InspectorTest.expectEqual(WI.mainTarget.RuntimeAgent, RuntimeAgent, "Main target should have the global RuntimeAgent.");
     33            InspectorTest.expectEqual(WI.mainTarget.RuntimeAgent, WI.pageTarget.RuntimeAgent, "Main target should have the page target's RuntimeAgent.");
    3434            dumpTargets();
    3535        }
  • trunk/Source/JavaScriptCore/ChangeLog

    r238326 r238330  
     12018-11-16  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Keep Web Inspector window alive across process swaps (PSON) (Local Inspector)
     4        https://bugs.webkit.org/show_bug.cgi?id=191740
     5        <rdar://problem/45470897>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * inspector/InspectorFrontendChannel.h:
     10        Expose EnumTraits for ConnectionType for WebKit IPC messages.
     11
    1122018-11-16  Filip Pizlo  <fpizlo@apple.com>
    213
  • trunk/Source/JavaScriptCore/inspector/InspectorFrontendChannel.h

    r207928 r238330  
    4747
    4848} // namespace Inspector
     49
     50namespace WTF {
     51
     52template<> struct EnumTraits<Inspector::FrontendChannel::ConnectionType> {
     53    using values = EnumValues<
     54        Inspector::FrontendChannel::ConnectionType,
     55        Inspector::FrontendChannel::ConnectionType::Remote,
     56        Inspector::FrontendChannel::ConnectionType::Local
     57    >;
     58};
     59
     60} // namespace WTF
  • trunk/Source/WebInspectorUI/ChangeLog

    r238305 r238330  
     12018-11-16  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Keep Web Inspector window alive across process swaps (PSON) (Local Inspector)
     4        https://bugs.webkit.org/show_bug.cgi?id=191740
     5        <rdar://problem/45470897>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * UserInterface/Protocol/Connection.js:
     10        (InspectorBackend.Connection.prototype._dispatchResponse):
     11        Hide the TargetAgent does not exist message. This is necessary so that WebKitLegacy
     12        tests don't include this line in output each test.
     13
     14        * UserInterface/Test.html:
     15        * UserInterface/Test/Test.js:
     16        (WI.loaded):
     17        (WI.resetMainExecutionContext):
     18        (WI.performOneTimeFrontendInitializationsUsingTarget):
     19        Behave more like Main.js and initialize a MultiplexingBackendTarget when the
     20        TargetAgent is available.
     21
     22        * UserInterface/Protocol/InspectorBackend.js:
     23        (InspectorBackendClass.prototype.runAfterPendingDispatches):
     24        Use the main target, a.k.a. the page connection. The backend target's
     25        messages don't have any responses, so this was effectively not waiting
     26        at all.
     27
    1282018-11-16  Matt Baker  <mattbaker@apple.com>
    229
  • trunk/Source/WebInspectorUI/UserInterface/Protocol/Connection.js

    r238197 r238330  
    9797
    9898        if (messageObject["error"]) {
    99             if (messageObject["error"].code !== -32000)
     99            // FIXME: Eliminate Target.exists
     100            if (messageObject["error"].code !== -32000 && messageObject["error"].message !== "'Target' domain was not found")
    100101                console.error("Request with id = " + messageObject["id"] + " failed. " + JSON.stringify(messageObject["error"]));
    101102        }
  • trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js

    r238192 r238330  
    164164    {
    165165        // FIXME: Should this respect pending dispatches in all connections?
    166         InspectorBackend.backendConnection.runAfterPendingDispatches(script);
     166        WI.mainTarget.connection.runAfterPendingDispatches(script);
    167167    }
    168168
  • trunk/Source/WebInspectorUI/UserInterface/Test.html

    r238192 r238330  
    7676    <script src="Protocol/DirectBackendTarget.js"></script>
    7777    <script src="Protocol/MultiplexingBackendTarget.js"></script>
     78    <script src="Protocol/JavaScriptContextTarget.js"></script>
     79    <script src="Protocol/PageTarget.js"></script>
    7880    <script src="Protocol/WorkerTarget.js"></script>
    7981
  • trunk/Source/WebInspectorUI/UserInterface/Test/Test.js

    r238192 r238330  
    7676    WI.pageTarget = null;
    7777
    78     // Tests directly connect to a page target.
    79     WI.targetManager.createDirectBackendTarget();
     78    // FIXME: Eliminate `TargetAgent.exists`.
     79    TargetAgent.exists((error) => {
     80        if (error)
     81            WI.targetManager.createDirectBackendTarget();
     82    });
    8083};
    8184
     
    108111WI.resetMainExecutionContext = function()
    109112{
    110     console.assert(WI.mainTarget.executionContext);
     113    if (WI.mainTarget instanceof WI.MultiplexingBackendTarget)
     114        return;
    111115
    112     WI.runtimeManager.activeExecutionContext = WI.mainTarget.executionContext;
     116    if (WI.mainTarget.executionContext)
     117        WI.runtimeManager.activeExecutionContext = WI.mainTarget.executionContext;
    113118};
    114119
     
    139144    }
    140145
     146    // FIXME: This slows down test debug logging considerably.
    141147    if (!WI.__didPerformCSSInitialization && target.CSSAgent) {
    142148        WI.__didPerformCSSInitialization = true;
  • trunk/Source/WebKit/ChangeLog

    r238318 r238330  
     12018-11-16  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Keep Web Inspector window alive across process swaps (PSON) (Local Inspector)
     4        https://bugs.webkit.org/show_bug.cgi?id=191740
     5        <rdar://problem/45470897>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        When a web page asks to open a local Web Inspector, that inspector
     10        will now connect in the UIProcess (WebPageProxy / WebPageInspectorController)
     11        instead of the WebContentProcess (WebKit::WebInspector / InspectorController).
     12
     13        Previously a WebInspectorProxy was re-created every time the WebPageProxy's
     14        WebPage / WebProcess was changed, effectively closing the Web Inspector
     15        frontend when the WebPage was swapped or crashed.
     16
     17        This change keeps the WebInspectorProxy alive as long as the WebPageProxy
     18        is alive. During process swaps, or process crashes, the WebInspectorProxy
     19        is reset when the page is reset and updated when the page's WebProcess
     20        changes. Since WebInspectorProxy owns the Web Inspector view / window
     21        the Web Inspector window can be kept alive across (and attached state)
     22        across WebPage / WebProcess changes.
     23
     24        Previously the WebContentProcess's WebKit::WebInspector was the Local
     25        FrontendChannel for the WebCore::InspectorController. This can't
     26        outlive the single WebContentProcess.
     27
     28        This change makes the UIProcesses' WebInspectorProxy the Local FrontendChannel
     29        for the WebKit::WebPageInspectorController. Given the WebInspectorProxy
     30        now stays alive alongside the WebPageProxy this will live across process changes.
     31        This means that the WebInspectorUI process must send its backend messages to
     32        the WebInspectorProxy -> WebPageInspectorController now instead of the
     33        old path WebInspector -> WebCore::InspectorController.
     34
     35        A direct IPC connection is still maintained between the WebContentProcess's
     36        WebKit::WebInspector and the InspectorProcess's WebInspectorUI. Previously
     37        this connection was established by WebKit::WebInspector vending an
     38        IPC::Attachment to the WebInspectorUI process. This patch inverts that
     39        relationship, because the WebInspectorUI process now lives across multiple
     40        WebContentProcess changes. The WebInspectorUI now vends the IPC::Attachment
     41        to the WebContentProcess each time the process changes. This way they can both
     42        still communicate through normal Messages::WebInspector/WebInspectorUI
     43        messages and everything behaves as previously expected.
     44
     45        * Scripts/webkit/messages.py:
     46        Header for Inspector::FrontendChannel::ConnectionType.
     47
     48        * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
     49        (WebKit::WebInspectorClient::openLocalFrontend):
     50        * WebProcess/WebPage/WebInspector.cpp:
     51        (WebKit::WebInspector::openLocalInspectorFrontend):
     52        (WebKit::WebInspector::setFrontendConnection):
     53        (WebKit::WebInspector::closeFrontendConnection):
     54        (WebKit::WebInspector::close):
     55        (WebKit::WebInspector::openFrontendConnection): Deleted.
     56        (WebKit::WebInspector::sendMessageToBackend): Deleted.
     57        (WebKit::WebInspector::sendMessageToFrontend): Deleted.
     58        On the WebProcess side we ask the UIProcess to open a local frontend and now
     59        receive instead of vend an IPC connection to the WebInspectorUI process.
     60
     61        * UIProcess/WebPageProxy.cpp:
     62        (WebKit::WebPageProxy::finishAttachingToWebProcess):
     63        (WebKit::WebPageProxy::close):
     64        (WebKit::WebPageProxy::resetState):
     65        Keep the WebInspectorProxy alive alongside the WebPageProxy.
     66        Update it as processes / states change.
     67
     68        * UIProcess/WebInspectorProxy.h:
     69        * UIProcess/WebInspectorProxy.messages.in:
     70        * UIProcess/WebInspectorProxy.cpp:
     71        (WebKit::WebInspectorProxy::openLocalInspectorFrontend):
     72        (WebKit::WebInspectorProxy::createInspectorPage): Deleted.
     73        (WebKit::WebInspectorProxy::sendMessageToFrontend):
     74        (WebKit::WebInspectorProxy::closeFrontendPageAndWindow):
     75        Open and close a local frontend by being the FrontendChannel on the UIProcess side.
     76
     77        (WebKit::WebInspectorProxy::sendMessageToBackend):
     78        Dispatch WebInspectorUI backend messages to the UIProcess's InspectorController
     79        now that the InspectorController is here instead of in the WebProcess.
     80
     81        (WebKit::WebInspectorProxy::setFrontendConnection):
     82        Transfer the WebProcess <-> InspectorProcess IPC connection through us
     83        because we are the one link between them when processes change.
     84
     85        (WebKit::WebInspectorProxy::invalidate):
     86        (WebKit::WebInspectorProxy::frontendLoaded):
     87        Be safer and handle inspectedPage being potentially null.
     88
     89        * WebProcess/WebPage/WebPageInspectorTargetController.cpp:
     90        (WebKit::WebPageInspectorTargetController::connectInspector):
     91        * WebProcess/WebPage/WebPageInspectorTargetController.h:
     92        * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp:
     93        (WebKit::WebPageInspectorTargetFrontendChannel::create):
     94        (WebKit::WebPageInspectorTargetFrontendChannel::WebPageInspectorTargetFrontendChannel):
     95        * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.h:
     96        * UIProcess/InspectorTargetProxy.cpp:
     97        (WebKit::InspectorTargetProxy::connect):
     98        Proxy the ConnectionType received on the UIProcess side to the WebProcess side
     99        when connecting to sub-targets.
     100
     101        * WebProcess/WebPage/WebPage.cpp:
     102        (WebKit::WebPage::connectInspector):
     103        (WebKit::WebPage::setHasLocalInspectorFrontend): Deleted.
     104        * WebProcess/WebPage/WebPage.h:
     105        * WebProcess/WebPage/WebPage.messages.in:
     106        * UIProcess/WebPageProxy.h:
     107        (WebKit::WebPageProxy::hasLocalInspectorFrontend const): Deleted.
     108        (WebKit::WebPageProxy::setHasLocalInspectorFrontend): Deleted.
     109        * UIProcess/WebPageProxy.messages.in:
     110        * UIProcess/WebProcessPool.cpp:
     111        (WebKit::WebProcessPool::processForNavigationInternal):
     112        Eliminate the hasLocalInspectorFrontend state that was only used
     113        to disable PSON. PSON no longer needs to be disabled for this reason.
     114
     115        * WebProcess/WebPage/WebInspector.h:
     116        * WebProcess/WebPage/WebInspector.messages.in:
     117        * WebProcess/WebPage/WebInspectorUI.cpp:
     118        (WebKit::WebInspectorUI::establishConnection):
     119        (WebKit::WebInspectorUI::updateConnection):
     120        (WebKit::WebInspectorUI::closeWindow):
     121        (WebKit::WebInspectorUI::sendMessageToBackend):
     122        * WebProcess/WebPage/WebInspectorUI.h:
     123        * WebProcess/WebPage/WebInspectorUI.messages.in:
     124        Vend an IPC connection on demand to the WebProcess side.
     125
    11262018-11-16  Michael Catanzaro  <mcatanzaro@igalia.com>
    2127
  • trunk/Source/WebKit/Scripts/webkit/messages.py

    r238192 r238330  
    391391        'JSC::MessageSource': ['<JavaScriptCore/ConsoleTypes.h>'],
    392392        'Inspector::InspectorTargetType': ['<JavaScriptCore/InspectorTarget.h>'],
     393        'Inspector::FrontendChannel::ConnectionType': ['<JavaScriptCore/InspectorFrontendChannel.h>'],
    393394        'MonotonicTime': ['<wtf/MonotonicTime.h>'],
    394395        'Seconds': ['<wtf/Seconds.h>'],
  • trunk/Source/WebKit/UIProcess/InspectorTargetProxy.cpp

    r238192 r238330  
    4747}
    4848
    49 void InspectorTargetProxy::connect(Inspector::FrontendChannel&)
     49void InspectorTargetProxy::connect(Inspector::FrontendChannel& channel)
    5050{
    5151    if (m_page.isValid())
    52         m_page.process().send(Messages::WebPage::ConnectInspector(identifier()), m_page.pageID());
     52        m_page.process().send(Messages::WebPage::ConnectInspector(identifier(), channel.connectionType()), m_page.pageID());
    5353}
    5454
  • trunk/Source/WebKit/UIProcess/WebInspectorProxy.cpp

    r238254 r238330  
    3737#include "WebInspectorUIMessages.h"
    3838#include "WebPageGroup.h"
     39#include "WebPageInspectorController.h"
    3940#include "WebPageProxy.h"
    4041#include "WebPreferences.h"
     
    8485void WebInspectorProxy::invalidate()
    8586{
    86     m_inspectedPage->process().removeMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_inspectedPage->pageID());
     87    if (m_inspectedPage)
     88        m_inspectedPage->process().removeMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_inspectedPage->pageID());
    8789
    8890    closeFrontendPageAndWindow();
     
    9294}
    9395
     96void WebInspectorProxy::sendMessageToFrontend(const String& message)
     97{
     98    if (!m_inspectorPage)
     99        return;
     100
     101    m_inspectorPage->process().send(Messages::WebInspectorUI::SendMessageToFrontend(message), m_inspectorPage->pageID());
     102}
     103
    94104// Public APIs
    95105bool WebInspectorProxy::isFront()
     
    159169
    160170    platformDidCloseForCrash();
     171}
     172
     173void WebInspectorProxy::reset()
     174{
     175    if (m_inspectedPage) {
     176        m_inspectedPage->process().removeMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_inspectedPage->pageID());
     177        m_inspectedPage = nullptr;
     178    }
     179}
     180
     181void WebInspectorProxy::updateForNewPageProcess(WebPageProxy* inspectedPage)
     182{
     183    ASSERT(!m_inspectedPage);
     184    ASSERT(inspectedPage);
     185
     186    m_inspectedPage = inspectedPage;
     187    m_inspectedPage->process().addMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_inspectedPage->pageID(), *this);
     188
     189    if (m_inspectorPage)
     190        m_inspectorPage->process().send(Messages::WebInspectorUI::UpdateConnection(), m_inspectorPage->pageID());
     191}
     192
     193void WebInspectorProxy::setFrontendConnection(IPC::Attachment connectionIdentifier)
     194{
     195    if (!m_inspectedPage)
     196        return;
     197
     198    m_inspectedPage->process().send(Messages::WebInspector::SetFrontendConnection(connectionIdentifier), m_inspectedPage->pageID());
    161199}
    162200
     
    341379}
    342380
    343 // Called by WebInspectorProxy messages
    344 void WebInspectorProxy::createInspectorPage(IPC::Attachment connectionIdentifier, bool canAttach, bool underTest)
    345 {
    346     if (!m_inspectedPage)
    347         return;
     381void WebInspectorProxy::openLocalInspectorFrontend(bool canAttach, bool underTest)
     382{
     383    if (!m_inspectedPage)
     384        return;
     385
     386    if (m_inspectedPage->inspectorController().hasLocalFrontend()) {
     387        show();
     388        return;
     389    }
    348390
    349391    m_underTest = underTest;
     
    354396        return;
    355397
    356     m_inspectorPage->process().send(Messages::WebInspectorUI::EstablishConnection(WTFMove(connectionIdentifier), m_inspectedPage->pageID(), m_underTest, inspectionLevel()), m_inspectorPage->pageID());
     398    m_inspectorPage->process().send(Messages::WebInspectorUI::EstablishConnection(m_inspectedPage->pageID(), m_underTest, inspectionLevel()), m_inspectorPage->pageID());
     399
     400    m_inspectedPage->inspectorController().connectFrontend(*this);
    357401
    358402    if (!m_underTest) {
     
    426470    m_inspectorPage->process().removeMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_inspectedPage->pageID());
    427471
     472    m_inspectedPage->inspectorController().disconnectFrontend(*this);
     473
    428474    if (m_isAttached)
    429475        platformDetach();
     
    439485}
    440486
     487void WebInspectorProxy::sendMessageToBackend(const String& message)
     488{
     489    if (!m_inspectedPage)
     490        return;
     491
     492    m_inspectedPage->inspectorController().dispatchMessageFromFrontend(message);
     493}
     494
    441495void WebInspectorProxy::frontendLoaded()
    442496{
     497    if (!m_inspectedPage)
     498        return;
     499
    443500    if (auto* automationSession = m_inspectedPage->process().processPool().automationSession())
    444501        automationSession->inspectorFrontendLoaded(*m_inspectedPage);
  • trunk/Source/WebKit/UIProcess/WebInspectorProxy.h

    r238254 r238330  
    3131#include "MessageReceiver.h"
    3232#include "WebInspectorUtilities.h"
     33#include <JavaScriptCore/InspectorFrontendChannel.h>
    3334#include <wtf/Forward.h>
    3435#include <wtf/RefPtr.h>
     
    7172    : public API::ObjectImpl<API::Object::Type::Inspector>
    7273    , public IPC::MessageReceiver
     74    , public Inspector::FrontendChannel
    7375#if PLATFORM(WIN)
    7476    , public WebCore::WindowMessageListener
     
    98100    void close();
    99101    void closeForCrash();
     102
     103    void reset();
     104    void updateForNewPageProcess(WebPageProxy*);
    100105
    101106#if PLATFORM(MAC) && WK_API_ENABLED
     
    167172    // IPC::MessageReceiver
    168173    void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
     174
     175    // Inspector::FrontendChannel
     176    void sendMessageToFrontend(const String& message) override;
     177    ConnectionType connectionType() const override { return ConnectionType::Local; }
    169178
    170179    WebPageProxy* platformCreateFrontendPage();
     
    197206
    198207    // Called by WebInspectorProxy messages
    199     void createInspectorPage(IPC::Attachment, bool canAttach, bool underTest);
     208    void openLocalInspectorFrontend(bool canAttach, bool underTest);
     209    void setFrontendConnection(IPC::Attachment);
     210
     211    void sendMessageToBackend(const String&);
    200212    void frontendLoaded();
    201213    void didClose();
  • trunk/Source/WebKit/UIProcess/WebInspectorProxy.messages.in

    r217924 r238330  
    2222
    2323messages -> WebInspectorProxy {
    24     CreateInspectorPage(IPC::Attachment connectionIdentifier, bool canAttach, bool underTest)
     24    OpenLocalInspectorFrontend(bool canAttach, bool underTest)
     25    SetFrontendConnection(IPC::Attachment connectionIdentifier)
     26
     27    SendMessageToBackend(String message)
    2528
    2629    FrontendLoaded()
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r238274 r238330  
    801801    updateThrottleState();
    802802
    803     m_inspector = WebInspectorProxy::create(this);
    804803#if ENABLE(FULLSCREEN_API)
    805804    m_fullScreenManager = std::make_unique<WebFullScreenManagerProxy>(*this, pageClient().fullScreenManagerProxyClient());
     
    823822
    824823    initializeWebPage(shouldDelayAttachingDrawingArea);
     824
     825    m_inspector->updateForNewPageProcess(this);
    825826
    826827#if ENABLE(REMOTE_INSPECTOR)
     
    939940    m_activeContextMenu = nullptr;
    940941#endif
     942
     943    m_inspector->invalidate();
     944    m_inspector = nullptr;
    941945
    942946    m_backForwardList->pageClosed();
     
    62516255    closeOverlayedViews();
    62526256
    6253     if (m_inspector) {
    6254         m_inspector->invalidate();
    6255         m_inspector = nullptr;
    6256     }
     6257    m_inspector->reset();
    62576258
    62586259#if ENABLE(FULLSCREEN_API)
     
    62836284
    62846285    m_toolTip = String();
    6285 
    6286     m_inspectorHasLocalFrontend = false;
    62876286
    62886287    m_mainFrameHasHorizontalScrollbar = false;
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r238274 r238330  
    381381    WebInspectorProxy* inspector() const;
    382382
    383     bool hasLocalInspectorFrontend() const { return m_inspectorHasLocalFrontend; }
    384     void setHasLocalInspectorFrontend(bool hasLocalFrontend) { m_inspectorHasLocalFrontend = hasLocalFrontend; }
    385 
    386383    void didChangeInspectorFrontendCount(unsigned count) { m_inspectorFrontendCount = count; }
    387384    unsigned inspectorFrontendCount() const { return m_inspectorFrontendCount; }
     
    21182115
    21192116    unsigned m_inspectorFrontendCount { 0 };
    2120     bool m_inspectorHasLocalFrontend { false };
    21212117
    21222118#if PLATFORM(COCOA)
  • trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in

    r238322 r238330  
    419419#endif
    420420
    421     SetHasLocalInspectorFrontend(bool hasLocalFrontend)
    422421    DidChangeInspectorFrontendCount(uint64_t count)
    423422
  • trunk/Source/WebKit/UIProcess/WebProcessPool.cpp

    r238284 r238330  
    21372137    }
    21382138
    2139     // FIXME: We should support process swap with a local web inspector.
    2140     if (page.hasLocalInspectorFrontend()) {
    2141         reason = "A Local Web Inspector frontend is connected"_s;
    2142         return page.process();
    2143     }
    2144 
    21452139    if (m_automationSession) {
    21462140        reason = "An automation session is active"_s;
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp

    r237266 r238330  
    9191Inspector::FrontendChannel* WebInspectorClient::openLocalFrontend(InspectorController* controller)
    9292{
    93     m_page->inspector()->openFrontendConnection(controller->isUnderTest());
    94 
    95     return m_page->inspector();
     93    m_page->inspector()->openLocalInspectorFrontend(controller->isUnderTest());
     94
     95    return nullptr;
    9696}
    9797
  • trunk/Source/WebKit/WebProcess/WebPage/WebInspector.cpp

    r238206 r238330  
    7171}
    7272
    73 // Called from WebInspectorClient
    74 void WebInspector::openFrontendConnection(bool underTest)
    75 {
     73void WebInspector::openLocalInspectorFrontend(bool underTest)
     74{
     75    WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::OpenLocalInspectorFrontend(canAttachWindow(), underTest), m_page->pageID());
     76}
     77
     78void WebInspector::setFrontendConnection(IPC::Attachment encodedConnectionIdentifier)
     79{
     80    ASSERT(!m_frontendConnection);
     81
    7682#if USE(UNIX_DOMAIN_SOCKETS)
    77     IPC::Connection::SocketPair socketPair = IPC::Connection::createPlatformConnection();
    78     IPC::Connection::Identifier connectionIdentifier(socketPair.server);
    79     IPC::Attachment connectionClientPort(socketPair.client);
     83    IPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.releaseFileDescriptor());
    8084#elif OS(DARWIN)
    81     mach_port_t listeningPort = MACH_PORT_NULL;
    82     if (mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &listeningPort) != KERN_SUCCESS)
    83         CRASH();
    84 
    85     if (mach_port_insert_right(mach_task_self(), listeningPort, listeningPort, MACH_MSG_TYPE_MAKE_SEND) != KERN_SUCCESS)
    86         CRASH();
    87 
    88     IPC::Connection::Identifier connectionIdentifier(listeningPort);
    89     IPC::Attachment connectionClientPort(listeningPort, MACH_MSG_TYPE_MOVE_SEND);
    90 #elif PLATFORM(WIN)
    91     IPC::Connection::Identifier connectionIdentifier, connClient;
    92     IPC::Connection::createServerAndClientIdentifiers(connectionIdentifier, connClient);
    93     IPC::Attachment connectionClientPort(connClient);
     85    IPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.port());
     86#elif OS(WINDOWS)
     87    IPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.handle());
    9488#else
    9589    notImplemented();
     
    9791#endif
    9892
    99 #if USE(UNIX_DOMAIN_SOCKETS) || OS(DARWIN) || PLATFORM(WIN)
    100     m_frontendConnection = IPC::Connection::createServerConnection(connectionIdentifier, *this);
     93    if (!IPC::Connection::identifierIsValid(connectionIdentifier))
     94        return;
     95
     96    m_frontendConnection = IPC::Connection::createClientConnection(connectionIdentifier, *this);
    10197    m_frontendConnection->open();
    102 
    103     m_page->setHasLocalInspectorFrontend(true);
    104 
    105     WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::CreateInspectorPage(connectionClientPort, canAttachWindow(), underTest), m_page->pageID());
    106 #endif
    10798}
    10899
    109100void WebInspector::closeFrontendConnection()
    110101{
    111     m_page->setHasLocalInspectorFrontend(false);
    112 
    113102    WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::DidClose(), m_page->pageID());
    114103
     
    146135        return;
    147136
    148     m_page->corePage()->inspectorController().disconnectFrontend(*this);
    149137    closeFrontendConnection();
    150138}
     
    290278}
    291279
    292 void WebInspector::sendMessageToBackend(const String& message)
    293 {
    294     if (!m_page->corePage())
    295         return;
    296 
    297     m_page->corePage()->inspectorController().dispatchMessageFromFrontend(message);
    298 }
    299 
    300 void WebInspector::sendMessageToFrontend(const String& message)
    301 {
    302     m_frontendConnection->send(Messages::WebInspectorUI::SendMessageToFrontend(message), 0);
    303 }
    304 
    305280} // namespace WebKit
  • trunk/Source/WebKit/WebProcess/WebPage/WebInspector.h

    r238254 r238330  
    2929#include "Connection.h"
    3030#include "MessageReceiver.h"
    31 #include <JavaScriptCore/InspectorFrontendChannel.h>
    3231#include <wtf/Noncopyable.h>
    3332#include <wtf/text/WTFString.h>
     
    3736class WebPage;
    3837
    39 class WebInspector : public API::ObjectImpl<API::Object::Type::BundleInspector>, private IPC::Connection::Client, public Inspector::FrontendChannel {
     38class WebInspector : public API::ObjectImpl<API::Object::Type::BundleInspector>, private IPC::Connection::Client {
    4039public:
    4140    static Ref<WebInspector> create(WebPage*);
     
    4443
    4544    void updateDockingAvailability();
    46 
    47     void sendMessageToFrontend(const String& message) override;
    48     ConnectionType connectionType() const override { return ConnectionType::Local; }
    4945
    5046    // Implemented in generated WebInspectorMessageReceiver.cpp
     
    7975    void elementSelectionChanged(bool);
    8076
    81     void sendMessageToBackend(const String&);
     77    void setFrontendConnection(IPC::Attachment);
    8278
    8379    void disconnectFromPage() { close(); }
     
    9288
    9389    // Called from WebInspectorClient
    94     void openFrontendConnection(bool underTest);
     90    void openLocalInspectorFrontend(bool underTest);
    9591    void closeFrontendConnection();
    9692
  • trunk/Source/WebKit/WebProcess/WebPage/WebInspector.messages.in

    r217924 r238330  
    4141    StopElementSelection()
    4242
    43     SendMessageToBackend(String message)
     43    SetFrontendConnection(IPC::Attachment connectionIdentifier)
    4444}
  • trunk/Source/WebKit/WebProcess/WebPage/WebInspectorUI.cpp

    r235205 r238330  
    5353}
    5454
    55 void WebInspectorUI::establishConnection(IPC::Attachment encodedConnectionIdentifier, uint64_t inspectedPageIdentifier, bool underTest, unsigned inspectionLevel)
    56 {
     55void WebInspectorUI::establishConnection(uint64_t inspectedPageIdentifier, bool underTest, unsigned inspectionLevel)
     56{
     57    m_inspectedPageIdentifier = inspectedPageIdentifier;
     58    m_frontendAPIDispatcher.reset();
     59    m_underTest = underTest;
     60    m_inspectionLevel = inspectionLevel;
     61
     62    m_frontendController = &m_page.corePage()->inspectorController();
     63    m_frontendController->setInspectorFrontendClient(this);
     64
     65    updateConnection();
     66}
     67
     68void WebInspectorUI::updateConnection()
     69{
     70    if (m_backendConnection) {
     71        m_backendConnection->invalidate();
     72        m_backendConnection = nullptr;
     73    }
     74
    5775#if USE(UNIX_DOMAIN_SOCKETS)
    58     IPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.releaseFileDescriptor());
     76    IPC::Connection::SocketPair socketPair = IPC::Connection::createPlatformConnection();
     77    IPC::Connection::Identifier connectionIdentifier(socketPair.server);
     78    IPC::Attachment connectionClientPort(socketPair.client);
    5979#elif OS(DARWIN)
    60     IPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.port());
    61 #elif OS(WINDOWS)
    62     IPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.handle());
     80    mach_port_t listeningPort = MACH_PORT_NULL;
     81    if (mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &listeningPort) != KERN_SUCCESS)
     82        CRASH();
     83
     84    if (mach_port_insert_right(mach_task_self(), listeningPort, listeningPort, MACH_MSG_TYPE_MAKE_SEND) != KERN_SUCCESS)
     85        CRASH();
     86
     87    IPC::Connection::Identifier connectionIdentifier(listeningPort);
     88    IPC::Attachment connectionClientPort(listeningPort, MACH_MSG_TYPE_MOVE_SEND);
     89#elif PLATFORM(WIN)
     90    IPC::Connection::Identifier connectionIdentifier, connClient;
     91    IPC::Connection::createServerAndClientIdentifiers(connectionIdentifier, connClient);
     92    IPC::Attachment connectionClientPort(connClient);
    6393#else
    6494    notImplemented();
     
    6696#endif
    6797
    68     if (!IPC::Connection::identifierIsValid(connectionIdentifier))
    69         return;
    70 
    71     m_inspectedPageIdentifier = inspectedPageIdentifier;
    72     m_frontendAPIDispatcher.reset();
    73     m_underTest = underTest;
    74     m_inspectionLevel = inspectionLevel;
    75 
    76     m_frontendController = &m_page.corePage()->inspectorController();
    77     m_frontendController->setInspectorFrontendClient(this);
    78 
    79     m_backendConnection = IPC::Connection::createClientConnection(connectionIdentifier, *this);
     98#if USE(UNIX_DOMAIN_SOCKETS) || OS(DARWIN) || PLATFORM(WIN)
     99    m_backendConnection = IPC::Connection::createServerConnection(connectionIdentifier, *this);
    80100    m_backendConnection->open();
     101#endif
     102
     103    WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::SetFrontendConnection(connectionClientPort), m_inspectedPageIdentifier);
    81104}
    82105
     
    126149    WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::DidClose(), m_inspectedPageIdentifier);
    127150
    128     if (m_backendConnection)
     151    if (m_backendConnection) {
    129152        m_backendConnection->invalidate();
    130     m_backendConnection = nullptr;
    131 
    132     if (m_frontendController)
     153        m_backendConnection = nullptr;
     154    }
     155
     156    if (m_frontendController) {
    133157        m_frontendController->setInspectorFrontendClient(nullptr);
    134     m_frontendController = nullptr;
     158        m_frontendController = nullptr;
     159    }
    135160
    136161    if (m_frontendHost)
     
    304329void WebInspectorUI::sendMessageToBackend(const String& message)
    305330{
    306     if (m_backendConnection)
    307         m_backendConnection->send(Messages::WebInspector::SendMessageToBackend(message), 0);
     331    WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::SendMessageToBackend(message), m_inspectedPageIdentifier);
    308332}
    309333
  • trunk/Source/WebKit/WebProcess/WebPage/WebInspectorUI.h

    r222684 r238330  
    4747
    4848    // IPC::Connection::Client
    49     void didClose(IPC::Connection&) override { closeWindow(); }
     49    void didClose(IPC::Connection&) override { /* Do nothing, the inspected page process may have crashed and may be getting replaced. */ }
    5050    void didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference, IPC::StringReference) override { closeWindow(); }
    5151
    5252    // Called by WebInspectorUI messages
    53     void establishConnection(IPC::Attachment connectionIdentifier, uint64_t inspectedPageIdentifier, bool underTest, unsigned inspectionLevel);
     53    void establishConnection(uint64_t inspectedPageIdentifier, bool underTest, unsigned inspectionLevel);
     54    void updateConnection();
    5455
    5556    void showConsole();
  • trunk/Source/WebKit/WebProcess/WebPage/WebInspectorUI.messages.in

    r212597 r238330  
    2222
    2323messages -> WebInspectorUI {
    24     EstablishConnection(IPC::Attachment connectionIdentifier, uint64_t inspectedPageIdentifier, bool underTest, unsigned inspectionLevel)
     24    EstablishConnection(uint64_t inspectedPageIdentifier, bool underTest, unsigned inspectionLevel)
     25    UpdateConnection()
    2526
    2627    AttachedBottom()
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r238286 r238330  
    27782778}
    27792779
    2780 void WebPage::connectInspector(const String& targetId)
    2781 {
    2782     m_inspectorTargetController->connectInspector(targetId);
     2780void WebPage::connectInspector(const String& targetId, Inspector::FrontendChannel::ConnectionType connectionType)
     2781{
     2782    m_inspectorTargetController->connectInspector(targetId, connectionType);
    27832783}
    27842784
     
    34873487}
    34883488
    3489 void WebPage::setHasLocalInspectorFrontend(bool hasLocalFrontend)
    3490 {
    3491     send(Messages::WebPageProxy::SetHasLocalInspectorFrontend(hasLocalFrontend));
    3492 }
    3493 
    34943489void WebPage::inspectorFrontendCountChanged(unsigned count)
    34953490{
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r238193 r238330  
    5151#include "WebURLSchemeHandler.h"
    5252#include "WebUserContentController.h"
     53#include <JavaScriptCore/InspectorFrontendChannel.h>
    5354#include <WebCore/ActivityState.h>
    5455#include <WebCore/DictionaryPopupInfo.h>
     
    300301    bool isInspectorPage() { return !!m_inspectorUI || !!m_remoteInspectorUI; }
    301302
    302     void setHasLocalInspectorFrontend(bool);
    303303    void inspectorFrontendCountChanged(unsigned);
    304304
     
    10441044    void setControlledByAutomation(bool);
    10451045
    1046     void connectInspector(const String& targetId);
     1046    void connectInspector(const String& targetId, Inspector::FrontendChannel::ConnectionType);
    10471047    void disconnectInspector(const String& targetId);
    10481048    void sendMessageToTargetBackend(const String& targetId, const String& message);
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in

    r238192 r238330  
    112112    SetControlledByAutomation(bool controlled)
    113113
    114     ConnectInspector(String targetId)
     114    ConnectInspector(String targetId, Inspector::FrontendChannel::ConnectionType connectionType)
    115115    DisconnectInspector(String targetId)
    116116    SendMessageToTargetBackend(String targetId, String message)
  • trunk/Source/WebKit/WebProcess/WebPage/WebPageInspectorTargetController.cpp

    r238192 r238330  
    6262}
    6363
    64 void WebPageInspectorTargetController::connectInspector(const String& targetId)
     64void WebPageInspectorTargetController::connectInspector(const String& targetId, Inspector::FrontendChannel::ConnectionType connectionType)
    6565{
    6666    InspectorTarget* target = m_targets.get(targetId);
     
    7070    RefPtr<WebPageInspectorTargetFrontendChannel> channel = m_targetFrontendChannels.get(targetId);
    7171    if (!channel) {
    72         channel = WebPageInspectorTargetFrontendChannel::create(*this, targetId);
     72        channel = WebPageInspectorTargetFrontendChannel::create(*this, targetId, connectionType);
    7373        m_targetFrontendChannels.set(target->identifier(), channel);
    7474    }
  • trunk/Source/WebKit/WebProcess/WebPage/WebPageInspectorTargetController.h

    r238195 r238330  
    4848    void removeTarget(Inspector::InspectorTarget&);
    4949
    50     void connectInspector(const String& targetId);
     50    void connectInspector(const String& targetId, Inspector::FrontendChannel::ConnectionType);
    5151    void disconnectInspector(const String& targetId);
    5252    void sendMessageToTargetBackend(const String& targetId, const String& message);
  • trunk/Source/WebKit/WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp

    r238195 r238330  
    3131namespace WebKit {
    3232
    33 Ref<WebPageInspectorTargetFrontendChannel> WebPageInspectorTargetFrontendChannel::create(WebPageInspectorTargetController& targetController, const String& targetId)
     33Ref<WebPageInspectorTargetFrontendChannel> WebPageInspectorTargetFrontendChannel::create(WebPageInspectorTargetController& targetController, const String& targetId, Inspector::FrontendChannel::ConnectionType connectionType)
    3434{
    35     return adoptRef(*new WebPageInspectorTargetFrontendChannel(targetController, targetId));
     35    return adoptRef(*new WebPageInspectorTargetFrontendChannel(targetController, targetId, connectionType));
    3636}
    3737
    38 WebPageInspectorTargetFrontendChannel::WebPageInspectorTargetFrontendChannel(WebPageInspectorTargetController& targetController, const String& targetId)
     38WebPageInspectorTargetFrontendChannel::WebPageInspectorTargetFrontendChannel(WebPageInspectorTargetController& targetController, const String& targetId, Inspector::FrontendChannel::ConnectionType connectionType)
    3939    : m_targetController(targetController)
    4040    , m_targetId(targetId)
     41    , m_connectionType(connectionType)
    4142{
    4243}
  • trunk/Source/WebKit/WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.h

    r238192 r238330  
    3737    WTF_MAKE_FAST_ALLOCATED;
    3838public:
    39     static Ref<WebPageInspectorTargetFrontendChannel> create(WebPageInspectorTargetController&, const String& targetId);
     39    static Ref<WebPageInspectorTargetFrontendChannel> create(WebPageInspectorTargetController&, const String& targetId, Inspector::FrontendChannel::ConnectionType);
    4040    virtual ~WebPageInspectorTargetFrontendChannel() = default;
    4141
    4242private:
    43     WebPageInspectorTargetFrontendChannel(WebPageInspectorTargetController&, const String& targetId);
     43    WebPageInspectorTargetFrontendChannel(WebPageInspectorTargetController&, const String& targetId, Inspector::FrontendChannel::ConnectionType);
    4444
    45     ConnectionType connectionType() const override { return ConnectionType::Remote; }
     45    ConnectionType connectionType() const override { return m_connectionType; }
    4646    void sendMessageToFrontend(const String& message) override;
    4747
     
    4949    WebPageInspectorTargetController& m_targetController;
    5050    String m_targetId;
     51    Inspector::FrontendChannel::ConnectionType m_connectionType { Inspector::FrontendChannel::ConnectionType::Remote };
    5152};
    5253
Note: See TracChangeset for help on using the changeset viewer.