Changeset 230393 in webkit


Ignore:
Timestamp:
Apr 9, 2018 3:52:25 AM (6 years ago)
Author:
Carlos Garcia Campos
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.

Location:
releases/WebKitGTK/webkit-2.20/Source/WebKit
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • releases/WebKitGTK/webkit-2.20/Source/WebKit/ChangeLog

    r229528 r230393  
     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-12  Carlos Garcia Campos  <cgarcia@igalia.com>
    234
  • releases/WebKitGTK/webkit-2.20/Source/WebKit/NetworkProcess/NetworkProcess.cpp

    r228621 r230393  
    315315{
    316316    SessionTracker::destroySession(sessionID);
     317    m_sessionsControlledByAutomation.remove(sessionID);
    317318}
    318319
     
    389390}
    390391#endif
     392
     393bool NetworkProcess::sessionIsControlledByAutomation(PAL::SessionID sessionID) const
     394{
     395    return m_sessionsControlledByAutomation.contains(sessionID);
     396}
     397
     398void NetworkProcess::setSessionIsControlledByAutomation(PAL::SessionID sessionID, bool controlled)
     399{
     400    if (controlled)
     401        m_sessionsControlledByAutomation.add(sessionID);
     402    else
     403        m_sessionsControlledByAutomation.remove(sessionID);
     404}
    391405
    392406static void fetchDiskCacheEntries(PAL::SessionID sessionID, OptionSet<WebsiteDataFetchOption> fetchOptions, Function<void (Vector<WebsiteData::Entry>)>&& completionHandler)
  • releases/WebKitGTK/webkit-2.20/Source/WebKit/NetworkProcess/NetworkProcess.h

    r228621 r230393  
    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)
  • releases/WebKitGTK/webkit-2.20/Source/WebKit/NetworkProcess/NetworkProcess.messages.in

    r228621 r230393  
    8989    RemovePrevalentDomains(PAL::SessionID sessionID, Vector<String> domainsWithInteraction);
    9090#endif
     91
     92    SetSessionIsControlledByAutomation(PAL::SessionID sessionID, bool controlled);
    9193}
  • releases/WebKitGTK/webkit-2.20/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp

    r227991 r230393  
    702702bool NetworkResourceLoader::isAlwaysOnLoggingAllowed() const
    703703{
     704    if (NetworkProcess::singleton().sessionIsControlledByAutomation(sessionID()))
     705        return true;
     706
    704707    return sessionID().isAlwaysOnLoggingAllowed();
    705708}
  • releases/WebKitGTK/webkit-2.20/Source/WebKit/UIProcess/WebPageProxy.cpp

    r229016 r230393  
    12641264    m_controlledByAutomation = controlled;
    12651265
    1266     if (isValid())
    1267         m_process->send(Messages::WebPage::SetControlledByAutomation(controlled), m_pageID);
     1266    if (!isValid())
     1267        return;
     1268
     1269    m_process->send(Messages::WebPage::SetControlledByAutomation(controlled), m_pageID);
     1270    m_process->processPool().sendToNetworkingProcess(Messages::NetworkProcess::SetSessionIsControlledByAutomation(m_websiteDataStore->sessionID(), m_controlledByAutomation));
    12681271}
    12691272
Note: See TracChangeset for help on using the changeset viewer.