⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 257758 in webkit


Ignore:
Timestamp:
Mar 2, 2020, 7:11:06 PM (7 years ago)
Author:
Brent Fulgham
Message:

Add flag to indicate that ITP state was explicitly set
https://bugs.webkit.org/show_bug.cgi?id=208461
<rdar://problem/59960829>

Reviewed by John Wilander.

Now that ITP is supported in Ephemeral sessions, we would like to move to a process-wide
concept of ITP being on or off, rather than controlling this at a website data level.
This patch takes the first step by adding a flag to the WebKit::NetworkSessionCreationParameters
structure that tracks whether the state of ITP (On or Off) was explicitly set by
SPI (primarily during testing).

This patch also ensures that we can communicate with TCC for the purpose of checking if
ITP is on or off.

  • NetworkProcess/NetworkSessionCreationParameters.cpp:

(WebKit::NetworkSessionCreationParameters::encode const):
(WebKit::NetworkSessionCreationParameters::decode):

  • NetworkProcess/NetworkSessionCreationParameters.h:
  • NetworkProcess/cocoa/NetworkSessionCocoa.mm:

(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):

  • NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
  • Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
  • Scripts/process-entitlements.sh:
  • UIProcess/API/C/WKWebsiteDataStoreRef.cpp:

(WKWebsiteDataStoreSetResourceLoadStatisticsEnabled):

  • UIProcess/API/Cocoa/WKWebsiteDataStore.mm:

(-[WKWebsiteDataStore _setResourceLoadStatisticsEnabled:]):

  • UIProcess/Cocoa/VersionChecks.h:
  • UIProcess/WebProcessPool.cpp:

(WebKit::WebProcessPool::WebProcessPool):
(WebKit::WebProcessPool::ensureNetworkProcess):
(WebKit::WebProcessPool::createNewWebProcess):

  • UIProcess/WebProcessPool.h:
  • UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:

(WebKit::WebsiteDataStore::parameters):

  • UIProcess/WebsiteData/WebsiteDataStore.cpp:

(WebKit::WebsiteDataStore::setIsRunningResourceLoadStatisticsTest):

  • UIProcess/WebsiteData/WebsiteDataStore.h:

(WebKit::WebsiteDataStore::itpStateWasExplicitlySet const):
(WebKit::WebsiteDataStore::useExplicitITPState):

