Changeset 229343 in webkit


Ignore:
Timestamp:
Mar 6, 2018 2:49:21 PM (6 years ago)
Author:
Brent Fulgham
Message:

NetworkDataTask should enable logging for automation clients
https://bugs.webkit.org/show_bug.cgi?id=183378
<rdar://problem/38189556>

Reviewed by Brian Burg.

The NetworkDataTaskCocoa class was only logging if the SessionID object allowed logging.
It should also be considering whether the current session is working on behalf of an
automation client. If so, it should allow logging.

  • NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
  • NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:

(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
(WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
(WebKit::NetworkDataTaskCocoa::isAlwaysOnLoggingAllowed const):

Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r229342 r229343  
     12018-03-06  Brent Fulgham  <bfulgham@apple.com>
     2
     3        NetworkDataTask should enable logging for automation clients
     4        https://bugs.webkit.org/show_bug.cgi?id=183378
     5        <rdar://problem/38189556>
     6
     7        Reviewed by Brian Burg.
     8
     9        The NetworkDataTaskCocoa class was only logging if the SessionID object allowed logging.
     10        It should also be considering whether the current session is working on behalf of an
     11        automation client. If so, it should allow logging.
     12
     13        * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
     14        * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
     15        (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
     16        (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
     17        (WebKit::NetworkDataTaskCocoa::isAlwaysOnLoggingAllowed const):
     18
    1192018-03-06  Ryan Haddad  <ryanhaddad@apple.com>
    220
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h

    r228239 r229343  
    11/*
    2  * Copyright (C) 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    8484#endif
    8585    bool isThirdPartyRequest(const WebCore::ResourceRequest&);
     86    bool isAlwaysOnLoggingAllowed() const;
    8687
    8788    RefPtr<SandboxExtension> m_sandboxExtension;
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm

    r228244 r229343  
    213213#if HAVE(CFNETWORK_STORAGE_PARTITIONING) && !RELEASE_LOG_DISABLED
    214214        if (NetworkProcess::singleton().shouldLogCookieInformation())
    215             RELEASE_LOG_IF(m_session->sessionID().isAlwaysOnLoggingAllowed(), Network, "%p - NetworkDataTaskCocoa::logCookieInformation: pageID = %llu, frameID = %llu, taskID = %lu: Blocking cookies for URL %s", this, pageID, frameID, (unsigned long)[m_task taskIdentifier], nsRequest.URL.absoluteString.UTF8String);
     215            RELEASE_LOG_IF(isAlwaysOnLoggingAllowed(), Network, "%p - NetworkDataTaskCocoa::logCookieInformation: pageID = %llu, frameID = %llu, taskID = %lu: Blocking cookies for URL %s", this, pageID, frameID, (unsigned long)[m_task taskIdentifier], nsRequest.URL.absoluteString.UTF8String);
    216216#else
    217217        LOG(NetworkSession, "%llu Blocking cookies for URL %s", [m_task taskIdentifier], nsRequest.URL.absoluteString.UTF8String);
     
    223223#if HAVE(CFNETWORK_STORAGE_PARTITIONING) && !RELEASE_LOG_DISABLED
    224224            if (NetworkProcess::singleton().shouldLogCookieInformation())
    225                 RELEASE_LOG_IF(m_session->sessionID().isAlwaysOnLoggingAllowed(), Network, "%p - NetworkDataTaskCocoa::logCookieInformation: pageID = %llu, frameID = %llu, taskID = %lu: Partitioning cookies for URL %s", this, pageID, frameID, (unsigned long)[m_task taskIdentifier], nsRequest.URL.absoluteString.UTF8String);
     225                RELEASE_LOG_IF(isAlwaysOnLoggingAllowed(), Network, "%p - NetworkDataTaskCocoa::logCookieInformation: pageID = %llu, frameID = %llu, taskID = %lu: Partitioning cookies for URL %s", this, pageID, frameID, (unsigned long)[m_task taskIdentifier], nsRequest.URL.absoluteString.UTF8String);
    226226#else
    227227            LOG(NetworkSession, "%llu Partitioning cookies for URL %s", [m_task taskIdentifier], nsRequest.URL.absoluteString.UTF8String);
     
    331331#if !RELEASE_LOG_DISABLED
    332332    if (NetworkProcess::singleton().shouldLogCookieInformation())
    333         RELEASE_LOG_IF(m_session->sessionID().isAlwaysOnLoggingAllowed(), Network, "%p - NetworkDataTaskCocoa::willPerformHTTPRedirection::logCookieInformation: pageID = %llu, frameID = %llu, taskID = %lu: %s cookies for redirect URL %s", this, m_pageID, m_frameID, (unsigned long)[m_task taskIdentifier], (shouldBlockCookies ? "Blocking" : "Not blocking"), request.url().string().utf8().data());
     333        RELEASE_LOG_IF(isAlwaysOnLoggingAllowed(), Network, "%p - NetworkDataTaskCocoa::willPerformHTTPRedirection::logCookieInformation: pageID = %llu, frameID = %llu, taskID = %lu: %s cookies for redirect URL %s", this, m_pageID, m_frameID, (unsigned long)[m_task taskIdentifier], (shouldBlockCookies ? "Blocking" : "Not blocking"), request.url().string().utf8().data());
    334334#else
    335335    LOG(NetworkSession, "%llu %s cookies for redirect URL %s", [m_task taskIdentifier], (shouldBlockCookies ? "Blocking" : "Not blocking"), request.url().string().utf8().data());
     
    348348#if !RELEASE_LOG_DISABLED
    349349        if (NetworkProcess::singleton().shouldLogCookieInformation())
    350             RELEASE_LOG_IF(m_session->sessionID().isAlwaysOnLoggingAllowed(), Network, "%p - NetworkDataTaskCocoa::willPerformHTTPRedirection::logCookieInformation: pageID = %llu, frameID = %llu, taskID = %lu: %s cookies for redirect URL %s", this, m_pageID, m_frameID, (unsigned long)[m_task taskIdentifier], (requiredStoragePartition.isEmpty() ? "Not partitioning" : "Partitioning"), request.url().string().utf8().data());
     350            RELEASE_LOG_IF(isAlwaysOnLoggingAllowed(), Network, "%p - NetworkDataTaskCocoa::willPerformHTTPRedirection::logCookieInformation: pageID = %llu, frameID = %llu, taskID = %lu: %s cookies for redirect URL %s", this, m_pageID, m_frameID, (unsigned long)[m_task taskIdentifier], (requiredStoragePartition.isEmpty() ? "Not partitioning" : "Partitioning"), request.url().string().utf8().data());
    351351#else
    352352        LOG(NetworkSession, "%llu %s cookies for redirect URL %s", [m_task taskIdentifier], (requiredStoragePartition.isEmpty() ? "Not partitioning" : "Partitioning"), request.url().string().utf8().data());
     
    477477}
    478478
    479 }
     479bool NetworkDataTaskCocoa::isAlwaysOnLoggingAllowed() const
     480{
     481    if (NetworkProcess::singleton().sessionIsControlledByAutomation(m_session->sessionID()))
     482        return true;
     483
     484    return m_session->sessionID().isAlwaysOnLoggingAllowed();
     485}
     486
     487}
Note: See TracChangeset for help on using the changeset viewer.