Changeset 252549 in webkit


Ignore:
Timestamp:
Nov 18, 2019, 10:15:44 AM (6 years ago)
Author:
Kocsen Chung
Message:

Apply patch. rdar://problem/57283187

Location:
branches/safari-608.4.9.0-branch
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-608.4.9.0-branch/LayoutTests/ChangeLog

    r252039 r252549  
     12019-11-18  Kocsen Chung  <kocsen_chung@apple.com>
     2
     3        Apply patch. rdar://problem/57283187
     4
     5    2019-11-18  John Wilander  <wilander@apple.com>
     6
     7            Check if ITP is on before applying third-party cookie blocking
     8            https://bugs.webkit.org/show_bug.cgi?id=204109
     9            <rdar://problem/57120772>
     10
     11            Reviewed by Chris Dumez and Alexey Proskuryakov.
     12
     13            * http/tests/resourceLoadStatistics/no-third-party-cookie-blocking-when-itp-is-off-expected.txt: Added.
     14            * http/tests/resourceLoadStatistics/no-third-party-cookie-blocking-when-itp-is-off.html: Added.
     15
    1162019-11-04  Alan Coon  <alancoon@apple.com>
    217
  • branches/safari-608.4.9.0-branch/Source/WebCore/ChangeLog

    r252321 r252549  
     12019-11-18  Kocsen Chung  <kocsen_chung@apple.com>
     2
     3        Apply patch. rdar://problem/57283187
     4
     5    2019-11-18  John Wilander  <wilander@apple.com>
     6
     7            Check if ITP is on before applying third-party cookie blocking
     8            https://bugs.webkit.org/show_bug.cgi?id=204109
     9            <rdar://problem/57120772>
     10
     11            Reviewed by Chris Dumez and Alexey Proskuryakov.
     12
     13            This change makes sure WebCore::NetworkStorageSession knows
     14            whether ITP is on or off and checks that first thing in
     15            WebCore::NetworkStorageSession::shouldBlockCookies().
     16
     17            This check was never needed before since if ITP was off,
     18            there would be no classified domains and thus the function
     19            would always return false. However,
     20            https://trac.webkit.org/changeset/251353/webkit introduced
     21            full third-party cookie blocking for websites without user
     22            interaction and that rule is checked before checking domain
     23            classification. The effect was unconditional third-party
     24            cookie blocking if ITP is off. This changes fixes that bug.
     25
     26            Note that this patch is branch-specific and expected to not
     27            apply to trunk.
     28
     29            Test: http/tests/resourceLoadStatistics/no-third-party-cookie-blocking-when-itp-is-off.html
     30
     31            * platform/network/NetworkStorageSession.cpp:
     32            (WebCore::NetworkStorageSession::shouldBlockThirdPartyCookies const):
     33            (WebCore::NetworkStorageSession::shouldBlockCookies const):
     34                Now checks whether ITP is on or off.
     35            * platform/network/NetworkStorageSession.h:
     36            (WebCore::NetworkStorageSession::setResourceLoadStatisticsEnabled):
     37
    1382019-11-10  Kocsen Chung  <kocsen_chung@apple.com>
    239
  • branches/safari-608.4.9.0-branch/Source/WebCore/platform/network/NetworkStorageSession.cpp

    r251353 r252549  
    6161bool NetworkStorageSession::shouldBlockThirdPartyCookies(const RegistrableDomain& registrableDomain) const
    6262{
     63    if (!m_isResourceLoadStatisticsEnabled || registrableDomain.isEmpty())
     64        return false;
     65
     66    return m_registrableDomainsToBlockCookieFor.contains(registrableDomain);
     67}
     68
     69bool NetworkStorageSession::hasHadUserInteractionAsFirstParty(const RegistrableDomain& registrableDomain) const
     70{
    6371    if (registrableDomain.isEmpty())
    6472        return false;
    6573
    66     return m_registrableDomainsToBlockCookieFor.contains(registrableDomain);
    67 }
    68 
    69 bool NetworkStorageSession::hasHadUserInteractionAsFirstParty(const RegistrableDomain& registrableDomain) const
    70 {
    71     if (registrableDomain.isEmpty())
    72         return false;
    73 
    7474    return m_registrableDomainsWithUserInteractionAsFirstParty.contains(registrableDomain);
    7575}
     
    7777bool NetworkStorageSession::shouldBlockCookies(const ResourceRequest& request, Optional<uint64_t> frameID, Optional<PageIdentifier> pageID) const
    7878{
     79    if (!m_isResourceLoadStatisticsEnabled)
     80        return false;
     81
    7982    return shouldBlockCookies(request.firstPartyForCookies(), request.url(), frameID, pageID);
    8083}
     
    8285bool NetworkStorageSession::shouldBlockCookies(const URL& firstPartyForCookies, const URL& resource, Optional<uint64_t> frameID, Optional<PageIdentifier> pageID) const
    8386{
     87    if (!m_isResourceLoadStatisticsEnabled)
     88        return false;
     89
    8490    RegistrableDomain firstPartyDomain { firstPartyForCookies };
    8591    if (firstPartyDomain.isEmpty())
  • branches/safari-608.4.9.0-branch/Source/WebCore/platform/network/NetworkStorageSession.h

    r251353 r252549  
    166166    WEBCORE_EXPORT void resetCrossSiteLoadsWithLinkDecorationForTesting();
    167167    void setIsThirdPartyCookieBlockingOnSitesWithoutUserInteractionEnabled(bool enabled) { m_isThirdPartyCookieBlockingOnSitesWithoutUserInteractionEnabled = enabled; }
     168    void setResourceLoadStatisticsEnabled(bool enabled) { m_isResourceLoadStatisticsEnabled = enabled; }
    168169#endif
    169170
     
    200201    bool m_navigationWithLinkDecorationTestMode = false;
    201202    bool m_isThirdPartyCookieBlockingOnSitesWithoutUserInteractionEnabled = true;
     203    bool m_isResourceLoadStatisticsEnabled = false;
    202204#endif
    203205
  • branches/safari-608.4.9.0-branch/Source/WebKit/ChangeLog

    r252372 r252549  
     12019-11-18  Kocsen Chung  <kocsen_chung@apple.com>
     2
     3        Apply patch. rdar://problem/57283187
     4
     5    2019-11-18  John Wilander  <wilander@apple.com>
     6
     7            Check if ITP is on before applying third-party cookie blocking
     8            https://bugs.webkit.org/show_bug.cgi?id=204109
     9            <rdar://problem/57120772>
     10
     11            Reviewed by Chris Dumez and Alexey Proskuryakov.
     12
     13            This change makes sure WebCore::NetworkStorageSession knows
     14            whether ITP is on or off and checks that first thing in
     15            WebCore::NetworkStorageSession::shouldBlockCookies().
     16
     17            This check was never needed before since if ITP was off,
     18            there would be no classified domains and thus the function
     19            would always return false. However,
     20            https://trac.webkit.org/changeset/251353/webkit introduced
     21            full third-party cookie blocking for websites without user
     22            interaction and that rule is checked before checking domain
     23            classification. The effect was unconditional third-party
     24            cookie blocking if ITP is off. This changes fixes that bug.
     25
     26            Note that this patch is branch-specific and expected to not
     27            apply to trunk.
     28
     29            * NetworkProcess/NetworkSession.cpp:
     30            (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
     31                Now tells WebCore::NetworkStorageSession the status of
     32                ITP.
     33
    1342019-11-12  Kocsen Chung  <kocsen_chung@apple.com>
    235
  • branches/safari-608.4.9.0-branch/Source/WebKit/NetworkProcess/NetworkSession.cpp

    r250493 r252549  
    131131{
    132132    ASSERT(!m_isInvalidated);
     133    if (auto* storageSession = networkStorageSession())
     134        storageSession->setResourceLoadStatisticsEnabled(enable);
    133135    if (!enable) {
    134136        destroyResourceLoadStatistics();
  • branches/safari-608.4.9.0-branch/Tools/ChangeLog

    r252326 r252549  
     12019-11-18  Kocsen Chung  <kocsen_chung@apple.com>
     2
     3        Apply patch. rdar://problem/57283187
     4
     5    2019-11-18  John Wilander  <wilander@apple.com>
     6
     7            Check if ITP is on before applying third-party cookie blocking
     8            https://bugs.webkit.org/show_bug.cgi?id=204109
     9            <rdar://problem/57120772>
     10
     11            Reviewed by Chris Dumez and Alexey Proskuryakov.
     12
     13            This is test infrastructure to allow a layout test to
     14            disable ITP in the network process.
     15
     16            * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
     17            * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
     18            (WTR::TestRunner::setStatisticsEnabled):
     19            (WTR::TestRunner::setStatisticsDebugMode):
     20            * WebKitTestRunner/InjectedBundle/TestRunner.h:
     21            * WebKitTestRunner/TestController.cpp:
     22            (WTR::TestController::setStatisticsEnabled):
     23            * WebKitTestRunner/TestController.h:
     24            * WebKitTestRunner/TestInvocation.cpp:
     25            (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
     26
    1272019-11-11  Kocsen Chung  <kocsen_chung@apple.com>
    228
  • branches/safari-608.4.9.0-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl

    r251899 r252549  
    293293
    294294    // Resource Load Statistics
     295    void setStatisticsEnabled(boolean value);
    295296    void installStatisticsDidModifyDataRecordsCallback(object callback);
    296297    void installStatisticsDidScanDataRecordsCallback(object callback);
  • branches/safari-608.4.9.0-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp

    r251899 r252549  
    13781378}
    13791379
     1380void TestRunner::setStatisticsEnabled(bool value)
     1381{
     1382    WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("SetStatisticsEnabled"));
     1383    WKRetainPtr<WKBooleanRef> messageBody = adoptWK(WKBooleanCreate(value));
     1384    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
     1385}
     1386
    13801387void TestRunner::setStatisticsDebugMode(bool value, JSValueRef completionHandler)
    13811388{
     
    13851392    WKRetainPtr<WKBooleanRef> messageBody = adoptWK(WKBooleanCreate(value));
    13861393    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
    1387 
    13881394}
    13891395
  • branches/safari-608.4.9.0-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h

    r251899 r252549  
    381381   
    382382    // Resource Load Statistics
     383    void setStatisticsEnabled(bool value);
    383384    void installStatisticsDidModifyDataRecordsCallback(JSValueRef callback);
    384385    void installStatisticsDidScanDataRecordsCallback(JSValueRef callback);
  • branches/safari-608.4.9.0-branch/Tools/WebKitTestRunner/TestController.cpp

    r251899 r252549  
    32113211}
    32123212
     3213void TestController::setStatisticsEnabled(bool value)
     3214{
     3215    auto* dataStore = WKContextGetWebsiteDataStore(platformContext());
     3216    WKWebsiteDataStoreSetResourceLoadStatisticsEnabled(dataStore, value);
     3217}
     3218
    32133219void TestController::setStatisticsDebugMode(bool value)
    32143220{
  • branches/safari-608.4.9.0-branch/Tools/WebKitTestRunner/TestController.h

    r251899 r252549  
    205205    void setShouldAllowDeviceOrientationAndMotionAccess(bool value) { m_shouldAllowDeviceOrientationAndMotionAccess = value; }
    206206
     207    void setStatisticsEnabled(bool value);
    207208    void setStatisticsDebugMode(bool value);
    208209    void setStatisticsPrevalentResourceForDebugMode(WKStringRef hostName);
  • branches/safari-608.4.9.0-branch/Tools/WebKitTestRunner/TestInvocation.cpp

    r251899 r252549  
    10621062    }
    10631063
     1064    if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsEnabled")) {
     1065        ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
     1066        WKBooleanRef value = static_cast<WKBooleanRef>(messageBody);
     1067        TestController::singleton().setStatisticsEnabled(WKBooleanGetValue(value));
     1068        return nullptr;
     1069    }
     1070   
    10641071    if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsDebugMode")) {
    10651072        ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
Note: See TracChangeset for help on using the changeset viewer.