| 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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 void FrameFetchContext::addCSPHeaderIfNecessary(Resource::Type type, FetchReques
t& fetchRequest) | 720 void FrameFetchContext::addCSPHeaderIfNecessary(Resource::Type type, FetchReques
t& fetchRequest) |
| 721 { | 721 { |
| 722 if (!m_document) | 722 if (!m_document) |
| 723 return; | 723 return; |
| 724 | 724 |
| 725 const ContentSecurityPolicy* csp = m_document->contentSecurityPolicy(); | 725 const ContentSecurityPolicy* csp = m_document->contentSecurityPolicy(); |
| 726 if (csp->shouldSendCSPHeader(type)) | 726 if (csp->shouldSendCSPHeader(type)) |
| 727 fetchRequest.mutableResourceRequest().addHTTPHeaderField("CSP", "active"
); | 727 fetchRequest.mutableResourceRequest().addHTTPHeaderField("CSP", "active"
); |
| 728 } | 728 } |
| 729 | 729 |
| 730 void FrameFetchContext::populateRequestorDataIfNecessary(ResourceRequest& reques
t) |
| 731 { |
| 732 if (!m_document) |
| 733 return; |
| 734 |
| 735 // Subresource requests inherit their requestor origin and first-party for |
| 736 // cookies from |m_document| directly. |
| 737 if (request.frameType() == WebURLRequest::FrameTypeNone) { |
| 738 RefPtr<SecurityOrigin> documentSite = SecurityOrigin::create(m_document-
>url()); |
| 739 if (request.requestorOrigin()->isUnique() && !documentSite->isUnique()) |
| 740 request.setRequestorOrigin(documentSite); |
| 741 if (request.firstPartyForCookies().isEmpty()) |
| 742 request.setFirstPartyForCookies(m_document->firstPartyForCookies()); |
| 743 } |
| 744 |
| 745 // Top-level and nested frame types are taken care of in 'FrameLoadRequest()
'. |
| 746 // Auxiliary frame types in 'createWindow()' and 'FrameLoader::load'. |
| 747 } |
| 748 |
| 730 MHTMLArchive* FrameFetchContext::archive() const | 749 MHTMLArchive* FrameFetchContext::archive() const |
| 731 { | 750 { |
| 732 ASSERT(!isMainFrame()); | 751 ASSERT(!isMainFrame()); |
| 733 // TODO(nasko): How should this work with OOPIF? | 752 // TODO(nasko): How should this work with OOPIF? |
| 734 // The MHTMLArchive is parsed as a whole, but can be constructed from | 753 // The MHTMLArchive is parsed as a whole, but can be constructed from |
| 735 // frames in mutliple processes. In that case, which process should parse | 754 // frames in mutliple processes. In that case, which process should parse |
| 736 // it and how should the output be spread back across multiple processes? | 755 // it and how should the output be spread back across multiple processes? |
| 737 if (!frame()->tree().parent()->isLocalFrame()) | 756 if (!frame()->tree().parent()->isLocalFrame()) |
| 738 return nullptr; | 757 return nullptr; |
| 739 return toLocalFrame(frame()->tree().parent())->loader().documentLoader()->fe
tcher()->archive(); | 758 return toLocalFrame(frame()->tree().parent())->loader().documentLoader()->fe
tcher()->archive(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 } | 792 } |
| 774 | 793 |
| 775 DEFINE_TRACE(FrameFetchContext) | 794 DEFINE_TRACE(FrameFetchContext) |
| 776 { | 795 { |
| 777 visitor->trace(m_document); | 796 visitor->trace(m_document); |
| 778 visitor->trace(m_documentLoader); | 797 visitor->trace(m_documentLoader); |
| 779 FetchContext::trace(visitor); | 798 FetchContext::trace(visitor); |
| 780 } | 799 } |
| 781 | 800 |
| 782 } // namespace blink | 801 } // namespace blink |
| OLD | NEW |