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

Side by Side Diff: third_party/WebKit/Source/platform/weborigin/SchemeRegistry.cpp

Issue 1383483007: Add scheme exceptions for isSecureContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Fixes Created 5 years, 2 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) 2010 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2010 Apple 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 return firstPartyWhenTopLevelSchemes; 196 return firstPartyWhenTopLevelSchemes;
197 } 197 }
198 198
199 static URLSchemesMap<SchemeRegistry::PolicyAreas>& ContentSecurityPolicyBypassin gSchemes() 199 static URLSchemesMap<SchemeRegistry::PolicyAreas>& ContentSecurityPolicyBypassin gSchemes()
200 { 200 {
201 assertLockHeld(); 201 assertLockHeld();
202 DEFINE_STATIC_LOCAL_NOASSERT(URLSchemesMap<SchemeRegistry::PolicyAreas>, sch emes, ()); 202 DEFINE_STATIC_LOCAL_NOASSERT(URLSchemesMap<SchemeRegistry::PolicyAreas>, sch emes, ());
203 return schemes; 203 return schemes;
204 } 204 }
205 205
206 static URLSchemesSet& secureContextBypassingSchemes()
207 {
208 assertLockHeld();
209 DEFINE_STATIC_LOCAL_NOASSERT(URLSchemesSet, secureContextBypassingSchemes, ( ));
210 return secureContextBypassingSchemes;
211 }
212
206 bool SchemeRegistry::shouldTreatURLSchemeAsLocal(const String& scheme) 213 bool SchemeRegistry::shouldTreatURLSchemeAsLocal(const String& scheme)
207 { 214 {
208 if (scheme.isEmpty()) 215 if (scheme.isEmpty())
209 return false; 216 return false;
210 MutexLocker locker(mutex()); 217 MutexLocker locker(mutex());
211 return localURLSchemes().contains(scheme); 218 return localURLSchemes().contains(scheme);
212 } 219 }
213 220
214 void SchemeRegistry::registerURLSchemeAsNoAccess(const String& scheme) 221 void SchemeRegistry::registerURLSchemeAsNoAccess(const String& scheme)
215 { 222 {
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 ASSERT(policyAreas != PolicyAreaNone); 425 ASSERT(policyAreas != PolicyAreaNone);
419 if (scheme.isEmpty() || policyAreas == PolicyAreaNone) 426 if (scheme.isEmpty() || policyAreas == PolicyAreaNone)
420 return false; 427 return false;
421 428
422 // get() returns 0 (PolicyAreaNone) if there is no entry in the map. 429 // get() returns 0 (PolicyAreaNone) if there is no entry in the map.
423 // Thus by default, schemes do not bypass CSP. 430 // Thus by default, schemes do not bypass CSP.
424 MutexLocker locker(mutex()); 431 MutexLocker locker(mutex());
425 return (ContentSecurityPolicyBypassingSchemes().get(scheme) & policyAreas) = = policyAreas; 432 return (ContentSecurityPolicyBypassingSchemes().get(scheme) & policyAreas) = = policyAreas;
426 } 433 }
427 434
435 void SchemeRegistry::registerURLSchemeBypassingSecureContextCheck(const String& scheme)
436 {
437 MutexLocker locker(mutex());
438 secureContextBypassingSchemes().add(scheme.lower());
439 }
440
441 bool SchemeRegistry::schemeShouldBypassSecureContextCheck(const String& scheme)
442 {
443 if (scheme.isEmpty())
444 return false;
445 MutexLocker locker(mutex());
446 return secureContextBypassingSchemes().contains(scheme.lower());
447 }
448
428 } // namespace blink 449 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698