Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(811)

Side by Side Diff: third_party/WebKit/Source/core/loader/MixedContentChecker.cpp

Issue 2160583003: Tests that main resource loads always require log/reporting of mixed content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 default: 175 default:
176 NOTREACHED(); 176 NOTREACHED();
177 return; 177 return;
178 } 178 }
179 UseCounter::count(frame, feature); 179 UseCounter::count(frame, feature);
180 } 180 }
181 181
182 // static 182 // static
183 bool MixedContentChecker::shouldBlockFetch(LocalFrame* frame, WebURLRequest::Req uestContext requestContext, WebURLRequest::FrameType frameType, ResourceRequest: :RedirectStatus redirectStatus, const KURL& url, MixedContentChecker::ReportingS tatus reportingStatus) 183 bool MixedContentChecker::shouldBlockFetch(LocalFrame* frame, WebURLRequest::Req uestContext requestContext, WebURLRequest::FrameType frameType, ResourceRequest: :RedirectStatus redirectStatus, const KURL& url, MixedContentChecker::ReportingS tatus reportingStatus)
184 { 184 {
185 // Tests that all main resource loads (frame navigations) always send a repo rt.
186 DCHECK(frameType == WebURLRequest::FrameTypeNone || reportingStatus == SendR eport);
187
185 Frame* effectiveFrame = effectiveFrameForFrameType(frame, frameType); 188 Frame* effectiveFrame = effectiveFrameForFrameType(frame, frameType);
186 Frame* mixedFrame = inWhichFrameIsContentMixed(effectiveFrame, frameType, ur l); 189 Frame* mixedFrame = inWhichFrameIsContentMixed(effectiveFrame, frameType, ur l);
187 if (!mixedFrame) 190 if (!mixedFrame)
188 return false; 191 return false;
189 192
190 MixedContentChecker::count(mixedFrame, requestContext); 193 MixedContentChecker::count(mixedFrame, requestContext);
191 if (ContentSecurityPolicy* policy = frame->securityContext()->contentSecurit yPolicy()) 194 if (ContentSecurityPolicy* policy = frame->securityContext()->contentSecurit yPolicy())
192 policy->reportMixedContent(url, redirectStatus); 195 policy->reportMixedContent(url, redirectStatus);
193 196
194 Settings* settings = mixedFrame->settings(); 197 Settings* settings = mixedFrame->settings();
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 // See comment in shouldBlockFetch() about loading the main resource of a su bframe. 395 // See comment in shouldBlockFetch() about loading the main resource of a su bframe.
393 if (request.frameType() == WebURLRequest::FrameTypeNested && !SchemeRegistry ::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol())) { 396 if (request.frameType() == WebURLRequest::FrameTypeNested && !SchemeRegistry ::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol())) {
394 return WebMixedContent::ContextType::OptionallyBlockable; 397 return WebMixedContent::ContextType::OptionallyBlockable;
395 } 398 }
396 399
397 bool strictMixedContentCheckingForPlugin = mixedFrame->settings() && mixedFr ame->settings()->strictMixedContentCheckingForPlugin(); 400 bool strictMixedContentCheckingForPlugin = mixedFrame->settings() && mixedFr ame->settings()->strictMixedContentCheckingForPlugin();
398 return WebMixedContent::contextTypeFromRequestContext(request.requestContext (), strictMixedContentCheckingForPlugin); 401 return WebMixedContent::contextTypeFromRequestContext(request.requestContext (), strictMixedContentCheckingForPlugin);
399 } 402 }
400 403
401 } // namespace blink 404 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698