- Revision
- 230393
- Author
- carlo...@webkit.org
- Date
- 2018-04-09 03:52:25 -0700 (Mon, 09 Apr 2018)
Log Message
Merge r229201 - Notify the NetworkProcess when a session is servicing an automation client
https://bugs.webkit.org/show_bug.cgi?id=183306
<rdar://problem/37835783>
Reviewed by Brian Burg.
Network loads servicing WebDriver are done through an ephemeral session. While this is great
for protecting a developer's machine from sharing state with test runs, it has the unintended
effect of blocking certain logging operations.
We do not log content in ephemeral sessions to protect user privacy. However, ephemeral sessions
generated by WebDriver should participate in logging so that proper testing (with logging) can
be done.
This patch signals the NetworkProcess when an ephemeral session (created for automation purposes)
is created, so that it can allow logging.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::destroySession): Remove controlled-by-automation entry.
(WebKit::NetworkProcess::sessionIsControlledByAutomation const): Added.
(WebKit::NetworkProcess::setSessionIsControlledByAutomation): Added.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::isAlwaysOnLoggingAllowed const): Checks if the relevant session
is servicing an automation client, and returns true if it is.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy): Signal the network process if this page is being created
for an automation client.
Modified Paths
Diff
Modified: releases/WebKitGTK/webkit-2.20/Source/WebKit/ChangeLog (230392 => 230393)
--- releases/WebKitGTK/webkit-2.20/Source/WebKit/ChangeLog 2018-04-09 10:52:15 UTC (rev 230392)
+++ releases/WebKitGTK/webkit-2.20/Source/WebKit/ChangeLog 2018-04-09 10:52:25 UTC (rev 230393)
@@ -1,3 +1,35 @@
+2018-03-03 Brent Fulgham <bfulg...@apple.com>
+
+ Notify the NetworkProcess when a session is servicing an automation client
+ https://bugs.webkit.org/show_bug.cgi?id=183306
+ <rdar://problem/37835783>
+
+ Reviewed by Brian Burg.
+
+ Network loads servicing WebDriver are done through an ephemeral session. While this is great
+ for protecting a developer's machine from sharing state with test runs, it has the unintended
+ effect of blocking certain logging operations.
+
+ We do not log content in ephemeral sessions to protect user privacy. However, ephemeral sessions
+ generated by WebDriver should participate in logging so that proper testing (with logging) can
+ be done.
+
+ This patch signals the NetworkProcess when an ephemeral session (created for automation purposes)
+ is created, so that it can allow logging.
+
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::destroySession): Remove controlled-by-automation entry.
+ (WebKit::NetworkProcess::sessionIsControlledByAutomation const): Added.
+ (WebKit::NetworkProcess::setSessionIsControlledByAutomation): Added.
+ * NetworkProcess/NetworkProcess.h:
+ * NetworkProcess/NetworkProcess.messages.in:
+ * NetworkProcess/NetworkResourceLoader.cpp:
+ (WebKit::NetworkResourceLoader::isAlwaysOnLoggingAllowed const): Checks if the relevant session
+ is servicing an automation client, and returns true if it is.
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::WebPageProxy): Signal the network process if this page is being created
+ for an automation client.
+
2018-03-12 Carlos Garcia Campos <cgar...@igalia.com>
Unreviewed. Update OptionsGTK.cmake and NEWS for 2.20.0 release.
Modified: releases/WebKitGTK/webkit-2.20/Source/WebKit/NetworkProcess/NetworkProcess.cpp (230392 => 230393)
--- releases/WebKitGTK/webkit-2.20/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2018-04-09 10:52:15 UTC (rev 230392)
+++ releases/WebKitGTK/webkit-2.20/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2018-04-09 10:52:25 UTC (rev 230393)
@@ -314,6 +314,7 @@
void NetworkProcess::destroySession(PAL::SessionID sessionID)
{
SessionTracker::destroySession(sessionID);
+ m_sessionsControlledByAutomation.remove(sessionID);
}
void NetworkProcess::grantSandboxExtensionsToStorageProcessForBlobs(const Vector<String>& filenames, Function<void ()>&& completionHandler)
@@ -389,6 +390,19 @@
}
#endif
+bool NetworkProcess::sessionIsControlledByAutomation(PAL::SessionID sessionID) const
+{
+ return m_sessionsControlledByAutomation.contains(sessionID);
+}
+
+void NetworkProcess::setSessionIsControlledByAutomation(PAL::SessionID sessionID, bool controlled)
+{
+ if (controlled)
+ m_sessionsControlledByAutomation.add(sessionID);
+ else
+ m_sessionsControlledByAutomation.remove(sessionID);
+}
+
static void fetchDiskCacheEntries(PAL::SessionID sessionID, OptionSet<WebsiteDataFetchOption> fetchOptions, Function<void (Vector<WebsiteData::Entry>)>&& completionHandler)
{
if (auto* cache = NetworkProcess::singleton().cache()) {
Modified: releases/WebKitGTK/webkit-2.20/Source/WebKit/NetworkProcess/NetworkProcess.h (230392 => 230393)
--- releases/WebKitGTK/webkit-2.20/Source/WebKit/NetworkProcess/NetworkProcess.h 2018-04-09 10:52:15 UTC (rev 230392)
+++ releases/WebKitGTK/webkit-2.20/Source/WebKit/NetworkProcess/NetworkProcess.h 2018-04-09 10:52:25 UTC (rev 230393)
@@ -34,6 +34,7 @@
#include <pal/SessionID.h>
#include <wtf/Forward.h>
#include <wtf/Function.h>
+#include <wtf/HashSet.h>
#include <wtf/MemoryPressureHandler.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/RetainPtr.h>
@@ -152,6 +153,9 @@
bool shouldLogCookieInformation() const { return m_logCookieInformation; }
#endif
+ void setSessionIsControlledByAutomation(PAL::SessionID, bool);
+ bool sessionIsControlledByAutomation(PAL::SessionID) const;
+
private:
NetworkProcess();
~NetworkProcess();
@@ -258,6 +262,7 @@
#if ENABLE(SERVER_PRECONNECT)
HashMap<uint64_t, WeakPtr<PreconnectTask>> m_waitingPreconnectTasks;
#endif
+ HashSet<PAL::SessionID> m_sessionsControlledByAutomation;
#if PLATFORM(COCOA)
void platformInitializeNetworkProcessCocoa(const NetworkProcessCreationParameters&);
Modified: releases/WebKitGTK/webkit-2.20/Source/WebKit/NetworkProcess/NetworkProcess.messages.in (230392 => 230393)
--- releases/WebKitGTK/webkit-2.20/Source/WebKit/NetworkProcess/NetworkProcess.messages.in 2018-04-09 10:52:15 UTC (rev 230392)
+++ releases/WebKitGTK/webkit-2.20/Source/WebKit/NetworkProcess/NetworkProcess.messages.in 2018-04-09 10:52:25 UTC (rev 230393)
@@ -88,4 +88,6 @@
GrantStorageAccessForFrame(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId)
RemovePrevalentDomains(PAL::SessionID sessionID, Vector<String> domainsWithInteraction);
#endif
+
+ SetSessionIsControlledByAutomation(PAL::SessionID sessionID, bool controlled);
}
Modified: releases/WebKitGTK/webkit-2.20/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp (230392 => 230393)
--- releases/WebKitGTK/webkit-2.20/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp 2018-04-09 10:52:15 UTC (rev 230392)
+++ releases/WebKitGTK/webkit-2.20/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp 2018-04-09 10:52:25 UTC (rev 230393)
@@ -701,6 +701,9 @@
bool NetworkResourceLoader::isAlwaysOnLoggingAllowed() const
{
+ if (NetworkProcess::singleton().sessionIsControlledByAutomation(sessionID()))
+ return true;
+
return sessionID().isAlwaysOnLoggingAllowed();
}
Modified: releases/WebKitGTK/webkit-2.20/Source/WebKit/UIProcess/WebPageProxy.cpp (230392 => 230393)
--- releases/WebKitGTK/webkit-2.20/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-04-09 10:52:15 UTC (rev 230392)
+++ releases/WebKitGTK/webkit-2.20/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-04-09 10:52:25 UTC (rev 230393)
@@ -1263,8 +1263,11 @@
m_controlledByAutomation = controlled;
- if (isValid())
- m_process->send(Messages::WebPage::SetControlledByAutomation(controlled), m_pageID);
+ if (!isValid())
+ return;
+
+ m_process->send(Messages::WebPage::SetControlledByAutomation(controlled), m_pageID);
+ m_process->processPool().sendToNetworkingProcess(Messages::NetworkProcess::SetSessionIsControlledByAutomation(m_websiteDataStore->sessionID(), m_controlledByAutomation));
}
#if ENABLE(REMOTE_INSPECTOR)