Index: third_party/WebKit/Source/core/loader/MixedContentChecker.cpp |
diff --git a/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp b/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp |
index fdcc09b14a13bba18e331b1fa85bb1848942e2f5..00d31fecf7cadc8fae04c11982fcd5c72f9ae3a4 100644 |
--- a/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp |
+++ b/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp |
@@ -458,6 +458,37 @@ LocalFrame* MixedContentChecker::effectiveFrameForFrameType(LocalFrame* frame, W |
return effectiveFrame; |
} |
+void MixedContentChecker::handleCertificateError(LocalFrame* frame, const ResourceRequest& request, const ResourceResponse& response) |
+{ |
+ WebURLRequest::FrameType frameType = request.frameType(); |
+ LocalFrame* effectiveFrame = effectiveFrameForFrameType(frame, frameType); |
+ if (frameType == WebURLRequest::FrameTypeTopLevel || !effectiveFrame) |
+ return; |
+ |
+ FrameLoaderClient* client = effectiveFrame->loader().client(); |
+ WebURLRequest::RequestContext requestContext = request.requestContext(); |
+ ContextType contextType = MixedContentChecker::contextTypeFromContext(requestContext, frame); |
+ logToConsoleAboutCertificateError(effectiveFrame, response.url(), requestContext); |
+ if (contextType == ContextTypeBlockable) { |
+ client->didRunContentWithCertificateErrors(response.url(), response.getSecurityInfo(), effectiveFrame->document()->url(), effectiveFrame->loader().documentLoader()->response().getSecurityInfo()); |
+ } else { |
+ // contextTypeFromContext() never returns NotMixedContent (it |
+ // computes the type of mixed content, given that the content is |
+ // mixed). |
+ ASSERT(contextType != ContextTypeNotMixedContent); |
+ client->didDisplayContentWithCertificateErrors(response.url(), response.getSecurityInfo(), effectiveFrame->document()->url(), effectiveFrame->loader().documentLoader()->response().getSecurityInfo()); |
+ } |
+} |
+ |
+// static |
+void MixedContentChecker::logToConsoleAboutCertificateError(LocalFrame* frame, const KURL& url, WebURLRequest::RequestContext requestContext) |
+{ |
+ String message = String::format( |
+ "Invalid certificate: The page at '%s' loaded a %s with certificate errors from '%s'.", |
+ frame->document()->url().elidedString().utf8().data(), typeNameFromContext(requestContext), url.elidedString().utf8().data()); |
+ frame->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, WarningMessageLevel, message)); |
+} |
+ |
MixedContentChecker::ContextType MixedContentChecker::contextTypeForInspector(LocalFrame* frame, const ResourceRequest& request) |
{ |
LocalFrame* effectiveFrame = effectiveFrameForFrameType(frame, request.frameType()); |