WebKit Bugzilla
Attachment 339615 Details for
Bug 184861
: Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix API Test
bug-184861-20180504170602.patch (text/plain), 14.37 KB, created by
BJ Burg
on 2018-05-04 17:06:03 PDT
(
hide
)
Description:
Fix API Test
Filename:
MIME Type:
Creator:
BJ Burg
Created:
2018-05-04 17:06:03 PDT
Size:
14.37 KB
patch
obsolete
>Subversion Revision: 231391 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 270c593c111986d3b7e3a925c025e7bab07a53c3..ec7168d431d7b0b4cf0d9498cdad251c399dc218 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,23 @@ >+2018-04-21 Brian Burg <bburg@apple.com> >+ >+ Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected >+ https://bugs.webkit.org/show_bug.cgi?id=184861 >+ <rdar://problem/39153768> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Notify the client of the current connection count whenever a frontend connects or disconnects. >+ >+ Covered by new API test. >+ >+ * inspector/InspectorClient.h: >+ (WebCore::InspectorClient::frontendCountChanged): >+ * inspector/InspectorController.cpp: >+ (WebCore::InspectorController::connectFrontend): >+ (WebCore::InspectorController::disconnectFrontend): >+ (WebCore::InspectorController::disconnectAllFrontends): >+ * inspector/InspectorController.h: >+ > 2018-05-04 Ryosuke Niwa <rniwa@webkit.org> > > Rename DocumentOrderedMap to TreeScopeOrderedMap >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 8a807eab6932f1375cbaebd71300b89d76c43e07..d0f00e807eb661e8c4913c763b103f479c6249a3 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,30 @@ >+2018-04-21 Brian Burg <bburg@apple.com> >+ >+ Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected >+ https://bugs.webkit.org/show_bug.cgi?id=184861 >+ <rdar://problem/39153768> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ We need to track how many frontends are attached to the web page (both local and remote). >+ InspectorController propagates this out to WebKit via InspectorClient. This is then >+ kept in UIProcess as a member of WebPageProxy. When making a decision whether to use a >+ new process for a navigation, return early with "no" if any frontends are open for the >+ page being navigated. >+ >+ * UIProcess/WebPageProxy.h: >+ (WebKit::WebPageProxy::didChangeInspectorFrontendCount): >+ (WebKit::WebPageProxy::inspectorFrontendCount const): >+ * UIProcess/WebPageProxy.messages.in: >+ * UIProcess/WebProcessPool.cpp: >+ (WebKit::WebProcessPool::processForNavigation): >+ * WebProcess/WebCoreSupport/WebInspectorClient.cpp: >+ (WebKit::WebInspectorClient::frontendCountChanged): >+ * WebProcess/WebCoreSupport/WebInspectorClient.h: >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::inspectorFrontendCountChanged): >+ * WebProcess/WebPage/WebPage.h: >+ > 2018-05-04 Per Arne Vollan <pvollan@apple.com> > > Shutdown WindowServer connections after checking in with launch services >diff --git a/Source/WebCore/inspector/InspectorClient.h b/Source/WebCore/inspector/InspectorClient.h >index b5ea4b2642a76275295f63f96dd084b478a8d5c2..736edcad129a61ab7b5e947111d6abf6993065bc 100644 >--- a/Source/WebCore/inspector/InspectorClient.h >+++ b/Source/WebCore/inspector/InspectorClient.h >@@ -44,6 +44,7 @@ public: > virtual ~InspectorClient() = default; > > virtual void inspectedPageDestroyed() = 0; >+ virtual void frontendCountChanged(unsigned) { } > > virtual Inspector::FrontendChannel* openLocalFrontend(InspectorController*) = 0; > virtual void bringFrontendToFront() = 0; >diff --git a/Source/WebCore/inspector/InspectorController.cpp b/Source/WebCore/inspector/InspectorController.cpp >index e9ea1c5ffcb273632508287d857e42fba5b541c1..20eb10fa5db8b37ae70687f1aa86572352c8d471 100644 >--- a/Source/WebCore/inspector/InspectorController.cpp >+++ b/Source/WebCore/inspector/InspectorController.cpp >@@ -274,6 +274,8 @@ void InspectorController::connectFrontend(Inspector::FrontendChannel* frontendCh > m_agents.didCreateFrontendAndBackend(&m_frontendRouter.get(), &m_backendDispatcher.get()); > } > >+ m_inspectorClient->frontendCountChanged(m_frontendRouter->frontendCount()); >+ > #if ENABLE(REMOTE_INSPECTOR) > if (!m_frontendRouter->hasRemoteFrontend()) > m_page.remoteInspectorInformationDidChange(); >@@ -302,6 +304,8 @@ void InspectorController::disconnectFrontend(FrontendChannel* frontendChannel) > InspectorInstrumentation::unregisterInstrumentingAgents(m_instrumentingAgents.get()); > } > >+ m_inspectorClient->frontendCountChanged(m_frontendRouter->frontendCount()); >+ > #if ENABLE(REMOTE_INSPECTOR) > if (!m_frontendRouter->hasFrontends()) > m_page.remoteInspectorInformationDidChange(); >@@ -338,6 +342,8 @@ void InspectorController::disconnectAllFrontends() > m_isAutomaticInspection = false; > m_pauseAfterInitialization = false; > >+ m_inspectorClient->frontendCountChanged(m_frontendRouter->frontendCount()); >+ > #if ENABLE(REMOTE_INSPECTOR) > m_page.remoteInspectorInformationDidChange(); > #endif >diff --git a/Source/WebCore/inspector/InspectorController.h b/Source/WebCore/inspector/InspectorController.h >index 9a129e0dc95014d0178b6b2599f951a5d764e826..b45d6a30537607d122cfc96e2c935b580f07eecc 100644 >--- a/Source/WebCore/inspector/InspectorController.h >+++ b/Source/WebCore/inspector/InspectorController.h >@@ -94,7 +94,6 @@ public: > WEBCORE_EXPORT void connectFrontend(Inspector::FrontendChannel*, bool isAutomaticInspection = false, bool immediatelyPause = false); > WEBCORE_EXPORT void disconnectFrontend(Inspector::FrontendChannel*); > WEBCORE_EXPORT void disconnectAllFrontends(); >- void setProcessId(long); > > void inspect(Node*); > WEBCORE_EXPORT void drawHighlight(GraphicsContext&) const; >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index 9d1355d0cd7c9daebbb837176d747f3df57ebaed..561d2b3fd0641338ba9ab34829c2698e812ad152 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -362,6 +362,9 @@ public: > > WebInspectorProxy* inspector() const; > >+ void didChangeInspectorFrontendCount(unsigned count) { m_inspectorFrontendCount = count; } >+ unsigned inspectorFrontendCount() const { return m_inspectorFrontendCount; } >+ > bool isControlledByAutomation() const { return m_controlledByAutomation; } > void setControlledByAutomation(bool); > >@@ -2009,6 +2012,7 @@ private: > bool m_allowsRemoteInspection { true }; > String m_remoteInspectionNameOverride; > #endif >+ unsigned m_inspectorFrontendCount { 0 }; > > #if PLATFORM(COCOA) > bool m_isSmartInsertDeleteEnabled { false }; >diff --git a/Source/WebKit/UIProcess/WebPageProxy.messages.in b/Source/WebKit/UIProcess/WebPageProxy.messages.in >index ac7aa760557497d4b6ff298ce8d4d49d4ee8c995..999678d07df12c7b00bea4c99658c7c128d04a9a 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.messages.in >+++ b/Source/WebKit/UIProcess/WebPageProxy.messages.in >@@ -410,6 +410,8 @@ messages -> WebPageProxy { > DisableInspectorNodeSearch() > #endif > >+ DidChangeInspectorFrontendCount(uint64_t count) >+ > # Search popup menus > SaveRecentSearches(String name, Vector<WebCore::RecentSearch> searchItems) > LoadRecentSearches(String name) -> (Vector<WebCore::RecentSearch> result) >diff --git a/Source/WebKit/UIProcess/WebProcessPool.cpp b/Source/WebKit/UIProcess/WebProcessPool.cpp >index a63c75b0811e7d757e3a75ea3495f5f8305fec1e..5abcf96fe789ab6c8f9a526767c8edeb73a7c0bb 100644 >--- a/Source/WebKit/UIProcess/WebProcessPool.cpp >+++ b/Source/WebKit/UIProcess/WebProcessPool.cpp >@@ -2074,6 +2074,9 @@ Ref<WebProcessProxy> WebProcessPool::processForNavigationInternal(WebPageProxy& > if (!m_configuration->processSwapsOnNavigation()) > return page.process(); > >+ if (page.inspectorFrontendCount() > 0) >+ return page.process(); >+ > if (!page.process().hasCommittedAnyProvisionalLoads()) > return page.process(); > >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp >index d5c90e535c7156bfd9b247c80275718b8a202c26..0f1d53c4412a931e895799e890b1c31a0861ca91 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp >@@ -84,6 +84,11 @@ void WebInspectorClient::inspectedPageDestroyed() > delete this; > } > >+void WebInspectorClient::frontendCountChanged(unsigned count) >+{ >+ m_page->inspectorFrontendCountChanged(count); >+} >+ > Inspector::FrontendChannel* WebInspectorClient::openLocalFrontend(InspectorController* controller) > { > m_page->inspector()->openFrontendConnection(controller->isUnderTest()); >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.h >index 96b9a2613960c23690af368ee0b5ebc1261e6cd3..9c214ce5b82266ea6cffedde722463a912a569b6 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.h >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.h >@@ -50,6 +50,7 @@ public: > private: > // WebCore::InspectorClient > void inspectedPageDestroyed() override; >+ void frontendCountChanged(unsigned) override; > > Inspector::FrontendChannel* openLocalFrontend(WebCore::InspectorController*) override; > void bringFrontendToFront() override; >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index a82871d5691fba588ddb6655c435fbe71a1638b0..21e6e2fbdbd45c46217eb7ae670888ebb9843c26 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -3265,6 +3265,11 @@ RemoteWebInspectorUI* WebPage::remoteInspectorUI() > return m_remoteInspectorUI.get(); > } > >+void WebPage::inspectorFrontendCountChanged(unsigned count) >+{ >+ send(Messages::WebPageProxy::DidChangeInspectorFrontendCount(count)); >+} >+ > #if (PLATFORM(IOS) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) > PlaybackSessionManager& WebPage::playbackSessionManager() > { >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index 9780cfc6c5af840cbdafb1d093eca8e4e2eef2f1..8e53da5cd3d3dfbf8527bd8fc9e8b2a14f13455c 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -290,6 +290,8 @@ public: > RemoteWebInspectorUI* remoteInspectorUI(); > bool isInspectorPage() { return !!m_inspectorUI || !!m_remoteInspectorUI; } > >+ void inspectorFrontendCountChanged(unsigned); >+ > #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) > PlaybackSessionManager& playbackSessionManager(); > VideoFullscreenManager& videoFullscreenManager(); >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 5316f6465c6a9d226a48a1b4fb53a1de7253100c..e86e69a9691852400680320e403ea1ac1abaecd2 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,17 @@ >+2018-04-21 Brian Burg <bburg@apple.com> >+ >+ Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected >+ https://bugs.webkit.org/show_bug.cgi?id=184861 >+ <rdar://problem/39153768> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a new test that checks whether a new process is used for navigation when >+ an Inspector is shown. Also check that the behavior reverts to normal after >+ the Inspector has been closed. >+ >+ * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: >+ > 2018-05-04 Timothy Hatcher <timothy@apple.com> > > Deprecate legacy WebView and friends >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm >index c2d9d521ea05cc5a62b57c2fe20b69f41d1e66f1..5db6b85568cead05faa799a345b940b335083f44 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm >@@ -27,6 +27,7 @@ > > #import "PlatformUtilities.h" > #import "Test.h" >+#import <WebKit/WKInspector.h> > #import <WebKit/WKNavigationDelegate.h> > #import <WebKit/WKNavigationPrivate.h> > #import <WebKit/WKPreferencesPrivate.h> >@@ -1066,6 +1067,59 @@ TEST(ProcessSwap, LoadUnload) > EXPECT_TRUE([receivedMessages.get()[5] isEqualToString:@"pson1://host/main.html - unload" ]); > EXPECT_TRUE([receivedMessages.get()[6] isEqualToString:@"pson2://host/main.html - load" ]); > } >+ >+TEST(ProcessSwap, DisableForInspector) >+{ >+ auto processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]); >+ processPoolConfiguration.get().processSwapsOnNavigation = YES; >+ auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]); >+ >+ auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]); >+ [webViewConfiguration setProcessPool:processPool.get()]; >+ webViewConfiguration.get().preferences._developerExtrasEnabled = YES; >+ >+ RetainPtr<PSONScheme> handler = adoptNS([[PSONScheme alloc] init]); >+ [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON1"]; >+ [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON2"]; >+ >+ auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]); >+ auto delegate = adoptNS([[PSONNavigationDelegate alloc] init]); >+ [webView setNavigationDelegate:delegate.get()]; >+ >+ NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson1://host/main1.html"]]; >+ [webView loadRequest:request]; >+ >+ TestWebKitAPI::Util::run(&done); >+ done = false; >+ >+ auto pid1 = [webView _webProcessIdentifier]; >+ >+ // FIXME: use ObjC equivalent for WKInspectorRef when available. >+ WKInspectorShow(WKPageGetInspector([webView _pageRefForTransitionToWKWebView])); >+ >+ request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson2://host/main2.html"]]; >+ [webView loadRequest:request]; >+ >+ TestWebKitAPI::Util::run(&done); >+ done = false; >+ >+ auto pid2 = [webView _webProcessIdentifier]; >+ >+ WKInspectorClose(WKPageGetInspector([webView _pageRefForTransitionToWKWebView])); >+ >+ request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson1://host/main2.html"]]; >+ [webView loadRequest:request]; >+ >+ TestWebKitAPI::Util::run(&done); >+ done = false; >+ >+ auto pid3 = [webView _webProcessIdentifier]; >+ >+ EXPECT_EQ(pid1, pid2); >+ EXPECT_FALSE(pid2 == pid3); >+ EXPECT_EQ(numberOfDecidePolicyCalls, 3); >+} >+ > #endif // !TARGET_OS_IPHONE > > static const char* sameOriginBlobNavigationTestBytes = R"PSONRESOURCE(
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 184861
:
338528
| 339615