OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 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 * | 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 return m_protocol == protocol || SecurityPolicy::isAccessToURLWhiteListe
d(this, url); | 349 return m_protocol == protocol || SecurityPolicy::isAccessToURLWhiteListe
d(this, url); |
350 | 350 |
351 if (SchemeRegistry::shouldTreatURLSchemeAsLocal(protocol)) | 351 if (SchemeRegistry::shouldTreatURLSchemeAsLocal(protocol)) |
352 return canLoadLocalResources() || SecurityPolicy::isAccessToURLWhiteList
ed(this, url); | 352 return canLoadLocalResources() || SecurityPolicy::isAccessToURLWhiteList
ed(this, url); |
353 | 353 |
354 return true; | 354 return true; |
355 } | 355 } |
356 | 356 |
357 bool SecurityOrigin::isPotentiallyTrustworthy(String& errorMessage) const | 357 bool SecurityOrigin::isPotentiallyTrustworthy(String& errorMessage) const |
358 { | 358 { |
| 359 if (isPotentiallyTrustworthy()) |
| 360 return true; |
| 361 |
| 362 errorMessage = "Only secure origins are allowed (see: https://goo.gl/Y0ZkNV)
."; |
| 363 return false; |
| 364 } |
| 365 |
| 366 bool SecurityOrigin::isPotentiallyTrustworthy() const |
| 367 { |
359 ASSERT(m_protocol != "data"); | 368 ASSERT(m_protocol != "data"); |
360 if (SchemeRegistry::shouldTreatURLSchemeAsSecure(m_protocol) || isLocal() ||
isLocalhost()) | 369 if (SchemeRegistry::shouldTreatURLSchemeAsSecure(m_protocol) || isLocal() ||
isLocalhost()) |
361 return true; | 370 return true; |
362 | 371 |
363 if (SecurityPolicy::isOriginWhiteListedTrustworthy(*this)) | 372 if (SecurityPolicy::isOriginWhiteListedTrustworthy(*this)) |
364 return true; | 373 return true; |
365 | 374 |
366 errorMessage = "Only secure origins are allowed (see: https://goo.gl/Y0ZkNV)
."; | |
367 return false; | 375 return false; |
368 } | 376 } |
369 | 377 |
370 void SecurityOrigin::grantLoadLocalResources() | 378 void SecurityOrigin::grantLoadLocalResources() |
371 { | 379 { |
372 // Granting privileges to some, but not all, documents in a SecurityOrigin | 380 // Granting privileges to some, but not all, documents in a SecurityOrigin |
373 // is a security hazard because the documents without the privilege can | 381 // is a security hazard because the documents without the privilege can |
374 // obtain the privilege by injecting script into the documents that have | 382 // obtain the privilege by injecting script into the documents that have |
375 // been granted the privilege. | 383 // been granted the privilege. |
376 m_canLoadLocalResources = true; | 384 m_canLoadLocalResources = true; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 } | 549 } |
542 | 550 |
543 void SecurityOrigin::transferPrivilegesFrom(PassOwnPtr<PrivilegeData> privilegeD
ata) | 551 void SecurityOrigin::transferPrivilegesFrom(PassOwnPtr<PrivilegeData> privilegeD
ata) |
544 { | 552 { |
545 m_universalAccess = privilegeData->m_universalAccess; | 553 m_universalAccess = privilegeData->m_universalAccess; |
546 m_canLoadLocalResources = privilegeData->m_canLoadLocalResources; | 554 m_canLoadLocalResources = privilegeData->m_canLoadLocalResources; |
547 m_blockLocalAccessFromLocalOrigin = privilegeData->m_blockLocalAccessFromLoc
alOrigin; | 555 m_blockLocalAccessFromLocalOrigin = privilegeData->m_blockLocalAccessFromLoc
alOrigin; |
548 } | 556 } |
549 | 557 |
550 } // namespace blink | 558 } // namespace blink |
OLD | NEW |