| 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 27 matching lines...) Expand all Loading... |
| 38 #include "core/loader/DocumentLoader.h" | 38 #include "core/loader/DocumentLoader.h" |
| 39 #include "core/loader/FrameLoader.h" | 39 #include "core/loader/FrameLoader.h" |
| 40 #include "core/loader/FrameLoaderClient.h" | 40 #include "core/loader/FrameLoaderClient.h" |
| 41 #include "core/loader/ProgressTracker.h" | 41 #include "core/loader/ProgressTracker.h" |
| 42 #include "core/page/Page.h" | 42 #include "core/page/Page.h" |
| 43 #include "core/frame/Settings.h" | 43 #include "core/frame/Settings.h" |
| 44 #include "platform/weborigin/SecurityPolicy.h" | 44 #include "platform/weborigin/SecurityPolicy.h" |
| 45 | 45 |
| 46 namespace WebCore { | 46 namespace WebCore { |
| 47 | 47 |
| 48 static const char defaultAcceptHeader[] = "text/html,application/xhtml+xml,appli
cation/xml;q=0.9,image/webp,*/*;q=0.8"; | |
| 49 | |
| 50 FrameFetchContext::FrameFetchContext(LocalFrame* frame) | 48 FrameFetchContext::FrameFetchContext(LocalFrame* frame) |
| 51 : m_frame(frame) | 49 : m_frame(frame) |
| 52 { | 50 { |
| 53 } | 51 } |
| 54 | 52 |
| 55 void FrameFetchContext::reportLocalLoadFailed(const KURL& url) | 53 void FrameFetchContext::reportLocalLoadFailed(const KURL& url) |
| 56 { | 54 { |
| 57 FrameLoader::reportLocalLoadFailed(m_frame, url.elidedString()); | 55 FrameLoader::reportLocalLoadFailed(m_frame, url.elidedString()); |
| 58 } | 56 } |
| 59 | 57 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 84 request.setFirstPartyForCookies(request.url()); | 82 request.setFirstPartyForCookies(request.url()); |
| 85 else if (m_frame->tree().top()->isLocalFrame()) | 83 else if (m_frame->tree().top()->isLocalFrame()) |
| 86 request.setFirstPartyForCookies(m_frame->tree().top()->document()->first
PartyForCookies()); | 84 request.setFirstPartyForCookies(m_frame->tree().top()->document()->first
PartyForCookies()); |
| 87 | 85 |
| 88 // The remaining modifications are only necessary for HTTP and HTTPS. | 86 // The remaining modifications are only necessary for HTTP and HTTPS. |
| 89 if (!request.url().isEmpty() && !request.url().protocolIsInHTTPFamily()) | 87 if (!request.url().isEmpty() && !request.url().protocolIsInHTTPFamily()) |
| 90 return; | 88 return; |
| 91 | 89 |
| 92 m_frame->loader().applyUserAgent(request); | 90 m_frame->loader().applyUserAgent(request); |
| 93 | 91 |
| 94 if (isMainResource) | |
| 95 request.setHTTPAccept(defaultAcceptHeader); | |
| 96 | |
| 97 // Default to sending an empty Origin header if one hasn't been set yet. | 92 // Default to sending an empty Origin header if one hasn't been set yet. |
| 98 FrameLoader::addHTTPOriginIfNeeded(request, nullAtom); | 93 FrameLoader::addHTTPOriginIfNeeded(request, nullAtom); |
| 99 } | 94 } |
| 100 | 95 |
| 101 CachePolicy FrameFetchContext::cachePolicy(Document* document) const | 96 CachePolicy FrameFetchContext::cachePolicy(Document* document) const |
| 102 { | 97 { |
| 103 if (document && document->loadEventFinished()) | 98 if (document && document->loadEventFinished()) |
| 104 return CachePolicyVerify; | 99 return CachePolicyVerify; |
| 105 | 100 |
| 106 FrameLoadType loadType = m_frame->loader().loadType(); | 101 FrameLoadType loadType = m_frame->loader().loadType(); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 if (!response.isNull()) | 196 if (!response.isNull()) |
| 202 dispatchDidReceiveResponse(ensureLoader(loader), identifier, response); | 197 dispatchDidReceiveResponse(ensureLoader(loader), identifier, response); |
| 203 | 198 |
| 204 if (dataLength > 0) | 199 if (dataLength > 0) |
| 205 dispatchDidReceiveData(ensureLoader(loader), identifier, 0, dataLength,
0); | 200 dispatchDidReceiveData(ensureLoader(loader), identifier, 0, dataLength,
0); |
| 206 | 201 |
| 207 dispatchDidFinishLoading(ensureLoader(loader), identifier, 0, 0); | 202 dispatchDidFinishLoading(ensureLoader(loader), identifier, 0, 0); |
| 208 } | 203 } |
| 209 | 204 |
| 210 } // namespace WebCore | 205 } // namespace WebCore |
| OLD | NEW |