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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 void FrameFetchContext::reportLocalLoadFailed(const KURL& url) | 54 void FrameFetchContext::reportLocalLoadFailed(const KURL& url) |
55 { | 55 { |
56 FrameLoader::reportLocalLoadFailed(m_frame, url.elidedString()); | 56 FrameLoader::reportLocalLoadFailed(m_frame, url.elidedString()); |
57 } | 57 } |
58 | 58 |
59 void FrameFetchContext::addAdditionalRequestHeaders(Document* document, Resource
Request& request, FetchResourceType type) | 59 void FrameFetchContext::addAdditionalRequestHeaders(Document* document, Resource
Request& request, FetchResourceType type) |
60 { | 60 { |
61 bool isMainResource = type == FetchMainResource; | 61 bool isMainResource = type == FetchMainResource; |
62 if (!isMainResource) { | 62 if (!isMainResource) { |
63 String outgoingReferrer; | 63 String outgoingReferrer; |
| 64 ReferrerPolicy referrerPolicy; |
64 String outgoingOrigin; | 65 String outgoingOrigin; |
65 if (request.httpReferrer().isNull()) { | 66 if (request.httpReferrer().isNull()) { |
66 outgoingReferrer = document->outgoingReferrer(); | 67 outgoingReferrer = document->outgoingReferrer(); |
| 68 referrerPolicy = document->referrerPolicy(); |
67 outgoingOrigin = document->outgoingOrigin(); | 69 outgoingOrigin = document->outgoingOrigin(); |
68 } else { | 70 } else { |
69 outgoingReferrer = request.httpReferrer(); | 71 outgoingReferrer = request.httpReferrer(); |
| 72 referrerPolicy = request.referrerPolicy(); |
70 outgoingOrigin = SecurityOrigin::createFromString(outgoingReferrer)-
>toString(); | 73 outgoingOrigin = SecurityOrigin::createFromString(outgoingReferrer)-
>toString(); |
71 } | 74 } |
72 | 75 |
73 outgoingReferrer = SecurityPolicy::generateReferrerHeader(document->refe
rrerPolicy(), request.url(), outgoingReferrer); | 76 outgoingReferrer = SecurityPolicy::generateReferrerHeader(referrerPolicy
, request.url(), outgoingReferrer); |
74 if (outgoingReferrer.isEmpty()) | 77 if (outgoingReferrer.isEmpty()) |
75 request.clearHTTPReferrer(); | 78 request.clearHTTPReferrer(); |
76 else if (!request.httpReferrer()) | 79 else |
77 request.setHTTPReferrer(Referrer(outgoingReferrer, document->referre
rPolicy())); | 80 request.setHTTPReferrer(Referrer(outgoingReferrer, referrerPolicy)); |
78 | 81 |
79 request.addHTTPOriginIfNeeded(AtomicString(outgoingOrigin)); | 82 request.addHTTPOriginIfNeeded(AtomicString(outgoingOrigin)); |
80 } | 83 } |
81 | 84 |
82 // The remaining modifications are only necessary for HTTP and HTTPS. | 85 // The remaining modifications are only necessary for HTTP and HTTPS. |
83 if (!request.url().isEmpty() && !request.url().protocolIsInHTTPFamily()) | 86 if (!request.url().isEmpty() && !request.url().protocolIsInHTTPFamily()) |
84 return; | 87 return; |
85 | 88 |
86 m_frame->loader().applyUserAgent(request); | 89 m_frame->loader().applyUserAgent(request); |
87 } | 90 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 if (!response.isNull()) | 201 if (!response.isNull()) |
199 dispatchDidReceiveResponse(ensureLoader(loader), identifier, response); | 202 dispatchDidReceiveResponse(ensureLoader(loader), identifier, response); |
200 | 203 |
201 if (dataLength > 0) | 204 if (dataLength > 0) |
202 dispatchDidReceiveData(ensureLoader(loader), identifier, 0, dataLength,
0); | 205 dispatchDidReceiveData(ensureLoader(loader), identifier, 0, dataLength,
0); |
203 | 206 |
204 dispatchDidFinishLoading(ensureLoader(loader), identifier, 0, 0); | 207 dispatchDidFinishLoading(ensureLoader(loader), identifier, 0, 0); |
205 } | 208 } |
206 | 209 |
207 } // namespace blink | 210 } // namespace blink |
OLD | NEW |