| 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 23 matching lines...) Expand all Loading... |
| 34 #include "core/frame/Settings.h" | 34 #include "core/frame/Settings.h" |
| 35 #include "core/frame/UseCounter.h" | 35 #include "core/frame/UseCounter.h" |
| 36 #include "core/inspector/ConsoleMessage.h" | 36 #include "core/inspector/ConsoleMessage.h" |
| 37 #include "core/loader/DocumentLoader.h" | 37 #include "core/loader/DocumentLoader.h" |
| 38 #include "core/loader/FrameLoader.h" | 38 #include "core/loader/FrameLoader.h" |
| 39 #include "core/loader/FrameLoaderClient.h" | 39 #include "core/loader/FrameLoaderClient.h" |
| 40 #include "platform/RuntimeEnabledFeatures.h" | 40 #include "platform/RuntimeEnabledFeatures.h" |
| 41 #include "platform/weborigin/SchemeRegistry.h" | 41 #include "platform/weborigin/SchemeRegistry.h" |
| 42 #include "platform/weborigin/SecurityOrigin.h" | 42 #include "platform/weborigin/SecurityOrigin.h" |
| 43 #include "public/platform/Platform.h" | 43 #include "public/platform/Platform.h" |
| 44 #include "public/platform/WebAddressSpace.h" |
| 44 #include "wtf/text/StringBuilder.h" | 45 #include "wtf/text/StringBuilder.h" |
| 45 | 46 |
| 46 namespace blink { | 47 namespace blink { |
| 47 | 48 |
| 48 namespace { | 49 namespace { |
| 49 | 50 |
| 50 // When a frame is local, use its full URL to represent the main | 51 // When a frame is local, use its full URL to represent the main |
| 51 // resource. When the frame is remote, the full URL isn't accessible, so | 52 // resource. When the frame is remote, the full URL isn't accessible, so |
| 52 // use the origin. This function is used, for example, to determine the | 53 // use the origin. This function is used, for example, to determine the |
| 53 // URL to show in console messages about mixed content. | 54 // URL to show in console messages about mixed content. |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 | 458 |
| 458 return true; | 459 return true; |
| 459 } | 460 } |
| 460 | 461 |
| 461 void MixedContentChecker::checkMixedPrivatePublic(LocalFrame* frame, const Atomi
cString& resourceIPAddress) | 462 void MixedContentChecker::checkMixedPrivatePublic(LocalFrame* frame, const Atomi
cString& resourceIPAddress) |
| 462 { | 463 { |
| 463 if (!frame || !frame->document() || !frame->document()->loader()) | 464 if (!frame || !frame->document() || !frame->document()->loader()) |
| 464 return; | 465 return; |
| 465 | 466 |
| 466 // Just count these for the moment, don't block them. | 467 // Just count these for the moment, don't block them. |
| 467 if (Platform::current()->isReservedIPAddress(resourceIPAddress) && frame->do
cument()->addressSpace() == WebURLRequest::AddressSpacePublic) | 468 if (Platform::current()->isReservedIPAddress(resourceIPAddress) && frame->do
cument()->addressSpace() == WebAddressSpacePublic) |
| 468 UseCounter::count(frame->document(), UseCounter::MixedContentPrivateHost
nameInPublicHostname); | 469 UseCounter::count(frame->document(), UseCounter::MixedContentPrivateHost
nameInPublicHostname); |
| 469 } | 470 } |
| 470 | 471 |
| 471 Frame* MixedContentChecker::effectiveFrameForFrameType(LocalFrame* frame, WebURL
Request::FrameType frameType) | 472 Frame* MixedContentChecker::effectiveFrameForFrameType(LocalFrame* frame, WebURL
Request::FrameType frameType) |
| 472 { | 473 { |
| 473 // If we're loading the main resource of a subframe, ensure that we check | 474 // If we're loading the main resource of a subframe, ensure that we check |
| 474 // against the parent of the active frame, rather than the frame itself. | 475 // against the parent of the active frame, rather than the frame itself. |
| 475 if (frameType != WebURLRequest::FrameTypeNested) | 476 if (frameType != WebURLRequest::FrameTypeNested) |
| 476 return frame; | 477 return frame; |
| 477 | 478 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 | 519 |
| 519 // See comment in shouldBlockFetch() about loading the main resource of a su
bframe. | 520 // See comment in shouldBlockFetch() about loading the main resource of a su
bframe. |
| 520 if (request.frameType() == WebURLRequest::FrameTypeNested && !SchemeRegistry
::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol())) { | 521 if (request.frameType() == WebURLRequest::FrameTypeNested && !SchemeRegistry
::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol())) { |
| 521 return ContextTypeOptionallyBlockable; | 522 return ContextTypeOptionallyBlockable; |
| 522 } | 523 } |
| 523 | 524 |
| 524 return contextTypeFromContext(request.requestContext(), mixedFrame); | 525 return contextTypeFromContext(request.requestContext(), mixedFrame); |
| 525 } | 526 } |
| 526 | 527 |
| 527 } // namespace blink | 528 } // namespace blink |
| OLD | NEW |