Changeset 149905 in webkit
- Timestamp:
- May 10, 2013 1:54:54 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r149899 r149905 1 2013-05-10 Timothy Hatcher <timothy@apple.com> 2 3 Web Inspector: determine the resource type in InspectorResourceAgent::willSendRequest. 4 5 This allows the Network timeline and Resources sidebar to filter Resources earlier, 6 before the server sends a response. Useful for long polling (comet) XHRs. 7 8 https://webkit.org/b/74935 9 rdar://problem/13726105 10 11 Reviewed by Joseph Pecoraro. 12 13 * inspector/Inspector.json: 14 (Network.requestWillBeSent): Added. 15 * inspector/InspectorResourceAgent.cpp: 16 (WebCore::InspectorResourceAgent::willSendRequest): Send the type if it isn't Other along in requestWillBeSent. 17 (WebCore::InspectorResourceAgent::didReceiveResponse): Don't determine the type here anymore. Clear the CachedResource 18 if isNotModified like the old code path did by not setting cachedResource if !isNotModified. 19 1 20 2013-05-10 Laszlo Gombos <l.gombos@samsung.com> 2 21 -
trunk/Source/WebCore/inspector/Inspector.json
r149202 r149905 1094 1094 { "name": "timestamp", "$ref": "Timestamp", "description": "Timestamp." }, 1095 1095 { "name": "initiator", "$ref": "Initiator", "description": "Request initiator." }, 1096 { "name": "redirectResponse", "optional": true, "$ref": "Response", "description": "Redirect response data." } 1096 { "name": "redirectResponse", "optional": true, "$ref": "Response", "description": "Redirect response data." }, 1097 { "name": "type", "$ref": "Page.ResourceType", "optional": true, "description": "Resource type." } 1097 1098 ] 1098 1099 }, -
trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp
r148921 r149905 199 199 m_resourcesData->resourceCreated(requestId, m_pageAgent->loaderId(loader)); 200 200 201 RefPtr<InspectorObject> headers = m_state->getObject(ResourceAgentState::extraRequestHeaders); 202 203 if (headers) { 201 CachedResource* cachedResource = loader ? InspectorPageAgent::cachedResource(loader->frame(), request.url()) : 0; 202 InspectorPageAgent::ResourceType type = cachedResource ? InspectorPageAgent::cachedResourceType(*cachedResource) : m_resourcesData->resourceType(requestId); 203 if (type == InspectorPageAgent::OtherResource) { 204 if (m_loadingXHRSynchronously) 205 type = InspectorPageAgent::XHRResource; 206 else if (equalIgnoringFragmentIdentifier(request.url(), loader->frameLoader()->icon()->url())) 207 type = InspectorPageAgent::ImageResource; 208 else if (equalIgnoringFragmentIdentifier(request.url(), loader->url()) && !loader->isCommitted()) 209 type = InspectorPageAgent::DocumentResource; 210 } 211 212 m_resourcesData->setResourceType(requestId, type); 213 214 if (RefPtr<InspectorObject> headers = m_state->getObject(ResourceAgentState::extraRequestHeaders)) { 204 215 InspectorObject::const_iterator end = headers->end(); 205 216 for (InspectorObject::const_iterator it = headers->begin(); it != end; ++it) { … … 219 230 } 220 231 232 TypeBuilder::Page::ResourceType::Enum resourceType = InspectorPageAgent::resourceTypeJson(type); 233 221 234 RefPtr<TypeBuilder::Network::Initiator> initiatorObject = buildInitiatorObject(loader->frame() ? loader->frame()->document() : 0); 222 m_frontend->requestWillBeSent(requestId, m_pageAgent->frameId(loader->frame()), m_pageAgent->loaderId(loader), loader->url().string(), buildObjectForResourceRequest(request), currentTime(), initiatorObject, buildObjectForResourceResponse(redirectResponse, loader) );235 m_frontend->requestWillBeSent(requestId, m_pageAgent->frameId(loader->frame()), m_pageAgent->loaderId(loader), loader->url().string(), buildObjectForResourceRequest(request), currentTime(), initiatorObject, buildObjectForResourceResponse(redirectResponse, loader), type != InspectorPageAgent::OtherResource ? &resourceType : 0); 223 236 } 224 237 … … 248 261 } 249 262 250 InspectorPageAgent::ResourceType type = cachedResource ? InspectorPageAgent::cachedResourceType(*cachedResource) : InspectorPageAgent::OtherResource; 251 if (m_loadingXHRSynchronously || m_resourcesData->resourceType(requestId) == InspectorPageAgent::XHRResource) 252 type = InspectorPageAgent::XHRResource; 253 else if (m_resourcesData->resourceType(requestId) == InspectorPageAgent::ScriptResource) 254 type = InspectorPageAgent::ScriptResource; 255 else if (equalIgnoringFragmentIdentifier(response.url(), loader->frameLoader()->icon()->url())) 256 type = InspectorPageAgent::ImageResource; 257 else if (equalIgnoringFragmentIdentifier(response.url(), loader->url()) && !loader->isCommitted()) 258 type = InspectorPageAgent::DocumentResource; 263 InspectorPageAgent::ResourceType type = m_resourcesData->resourceType(requestId); 264 InspectorPageAgent::ResourceType newType = cachedResource ? InspectorPageAgent::cachedResourceType(*cachedResource) : type; 265 266 // FIXME: XHRResource is returned for CachedResource::RawResource, it should be OtherResource unless it truly is an XHR. 267 // RawResource is used for loading worker scripts, and those should stay as ScriptResource and not change to XHRResource. 268 if (type != newType && newType != InspectorPageAgent::XHRResource && newType != InspectorPageAgent::OtherResource) 269 type = newType; 259 270 260 271 m_resourcesData->responseReceived(requestId, m_pageAgent->frameId(loader->frame()), response); 261 272 m_resourcesData->setResourceType(requestId, type); 273 262 274 m_frontend->responseReceived(requestId, m_pageAgent->frameId(loader->frame()), m_pageAgent->loaderId(loader), currentTime(), InspectorPageAgent::resourceTypeJson(type), resourceResponse); 275 263 276 // If we revalidated the resource and got Not modified, send content length following didReceiveResponse 264 277 // as there will be no calls to didReceiveData from the network stack.
Note: See TracChangeset
for help on using the changeset viewer.