Location:
trunk/Source/WebKit
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r257755 r257758  
     12020-03-02  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Add flag to indicate that ITP state was explicitly set
     4        https://bugs.webkit.org/show_bug.cgi?id=208461
     5        <rdar://problem/59960829>
     6
     7        Reviewed by John Wilander.
     8
     9        Now that ITP is supported in Ephemeral sessions, we would like to move to a process-wide
     10        concept of ITP being on or off, rather than controlling this at a website data level.
     11        This patch takes the first step by adding a flag to the WebKit::NetworkSessionCreationParameters
     12        structure that tracks whether the state of ITP (On or Off) was explicitly set by
     13        SPI (primarily during testing).
     14
     15        This patch also ensures that we can communicate with TCC for the purpose of checking if
     16        ITP is on or off.
     17
     18        * NetworkProcess/NetworkSessionCreationParameters.cpp:
     19        (WebKit::NetworkSessionCreationParameters::encode const):
     20        (WebKit::NetworkSessionCreationParameters::decode):
     21        * NetworkProcess/NetworkSessionCreationParameters.h:
     22        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
     23        (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
     24        * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
     25        * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
     26        * Scripts/process-entitlements.sh:
     27        * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
     28        (WKWebsiteDataStoreSetResourceLoadStatisticsEnabled):
     29        * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
     30        (-[WKWebsiteDataStore _setResourceLoadStatisticsEnabled:]):
     31        * UIProcess/Cocoa/VersionChecks.h:
     32        * UIProcess/WebProcessPool.cpp:
     33        (WebKit::WebProcessPool::WebProcessPool):
     34        (WebKit::WebProcessPool::ensureNetworkProcess):
     35        (WebKit::WebProcessPool::createNewWebProcess):
     36        * UIProcess/WebProcessPool.h:
     37        * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
     38        (WebKit::WebsiteDataStore::parameters):
     39        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
     40        (WebKit::WebsiteDataStore::setIsRunningResourceLoadStatisticsTest):
     41        * UIProcess/WebsiteData/WebsiteDataStore.h:
     42        (WebKit::WebsiteDataStore::itpStateWasExplicitlySet const):
     43        (WebKit::WebsiteDataStore::useExplicitITPState):
     44
    1452020-03-02  Alan Coon  <alancoon@apple.com>
    246
  • trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp

    r257185 r257758  
    11/*
    2  * Copyright (C) 2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2018-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    6464    encoder << resourceLoadStatisticsDirectoryExtensionHandle;
    6565    encoder << enableResourceLoadStatistics;
     66    encoder << isItpStateExplicitlySet;
    6667    encoder << enableResourceLoadStatisticsLogTestingEvent;
    6768    encoder << shouldIncludeLocalhostInResourceLoadStatistics;
     
    180181        return WTF::nullopt;
    181182
     183    Optional<bool> isItpStateExplicitlySet;
     184    decoder >> isItpStateExplicitlySet;
     185    if (!isItpStateExplicitlySet)
     186        return WTF::nullopt;
     187
    182188    Optional<bool> enableResourceLoadStatisticsLogTestingEvent;
    183189    decoder >> enableResourceLoadStatisticsLogTestingEvent;
     
    301307        , WTFMove(*resourceLoadStatisticsDirectoryExtensionHandle)
    302308        , WTFMove(*enableResourceLoadStatistics)
     309        , WTFMove(*isItpStateExplicitlySet)
    303310        , WTFMove(*enableResourceLoadStatisticsLogTestingEvent)
    304311        , WTFMove(*shouldIncludeLocalhostInResourceLoadStatistics)
  • trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h

    r257185 r257758  
    11/*
    2  * Copyright (C) 2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2017-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    8383    SandboxExtension::Handle resourceLoadStatisticsDirectoryExtensionHandle;
    8484    bool enableResourceLoadStatistics { false };
     85    bool isItpStateExplicitlySet { false };
    8586    bool enableResourceLoadStatisticsLogTestingEvent { false };
    8687    bool shouldIncludeLocalhostInResourceLoadStatistics { true };
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm

    r257185 r257758  
    11/*
    2  * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    11621162
    11631163#if HAVE(SESSION_CLEANUP)
    1164     activateSessionCleanup(*this);
     1164    activateSessionCleanup(*this, parameters);
    11651165#endif
    11661166}
  • trunk/Source/WebKit/NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in

    r257162 r257758  
    441441    (global-name "com.apple.ProgressReporting"))
    442442
     443;; Needed for TCC.
     444(allow mach-lookup
     445    (global-name "com.apple.tccd"))
  • trunk/Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb

    r257643 r257758  
    675675(allow iokit-get-properties
    676676    (iokit-property "IORegistryEntryPropertyKeys"))
     677
     678;; Needed for TCC.
     679(allow mach-lookup
     680    (global-name "com.apple.tccd"))
  • trunk/Source/WebKit/Scripts/process-entitlements.sh

    r257386 r257758  
    4444        then
    4545            plistbuddy Add :com.apple.private.network.socket-delegate bool YES
     46        fi
     47
     48        if (( "${TARGET_MAC_OS_X_VERSION_MAJOR}" >= 101600 ))
     49        then
     50            plistbuddy Add :com.apple.private.tcc.manager.check-by-audit-token array
     51            plistbuddy Add :com.apple.private.tcc.manager.check-by-audit-token:0 string kTCCServiceWebKitIntelligentTrackingPrevention
    4652        fi
    4753
     
    102108    plistbuddy Add :com.apple.private.network.socket-delegate bool YES
    103109    plistbuddy Add :com.apple.security.network.client bool YES
     110
     111    plistbuddy Add :com.apple.private.tcc.manager.check-by-audit-token array
     112    plistbuddy Add :com.apple.private.tcc.manager.check-by-audit-token:0 string kTCCServiceWebKitIntelligentTrackingPrevention
    104113}
    105114
     
    169178    plistbuddy Add :com.apple.private.network.socket-delegate bool YES
    170179
     180    plistbuddy Add :com.apple.private.tcc.manager.check-by-audit-token array
     181    plistbuddy Add :com.apple.private.tcc.manager.check-by-audit-token:0 string kTCCServiceWebKitIntelligentTrackingPrevention
     182
    171183    plistbuddy Add :seatbelt-profiles array
    172184    plistbuddy Add :seatbelt-profiles:0 string com.apple.WebKit.Networking
  • trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp

    r257726 r257758  
    6969void WKWebsiteDataStoreSetResourceLoadStatisticsEnabled(WKWebsiteDataStoreRef dataStoreRef, bool enable)
    7070{
    71     WebKit::toImpl(dataStoreRef)->setResourceLoadStatisticsEnabled(enable);
     71    auto* websiteDataStore = WebKit::toImpl(dataStoreRef);
     72#if ENABLE(RESOURCE_LOAD_STATISTICS)
     73    websiteDataStore->useExplicitITPState();
     74#endif
     75    websiteDataStore->setResourceLoadStatisticsEnabled(enable);
    7276}
    7377
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm

    r257553 r257758  
    279279- (void)_setResourceLoadStatisticsEnabled:(BOOL)enabled
    280280{
     281    _websiteDataStore->useExplicitITPState();
    281282    _websiteDataStore->setResourceLoadStatisticsEnabled(enabled);
    282283}
  • trunk/Source/WebKit/UIProcess/Cocoa/VersionChecks.h

    r256191 r257758  
    4747#define DYLD_IOS_VERSION_FIRST_WITH_DEVICE_ORIENTATION_AND_MOTION_PERMISSION_API 0
    4848#endif
     49
     50#ifndef DYLD_IOS_VERSION_FIRST_WITH_SESSION_CLEANUP_BY_DEFAULT
     51#define DYLD_IOS_VERSION_FIRST_WITH_SESSION_CLEANUP_BY_DEFAULT 0
     52#endif
     53
    4954#endif // PLATFORM(IOS_FAMILY)
    5055
     
    5358#define DYLD_MACOS_VERSION_FIRST_WITH_EXCEPTIONS_FOR_RELATED_WEBVIEWS_USING_DIFFERENT_DATA_STORES 0
    5459#endif
     60
     61#ifndef DYLD_MACOS_VERSION_FIRST_WITH_SESSION_CLEANUP_BY_DEFAULT
     62#define DYLD_MACOS_VERSION_FIRST_WITH_SESSION_CLEANUP_BY_DEFAULT 0
    5563#endif
    5664
     65#endif // PLATFORM(MAC)
    5766
    5867
     
    8392    FirstWhereSiteSpecificQuirksAreEnabledByDefault = DYLD_IOS_VERSION_13_2,
    8493    FirstThatRestrictsBaseURLSchemes = DYLD_IOS_VERSION_13_4,
     94    FirstWithSessionCleanupByDefault = DYLD_IOS_VERSION_FIRST_WITH_SESSION_CLEANUP_BY_DEFAULT,
    8595#elif PLATFORM(MAC)
    8696    FirstWithNetworkCache = DYLD_MACOSX_VERSION_10_11,
     
    94104    FirstWhereSiteSpecificQuirksAreEnabledByDefault = DYLD_MACOSX_VERSION_10_15_1,
    95105    FirstThatRestrictsBaseURLSchemes = DYLD_MACOSX_VERSION_10_15_4,
     106    FirstWithSessionCleanupByDefault = DYLD_MACOS_VERSION_FIRST_WITH_SESSION_CLEANUP_BY_DEFAULT,
    96107#endif
    97108};
  • trunk/Source/WebKit/UIProcess/WebProcessPool.cpp

    r257675 r257758  
    11/*
    2  * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    137137#endif
    138138
     139#if USE(APPLE_INTERNAL_SDK)
     140#include <WebKitAdditions/WebProcessPoolAdditions.h>
     141#else
     142#define WEB_PROCESS_POOL_ADDITIONS
     143#define WEB_PROCESS_POOL_ADDITIONS_2
     144#define WEB_PROCESS_POOL_ADDITIONS_3
     145#endif
     146
    139147#define WEBPROCESSPOOL_RELEASE_LOG(channel, fmt, ...) RELEASE_LOG(channel, "%p - WebProcessPool::" fmt, this, ##__VA_ARGS__)
    140148#define WEBPROCESSPOOL_RELEASE_LOG_ERROR(channel, fmt, ...) RELEASE_LOG_ERROR(channel, "%p - WebProcessPool::" fmt, this, ##__VA_ARGS__)
     
    242250    , m_alwaysRunsAtBackgroundPriority(m_configuration->alwaysRunsAtBackgroundPriority())
    243251    , m_shouldTakeUIBackgroundAssertion(m_configuration->shouldTakeUIBackgroundAssertion())
     252    WEB_PROCESS_POOL_ADDITIONS
    244253    , m_userObservablePageCounter([this](RefCounterEvent) { updateProcessSuppressionState(); })
    245254    , m_processSuppressionDisabledForPageCounter([this](RefCounterEvent) { updateProcessSuppressionState(); })
     
    586595    WebCore::FirstPartyWebsiteDataRemovalMode firstPartyWebsiteDataRemovalMode = WebCore::FirstPartyWebsiteDataRemovalMode::AllButCookies;
    587596    WebCore::RegistrableDomain manualPrevalentResource { };
     597    WEB_PROCESS_POOL_ADDITIONS_2
    588598    if (withWebsiteDataStore) {
    589599        enableResourceLoadStatistics = withWebsiteDataStore->resourceLoadStatisticsEnabled();
     
    833843WebProcessProxy& WebProcessPool::createNewWebProcess(WebsiteDataStore* websiteDataStore, WebProcessProxy::IsPrewarmed isPrewarmed)
    834844{
     845    WEB_PROCESS_POOL_ADDITIONS_3
    835846    auto processProxy = WebProcessProxy::create(*this, websiteDataStore, isPrewarmed);
    836847    auto& process = processProxy.get();
  • trunk/Source/WebKit/UIProcess/WebProcessPool.h

    r257610 r257758  
    11/*
    2  * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    729729    bool m_shouldMakeNextWebProcessLaunchFailForTesting { false };
    730730    bool m_shouldMakeNextNetworkProcessLaunchFailForTesting { false };
     731    bool m_tccPreferenceEnabled { false };
    731732
    732733    UserObservablePageCounter m_userObservablePageCounter;
  • trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm

    r257553 r257758  
    11/*
    2  * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    163163        WTFMove(resourceLoadStatisticsDirectoryHandle),
    164164        resourceLoadStatisticsEnabled(),
     165        isItpStateExplicitlySet(),
    165166        hasStatisticsTestingCallback(),
    166167        shouldIncludeLocalhostInResourceLoadStatistics,
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp

    r257726 r257758  
    11/*
    2  * Copyright (C) 2014-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2014-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    16001600void WebsiteDataStore::setIsRunningResourceLoadStatisticsTest(bool value, CompletionHandler<void()>&& completionHandler)
    16011601{
     1602    useExplicitITPState();
    16021603    auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler));
    16031604   
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h

    r257726 r257758  
    11/*
    2  * Copyright (C) 2014-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2014-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    197197    void setResourceLoadStatisticsFirstPartyWebsiteDataRemovalModeForTesting(bool enabled, CompletionHandler<void()>&&);
    198198    WebCore::ThirdPartyCookieBlockingMode thirdPartyCookieBlockingMode() const;
     199    bool isItpStateExplicitlySet() const { return m_isItpStateExplicitlySet; }
     200    void useExplicitITPState() { m_isItpStateExplicitlySet = true; }
    199201#endif
    200202    void setCacheMaxAgeCapForPrevalentResources(Seconds, CompletionHandler<void()>&&);
     
    338340    WeakHashSet<WebProcessProxy> m_processes;
    339341
     342    bool m_isItpStateExplicitlySet { false };
     343
    340344#if HAVE(SEC_KEY_PROXY)
    341345    Vector<Ref<SecKeyProxyStore>> m_secKeyProxyStores;
Note: See TracChangeset for help on using the changeset viewer.