Changeset 238330 in webkit
- Timestamp:
- Nov 16, 2018 5:28:41 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 34 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r238307 r238330 1 2018-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 1 13 2018-11-16 Jeremy Jones <jeremyj@apple.com> 2 14 -
trunk/LayoutTests/inspector/unit-tests/target-manager-expected.txt
r225244 r238330 7 7 PASS: Target list should always contain the main target. 8 8 PASS: Main target should have an ExecutionContext. 9 PASS: Main target should have the globalRuntimeAgent.9 PASS: Main target should have the page target's RuntimeAgent. 10 10 Target - Symbol(page) - Page 11 11 -
trunk/LayoutTests/inspector/unit-tests/target-manager.html
r238192 r238330 31 31 InspectorTest.expectEqual([...WI.targets][0], WI.mainTarget, "Target list should always contain the main target."); 32 32 InspectorTest.expectNotNull(WI.mainTarget.executionContext, "Main target should have an ExecutionContext."); 33 InspectorTest.expectEqual(WI.mainTarget.RuntimeAgent, RuntimeAgent, "Main target should have the globalRuntimeAgent.");33 InspectorTest.expectEqual(WI.mainTarget.RuntimeAgent, WI.pageTarget.RuntimeAgent, "Main target should have the page target's RuntimeAgent."); 34 34 dumpTargets(); 35 35 } -
trunk/Source/JavaScriptCore/ChangeLog
r238326 r238330 1 2018-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 1 12 2018-11-16 Filip Pizlo <fpizlo@apple.com> 2 13 -
trunk/Source/JavaScriptCore/inspector/InspectorFrontendChannel.h
r207928 r238330 47 47 48 48 } // namespace Inspector 49 50 namespace WTF { 51 52 template<> 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 1 2018-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 1 28 2018-11-16 Matt Baker <mattbaker@apple.com> 2 29 -
trunk/Source/WebInspectorUI/UserInterface/Protocol/Connection.js
r238197 r238330 97 97 98 98 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") 100 101 console.error("Request with id = " + messageObject["id"] + " failed. " + JSON.stringify(messageObject["error"])); 101 102 } -
trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js
r238192 r238330 164 164 { 165 165 // FIXME: Should this respect pending dispatches in all connections? 166 InspectorBackend.backendConnection.runAfterPendingDispatches(script);166 WI.mainTarget.connection.runAfterPendingDispatches(script); 167 167 } 168 168 -
trunk/Source/WebInspectorUI/UserInterface/Test.html
r238192 r238330 76 76 <script src="Protocol/DirectBackendTarget.js"></script> 77 77 <script src="Protocol/MultiplexingBackendTarget.js"></script> 78 <script src="Protocol/JavaScriptContextTarget.js"></script> 79 <script src="Protocol/PageTarget.js"></script> 78 80 <script src="Protocol/WorkerTarget.js"></script> 79 81 -
trunk/Source/WebInspectorUI/UserInterface/Test/Test.js
r238192 r238330 76 76 WI.pageTarget = null; 77 77 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 }); 80 83 }; 81 84 … … 108 111 WI.resetMainExecutionContext = function() 109 112 { 110 console.assert(WI.mainTarget.executionContext); 113 if (WI.mainTarget instanceof WI.MultiplexingBackendTarget) 114 return; 111 115 112 WI.runtimeManager.activeExecutionContext = WI.mainTarget.executionContext; 116 if (WI.mainTarget.executionContext) 117 WI.runtimeManager.activeExecutionContext = WI.mainTarget.executionContext; 113 118 }; 114 119 … … 139 144 } 140 145 146 // FIXME: This slows down test debug logging considerably. 141 147 if (!WI.__didPerformCSSInitialization && target.CSSAgent) { 142 148 WI.__didPerformCSSInitialization = true; -
trunk/Source/WebKit/ChangeLog
r238318 r238330 1 2018-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 1 126 2018-11-16 Michael Catanzaro <mcatanzaro@igalia.com> 2 127 -
trunk/Source/WebKit/Scripts/webkit/messages.py
r238192 r238330 391 391 'JSC::MessageSource': ['<JavaScriptCore/ConsoleTypes.h>'], 392 392 'Inspector::InspectorTargetType': ['<JavaScriptCore/InspectorTarget.h>'], 393 'Inspector::FrontendChannel::ConnectionType': ['<JavaScriptCore/InspectorFrontendChannel.h>'], 393 394 'MonotonicTime': ['<wtf/MonotonicTime.h>'], 394 395 'Seconds': ['<wtf/Seconds.h>'], -
trunk/Source/WebKit/UIProcess/InspectorTargetProxy.cpp
r238192 r238330 47 47 } 48 48 49 void InspectorTargetProxy::connect(Inspector::FrontendChannel& )49 void InspectorTargetProxy::connect(Inspector::FrontendChannel& channel) 50 50 { 51 51 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()); 53 53 } 54 54 -
trunk/Source/WebKit/UIProcess/WebInspectorProxy.cpp
r238254 r238330 37 37 #include "WebInspectorUIMessages.h" 38 38 #include "WebPageGroup.h" 39 #include "WebPageInspectorController.h" 39 40 #include "WebPageProxy.h" 40 41 #include "WebPreferences.h" … … 84 85 void WebInspectorProxy::invalidate() 85 86 { 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()); 87 89 88 90 closeFrontendPageAndWindow(); … … 92 94 } 93 95 96 void 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 94 104 // Public APIs 95 105 bool WebInspectorProxy::isFront() … … 159 169 160 170 platformDidCloseForCrash(); 171 } 172 173 void 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 181 void 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 193 void 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()); 161 199 } 162 200 … … 341 379 } 342 380 343 // Called by WebInspectorProxy messages 344 void WebInspectorProxy::createInspectorPage(IPC::Attachment connectionIdentifier, bool canAttach, bool underTest) 345 { 346 if (!m_inspectedPage) 347 return; 381 void 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 } 348 390 349 391 m_underTest = underTest; … … 354 396 return; 355 397 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); 357 401 358 402 if (!m_underTest) { … … 426 470 m_inspectorPage->process().removeMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_inspectedPage->pageID()); 427 471 472 m_inspectedPage->inspectorController().disconnectFrontend(*this); 473 428 474 if (m_isAttached) 429 475 platformDetach(); … … 439 485 } 440 486 487 void WebInspectorProxy::sendMessageToBackend(const String& message) 488 { 489 if (!m_inspectedPage) 490 return; 491 492 m_inspectedPage->inspectorController().dispatchMessageFromFrontend(message); 493 } 494 441 495 void WebInspectorProxy::frontendLoaded() 442 496 { 497 if (!m_inspectedPage) 498 return; 499 443 500 if (auto* automationSession = m_inspectedPage->process().processPool().automationSession()) 444 501 automationSession->inspectorFrontendLoaded(*m_inspectedPage); -
trunk/Source/WebKit/UIProcess/WebInspectorProxy.h
r238254 r238330 31 31 #include "MessageReceiver.h" 32 32 #include "WebInspectorUtilities.h" 33 #include <JavaScriptCore/InspectorFrontendChannel.h> 33 34 #include <wtf/Forward.h> 34 35 #include <wtf/RefPtr.h> … … 71 72 : public API::ObjectImpl<API::Object::Type::Inspector> 72 73 , public IPC::MessageReceiver 74 , public Inspector::FrontendChannel 73 75 #if PLATFORM(WIN) 74 76 , public WebCore::WindowMessageListener … … 98 100 void close(); 99 101 void closeForCrash(); 102 103 void reset(); 104 void updateForNewPageProcess(WebPageProxy*); 100 105 101 106 #if PLATFORM(MAC) && WK_API_ENABLED … … 167 172 // IPC::MessageReceiver 168 173 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; } 169 178 170 179 WebPageProxy* platformCreateFrontendPage(); … … 197 206 198 207 // 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&); 200 212 void frontendLoaded(); 201 213 void didClose(); -
trunk/Source/WebKit/UIProcess/WebInspectorProxy.messages.in
r217924 r238330 22 22 23 23 messages -> 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) 25 28 26 29 FrontendLoaded() -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r238274 r238330 801 801 updateThrottleState(); 802 802 803 m_inspector = WebInspectorProxy::create(this);804 803 #if ENABLE(FULLSCREEN_API) 805 804 m_fullScreenManager = std::make_unique<WebFullScreenManagerProxy>(*this, pageClient().fullScreenManagerProxyClient()); … … 823 822 824 823 initializeWebPage(shouldDelayAttachingDrawingArea); 824 825 m_inspector->updateForNewPageProcess(this); 825 826 826 827 #if ENABLE(REMOTE_INSPECTOR) … … 939 940 m_activeContextMenu = nullptr; 940 941 #endif 942 943 m_inspector->invalidate(); 944 m_inspector = nullptr; 941 945 942 946 m_backForwardList->pageClosed(); … … 6251 6255 closeOverlayedViews(); 6252 6256 6253 if (m_inspector) { 6254 m_inspector->invalidate(); 6255 m_inspector = nullptr; 6256 } 6257 m_inspector->reset(); 6257 6258 6258 6259 #if ENABLE(FULLSCREEN_API) … … 6283 6284 6284 6285 m_toolTip = String(); 6285 6286 m_inspectorHasLocalFrontend = false;6287 6286 6288 6287 m_mainFrameHasHorizontalScrollbar = false; -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r238274 r238330 381 381 WebInspectorProxy* inspector() const; 382 382 383 bool hasLocalInspectorFrontend() const { return m_inspectorHasLocalFrontend; }384 void setHasLocalInspectorFrontend(bool hasLocalFrontend) { m_inspectorHasLocalFrontend = hasLocalFrontend; }385 386 383 void didChangeInspectorFrontendCount(unsigned count) { m_inspectorFrontendCount = count; } 387 384 unsigned inspectorFrontendCount() const { return m_inspectorFrontendCount; } … … 2118 2115 2119 2116 unsigned m_inspectorFrontendCount { 0 }; 2120 bool m_inspectorHasLocalFrontend { false };2121 2117 2122 2118 #if PLATFORM(COCOA) -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r238322 r238330 419 419 #endif 420 420 421 SetHasLocalInspectorFrontend(bool hasLocalFrontend)422 421 DidChangeInspectorFrontendCount(uint64_t count) 423 422 -
trunk/Source/WebKit/UIProcess/WebProcessPool.cpp
r238284 r238330 2137 2137 } 2138 2138 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 2145 2139 if (m_automationSession) { 2146 2140 reason = "An automation session is active"_s; -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp
r237266 r238330 91 91 Inspector::FrontendChannel* WebInspectorClient::openLocalFrontend(InspectorController* controller) 92 92 { 93 m_page->inspector()->open FrontendConnection(controller->isUnderTest());94 95 return m_page->inspector();93 m_page->inspector()->openLocalInspectorFrontend(controller->isUnderTest()); 94 95 return nullptr; 96 96 } 97 97 -
trunk/Source/WebKit/WebProcess/WebPage/WebInspector.cpp
r238206 r238330 71 71 } 72 72 73 // Called from WebInspectorClient 74 void WebInspector::openFrontendConnection(bool underTest) 75 { 73 void WebInspector::openLocalInspectorFrontend(bool underTest) 74 { 75 WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::OpenLocalInspectorFrontend(canAttachWindow(), underTest), m_page->pageID()); 76 } 77 78 void WebInspector::setFrontendConnection(IPC::Attachment encodedConnectionIdentifier) 79 { 80 ASSERT(!m_frontendConnection); 81 76 82 #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()); 80 84 #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()); 94 88 #else 95 89 notImplemented(); … … 97 91 #endif 98 92 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); 101 97 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 #endif107 98 } 108 99 109 100 void WebInspector::closeFrontendConnection() 110 101 { 111 m_page->setHasLocalInspectorFrontend(false);112 113 102 WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::DidClose(), m_page->pageID()); 114 103 … … 146 135 return; 147 136 148 m_page->corePage()->inspectorController().disconnectFrontend(*this);149 137 closeFrontendConnection(); 150 138 } … … 290 278 } 291 279 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 305 280 } // namespace WebKit -
trunk/Source/WebKit/WebProcess/WebPage/WebInspector.h
r238254 r238330 29 29 #include "Connection.h" 30 30 #include "MessageReceiver.h" 31 #include <JavaScriptCore/InspectorFrontendChannel.h>32 31 #include <wtf/Noncopyable.h> 33 32 #include <wtf/text/WTFString.h> … … 37 36 class WebPage; 38 37 39 class WebInspector : public API::ObjectImpl<API::Object::Type::BundleInspector>, private IPC::Connection::Client , public Inspector::FrontendChannel{38 class WebInspector : public API::ObjectImpl<API::Object::Type::BundleInspector>, private IPC::Connection::Client { 40 39 public: 41 40 static Ref<WebInspector> create(WebPage*); … … 44 43 45 44 void updateDockingAvailability(); 46 47 void sendMessageToFrontend(const String& message) override;48 ConnectionType connectionType() const override { return ConnectionType::Local; }49 45 50 46 // Implemented in generated WebInspectorMessageReceiver.cpp … … 79 75 void elementSelectionChanged(bool); 80 76 81 void se ndMessageToBackend(const String&);77 void setFrontendConnection(IPC::Attachment); 82 78 83 79 void disconnectFromPage() { close(); } … … 92 88 93 89 // Called from WebInspectorClient 94 void open FrontendConnection(bool underTest);90 void openLocalInspectorFrontend(bool underTest); 95 91 void closeFrontendConnection(); 96 92 -
trunk/Source/WebKit/WebProcess/WebPage/WebInspector.messages.in
r217924 r238330 41 41 StopElementSelection() 42 42 43 Se ndMessageToBackend(String message)43 SetFrontendConnection(IPC::Attachment connectionIdentifier) 44 44 } -
trunk/Source/WebKit/WebProcess/WebPage/WebInspectorUI.cpp
r235205 r238330 53 53 } 54 54 55 void WebInspectorUI::establishConnection(IPC::Attachment encodedConnectionIdentifier, uint64_t inspectedPageIdentifier, bool underTest, unsigned inspectionLevel) 56 { 55 void 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 68 void WebInspectorUI::updateConnection() 69 { 70 if (m_backendConnection) { 71 m_backendConnection->invalidate(); 72 m_backendConnection = nullptr; 73 } 74 57 75 #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); 59 79 #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); 63 93 #else 64 94 notImplemented(); … … 66 96 #endif 67 97 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); 80 100 m_backendConnection->open(); 101 #endif 102 103 WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::SetFrontendConnection(connectionClientPort), m_inspectedPageIdentifier); 81 104 } 82 105 … … 126 149 WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::DidClose(), m_inspectedPageIdentifier); 127 150 128 if (m_backendConnection) 151 if (m_backendConnection) { 129 152 m_backendConnection->invalidate(); 130 m_backendConnection = nullptr; 131 132 if (m_frontendController) 153 m_backendConnection = nullptr; 154 } 155 156 if (m_frontendController) { 133 157 m_frontendController->setInspectorFrontendClient(nullptr); 134 m_frontendController = nullptr; 158 m_frontendController = nullptr; 159 } 135 160 136 161 if (m_frontendHost) … … 304 329 void WebInspectorUI::sendMessageToBackend(const String& message) 305 330 { 306 if (m_backendConnection) 307 m_backendConnection->send(Messages::WebInspector::SendMessageToBackend(message), 0); 331 WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::SendMessageToBackend(message), m_inspectedPageIdentifier); 308 332 } 309 333 -
trunk/Source/WebKit/WebProcess/WebPage/WebInspectorUI.h
r222684 r238330 47 47 48 48 // 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. */ } 50 50 void didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference, IPC::StringReference) override { closeWindow(); } 51 51 52 52 // 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(); 54 55 55 56 void showConsole(); -
trunk/Source/WebKit/WebProcess/WebPage/WebInspectorUI.messages.in
r212597 r238330 22 22 23 23 messages -> WebInspectorUI { 24 EstablishConnection(IPC::Attachment connectionIdentifier, uint64_t inspectedPageIdentifier, bool underTest, unsigned inspectionLevel) 24 EstablishConnection(uint64_t inspectedPageIdentifier, bool underTest, unsigned inspectionLevel) 25 UpdateConnection() 25 26 26 27 AttachedBottom() -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r238286 r238330 2778 2778 } 2779 2779 2780 void WebPage::connectInspector(const String& targetId )2781 { 2782 m_inspectorTargetController->connectInspector(targetId );2780 void WebPage::connectInspector(const String& targetId, Inspector::FrontendChannel::ConnectionType connectionType) 2781 { 2782 m_inspectorTargetController->connectInspector(targetId, connectionType); 2783 2783 } 2784 2784 … … 3487 3487 } 3488 3488 3489 void WebPage::setHasLocalInspectorFrontend(bool hasLocalFrontend)3490 {3491 send(Messages::WebPageProxy::SetHasLocalInspectorFrontend(hasLocalFrontend));3492 }3493 3494 3489 void WebPage::inspectorFrontendCountChanged(unsigned count) 3495 3490 { -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r238193 r238330 51 51 #include "WebURLSchemeHandler.h" 52 52 #include "WebUserContentController.h" 53 #include <JavaScriptCore/InspectorFrontendChannel.h> 53 54 #include <WebCore/ActivityState.h> 54 55 #include <WebCore/DictionaryPopupInfo.h> … … 300 301 bool isInspectorPage() { return !!m_inspectorUI || !!m_remoteInspectorUI; } 301 302 302 void setHasLocalInspectorFrontend(bool);303 303 void inspectorFrontendCountChanged(unsigned); 304 304 … … 1044 1044 void setControlledByAutomation(bool); 1045 1045 1046 void connectInspector(const String& targetId );1046 void connectInspector(const String& targetId, Inspector::FrontendChannel::ConnectionType); 1047 1047 void disconnectInspector(const String& targetId); 1048 1048 void sendMessageToTargetBackend(const String& targetId, const String& message); -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in
r238192 r238330 112 112 SetControlledByAutomation(bool controlled) 113 113 114 ConnectInspector(String targetId )114 ConnectInspector(String targetId, Inspector::FrontendChannel::ConnectionType connectionType) 115 115 DisconnectInspector(String targetId) 116 116 SendMessageToTargetBackend(String targetId, String message) -
trunk/Source/WebKit/WebProcess/WebPage/WebPageInspectorTargetController.cpp
r238192 r238330 62 62 } 63 63 64 void WebPageInspectorTargetController::connectInspector(const String& targetId )64 void WebPageInspectorTargetController::connectInspector(const String& targetId, Inspector::FrontendChannel::ConnectionType connectionType) 65 65 { 66 66 InspectorTarget* target = m_targets.get(targetId); … … 70 70 RefPtr<WebPageInspectorTargetFrontendChannel> channel = m_targetFrontendChannels.get(targetId); 71 71 if (!channel) { 72 channel = WebPageInspectorTargetFrontendChannel::create(*this, targetId );72 channel = WebPageInspectorTargetFrontendChannel::create(*this, targetId, connectionType); 73 73 m_targetFrontendChannels.set(target->identifier(), channel); 74 74 } -
trunk/Source/WebKit/WebProcess/WebPage/WebPageInspectorTargetController.h
r238195 r238330 48 48 void removeTarget(Inspector::InspectorTarget&); 49 49 50 void connectInspector(const String& targetId );50 void connectInspector(const String& targetId, Inspector::FrontendChannel::ConnectionType); 51 51 void disconnectInspector(const String& targetId); 52 52 void sendMessageToTargetBackend(const String& targetId, const String& message); -
trunk/Source/WebKit/WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp
r238195 r238330 31 31 namespace WebKit { 32 32 33 Ref<WebPageInspectorTargetFrontendChannel> WebPageInspectorTargetFrontendChannel::create(WebPageInspectorTargetController& targetController, const String& targetId )33 Ref<WebPageInspectorTargetFrontendChannel> WebPageInspectorTargetFrontendChannel::create(WebPageInspectorTargetController& targetController, const String& targetId, Inspector::FrontendChannel::ConnectionType connectionType) 34 34 { 35 return adoptRef(*new WebPageInspectorTargetFrontendChannel(targetController, targetId ));35 return adoptRef(*new WebPageInspectorTargetFrontendChannel(targetController, targetId, connectionType)); 36 36 } 37 37 38 WebPageInspectorTargetFrontendChannel::WebPageInspectorTargetFrontendChannel(WebPageInspectorTargetController& targetController, const String& targetId )38 WebPageInspectorTargetFrontendChannel::WebPageInspectorTargetFrontendChannel(WebPageInspectorTargetController& targetController, const String& targetId, Inspector::FrontendChannel::ConnectionType connectionType) 39 39 : m_targetController(targetController) 40 40 , m_targetId(targetId) 41 , m_connectionType(connectionType) 41 42 { 42 43 } -
trunk/Source/WebKit/WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.h
r238192 r238330 37 37 WTF_MAKE_FAST_ALLOCATED; 38 38 public: 39 static Ref<WebPageInspectorTargetFrontendChannel> create(WebPageInspectorTargetController&, const String& targetId );39 static Ref<WebPageInspectorTargetFrontendChannel> create(WebPageInspectorTargetController&, const String& targetId, Inspector::FrontendChannel::ConnectionType); 40 40 virtual ~WebPageInspectorTargetFrontendChannel() = default; 41 41 42 42 private: 43 WebPageInspectorTargetFrontendChannel(WebPageInspectorTargetController&, const String& targetId );43 WebPageInspectorTargetFrontendChannel(WebPageInspectorTargetController&, const String& targetId, Inspector::FrontendChannel::ConnectionType); 44 44 45 ConnectionType connectionType() const override { return ConnectionType::Remote; }45 ConnectionType connectionType() const override { return m_connectionType; } 46 46 void sendMessageToFrontend(const String& message) override; 47 47 … … 49 49 WebPageInspectorTargetController& m_targetController; 50 50 String m_targetId; 51 Inspector::FrontendChannel::ConnectionType m_connectionType { Inspector::FrontendChannel::ConnectionType::Remote }; 51 52 }; 52 53
Note: See TracChangeset
for help on using the changeset viewer.