OLD | NEW |
1 /* | 1 /* |
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) | 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) |
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) | 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) |
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All | 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
6 rights reserved. | 6 rights reserved. |
7 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ | 7 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ |
8 | 8 |
9 This library is free software; you can redistribute it and/or | 9 This library is free software; you can redistribute it and/or |
10 modify it under the terms of the GNU Library General Public | 10 modify it under the terms of the GNU Library General Public |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 response.SetTextEncodingName(substitute_data.TextEncoding()); | 410 response.SetTextEncodingName(substitute_data.TextEncoding()); |
411 } else if (url.ProtocolIsData()) { | 411 } else if (url.ProtocolIsData()) { |
412 data = NetworkUtils::ParseDataURLAndPopulateResponse(url, response); | 412 data = NetworkUtils::ParseDataURLAndPopulateResponse(url, response); |
413 if (!data) | 413 if (!data) |
414 return nullptr; | 414 return nullptr; |
415 // |response| is modified by parseDataURLAndPopulateResponse() and is | 415 // |response| is modified by parseDataURLAndPopulateResponse() and is |
416 // ready to be used. | 416 // ready to be used. |
417 } else { | 417 } else { |
418 ArchiveResource* archive_resource = | 418 ArchiveResource* archive_resource = |
419 archive_->SubresourceForURL(params.Url()); | 419 archive_->SubresourceForURL(params.Url()); |
420 // Fall back to the network if the archive doesn't contain the resource. | 420 // The archive doesn't contain the resource, the request must be aborted. |
421 if (!archive_resource) | 421 if (!archive_resource) |
422 return nullptr; | 422 return nullptr; |
423 data = archive_resource->Data(); | 423 data = archive_resource->Data(); |
424 response.SetURL(url); | 424 response.SetURL(url); |
425 response.SetMimeType(archive_resource->MimeType()); | 425 response.SetMimeType(archive_resource->MimeType()); |
426 response.SetExpectedContentLength(data->size()); | 426 response.SetExpectedContentLength(data->size()); |
427 response.SetTextEncodingName(archive_resource->TextEncoding()); | 427 response.SetTextEncodingName(archive_resource->TextEncoding()); |
428 } | 428 } |
429 | 429 |
430 Resource* resource = factory.Create(params.GetResourceRequest(), | 430 Resource* resource = factory.Create(params.GetResourceRequest(), |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 if (result == kBlock) | 590 if (result == kBlock) |
591 return ResourceForBlockedRequest(params, factory, blocked_reason); | 591 return ResourceForBlockedRequest(params, factory, blocked_reason); |
592 | 592 |
593 if (!params.IsSpeculativePreload()) { | 593 if (!params.IsSpeculativePreload()) { |
594 // Only log if it's not for speculative preload. | 594 // Only log if it's not for speculative preload. |
595 Context().RecordLoadingActivity(identifier, resource_request, | 595 Context().RecordLoadingActivity(identifier, resource_request, |
596 factory.GetType(), | 596 factory.GetType(), |
597 params.Options().initiator_info.name); | 597 params.Options().initiator_info.name); |
598 } | 598 } |
599 | 599 |
| 600 // An URL with the "cid" scheme can only be handled by an MHTML Archive. |
| 601 // Abort the request when there is none. |
| 602 if (resource_request.Url().ProtocolIs(kContentIdScheme) && !archive_) { |
| 603 return nullptr; |
| 604 } |
| 605 |
600 bool is_data_url = resource_request.Url().ProtocolIsData(); | 606 bool is_data_url = resource_request.Url().ProtocolIsData(); |
601 bool is_static_data = is_data_url || substitute_data.IsValid() || archive_; | 607 bool is_static_data = is_data_url || substitute_data.IsValid() || archive_; |
602 if (is_static_data) { | 608 if (is_static_data) { |
603 resource = ResourceForStaticData(params, factory, substitute_data); | 609 resource = ResourceForStaticData(params, factory, substitute_data); |
604 // Abort the request if the archive doesn't contain the resource, except in | 610 // Abort the request if the archive doesn't contain the resource, except in |
605 // the case of data URLs which might have resources such as fonts that need | 611 // the case of data URLs which might have resources such as fonts that need |
606 // to be decoded only on demand. These data URLs are allowed to be | 612 // to be decoded only on demand. These data URLs are allowed to be |
607 // processed using the normal ResourceFetcher machinery. | 613 // processed using the normal ResourceFetcher machinery. |
608 if (!resource && !is_data_url && archive_) | 614 if (!resource && !is_data_url && archive_) |
609 return nullptr; | 615 return nullptr; |
610 } | 616 } |
611 RevalidationPolicy policy = kLoad; | 617 RevalidationPolicy policy = kLoad; |
612 bool preload_found = false; | 618 bool preload_found = false; |
613 if (!resource) { | 619 if (!resource) { |
614 resource = MatchPreload(params, factory.GetType()); | 620 resource = MatchPreload(params, factory.GetType()); |
615 if (resource) { | 621 if (resource) { |
616 preload_found = true; | 622 preload_found = true; |
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1612 visitor->Trace(context_); | 1618 visitor->Trace(context_); |
1613 visitor->Trace(archive_); | 1619 visitor->Trace(archive_); |
1614 visitor->Trace(loaders_); | 1620 visitor->Trace(loaders_); |
1615 visitor->Trace(non_blocking_loaders_); | 1621 visitor->Trace(non_blocking_loaders_); |
1616 visitor->Trace(document_resources_); | 1622 visitor->Trace(document_resources_); |
1617 visitor->Trace(preloads_); | 1623 visitor->Trace(preloads_); |
1618 visitor->Trace(resource_timing_info_map_); | 1624 visitor->Trace(resource_timing_info_map_); |
1619 } | 1625 } |
1620 | 1626 |
1621 } // namespace blink | 1627 } // namespace blink |
OLD | NEW |