Changeset 206988 in webkit


Ignore:
Timestamp:
Oct 10, 2016 12:45:52 AM (8 years ago)
Author:
Carlos Garcia Campos
Message:

NetworkSession: downloads started by startDownload() can fail before starting from the API point of view
https://bugs.webkit.org/show_bug.cgi?id=163107

Reviewed by Alex Christensen.

In the network process we use a PendingDownload in this case, but in the UI process we always have a single
download proxy. If an error happens before the pending download is converted inot a real download, the DidFail
messages is received in the download proxy before the DidStart one. This is problematic at least for the GTK+
API, because it's common to connect to the started signal and connect to all other signals from there, but in
this case the started signal is never emitted, and then the failed one is not handled. This is not a problem for
downloads started by convertTaskToDownload, because in that case those loads are not considered a download by
the UI process when those early errors happen, and then the web page handles them.

  • NetworkProcess/Downloads/PendingDownload.cpp:

(WebKit::PendingDownload::PendingDownload): Send DidStart message right after the network load starts like the
non network session code does.

  • NetworkProcess/NetworkLoad.cpp:

(WebKit::NetworkLoad::convertTaskToDownload): Send DidStart message now that the normal load has been converted
into a download.

  • NetworkProcess/NetworkProcess.cpp:

(WebKit::NetworkProcess::findPendingDownloadLocation): Do not send DidStart message here.

Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r206987 r206988  
     12016-10-10  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        NetworkSession: downloads started by startDownload() can fail before starting from the API point of view
     4        https://bugs.webkit.org/show_bug.cgi?id=163107
     5
     6        Reviewed by Alex Christensen.
     7
     8        In the network process we use a PendingDownload in this case, but in the UI process we always have a single
     9        download proxy. If an error happens before the pending download is converted inot a real download, the DidFail
     10        messages is received in the download proxy before the DidStart one. This is problematic at least for the GTK+
     11        API, because it's common to connect to the started signal and connect to all other signals from there, but in
     12        this case the started signal is never emitted, and then the failed one is not handled. This is not a problem for
     13        downloads started by convertTaskToDownload, because in that case those loads are not considered a download by
     14        the UI process when those early errors happen, and then the web page handles them.
     15
     16        * NetworkProcess/Downloads/PendingDownload.cpp:
     17        (WebKit::PendingDownload::PendingDownload): Send DidStart message right after the network load starts like the
     18        non network session code does.
     19        * NetworkProcess/NetworkLoad.cpp:
     20        (WebKit::NetworkLoad::convertTaskToDownload): Send DidStart message now that the normal load has been converted
     21        into a download.
     22        * NetworkProcess/NetworkProcess.cpp:
     23        (WebKit::NetworkProcess::findPendingDownloadLocation): Do not send DidStart message here.
     24
    1252016-10-10  Carlos Garcia Campos  <cgarcia@igalia.com>
    226
  • trunk/Source/WebKit2/NetworkProcess/Downloads/PendingDownload.cpp

    r206583 r206988  
    4545    m_networkLoad->setPendingDownload(*this);
    4646    m_networkLoad->setSuggestedFilename(suggestedName);
     47
     48    send(Messages::DownloadProxy::DidStart(m_networkLoad->currentRequest(), suggestedName));
    4749}
    4850
  • trunk/Source/WebKit2/NetworkProcess/NetworkLoad.cpp

    r206583 r206988  
    2525
    2626#include "config.h"
    27 
    2827#include "NetworkLoad.h"
    2928
    3029#include "AuthenticationManager.h"
     30#include "DownloadProxyMessages.h"
    3131#include "NetworkProcess.h"
    3232#include "SessionTracker.h"
     33#include "WebCoreArgumentCoders.h"
    3334#include "WebErrors.h"
    3435#include <WebCore/NotImplemented.h>
    3536#include <WebCore/ResourceHandle.h>
     37#include <WebCore/ResourceRequest.h>
    3638#include <WebCore/SessionID.h>
    3739#include <WebCore/SharedBuffer.h>
     
    188190        return;
    189191
     192    NetworkProcess::singleton().downloadManager().downloadProxyConnection()->send(Messages::DownloadProxy::DidStart(updatedRequest, String()), downloadID.downloadID());
    190193    m_task->setPendingDownloadID(downloadID);
    191194   
  • trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp

    r206604 r206988  
    514514{
    515515    uint64_t destinationID = networkDataTask.pendingDownloadID().downloadID();
    516     downloadProxyConnection()->send(Messages::DownloadProxy::DidStart(updatedRequest, String()), destinationID);
    517516    downloadProxyConnection()->send(Messages::DownloadProxy::DidReceiveResponse(response), destinationID);
    518517
Note: See TracChangeset for help on using the changeset viewer.