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