OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 22 matching lines...) Expand all Loading... |
33 #include "core/loader/PingLoader.h" | 33 #include "core/loader/PingLoader.h" |
34 | 34 |
35 #include "core/FetchInitiatorTypeNames.h" | 35 #include "core/FetchInitiatorTypeNames.h" |
36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
37 #include "core/fetch/FetchContext.h" | 37 #include "core/fetch/FetchContext.h" |
38 #include "core/frame/LocalFrame.h" | 38 #include "core/frame/LocalFrame.h" |
39 #include "core/inspector/InspectorInstrumentation.h" | 39 #include "core/inspector/InspectorInstrumentation.h" |
40 #include "core/inspector/InspectorTraceEvents.h" | 40 #include "core/inspector/InspectorTraceEvents.h" |
41 #include "core/loader/FrameLoader.h" | 41 #include "core/loader/FrameLoader.h" |
42 #include "core/loader/FrameLoaderClient.h" | 42 #include "core/loader/FrameLoaderClient.h" |
| 43 #include "core/loader/MixedContentChecker.h" |
43 #include "core/loader/UniqueIdentifier.h" | 44 #include "core/loader/UniqueIdentifier.h" |
44 #include "core/page/Page.h" | 45 #include "core/page/Page.h" |
45 #include "platform/exported/WrappedResourceRequest.h" | 46 #include "platform/exported/WrappedResourceRequest.h" |
46 #include "platform/network/ResourceError.h" | 47 #include "platform/network/ResourceError.h" |
47 #include "platform/network/ResourceRequest.h" | 48 #include "platform/network/ResourceRequest.h" |
48 #include "platform/network/ResourceResponse.h" | 49 #include "platform/network/ResourceResponse.h" |
49 #include "platform/weborigin/SecurityOrigin.h" | 50 #include "platform/weborigin/SecurityOrigin.h" |
50 #include "platform/weborigin/SecurityPolicy.h" | 51 #include "platform/weborigin/SecurityPolicy.h" |
51 #include "public/platform/Platform.h" | 52 #include "public/platform/Platform.h" |
52 #include "public/platform/WebURLLoader.h" | 53 #include "public/platform/WebURLLoader.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 frame->loader().fetchContext().addAdditionalRequestHeaders(frame->document()
, request, FetchSubresource); | 115 frame->loader().fetchContext().addAdditionalRequestHeaders(frame->document()
, request, FetchSubresource); |
115 frame->loader().fetchContext().setFirstPartyForCookies(request); | 116 frame->loader().fetchContext().setFirstPartyForCookies(request); |
116 | 117 |
117 FetchInitiatorInfo initiatorInfo; | 118 FetchInitiatorInfo initiatorInfo; |
118 initiatorInfo.name = FetchInitiatorTypeNames::violationreport; | 119 initiatorInfo.name = FetchInitiatorTypeNames::violationreport; |
119 PingLoader::start(frame, request, initiatorInfo, SecurityOrigin::create(repo
rtURL)->isSameSchemeHostPort(frame->document()->securityOrigin()) ? AllowStoredC
redentials : DoNotAllowStoredCredentials); | 120 PingLoader::start(frame, request, initiatorInfo, SecurityOrigin::create(repo
rtURL)->isSameSchemeHostPort(frame->document()->securityOrigin()) ? AllowStoredC
redentials : DoNotAllowStoredCredentials); |
120 } | 121 } |
121 | 122 |
122 void PingLoader::start(LocalFrame* frame, ResourceRequest& request, const FetchI
nitiatorInfo& initiatorInfo, StoredCredentials credentialsAllowed) | 123 void PingLoader::start(LocalFrame* frame, ResourceRequest& request, const FetchI
nitiatorInfo& initiatorInfo, StoredCredentials credentialsAllowed) |
123 { | 124 { |
124 if (!frame->loader().mixedContentChecker()->canRunInsecureContent(frame->doc
ument()->securityOrigin(), request.url())) | 125 if (MixedContentChecker::shouldBlockFetch(frame, request.requestContext(), r
equest.frameType(), request.url())) |
125 return; | 126 return; |
126 | 127 |
127 OwnPtr<PingLoader> pingLoader = adoptPtr(new PingLoader(frame, request, init
iatorInfo, credentialsAllowed)); | 128 OwnPtr<PingLoader> pingLoader = adoptPtr(new PingLoader(frame, request, init
iatorInfo, credentialsAllowed)); |
128 | 129 |
129 // Leak the ping loader, since it will kill itself as soon as it receives a
response. | 130 // Leak the ping loader, since it will kill itself as soon as it receives a
response. |
130 PingLoader* leakedPingLoader ALLOW_UNUSED = pingLoader.leakPtr(); | 131 PingLoader* leakedPingLoader ALLOW_UNUSED = pingLoader.leakPtr(); |
131 } | 132 } |
132 | 133 |
133 PingLoader::PingLoader(LocalFrame* frame, ResourceRequest& request, const FetchI
nitiatorInfo& initiatorInfo, StoredCredentials credentialsAllowed) | 134 PingLoader::PingLoader(LocalFrame* frame, ResourceRequest& request, const FetchI
nitiatorInfo& initiatorInfo, StoredCredentials credentialsAllowed) |
134 : PageLifecycleObserver(frame->page()) | 135 : PageLifecycleObserver(frame->page()) |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 void PingLoader::timeout(Timer<PingLoader>*) | 202 void PingLoader::timeout(Timer<PingLoader>*) |
202 { | 203 { |
203 if (Page* page = this->page()) { | 204 if (Page* page = this->page()) { |
204 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Re
sourceFinish", "data", InspectorResourceFinishEvent::data(m_identifier, 0, true)
); | 205 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Re
sourceFinish", "data", InspectorResourceFinishEvent::data(m_identifier, 0, true)
); |
205 InspectorInstrumentation::didFailLoading(page->deprecatedLocalMainFrame(
), m_identifier, ResourceError::cancelledError(m_url)); | 206 InspectorInstrumentation::didFailLoading(page->deprecatedLocalMainFrame(
), m_identifier, ResourceError::cancelledError(m_url)); |
206 } | 207 } |
207 delete this; | 208 delete this; |
208 } | 209 } |
209 | 210 |
210 } | 211 } |
OLD | NEW |