| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 } | 292 } |
| 293 | 293 |
| 294 void FrameFetchContext::dispatchWillSendRequest(unsigned long identifier, Resour
ceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiat
orInfo& initiatorInfo) | 294 void FrameFetchContext::dispatchWillSendRequest(unsigned long identifier, Resour
ceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiat
orInfo& initiatorInfo) |
| 295 { | 295 { |
| 296 frame()->loader().applyUserAgent(request); | 296 frame()->loader().applyUserAgent(request); |
| 297 frame()->loader().client()->dispatchWillSendRequest(m_documentLoader, identi
fier, request, redirectResponse); | 297 frame()->loader().client()->dispatchWillSendRequest(m_documentLoader, identi
fier, request, redirectResponse); |
| 298 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceSendRequest", TRACE_EVENT
_SCOPE_THREAD, "data", InspectorSendRequestEvent::data(identifier, frame(), requ
est)); | 298 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceSendRequest", TRACE_EVENT
_SCOPE_THREAD, "data", InspectorSendRequestEvent::data(identifier, frame(), requ
est)); |
| 299 InspectorInstrumentation::willSendRequest(frame(), identifier, ensureLoaderF
orNotifications(), request, redirectResponse, initiatorInfo); | 299 InspectorInstrumentation::willSendRequest(frame(), identifier, ensureLoaderF
orNotifications(), request, redirectResponse, initiatorInfo); |
| 300 } | 300 } |
| 301 | 301 |
| 302 void FrameFetchContext::dispatchDidReceiveResponse(unsigned long identifier, con
st ResourceResponse& response, WebURLRequest::FrameType frameType, WebURLRequest
::RequestContext requestContext, ResourceLoader* resourceLoader) | 302 void FrameFetchContext::dispatchDidReceiveResponse(unsigned long identifier, con
st ResourceResponse& response, WebURLRequest::FrameType frameType, WebURLRequest
::RequestContext requestContext, Resource* resource) |
| 303 { | 303 { |
| 304 LinkLoader::CanLoadResources resourceLoadingPolicy = LinkLoader::LoadResourc
esAndPreconnect; | 304 LinkLoader::CanLoadResources resourceLoadingPolicy = LinkLoader::LoadResourc
esAndPreconnect; |
| 305 MixedContentChecker::checkMixedPrivatePublic(frame(), response.remoteIPAddre
ss()); | 305 MixedContentChecker::checkMixedPrivatePublic(frame(), response.remoteIPAddre
ss()); |
| 306 if (m_documentLoader == frame()->loader().provisionalDocumentLoader()) { | 306 if (m_documentLoader == frame()->loader().provisionalDocumentLoader()) { |
| 307 ResourceFetcher* fetcher = nullptr; | 307 ResourceFetcher* fetcher = nullptr; |
| 308 if (frame()->document()) | 308 if (frame()->document()) |
| 309 fetcher = frame()->document()->fetcher(); | 309 fetcher = frame()->document()->fetcher(); |
| 310 m_documentLoader->clientHintsPreferences().updateFromAcceptClientHintsHe
ader(response.httpHeaderField(HTTPNames::Accept_CH), fetcher); | 310 m_documentLoader->clientHintsPreferences().updateFromAcceptClientHintsHe
ader(response.httpHeaderField(HTTPNames::Accept_CH), fetcher); |
| 311 // When response is received with a provisional docloader, the resource
haven't committed yet, and we cannot load resources, only preconnect. | 311 // When response is received with a provisional docloader, the resource
haven't committed yet, and we cannot load resources, only preconnect. |
| 312 resourceLoadingPolicy = LinkLoader::DoNotLoadResources; | 312 resourceLoadingPolicy = LinkLoader::DoNotLoadResources; |
| 313 } | 313 } |
| 314 LinkLoader::loadLinksFromHeader(response.httpHeaderField(HTTPNames::Link), r
esponse.url(), frame()->document(), NetworkHintsInterfaceImpl(), resourceLoading
Policy, nullptr); | 314 LinkLoader::loadLinksFromHeader(response.httpHeaderField(HTTPNames::Link), r
esponse.url(), frame()->document(), NetworkHintsInterfaceImpl(), resourceLoading
Policy, nullptr); |
| 315 | 315 |
| 316 if (response.hasMajorCertificateErrors()) | 316 if (response.hasMajorCertificateErrors()) |
| 317 MixedContentChecker::handleCertificateError(frame(), response, frameType
, requestContext); | 317 MixedContentChecker::handleCertificateError(frame(), response, frameType
, requestContext); |
| 318 | 318 |
| 319 frame()->loader().progress().incrementProgress(identifier, response); | 319 frame()->loader().progress().incrementProgress(identifier, response); |
| 320 frame()->loader().client()->dispatchDidReceiveResponse(m_documentLoader, ide
ntifier, response); | 320 frame()->loader().client()->dispatchDidReceiveResponse(m_documentLoader, ide
ntifier, response); |
| 321 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceReceiveResponse", TRACE_E
VENT_SCOPE_THREAD, "data", InspectorReceiveResponseEvent::data(identifier, frame
(), response)); | 321 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceReceiveResponse", TRACE_E
VENT_SCOPE_THREAD, "data", InspectorReceiveResponseEvent::data(identifier, frame
(), response)); |
| 322 DocumentLoader* documentLoader = ensureLoaderForNotifications(); | 322 DocumentLoader* documentLoader = ensureLoaderForNotifications(); |
| 323 InspectorInstrumentation::didReceiveResourceResponse(frame(), identifier, do
cumentLoader, response, resourceLoader); | 323 InspectorInstrumentation::didReceiveResourceResponse(frame(), identifier, do
cumentLoader, response, resource); |
| 324 // It is essential that inspector gets resource response BEFORE console. | 324 // It is essential that inspector gets resource response BEFORE console. |
| 325 frame()->console().reportResourceResponseReceived(documentLoader, identifier
, response); | 325 frame()->console().reportResourceResponseReceived(documentLoader, identifier
, response); |
| 326 } | 326 } |
| 327 | 327 |
| 328 void FrameFetchContext::dispatchDidReceiveData(unsigned long identifier, const c
har* data, int dataLength, int encodedDataLength) | 328 void FrameFetchContext::dispatchDidReceiveData(unsigned long identifier, const c
har* data, int dataLength, int encodedDataLength) |
| 329 { | 329 { |
| 330 frame()->loader().progress().incrementProgress(identifier, dataLength); | 330 frame()->loader().progress().incrementProgress(identifier, dataLength); |
| 331 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceReceivedData", TRACE_EVEN
T_SCOPE_THREAD, "data", InspectorReceiveDataEvent::data(identifier, frame(), enc
odedDataLength)); | 331 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceReceivedData", TRACE_EVEN
T_SCOPE_THREAD, "data", InspectorReceiveDataEvent::data(identifier, frame(), enc
odedDataLength)); |
| 332 InspectorInstrumentation::didReceiveData(frame(), identifier, data, dataLeng
th, encodedDataLength); | 332 InspectorInstrumentation::didReceiveData(frame(), identifier, data, dataLeng
th, encodedDataLength); |
| 333 } | 333 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 352 { | 352 { |
| 353 frame()->loader().progress().completeProgress(identifier); | 353 frame()->loader().progress().completeProgress(identifier); |
| 354 frame()->loader().client()->dispatchDidFinishLoading(m_documentLoader, ident
ifier); | 354 frame()->loader().client()->dispatchDidFinishLoading(m_documentLoader, ident
ifier); |
| 355 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOP
E_THREAD, "data", InspectorResourceFinishEvent::data(identifier, 0, true)); | 355 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOP
E_THREAD, "data", InspectorResourceFinishEvent::data(identifier, 0, true)); |
| 356 InspectorInstrumentation::didFailLoading(frame(), identifier, error); | 356 InspectorInstrumentation::didFailLoading(frame(), identifier, error); |
| 357 // Notification to FrameConsole should come AFTER InspectorInstrumentation c
all, DevTools front-end relies on this. | 357 // Notification to FrameConsole should come AFTER InspectorInstrumentation c
all, DevTools front-end relies on this. |
| 358 if (!isInternalRequest) | 358 if (!isInternalRequest) |
| 359 frame()->console().didFailLoading(identifier, error); | 359 frame()->console().didFailLoading(identifier, error); |
| 360 } | 360 } |
| 361 | 361 |
| 362 void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache(const Resource* r
esource, WebURLRequest::FrameType frameType, WebURLRequest::RequestContext reque
stContext) | 362 void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache(Resource* resourc
e, WebURLRequest::FrameType frameType, WebURLRequest::RequestContext requestCont
ext) |
| 363 { | 363 { |
| 364 ResourceRequest request(resource->url()); | 364 ResourceRequest request(resource->url()); |
| 365 unsigned long identifier = createUniqueIdentifier(); | 365 unsigned long identifier = createUniqueIdentifier(); |
| 366 frame()->loader().client()->dispatchDidLoadResourceFromMemoryCache(request,
resource->response()); | 366 frame()->loader().client()->dispatchDidLoadResourceFromMemoryCache(request,
resource->response()); |
| 367 dispatchWillSendRequest(identifier, request, ResourceResponse(), resource->o
ptions().initiatorInfo); | 367 dispatchWillSendRequest(identifier, request, ResourceResponse(), resource->o
ptions().initiatorInfo); |
| 368 | 368 |
| 369 InspectorInstrumentation::markResourceAsCached(frame(), identifier); | 369 InspectorInstrumentation::markResourceAsCached(frame(), identifier); |
| 370 if (!resource->response().isNull()) | 370 if (!resource->response().isNull()) |
| 371 dispatchDidReceiveResponse(identifier, resource->response(), frameType,
requestContext); | 371 dispatchDidReceiveResponse(identifier, resource->response(), frameType,
requestContext, resource); |
| 372 | 372 |
| 373 if (resource->encodedSize() > 0) | 373 if (resource->encodedSize() > 0) |
| 374 dispatchDidReceiveData(identifier, 0, resource->encodedSize(), 0); | 374 dispatchDidReceiveData(identifier, 0, resource->encodedSize(), 0); |
| 375 | 375 |
| 376 dispatchDidFinishLoading(identifier, 0, 0); | 376 dispatchDidFinishLoading(identifier, 0, 0); |
| 377 } | 377 } |
| 378 | 378 |
| 379 bool FrameFetchContext::shouldLoadNewResource(Resource::Type type) const | 379 bool FrameFetchContext::shouldLoadNewResource(Resource::Type type) const |
| 380 { | 380 { |
| 381 if (!m_documentLoader) | 381 if (!m_documentLoader) |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 } | 816 } |
| 817 | 817 |
| 818 DEFINE_TRACE(FrameFetchContext) | 818 DEFINE_TRACE(FrameFetchContext) |
| 819 { | 819 { |
| 820 visitor->trace(m_document); | 820 visitor->trace(m_document); |
| 821 visitor->trace(m_documentLoader); | 821 visitor->trace(m_documentLoader); |
| 822 FetchContext::trace(visitor); | 822 FetchContext::trace(visitor); |
| 823 } | 823 } |
| 824 | 824 |
| 825 } // namespace blink | 825 } // namespace blink |
| OLD | NEW |