Diff
Modified: trunk/Source/WebCore/ChangeLog (231438 => 231439)
--- trunk/Source/WebCore/ChangeLog 2018-05-07 15:54:56 UTC (rev 231438)
+++ trunk/Source/WebCore/ChangeLog 2018-05-07 17:10:34 UTC (rev 231439)
@@ -1,3 +1,23 @@
+2018-05-07 Brian Burg <[email protected]>
+
+ 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 Timothy Hatcher.
+
+ 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-07 Eric Carlson <[email protected]>
Text track cue logging should include cue text
Modified: trunk/Source/WebCore/inspector/InspectorClient.h (231438 => 231439)
--- trunk/Source/WebCore/inspector/InspectorClient.h 2018-05-07 15:54:56 UTC (rev 231438)
+++ trunk/Source/WebCore/inspector/InspectorClient.h 2018-05-07 17:10:34 UTC (rev 231439)
@@ -44,6 +44,7 @@
virtual ~InspectorClient() = default;
virtual void inspectedPageDestroyed() = 0;
+ virtual void frontendCountChanged(unsigned) { }
virtual Inspector::FrontendChannel* openLocalFrontend(InspectorController*) = 0;
virtual void bringFrontendToFront() = 0;
Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (231438 => 231439)
--- trunk/Source/WebCore/inspector/InspectorController.cpp 2018-05-07 15:54:56 UTC (rev 231438)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp 2018-05-07 17:10:34 UTC (rev 231439)
@@ -274,6 +274,8 @@
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 @@
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 @@
m_isAutomaticInspection = false;
m_pauseAfterInitialization = false;
+ m_inspectorClient->frontendCountChanged(m_frontendRouter->frontendCount());
+
#if ENABLE(REMOTE_INSPECTOR)
m_page.remoteInspectorInformationDidChange();
#endif
Modified: trunk/Source/WebCore/inspector/InspectorController.h (231438 => 231439)
--- trunk/Source/WebCore/inspector/InspectorController.h 2018-05-07 15:54:56 UTC (rev 231438)
+++ trunk/Source/WebCore/inspector/InspectorController.h 2018-05-07 17:10:34 UTC (rev 231439)
@@ -94,7 +94,6 @@
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;
Modified: trunk/Source/WebKit/ChangeLog (231438 => 231439)
--- trunk/Source/WebKit/ChangeLog 2018-05-07 15:54:56 UTC (rev 231438)
+++ trunk/Source/WebKit/ChangeLog 2018-05-07 17:10:34 UTC (rev 231439)
@@ -1,3 +1,30 @@
+2018-05-07 Brian Burg <[email protected]>
+
+ 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 Timothy Hatcher.
+
+ 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 Tim Horton <[email protected]>
Shift to a lower-level framework for simplifying URLs
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (231438 => 231439)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2018-05-07 15:54:56 UTC (rev 231438)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2018-05-07 17:10:34 UTC (rev 231439)
@@ -362,6 +362,9 @@
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 @@
bool m_allowsRemoteInspection { true };
String m_remoteInspectionNameOverride;
#endif
+ unsigned m_inspectorFrontendCount { 0 };
#if PLATFORM(COCOA)
bool m_isSmartInsertDeleteEnabled { false };
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (231438 => 231439)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2018-05-07 15:54:56 UTC (rev 231438)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2018-05-07 17:10:34 UTC (rev 231439)
@@ -410,6 +410,8 @@
DisableInspectorNodeSearch()
#endif
+ DidChangeInspectorFrontendCount(uint64_t count)
+
# Search popup menus
SaveRecentSearches(String name, Vector<WebCore::RecentSearch> searchItems)
LoadRecentSearches(String name) -> (Vector<WebCore::RecentSearch> result)
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (231438 => 231439)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2018-05-07 15:54:56 UTC (rev 231438)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2018-05-07 17:10:34 UTC (rev 231439)
@@ -2074,6 +2074,9 @@
if (!m_configuration->processSwapsOnNavigation())
return page.process();
+ if (page.inspectorFrontendCount() > 0)
+ return page.process();
+
if (!page.process().hasCommittedAnyProvisionalLoads())
return page.process();
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp (231438 => 231439)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp 2018-05-07 15:54:56 UTC (rev 231438)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp 2018-05-07 17:10:34 UTC (rev 231439)
@@ -84,6 +84,11 @@
delete this;
}
+void WebInspectorClient::frontendCountChanged(unsigned count)
+{
+ m_page->inspectorFrontendCountChanged(count);
+}
+
Inspector::FrontendChannel* WebInspectorClient::openLocalFrontend(InspectorController* controller)
{
m_page->inspector()->openFrontendConnection(controller->isUnderTest());
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.h (231438 => 231439)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.h 2018-05-07 15:54:56 UTC (rev 231438)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.h 2018-05-07 17:10:34 UTC (rev 231439)
@@ -50,6 +50,7 @@
private:
// WebCore::InspectorClient
void inspectedPageDestroyed() override;
+ void frontendCountChanged(unsigned) override;
Inspector::FrontendChannel* openLocalFrontend(WebCore::InspectorController*) override;
void bringFrontendToFront() override;
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (231438 => 231439)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2018-05-07 15:54:56 UTC (rev 231438)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2018-05-07 17:10:34 UTC (rev 231439)
@@ -3265,6 +3265,11 @@
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()
{
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (231438 => 231439)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2018-05-07 15:54:56 UTC (rev 231438)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2018-05-07 17:10:34 UTC (rev 231439)
@@ -290,6 +290,8 @@
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();
Modified: trunk/Tools/ChangeLog (231438 => 231439)
--- trunk/Tools/ChangeLog 2018-05-07 15:54:56 UTC (rev 231438)
+++ trunk/Tools/ChangeLog 2018-05-07 17:10:34 UTC (rev 231439)
@@ -1,3 +1,17 @@
+2018-05-07 Brian Burg <[email protected]>
+
+ 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 Timothy Hatcher.
+
+ 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 Wenson Hsieh <[email protected]>
[iOS] Multiple links in Mail are dropped in a single line, and are difficult to tell apart
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (231438 => 231439)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm 2018-05-07 15:54:56 UTC (rev 231438)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm 2018-05-07 17:10:34 UTC (rev 231439)
@@ -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 @@
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(