Changeset 229201 in webkit


Ignore:
Timestamp:
Mar 3, 2018 3:27:18 PM (6 years ago)
Author:
Brent Fulgham
Message:

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.

Location:
trunk/Source/WebKit
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r229195 r229201  
     12018-03-03  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Notify the NetworkProcess when a session is servicing an automation client
     4        https://bugs.webkit.org/show_bug.cgi?id=183306
     5        <rdar://problem/37835783>
     6
     7        Reviewed by Brian Burg.
     8
     9        Network loads servicing WebDriver are done through an ephemeral session. While this is great
     10        for protecting a developer's machine from sharing state with test runs, it has the unintended
     11        effect of blocking certain logging operations.
     12
     13        We do not log content in ephemeral sessions to protect user privacy. However, ephemeral sessions
     14        generated by WebDriver should participate in logging so that proper testing (with logging) can
     15        be done.
     16
     17        This patch signals the NetworkProcess when an ephemeral session (created for automation purposes)
     18        is created, so that it can allow logging.
     19
     20        * NetworkProcess/NetworkProcess.cpp:
     21        (WebKit::NetworkProcess::destroySession): Remove controlled-by-automation entry.
     22        (WebKit::NetworkProcess::sessionIsControlledByAutomation const): Added.
     23        (WebKit::NetworkProcess::setSessionIsControlledByAutomation): Added.
     24        * NetworkProcess/NetworkProcess.h:
     25        * NetworkProcess/NetworkProcess.messages.in:
     26        * NetworkProcess/NetworkResourceLoader.cpp:
     27        (WebKit::NetworkResourceLoader::isAlwaysOnLoggingAllowed const): Checks if the relevant session
     28        is servicing an automation client, and returns true if it is.
     29        * UIProcess/WebPageProxy.cpp:
     30        (WebKit::WebPageProxy::WebPageProxy): Signal the network process if this page is being created
     31        for an automation client.
     32
    1332018-03-02  Yusuke Suzuki  <utatane.tea@gmail.com>
    234
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp

    r228893 r229201  
    326326{
    327327    SessionTracker::destroySession(sessionID);
     328    m_sessionsControlledByAutomation.remove(sessionID);
    328329}
    329330
     
    400401}
    401402#endif
     403
     404bool NetworkProcess::sessionIsControlledByAutomation(PAL::SessionID sessionID) const
     405{
     406    return m_sessionsControlledByAutomation.contains(sessionID);
     407}
     408
     409void NetworkProcess::setSessionIsControlledByAutomation(PAL::SessionID sessionID, bool controlled)
     410{
     411    if (controlled)
     412        m_sessionsControlledByAutomation.add(sessionID);
     413    else
     414        m_sessionsControlledByAutomation.remove(sessionID);
     415}
    402416
    403417static void fetchDiskCacheEntries(PAL::SessionID sessionID, OptionSet<WebsiteDataFetchOption> fetchOptions, Function<void (Vector<WebsiteData::Entry>)>&& completionHandler)
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.h

    r228109 r229201  
    3535#include <wtf/Forward.h>
    3636#include <wtf/Function.h>
     37#include <wtf/HashSet.h>
    3738#include <wtf/MemoryPressureHandler.h>
    3839#include <wtf/NeverDestroyed.h>
     
    152153    bool shouldLogCookieInformation() const { return m_logCookieInformation; }
    153154#endif
     155
     156    void setSessionIsControlledByAutomation(PAL::SessionID, bool);
     157    bool sessionIsControlledByAutomation(PAL::SessionID) const;
    154158
    155159private:
     
    259263    HashMap<uint64_t, WeakPtr<PreconnectTask>> m_waitingPreconnectTasks;
    260264#endif
     265    HashSet<PAL::SessionID> m_sessionsControlledByAutomation;
    261266
    262267#if PLATFORM(COCOA)
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in

    r228109 r229201  
    8989    RemovePrevalentDomains(PAL::SessionID sessionID, Vector<String> domainsWithInteraction);
    9090#endif
     91
     92    SetSessionIsControlledByAutomation(PAL::SessionID sessionID, bool controlled);
    9193}
  • trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp

    r228231 r229201  
    707707bool NetworkResourceLoader::isAlwaysOnLoggingAllowed() const
    708708{
     709    if (NetworkProcess::singleton().sessionIsControlledByAutomation(sessionID()))
     710        return true;
     711
    709712    return sessionID().isAlwaysOnLoggingAllowed();
    710713}
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r229063 r229201  
    12821282    m_controlledByAutomation = controlled;
    12831283
    1284     if (isValid())
    1285         m_process->send(Messages::WebPage::SetControlledByAutomation(controlled), m_pageID);
     1284    if (!isValid())
     1285        return;
     1286
     1287    m_process->send(Messages::WebPage::SetControlledByAutomation(controlled), m_pageID);
     1288    m_process->processPool().sendToNetworkingProcess(Messages::NetworkProcess::SetSessionIsControlledByAutomation(m_websiteDataStore->sessionID(), m_controlledByAutomation));
    12861289}
    12871290
Note: See TracChangeset for help on using the changeset viewer.