Changeset 239791 in webkit


Ignore:
Timestamp:
Jan 9, 2019 4:19:25 PM (5 years ago)
Author:
achristensen@apple.com
Message:

REGRESSION(239737) iOS quicklook tests should not dereference null
https://bugs.webkit.org/show_bug.cgi?id=193307

Reviewed by Brent Fulgham.

The quicklook tests rely on ResourceHandle on iOS for some reason.
This is a problem we'll fix later, but for now keep them working by not crashing.

  • platform/network/mac/ResourceHandleMac.mm:

(WebCore::ResourceHandle::createNSURLConnection):
(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::willSendRequest):
(WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
(WebCore::ResourceHandle::receivedCredential):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r239786 r239791  
     12019-01-09  Alex Christensen  <achristensen@webkit.org>
     2
     3        REGRESSION(239737) iOS quicklook tests should not dereference null
     4        https://bugs.webkit.org/show_bug.cgi?id=193307
     5
     6        Reviewed by Brent Fulgham.
     7
     8        The quicklook tests rely on ResourceHandle on iOS for some reason.
     9        This is a problem we'll fix later, but for now keep them working by not crashing.
     10
     11        * platform/network/mac/ResourceHandleMac.mm:
     12        (WebCore::ResourceHandle::createNSURLConnection):
     13        (WebCore::ResourceHandle::start):
     14        (WebCore::ResourceHandle::willSendRequest):
     15        (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
     16        (WebCore::ResourceHandle::receivedCredential):
     17
    1182019-01-09  Zalan Bujtas  <zalan@apple.com>
    219
  • trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm

    r239737 r239791  
    158158            // <rdar://problem/7174050> - For URLs that match the paths of those previously challenged for HTTP Basic authentication,
    159159            // try and reuse the credential preemptively, as allowed by RFC 2617.
    160             d->m_initialCredential = d->m_context->storageSession()->credentialStorage().get(firstRequest().cachePartition(), firstRequest().url());
     160            if (auto* networkStorageSession = d->m_context->storageSession())
     161                d->m_initialCredential = networkStorageSession->credentialStorage().get(firstRequest().cachePartition(), firstRequest().url());
    161162        } else {
    162163            // If there is already a protection space known for the URL, update stored credentials before sending a request.
    163164            // This makes it possible to implement logout by sending an XMLHttpRequest with known incorrect credentials, and aborting it immediately
    164165            // (so that an authentication dialog doesn't pop up).
    165             d->m_context->storageSession()->credentialStorage().set(firstRequest().cachePartition(), Credential(d->m_user, d->m_pass, CredentialPersistenceNone), firstRequest().url());
     166            if (auto* networkStorageSession = d->m_context->storageSession())
     167                networkStorageSession->credentialStorage().set(firstRequest().cachePartition(), Credential(d->m_user, d->m_pass, CredentialPersistenceNone), firstRequest().url());
    166168        }
    167169    }
     
    241243        return false;
    242244
    243     d->m_storageSession = d->m_context->storageSession()->platformSession();
     245    if (auto* networkStorageSession = d->m_context->storageSession())
     246        d->m_storageSession = networkStorageSession->platformSession();
    244247
    245248    // FIXME: Do not use the sync version of shouldUseCredentialStorage when the client returns true from usesAsyncCallbacks.
     
    450453        // URL didn't include credentials of its own.
    451454        if (d->m_user.isEmpty() && d->m_pass.isEmpty() && !redirectResponse.isNull()) {
    452             Credential credential = d->m_context->storageSession()->credentialStorage().get(request.cachePartition(), request.url());
     455            Credential credential;
     456            if (auto* networkStorageSession = d->m_context->storageSession())
     457                credential = networkStorageSession->credentialStorage().get(request.cachePartition(), request.url());
    453458            if (!credential.isEmpty()) {
    454459                d->m_initialCredential = credential;
     
    541546            // There is a race condition here, since a different credential might have already been stored by another ResourceHandle,
    542547            // but the observable effect should be very minor, if any.
    543             d->m_context->storageSession()->credentialStorage().remove(d->m_partition, challenge.protectionSpace());
     548            if (auto* networkStorageSession = d->m_context->storageSession())
     549                networkStorageSession->credentialStorage().remove(d->m_partition, challenge.protectionSpace());
    544550        }
    545551
    546552        if (!challenge.previousFailureCount()) {
    547             Credential credential = d->m_context->storageSession()->credentialStorage().get(d->m_partition, challenge.protectionSpace());
     553            Credential credential;
     554            if (auto* networkStorageSession = d->m_context->storageSession())
     555                credential = networkStorageSession->credentialStorage().get(d->m_partition, challenge.protectionSpace());
    548556            if (!credential.isEmpty() && credential != d->m_initialCredential) {
    549557                ASSERT(credential.persistence() == CredentialPersistenceNone);
    550558                if (challenge.failureResponse().httpStatusCode() == 401) {
    551559                    // Store the credential back, possibly adding it as a default for this directory.
    552                     d->m_context->storageSession()->credentialStorage().set(d->m_partition, credential, challenge.protectionSpace(), challenge.failureResponse().url());
     560                    if (auto* networkStorageSession = d->m_context->storageSession())
     561                        networkStorageSession->credentialStorage().set(d->m_partition, credential, challenge.protectionSpace(), challenge.failureResponse().url());
    553562                }
    554563                [challenge.sender() useCredential:credential.nsCredential() forAuthenticationChallenge:mac(challenge)];
     
    592601        if (challenge.failureResponse().httpStatusCode() == 401)
    593602            urlToStore = challenge.failureResponse().url();
    594         d->m_context->storageSession()->credentialStorage().set(d->m_partition, webCredential, ProtectionSpace([d->m_currentMacChallenge protectionSpace]), urlToStore);
     603        if (auto* networkStorageSession = d->m_context->storageSession())
     604            networkStorageSession->credentialStorage().set(d->m_partition, webCredential, ProtectionSpace([d->m_currentMacChallenge protectionSpace]), urlToStore);
    595605        [[d->m_currentMacChallenge sender] useCredential:webCredential.nsCredential() forAuthenticationChallenge:d->m_currentMacChallenge];
    596606    } else
Note: See TracChangeset for help on using the changeset viewer.