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

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

Issue 1931063004: Stop blocking 'http://127.0.0.1/' as mixed content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 { 80 {
81 return (frame && frame != frame->tree().top() && frameType != WebURLRequest: :FrameTypeNested); 81 return (frame && frame != frame->tree().top() && frameType != WebURLRequest: :FrameTypeNested);
82 } 82 }
83 83
84 // static 84 // static
85 bool MixedContentChecker::isMixedContent(SecurityOrigin* securityOrigin, const K URL& url) 85 bool MixedContentChecker::isMixedContent(SecurityOrigin* securityOrigin, const K URL& url)
86 { 86 {
87 if (!SchemeRegistry::shouldTreatURLSchemeAsRestrictingMixedContent(securityO rigin->protocol())) 87 if (!SchemeRegistry::shouldTreatURLSchemeAsRestrictingMixedContent(securityO rigin->protocol()))
88 return false; 88 return false;
89 89
90 // We're in a secure context, so |url| is mixed content if it's insecure. 90 // |url| is mixed content if its origin is not potentially trustworthy, and
91 return !SecurityOrigin::isSecure(url); 91 // its protocol is not 'data'.
92 return !(SecurityOrigin::create(url)->isPotentiallyTrustworthy() || url.prot ocolIsData());
92 } 93 }
93 94
94 // static 95 // static
95 Frame* MixedContentChecker::inWhichFrameIsContentMixed(Frame* frame, WebURLReque st::FrameType frameType, const KURL& url) 96 Frame* MixedContentChecker::inWhichFrameIsContentMixed(Frame* frame, WebURLReque st::FrameType frameType, const KURL& url)
96 { 97 {
97 // We only care about subresource loads; top-level navigations cannot be mix ed content. Neither can frameless requests. 98 // We only care about subresource loads; top-level navigations cannot be mix ed content. Neither can frameless requests.
98 if (frameType == WebURLRequest::FrameTypeTopLevel || !frame) 99 if (frameType == WebURLRequest::FrameTypeTopLevel || !frame)
99 return nullptr; 100 return nullptr;
100 101
101 // Check the top frame first. 102 // Check the top frame first.
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 520
520 // See comment in shouldBlockFetch() about loading the main resource of a su bframe. 521 // See comment in shouldBlockFetch() about loading the main resource of a su bframe.
521 if (request.frameType() == WebURLRequest::FrameTypeNested && !SchemeRegistry ::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol())) { 522 if (request.frameType() == WebURLRequest::FrameTypeNested && !SchemeRegistry ::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol())) {
522 return ContextTypeOptionallyBlockable; 523 return ContextTypeOptionallyBlockable;
523 } 524 }
524 525
525 return contextTypeFromContext(request.requestContext(), mixedFrame); 526 return contextTypeFromContext(request.requestContext(), mixedFrame);
526 } 527 }
527 528
528 } // namespace blink 529 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698