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