Changeset 221632 in webkit


Ignore:
Timestamp:
Sep 5, 2017 1:41:31 PM (7 years ago)
Author:
Brent Fulgham
Message:

Use a single network storage session for stateless connections
https://bugs.webkit.org/show_bug.cgi?id=176386
<rdar://problem/34262148>

Reviewed by Alex Christensen.

Change the name of 'm_dataTaskMapWithoutCredentials' to 'm_dataTaskMapWithoutState'
to reflect that the data tasks do not involve credential or cookie storage. Ditto for
the change from 'm_sessionWIthoutCredentialStorage' to 'm_statelessSession'.

This update should not change behavior, unless some stateless sessions were depending
on cookies to be persistent (which would be a bug!)

  • NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:

(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Update for new variable names.
(WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa): Ditto.

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

(WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Update the configuration to block
cookies as well.
(WebKit::NetworkSessionCocoa::invalidateAndCancel): Update for new names.
(WebKit::NetworkSessionCocoa::clearCredentials): Ditto.
(WebKit::NetworkSessionCocoa::dataTaskForIdentifier): Ditto.

Location:
trunk/Source/WebKit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r221625 r221632  
     12017-09-05  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Use a single network storage session for stateless connections
     4        https://bugs.webkit.org/show_bug.cgi?id=176386
     5        <rdar://problem/34262148>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Change the name of 'm_dataTaskMapWithoutCredentials' to 'm_dataTaskMapWithoutState'
     10        to reflect that the data tasks do not involve credential or cookie storage. Ditto for
     11        the change from 'm_sessionWIthoutCredentialStorage' to 'm_statelessSession'.
     12
     13        This update should not change behavior, unless some stateless sessions were depending
     14        on cookies to be persistent (which would be a bug!)
     15
     16        * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
     17        (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Update for new variable names.
     18        (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa): Ditto.
     19        * NetworkProcess/cocoa/NetworkSessionCocoa.h:
     20        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
     21        (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Update the configuration to block
     22        cookies as well.
     23        (WebKit::NetworkSessionCocoa::invalidateAndCancel): Update for new names.
     24        (WebKit::NetworkSessionCocoa::clearCredentials): Ditto.
     25        (WebKit::NetworkSessionCocoa::dataTaskForIdentifier): Ditto.
     26
    1272017-09-05  Yousuke Kimoto  <yousuke.kimoto@sony.com>
    228
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm

    r221059 r221632  
    11/*
    2  * Copyright (C) 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    117117        cocoaSession.m_dataTaskMapWithCredentials.add([m_task taskIdentifier], this);
    118118    } else {
    119         m_task = [cocoaSession.m_sessionWithoutCredentialStorage dataTaskWithRequest:nsRequest];
    120         ASSERT(!cocoaSession.m_dataTaskMapWithoutCredentials.contains([m_task taskIdentifier]));
    121         cocoaSession.m_dataTaskMapWithoutCredentials.add([m_task taskIdentifier], this);
     119        m_task = [cocoaSession.m_statelessSession dataTaskWithRequest:nsRequest];
     120        ASSERT(!cocoaSession.m_dataTaskMapWithoutState.contains([m_task taskIdentifier]));
     121        cocoaSession.m_dataTaskMapWithoutState.add([m_task taskIdentifier], this);
    122122    }
    123123    LOG(NetworkSession, "%llu Creating NetworkDataTask with URL %s", [m_task taskIdentifier], nsRequest.URL.absoluteString.UTF8String);
     
    145145        cocoaSession.m_dataTaskMapWithCredentials.remove([m_task taskIdentifier]);
    146146    } else {
    147         ASSERT(cocoaSession.m_dataTaskMapWithoutCredentials.get([m_task taskIdentifier]) == this);
    148         cocoaSession.m_dataTaskMapWithoutCredentials.remove([m_task taskIdentifier]);
     147        ASSERT(cocoaSession.m_dataTaskMapWithoutState.get([m_task taskIdentifier]) == this);
     148        cocoaSession.m_dataTaskMapWithoutState.remove([m_task taskIdentifier]);
    149149    }
    150150}
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h

    r220857 r221632  
    11/*
    2  * Copyright (C) 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    7171
    7272    HashMap<NetworkDataTaskCocoa::TaskIdentifier, NetworkDataTaskCocoa*> m_dataTaskMapWithCredentials;
    73     HashMap<NetworkDataTaskCocoa::TaskIdentifier, NetworkDataTaskCocoa*> m_dataTaskMapWithoutCredentials;
     73    HashMap<NetworkDataTaskCocoa::TaskIdentifier, NetworkDataTaskCocoa*> m_dataTaskMapWithoutState;
    7474    HashMap<NetworkDataTaskCocoa::TaskIdentifier, DownloadID> m_downloadMap;
    7575
    7676    RetainPtr<NSURLSession> m_sessionWithCredentialStorage;
    7777    RetainPtr<WKNetworkSessionDelegate> m_sessionWithCredentialStorageDelegate;
    78     RetainPtr<NSURLSession> m_sessionWithoutCredentialStorage;
    79     RetainPtr<WKNetworkSessionDelegate> m_sessionWithoutCredentialStorageDelegate;
     78    RetainPtr<NSURLSession> m_statelessSession;
     79    RetainPtr<WKNetworkSessionDelegate> m_statelessSessionDelegate;
    8080};
    8181
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm

    r220857 r221632  
    598598    m_sessionWithCredentialStorageDelegate = adoptNS([[WKNetworkSessionDelegate alloc] initWithNetworkSession:*this withCredentials:true]);
    599599    m_sessionWithCredentialStorage = [NSURLSession sessionWithConfiguration:configuration delegate:static_cast<id>(m_sessionWithCredentialStorageDelegate.get()) delegateQueue:[NSOperationQueue mainQueue]];
     600    LOG(NetworkSession, "Created NetworkSession with cookieAcceptPolicy %lu", configuration.HTTPCookieStorage.cookieAcceptPolicy);
    600601
    601602    configuration.URLCredentialStorage = nil;
    602603    configuration._shouldSkipPreferredClientCertificateLookup = YES;
    603     m_sessionWithoutCredentialStorageDelegate = adoptNS([[WKNetworkSessionDelegate alloc] initWithNetworkSession:*this withCredentials:false]);
    604     m_sessionWithoutCredentialStorage = [NSURLSession sessionWithConfiguration:configuration delegate:static_cast<id>(m_sessionWithoutCredentialStorageDelegate.get()) delegateQueue:[NSOperationQueue mainQueue]];
    605     LOG(NetworkSession, "Created NetworkSession with cookieAcceptPolicy %lu", configuration.HTTPCookieStorage.cookieAcceptPolicy);
     604    configuration.HTTPCookieStorage = nil;
     605    configuration.HTTPCookieAcceptPolicy = NSHTTPCookieAcceptPolicyNever;
     606
     607    m_statelessSessionDelegate = adoptNS([[WKNetworkSessionDelegate alloc] initWithNetworkSession:*this withCredentials:false]);
     608    m_statelessSession = [NSURLSession sessionWithConfiguration:configuration delegate:static_cast<id>(m_statelessSessionDelegate.get()) delegateQueue:[NSOperationQueue mainQueue]];
    606609}
    607610
     
    615618
    616619    [m_sessionWithCredentialStorage invalidateAndCancel];
    617     [m_sessionWithoutCredentialStorage invalidateAndCancel];
     620    [m_statelessSession invalidateAndCancel];
    618621    [m_sessionWithCredentialStorageDelegate sessionInvalidated];
    619     [m_sessionWithoutCredentialStorageDelegate sessionInvalidated];
     622    [m_statelessSessionDelegate sessionInvalidated];
    620623}
    621624
     
    624627#if !USE(CREDENTIAL_STORAGE_WITH_NETWORK_SESSION)
    625628    ASSERT(m_dataTaskMapWithCredentials.isEmpty());
    626     ASSERT(m_dataTaskMapWithoutCredentials.isEmpty());
     629    ASSERT(m_dataTaskMapWithoutState.isEmpty());
    627630    ASSERT(m_downloadMap.isEmpty());
    628631    // FIXME: Use resetWithCompletionHandler instead.
    629632    m_sessionWithCredentialStorage = [NSURLSession sessionWithConfiguration:m_sessionWithCredentialStorage.get().configuration delegate:static_cast<id>(m_sessionWithCredentialStorageDelegate.get()) delegateQueue:[NSOperationQueue mainQueue]];
    630     m_sessionWithoutCredentialStorage = [NSURLSession sessionWithConfiguration:m_sessionWithoutCredentialStorage.get().configuration delegate:static_cast<id>(m_sessionWithoutCredentialStorageDelegate.get()) delegateQueue:[NSOperationQueue mainQueue]];
     633    m_statelessSession = [NSURLSession sessionWithConfiguration:m_statelessSession.get().configuration delegate:static_cast<id>(m_statelessSessionDelegate.get()) delegateQueue:[NSOperationQueue mainQueue]];
    631634#endif
    632635}
     
    637640    if (storedCredentials == WebCore::StoredCredentials::AllowStoredCredentials)
    638641        return m_dataTaskMapWithCredentials.get(taskIdentifier);
    639     return m_dataTaskMapWithoutCredentials.get(taskIdentifier);
     642    return m_dataTaskMapWithoutState.get(taskIdentifier);
    640643}
    641644
Note: See TracChangeset for help on using the changeset viewer.