Changeset 233842 in webkit


Ignore:
Timestamp:
Jul 15, 2018 10:22:36 PM (6 years ago)
Author:
Carlos Garcia Campos
Message:

[SOUP] http/tests/misc/bubble-drag-events.html crashes
https://bugs.webkit.org/show_bug.cgi?id=182352

Reviewed by Youenn Fablet.

PingLoad is not refcounted and deletes itself when the load finishes. The problem is that the network data
task can also finish the load, causing the PingLoad to be deleted early. We tried to fix it in r233032 in the
network data task soup implementation, but it caused regressions.

  • NetworkProcess/PingLoad.cpp:

(WebKit::PingLoad::didReceiveChallenge): Create a weak ref for the ping load before calling the operation completion
handler and return early after the completion handler if it was deleted.
(WebKit::PingLoad::didReceiveResponseNetworkSession): Ditto.

  • NetworkProcess/PingLoad.h:
  • NetworkProcess/soup/NetworkDataTaskSoup.cpp:

(WebKit::NetworkDataTaskSoup::continueAuthenticate): Revert r233032.

Location:
trunk/Source/WebKit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r233828 r233842  
     12018-07-15  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [SOUP] http/tests/misc/bubble-drag-events.html crashes
     4        https://bugs.webkit.org/show_bug.cgi?id=182352
     5
     6        Reviewed by Youenn Fablet.
     7
     8        PingLoad is not refcounted and deletes itself when the load finishes. The problem is that the network data
     9        task can also finish the load, causing the PingLoad to be deleted early. We tried to fix it in r233032 in the
     10        network data task soup implementation, but it caused regressions.
     11
     12        * NetworkProcess/PingLoad.cpp:
     13        (WebKit::PingLoad::didReceiveChallenge): Create a weak ref for the ping load before calling the operation completion
     14        handler and return early after the completion handler if it was deleted.
     15        (WebKit::PingLoad::didReceiveResponseNetworkSession): Ditto.
     16        * NetworkProcess/PingLoad.h:
     17        * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
     18        (WebKit::NetworkDataTaskSoup::continueAuthenticate): Revert r233032.
     19
    1202018-07-13  Timothy Hatcher  <timothy@apple.com>
    221
  • trunk/Source/WebKit/NetworkProcess/PingLoad.cpp

    r233720 r233842  
    115115{
    116116    RELEASE_LOG_IF_ALLOWED("didReceiveChallenge");
     117    auto weakThis = makeWeakPtr(*this);
    117118    completionHandler(AuthenticationChallengeDisposition::Cancel, { });
     119    if (!weakThis)
     120        return;
    118121    didFinish(ResourceError { String(), 0, currentURL(), "Failed HTTP authentication"_s, ResourceError::Type::AccessControl });
    119122}
     
    122125{
    123126    RELEASE_LOG_IF_ALLOWED("didReceiveResponseNetworkSession - httpStatusCode: %d", response.httpStatusCode());
     127    auto weakThis = makeWeakPtr(*this);
    124128    completionHandler(PolicyAction::Ignore);
     129    if (!weakThis)
     130        return;
    125131    didFinish({ }, response);
    126132}
  • trunk/Source/WebKit/NetworkProcess/PingLoad.h

    r233277 r233842  
    3232#include <wtf/CompletionHandler.h>
    3333#include <wtf/UniqueRef.h>
     34#include <wtf/WeakPtr.h>
    3435
    3536namespace WebCore {
     
    4445class NetworkLoadChecker;
    4546
    46 class PingLoad final : private NetworkDataTaskClient {
     47class PingLoad final : public CanMakeWeakPtr<PingLoad>, private NetworkDataTaskClient {
    4748public:
    4849    PingLoad(NetworkResourceLoadParameters&&, CompletionHandler<void(const WebCore::ResourceError&, const WebCore::ResourceResponse&)>&&);
  • trunk/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp

    r233668 r233842  
    528528
    529529        if (disposition == AuthenticationChallengeDisposition::Cancel) {
    530             invalidateAndCancel();
     530            cancel();
     531            didFail(cancelledError(m_soupRequest.get()));
    531532            return;
    532533        }
Note: See TracChangeset for help on using the changeset viewer.