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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 UseCounter::count(mixedFrame, UseCounter::MixedContentBlockableAllow
ed); | 335 UseCounter::count(mixedFrame, UseCounter::MixedContentBlockableAllow
ed); |
336 } | 336 } |
337 break; | 337 break; |
338 } | 338 } |
339 | 339 |
340 case ContextTypeShouldBeBlockable: | 340 case ContextTypeShouldBeBlockable: |
341 allowed = !strictMode; | 341 allowed = !strictMode; |
342 if (allowed) | 342 if (allowed) |
343 client->didDisplayInsecureContent(); | 343 client->didDisplayInsecureContent(); |
344 break; | 344 break; |
| 345 case ContextTypeNotMixedContent: |
| 346 ASSERT_NOT_REACHED(); |
| 347 break; |
345 }; | 348 }; |
346 | 349 |
347 if (reportingStatus == SendReport) | 350 if (reportingStatus == SendReport) |
348 logToConsoleAboutFetch(frame, url, requestContext, allowed); | 351 logToConsoleAboutFetch(frame, url, requestContext, allowed); |
349 return !allowed; | 352 return !allowed; |
350 } | 353 } |
351 | 354 |
352 // static | 355 // static |
353 void MixedContentChecker::logToConsoleAboutWebSocket(LocalFrame* frame, const KU
RL& url, bool allowed) | 356 void MixedContentChecker::logToConsoleAboutWebSocket(LocalFrame* frame, const KU
RL& url, bool allowed) |
354 { | 357 { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 void MixedContentChecker::checkMixedPrivatePublic(LocalFrame* frame, const Atomi
cString& resourceIPAddress) | 423 void MixedContentChecker::checkMixedPrivatePublic(LocalFrame* frame, const Atomi
cString& resourceIPAddress) |
421 { | 424 { |
422 if (!frame || !frame->document() || !frame->document()->loader()) | 425 if (!frame || !frame->document() || !frame->document()->loader()) |
423 return; | 426 return; |
424 | 427 |
425 // Just count these for the moment, don't block them. | 428 // Just count these for the moment, don't block them. |
426 if (Platform::current()->isReservedIPAddress(resourceIPAddress) && !frame->d
ocument()->isHostedInReservedIPRange()) | 429 if (Platform::current()->isReservedIPAddress(resourceIPAddress) && !frame->d
ocument()->isHostedInReservedIPRange()) |
427 UseCounter::count(frame->document(), UseCounter::MixedContentPrivateHost
nameInPublicHostname); | 430 UseCounter::count(frame->document(), UseCounter::MixedContentPrivateHost
nameInPublicHostname); |
428 } | 431 } |
429 | 432 |
| 433 LocalFrame* MixedContentChecker::effectiveFrameForFrameType(LocalFrame* frame, W
ebURLRequest::FrameType frameType) |
| 434 { |
| 435 // If we're loading the main resource of a subframe, ensure that we check |
| 436 // against the parent of the active frame, rather than the frame itself. |
| 437 LocalFrame* effectiveFrame = frame; |
| 438 if (frameType == WebURLRequest::FrameTypeNested) { |
| 439 // FIXME: Deal with RemoteFrames. |
| 440 Frame* parentFrame = effectiveFrame->tree().parent(); |
| 441 ASSERT(parentFrame); |
| 442 if (parentFrame->isLocalFrame()) |
| 443 effectiveFrame = toLocalFrame(parentFrame); |
| 444 } |
| 445 return effectiveFrame; |
| 446 } |
| 447 |
| 448 MixedContentChecker::ContextType MixedContentChecker::contextTypeForInspector(Lo
calFrame* frame, const ResourceRequest& request) |
| 449 { |
| 450 LocalFrame* effectiveFrame = effectiveFrameForFrameType(frame, request.frame
Type()); |
| 451 |
| 452 LocalFrame* mixedFrame = inWhichFrameIsContentMixed(effectiveFrame, request.
frameType(), request.url()); |
| 453 if (!mixedFrame) |
| 454 return ContextTypeNotMixedContent; |
| 455 |
| 456 if (request.frameType() == WebURLRequest::FrameTypeNested && !SchemeRegistry
::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol())) { |
| 457 return ContextTypeOptionallyBlockable; |
| 458 } |
| 459 |
| 460 return contextTypeFromContext(request.requestContext(), mixedFrame); |
| 461 } |
| 462 |
430 } // namespace blink | 463 } // namespace blink |
OLD | NEW |