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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 request.setFirstPartyForCookies(request.url()); | 84 request.setFirstPartyForCookies(request.url()); |
85 else if (m_frame->tree().top()->isLocalFrame()) | 85 else if (m_frame->tree().top()->isLocalFrame()) |
86 request.setFirstPartyForCookies(m_frame->tree().top()->document()->first
PartyForCookies()); | 86 request.setFirstPartyForCookies(m_frame->tree().top()->document()->first
PartyForCookies()); |
87 | 87 |
88 // The remaining modifications are only necessary for HTTP and HTTPS. | 88 // The remaining modifications are only necessary for HTTP and HTTPS. |
89 if (!request.url().isEmpty() && !request.url().protocolIsInHTTPFamily()) | 89 if (!request.url().isEmpty() && !request.url().protocolIsInHTTPFamily()) |
90 return; | 90 return; |
91 | 91 |
92 m_frame->loader().applyUserAgent(request); | 92 m_frame->loader().applyUserAgent(request); |
93 | 93 |
94 if (request.cachePolicy() == ReloadIgnoringCacheData | |
95 || request.cachePolicy() == ReloadBypassingCache) { | |
96 if (m_frame->loader().loadType() == FrameLoadTypeReload) { | |
97 request.setHTTPHeaderField("Cache-Control", "max-age=0"); | |
98 } else if (m_frame->loader().loadType() == FrameLoadTypeReloadFromOrigin
) { | |
99 request.setHTTPHeaderField("Cache-Control", "no-cache"); | |
100 request.setHTTPHeaderField("Pragma", "no-cache"); | |
101 } | |
102 } | |
103 | |
104 if (isMainResource) | 94 if (isMainResource) |
105 request.setHTTPAccept(defaultAcceptHeader); | 95 request.setHTTPAccept(defaultAcceptHeader); |
106 | 96 |
107 // Default to sending an empty Origin header if one hasn't been set yet. | 97 // Default to sending an empty Origin header if one hasn't been set yet. |
108 FrameLoader::addHTTPOriginIfNeeded(request, nullAtom); | 98 FrameLoader::addHTTPOriginIfNeeded(request, nullAtom); |
109 } | 99 } |
110 | 100 |
111 CachePolicy FrameFetchContext::cachePolicy(Document* document) const | 101 CachePolicy FrameFetchContext::cachePolicy(Document* document) const |
112 { | 102 { |
113 if (document && document->loadEventFinished()) | 103 if (document && document->loadEventFinished()) |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 if (!response.isNull()) | 201 if (!response.isNull()) |
212 dispatchDidReceiveResponse(ensureLoader(loader), identifier, response); | 202 dispatchDidReceiveResponse(ensureLoader(loader), identifier, response); |
213 | 203 |
214 if (dataLength > 0) | 204 if (dataLength > 0) |
215 dispatchDidReceiveData(ensureLoader(loader), identifier, 0, dataLength,
0); | 205 dispatchDidReceiveData(ensureLoader(loader), identifier, 0, dataLength,
0); |
216 | 206 |
217 dispatchDidFinishLoading(ensureLoader(loader), identifier, 0, 0); | 207 dispatchDidFinishLoading(ensureLoader(loader), identifier, 0, 0); |
218 } | 208 } |
219 | 209 |
220 } // namespace WebCore | 210 } // namespace WebCore |
OLD | NEW |