OLD | NEW |
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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 break; | 300 break; |
301 | 301 |
302 default: | 302 default: |
303 ASSERT_NOT_REACHED(); | 303 ASSERT_NOT_REACHED(); |
304 return; | 304 return; |
305 } | 305 } |
306 UseCounter::count(frame, feature); | 306 UseCounter::count(frame, feature); |
307 } | 307 } |
308 | 308 |
309 // static | 309 // static |
310 bool MixedContentChecker::shouldBlockFetch(LocalFrame* frame, WebURLRequest::Req
uestContext requestContext, WebURLRequest::FrameType frameType, const KURL& url,
MixedContentChecker::ReportingStatus reportingStatus) | 310 bool MixedContentChecker::shouldBlockFetch(LocalFrame* frame, WebURLRequest::Req
uestContext requestContext, WebURLRequest::FrameType frameType, ResourceRequest:
:RedirectStatus redirectStatus, const KURL& url, MixedContentChecker::ReportingS
tatus reportingStatus) |
311 { | 311 { |
312 Frame* effectiveFrame = effectiveFrameForFrameType(frame, frameType); | 312 Frame* effectiveFrame = effectiveFrameForFrameType(frame, frameType); |
313 Frame* mixedFrame = inWhichFrameIsContentMixed(effectiveFrame, frameType, ur
l); | 313 Frame* mixedFrame = inWhichFrameIsContentMixed(effectiveFrame, frameType, ur
l); |
314 if (!mixedFrame) | 314 if (!mixedFrame) |
315 return false; | 315 return false; |
316 | 316 |
317 MixedContentChecker::count(mixedFrame, requestContext); | 317 MixedContentChecker::count(mixedFrame, requestContext); |
318 if (ContentSecurityPolicy* policy = frame->securityContext()->contentSecurit
yPolicy()) | 318 if (ContentSecurityPolicy* policy = frame->securityContext()->contentSecurit
yPolicy()) |
319 policy->reportMixedContent(url); | 319 policy->reportMixedContent(url, redirectStatus); |
320 | 320 |
321 Settings* settings = mixedFrame->settings(); | 321 Settings* settings = mixedFrame->settings(); |
322 // Use the current local frame's client; the embedder doesn't | 322 // Use the current local frame's client; the embedder doesn't |
323 // distinguish mixed content signals from different frames on the | 323 // distinguish mixed content signals from different frames on the |
324 // same page. | 324 // same page. |
325 FrameLoaderClient* client = frame->loader().client(); | 325 FrameLoaderClient* client = frame->loader().client(); |
326 SecurityOrigin* securityOrigin = mixedFrame->securityContext()->getSecurityO
rigin(); | 326 SecurityOrigin* securityOrigin = mixedFrame->securityContext()->getSecurityO
rigin(); |
327 bool allowed = false; | 327 bool allowed = false; |
328 | 328 |
329 // If we're in strict mode, we'll automagically fail everything, and intenti
onally skip | 329 // If we're in strict mode, we'll automagically fail everything, and intenti
onally skip |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 // static | 401 // static |
402 bool MixedContentChecker::shouldBlockWebSocket(LocalFrame* frame, const KURL& ur
l, MixedContentChecker::ReportingStatus reportingStatus) | 402 bool MixedContentChecker::shouldBlockWebSocket(LocalFrame* frame, const KURL& ur
l, MixedContentChecker::ReportingStatus reportingStatus) |
403 { | 403 { |
404 Frame* mixedFrame = inWhichFrameIsContentMixed(frame, WebURLRequest::FrameTy
peNone, url); | 404 Frame* mixedFrame = inWhichFrameIsContentMixed(frame, WebURLRequest::FrameTy
peNone, url); |
405 if (!mixedFrame) | 405 if (!mixedFrame) |
406 return false; | 406 return false; |
407 | 407 |
408 UseCounter::count(mixedFrame, UseCounter::MixedContentPresent); | 408 UseCounter::count(mixedFrame, UseCounter::MixedContentPresent); |
409 UseCounter::count(mixedFrame, UseCounter::MixedContentWebSocket); | 409 UseCounter::count(mixedFrame, UseCounter::MixedContentWebSocket); |
410 if (ContentSecurityPolicy* policy = frame->securityContext()->contentSecurit
yPolicy()) | 410 if (ContentSecurityPolicy* policy = frame->securityContext()->contentSecurit
yPolicy()) |
411 policy->reportMixedContent(url); | 411 policy->reportMixedContent(url, ResourceRequest::RedirectStatus::NoRedir
ect); |
412 | 412 |
413 Settings* settings = mixedFrame->settings(); | 413 Settings* settings = mixedFrame->settings(); |
414 // Use the current local frame's client; the embedder doesn't | 414 // Use the current local frame's client; the embedder doesn't |
415 // distinguish mixed content signals from different frames on the | 415 // distinguish mixed content signals from different frames on the |
416 // same page. | 416 // same page. |
417 FrameLoaderClient* client = frame->loader().client(); | 417 FrameLoaderClient* client = frame->loader().client(); |
418 SecurityOrigin* securityOrigin = mixedFrame->securityContext()->getSecurityO
rigin(); | 418 SecurityOrigin* securityOrigin = mixedFrame->securityContext()->getSecurityO
rigin(); |
419 bool allowed = false; | 419 bool allowed = false; |
420 | 420 |
421 // If we're in strict mode, we'll automagically fail everything, and intenti
onally skip | 421 // If we're in strict mode, we'll automagically fail everything, and intenti
onally skip |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 | 517 |
518 // See comment in shouldBlockFetch() about loading the main resource of a su
bframe. | 518 // See comment in shouldBlockFetch() about loading the main resource of a su
bframe. |
519 if (request.frameType() == WebURLRequest::FrameTypeNested && !SchemeRegistry
::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol())) { | 519 if (request.frameType() == WebURLRequest::FrameTypeNested && !SchemeRegistry
::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol())) { |
520 return ContextTypeOptionallyBlockable; | 520 return ContextTypeOptionallyBlockable; |
521 } | 521 } |
522 | 522 |
523 return contextTypeFromContext(request.requestContext(), mixedFrame); | 523 return contextTypeFromContext(request.requestContext(), mixedFrame); |
524 } | 524 } |
525 | 525 |
526 } // namespace blink | 526 } // namespace blink |
OLD | NEW |