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

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

Issue 2433413003: Add metrics to measure localhost resources in non-secure contexts. (Closed)
Patch Set: Spelling. Created 4 years, 1 month 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
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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 LocalFrame* frame, 423 LocalFrame* frame,
424 const AtomicString& resourceIPAddress) { 424 const AtomicString& resourceIPAddress) {
425 if (!frame || !frame->document() || !frame->document()->loader()) 425 if (!frame || !frame->document() || !frame->document()->loader())
426 return; 426 return;
427 427
428 // Just count these for the moment, don't block them. 428 // Just count these for the moment, don't block them.
429 if (NetworkUtils::isReservedIPAddress(resourceIPAddress) && 429 if (NetworkUtils::isReservedIPAddress(resourceIPAddress) &&
430 frame->document()->addressSpace() == WebAddressSpacePublic) { 430 frame->document()->addressSpace() == WebAddressSpacePublic) {
431 UseCounter::count(frame->document(), 431 UseCounter::count(frame->document(),
432 UseCounter::MixedContentPrivateHostnameInPublicHostname); 432 UseCounter::MixedContentPrivateHostnameInPublicHostname);
433 // We can simplify the IP checks here, as we've already verified that
434 // |resourceIPAddress| is a reserved IP address, which means it's also a
435 // valid IP address in a normalized form.
436 if (resourceIPAddress.startsWith("127.0.0.") ||
437 resourceIPAddress == "[::1]") {
438 UseCounter::count(frame->document(),
439 frame->document()->isSecureContext()
440 ? UseCounter::LoopbackEmbeddedInSecureContext
441 : UseCounter::LoopbackEmbeddedInNonSecureContext);
442 }
433 } 443 }
434 } 444 }
435 445
436 Frame* MixedContentChecker::effectiveFrameForFrameType( 446 Frame* MixedContentChecker::effectiveFrameForFrameType(
437 LocalFrame* frame, 447 LocalFrame* frame,
438 WebURLRequest::FrameType frameType) { 448 WebURLRequest::FrameType frameType) {
439 // If we're loading the main resource of a subframe, ensure that we check 449 // If we're loading the main resource of a subframe, ensure that we check
440 // against the parent of the active frame, rather than the frame itself. 450 // against the parent of the active frame, rather than the frame itself.
441 if (frameType != WebURLRequest::FrameTypeNested) 451 if (frameType != WebURLRequest::FrameTypeNested)
442 return frame; 452 return frame;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 } 504 }
495 505
496 bool strictMixedContentCheckingForPlugin = 506 bool strictMixedContentCheckingForPlugin =
497 mixedFrame->settings() && 507 mixedFrame->settings() &&
498 mixedFrame->settings()->strictMixedContentCheckingForPlugin(); 508 mixedFrame->settings()->strictMixedContentCheckingForPlugin();
499 return WebMixedContent::contextTypeFromRequestContext( 509 return WebMixedContent::contextTypeFromRequestContext(
500 request.requestContext(), strictMixedContentCheckingForPlugin); 510 request.requestContext(), strictMixedContentCheckingForPlugin);
501 } 511 }
502 512
503 } // namespace blink 513 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698