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

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

Issue 2126753003: `about:blank` is not mixed content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 return (frame && frame != frame->tree().top() && frameType != WebURLRequest: :FrameTypeNested); 82 return (frame && frame != frame->tree().top() && frameType != WebURLRequest: :FrameTypeNested);
83 } 83 }
84 84
85 // static 85 // static
86 bool MixedContentChecker::isMixedContent(SecurityOrigin* securityOrigin, const K URL& url) 86 bool MixedContentChecker::isMixedContent(SecurityOrigin* securityOrigin, const K URL& url)
87 { 87 {
88 if (!SchemeRegistry::shouldTreatURLSchemeAsRestrictingMixedContent(securityO rigin->protocol())) 88 if (!SchemeRegistry::shouldTreatURLSchemeAsRestrictingMixedContent(securityO rigin->protocol()))
89 return false; 89 return false;
90 90
91 // |url| is mixed content if its origin is not potentially trustworthy, and 91 // |url| is mixed content if its origin is not potentially trustworthy, and
92 // its protocol is not 'data'. 92 // its protocol is not 'data'. We do a quick check against `SecurityOrigin:: isSecure`
93 bool isAllowed = url.protocolIsData() || SecurityOrigin::create(url)->isPote ntiallyTrustworthy(); 93 // to catch things like `about:blank`, which cannot be sanely passed into
94 // `SecurityOrigin::create` (as their origin depends on their context).
95 bool isAllowed = url.protocolIsData() || SecurityOrigin::isSecure(url) || Se curityOrigin::create(url)->isPotentiallyTrustworthy();
94 // TODO(mkwst): Remove this once 'localhost' is no longer considered potenti ally trustworthy: 96 // TODO(mkwst): Remove this once 'localhost' is no longer considered potenti ally trustworthy:
95 if (isAllowed && url.protocolIs("http") && url.host() == "localhost") 97 if (isAllowed && url.protocolIs("http") && url.host() == "localhost")
96 isAllowed = false; 98 isAllowed = false;
97 return !isAllowed; 99 return !isAllowed;
98 } 100 }
99 101
100 // static 102 // static
101 Frame* MixedContentChecker::inWhichFrameIsContentMixed(Frame* frame, WebURLReque st::FrameType frameType, const KURL& url) 103 Frame* MixedContentChecker::inWhichFrameIsContentMixed(Frame* frame, WebURLReque st::FrameType frameType, const KURL& url)
102 { 104 {
103 // We only care about subresource loads; top-level navigations cannot be mix ed content. Neither can frameless requests. 105 // We only care about subresource loads; top-level navigations cannot be mix ed content. Neither can frameless requests.
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 // See comment in shouldBlockFetch() about loading the main resource of a su bframe. 392 // See comment in shouldBlockFetch() about loading the main resource of a su bframe.
391 if (request.frameType() == WebURLRequest::FrameTypeNested && !SchemeRegistry ::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol())) { 393 if (request.frameType() == WebURLRequest::FrameTypeNested && !SchemeRegistry ::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol())) {
392 return WebMixedContent::ContextType::OptionallyBlockable; 394 return WebMixedContent::ContextType::OptionallyBlockable;
393 } 395 }
394 396
395 bool strictMixedContentCheckingForPlugin = mixedFrame->settings() && mixedFr ame->settings()->strictMixedContentCheckingForPlugin(); 397 bool strictMixedContentCheckingForPlugin = mixedFrame->settings() && mixedFr ame->settings()->strictMixedContentCheckingForPlugin();
396 return WebMixedContent::contextTypeFromRequestContext(request.requestContext (), strictMixedContentCheckingForPlugin); 398 return WebMixedContent::contextTypeFromRequestContext(request.requestContext (), strictMixedContentCheckingForPlugin);
397 } 399 }
398 400
399 } // namespace blink 401 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698