webengine/osswebengine/WebCore/loader/icon/IconLoader.cpp
changeset 65 5bfc169077b2
parent 38 6297cdf66332
child 94 919f36ff910f
equal deleted inserted replaced
42:d39add9822e2 65:5bfc169077b2
    93     // If we got a status code indicating an invalid response, then lets
    93     // If we got a status code indicating an invalid response, then lets
    94     // ignore the data and not try to decode the error page as an icon.
    94     // ignore the data and not try to decode the error page as an icon.
    95     int status = response.httpStatusCode();
    95     int status = response.httpStatusCode();
    96     LOG(IconDatabase, "IconLoader::didReceiveResponse() - Loader %p, response %i", resourceLoader, status);
    96     LOG(IconDatabase, "IconLoader::didReceiveResponse() - Loader %p, response %i", resourceLoader, status);
    97 
    97 
    98     // It is possible that we are receiving the response for previous load request which is cancelled.
    98     if (status && (status < 200 || status > 299)) {
    99     // Process down response of last resource loader only. Ignore if we can not remember other icon load requests. 
    99         ResourceHandle* handle = resourceLoader->handle();
   100     if(resourceLoader == m_resourceLoader) {
   100         finishLoading(handle ? handle->request().url() : KURL(), 0);
   101         if (status && (status < 200 || status > 299)) {
       
   102             ResourceHandle* handle = resourceLoader->handle();
       
   103             finishLoading(handle ? handle->request().url() : KURL(), 0);
       
   104         }
       
   105     }
   101     }
   106 }
   102 }
   107 
   103 
   108 void IconLoader::didReceiveData(SubresourceLoader* loader, const char*, int size)
   104 void IconLoader::didReceiveData(SubresourceLoader* loader, const char*, int size)
   109 {
   105 {
   116     
   112     
   117     // Until <rdar://problem/5463392> is resolved and we can properly cancel SubresourceLoaders when they get an error response,
   113     // Until <rdar://problem/5463392> is resolved and we can properly cancel SubresourceLoaders when they get an error response,
   118     // we need to be prepared to receive this call even after we've "finished loading" once.
   114     // we need to be prepared to receive this call even after we've "finished loading" once.
   119     // After it is resolved, we can restore an assertion that the load is in progress if ::didFail() is called
   115     // After it is resolved, we can restore an assertion that the load is in progress if ::didFail() is called
   120     
   116     
   121     // It is possible that we are receiving the response for previous load request which is cancelled.
   117     if (m_loadIsInProgress) {
   122     // Process down response of last resource loader only. Ignore if we can not remember other icon load requests.    
   118         ASSERT(resourceLoader == m_resourceLoader);
   123     if (m_loadIsInProgress && (resourceLoader == m_resourceLoader)) {
       
   124         //ASSERT(resourceLoader == m_resourceLoader);
       
   125         ResourceHandle* handle = resourceLoader->handle();
   119         ResourceHandle* handle = resourceLoader->handle();
   126         finishLoading(handle ? handle->request().url() : KURL(), 0);
   120         finishLoading(handle ? handle->request().url() : KURL(), 0);
   127     }
   121     }
   128 }
   122 }
   129 
   123 
   133 
   127 
   134     // Until <rdar://problem/5463392> is resolved and we can properly cancel SubresourceLoaders when they get an error response,
   128     // Until <rdar://problem/5463392> is resolved and we can properly cancel SubresourceLoaders when they get an error response,
   135     // we need to be prepared to receive this call even after we've "finished loading" once.
   129     // we need to be prepared to receive this call even after we've "finished loading" once.
   136     // After it is resolved, we can restore an assertion that the load is in progress if ::didFail() is called
   130     // After it is resolved, we can restore an assertion that the load is in progress if ::didFail() is called
   137     
   131     
   138     // It is possible that we are receiving the response for previous load request which is cancelled.
   132     if (m_loadIsInProgress) {
   139     // Process down response of last resource loader only. Ignore if we can not remember other icon load requests.    
   133         ASSERT(resourceLoader == m_resourceLoader);
   140     if (m_loadIsInProgress && (resourceLoader == m_resourceLoader)) {
       
   141         //ASSERT(resourceLoader == m_resourceLoader);
       
   142         ResourceHandle* handle = resourceLoader->handle();
   134         ResourceHandle* handle = resourceLoader->handle();
   143         finishLoading(handle ? handle->request().url() : KURL(), m_resourceLoader->resourceData());
   135         finishLoading(handle ? handle->request().url() : KURL(), m_resourceLoader->resourceData());
   144     }
   136     }
   145 }
   137 }
   146 
   138