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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 outgoingReferrer = SecurityPolicy::generateReferrerHeader(document->refe
rrerPolicy(), request.url(), outgoingReferrer); | 72 outgoingReferrer = SecurityPolicy::generateReferrerHeader(document->refe
rrerPolicy(), request.url(), outgoingReferrer); |
73 if (outgoingReferrer.isEmpty()) | 73 if (outgoingReferrer.isEmpty()) |
74 request.clearHTTPReferrer(); | 74 request.clearHTTPReferrer(); |
75 else if (!request.httpReferrer()) | 75 else if (!request.httpReferrer()) |
76 request.setHTTPReferrer(Referrer(outgoingReferrer, document->referre
rPolicy())); | 76 request.setHTTPReferrer(Referrer(outgoingReferrer, document->referre
rPolicy())); |
77 | 77 |
78 FrameLoader::addHTTPOriginIfNeeded(request, AtomicString(outgoingOrigin)
); | 78 FrameLoader::addHTTPOriginIfNeeded(request, AtomicString(outgoingOrigin)
); |
79 } | 79 } |
80 | 80 |
81 if (isMainResource && m_frame->isMainFrame()) | |
82 request.setFirstPartyForCookies(request.url()); | |
83 else if (m_frame->tree().top()->isLocalFrame()) | |
84 request.setFirstPartyForCookies(toLocalFrame(m_frame->tree().top())->doc
ument()->firstPartyForCookies()); | |
85 | |
86 // The remaining modifications are only necessary for HTTP and HTTPS. | 81 // The remaining modifications are only necessary for HTTP and HTTPS. |
87 if (!request.url().isEmpty() && !request.url().protocolIsInHTTPFamily()) | 82 if (!request.url().isEmpty() && !request.url().protocolIsInHTTPFamily()) |
88 return; | 83 return; |
89 | 84 |
90 m_frame->loader().applyUserAgent(request); | 85 m_frame->loader().applyUserAgent(request); |
91 | 86 |
92 // Default to sending an empty Origin header if one hasn't been set yet. | 87 // Default to sending an empty Origin header if one hasn't been set yet. |
93 FrameLoader::addHTTPOriginIfNeeded(request, nullAtom); | 88 FrameLoader::addHTTPOriginIfNeeded(request, nullAtom); |
94 } | 89 } |
95 | 90 |
| 91 void FrameFetchContext::setFirstPartyForCookies(ResourceRequest& request) |
| 92 { |
| 93 if (m_frame->tree().top()->isLocalFrame()) |
| 94 request.setFirstPartyForCookies(toLocalFrame(m_frame->tree().top())->doc
ument()->firstPartyForCookies()); |
| 95 } |
| 96 |
96 CachePolicy FrameFetchContext::cachePolicy(Document* document) const | 97 CachePolicy FrameFetchContext::cachePolicy(Document* document) const |
97 { | 98 { |
98 if (document && document->loadEventFinished()) | 99 if (document && document->loadEventFinished()) |
99 return CachePolicyVerify; | 100 return CachePolicyVerify; |
100 | 101 |
101 FrameLoadType loadType = m_frame->loader().loadType(); | 102 FrameLoadType loadType = m_frame->loader().loadType(); |
102 if (loadType == FrameLoadTypeReloadFromOrigin) | 103 if (loadType == FrameLoadTypeReloadFromOrigin) |
103 return CachePolicyReload; | 104 return CachePolicyReload; |
104 | 105 |
105 Frame* parentFrame = m_frame->tree().parent(); | 106 Frame* parentFrame = m_frame->tree().parent(); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 if (!response.isNull()) | 197 if (!response.isNull()) |
197 dispatchDidReceiveResponse(ensureLoader(loader), identifier, response); | 198 dispatchDidReceiveResponse(ensureLoader(loader), identifier, response); |
198 | 199 |
199 if (dataLength > 0) | 200 if (dataLength > 0) |
200 dispatchDidReceiveData(ensureLoader(loader), identifier, 0, dataLength,
0); | 201 dispatchDidReceiveData(ensureLoader(loader), identifier, 0, dataLength,
0); |
201 | 202 |
202 dispatchDidFinishLoading(ensureLoader(loader), identifier, 0, 0); | 203 dispatchDidFinishLoading(ensureLoader(loader), identifier, 0, 0); |
203 } | 204 } |
204 | 205 |
205 } // namespace WebCore | 206 } // namespace WebCore |
OLD | NEW |