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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
359 | 359 |
360 if (SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated(protocol)) | 360 if (SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated(protocol)) |
361 return m_protocol == protocol || SecurityPolicy::isAccessToURLWhiteListe d(this, url); | 361 return m_protocol == protocol || SecurityPolicy::isAccessToURLWhiteListe d(this, url); |
362 | 362 |
363 if (SchemeRegistry::shouldTreatURLSchemeAsLocal(protocol)) | 363 if (SchemeRegistry::shouldTreatURLSchemeAsLocal(protocol)) |
364 return canLoadLocalResources() || SecurityPolicy::isAccessToURLWhiteList ed(this, url); | 364 return canLoadLocalResources() || SecurityPolicy::isAccessToURLWhiteList ed(this, url); |
365 | 365 |
366 return true; | 366 return true; |
367 } | 367 } |
368 | 368 |
369 bool SecurityOrigin::areSamePageUrls(const KURL& a, const KURL& b) const | |
370 { | |
371 if (m_universalAccess) | |
372 return true; | |
373 | |
374 if (isUnique()) | |
375 return false; | |
376 | |
377 if (!equalIgnoringPathQueryAndFragment(a, b)) | |
brettw
2015/12/08 05:41:32
Personally, I would prefer manually checking schem
robwu
2015/12/08 08:45:17
Checking for scheme/host/port equality is not suff
Mike West
2015/12/08 13:45:19
This is defined somewhat strangely in HTML as "If
robwu
2015/12/08 14:10:39
I presume that you're fine with exposing the value
Mike West
2015/12/08 14:18:41
I would dearly love to murder that property entire
| |
378 return false; | |
379 | |
380 RefPtr<SecurityOrigin> originA = SecurityOrigin::create(a); | |
381 if (originA->isUnique() || !isSameSchemeHostPort(originA.get())) | |
382 return false; | |
383 | |
384 RefPtr<SecurityOrigin> originB = SecurityOrigin::create(b); | |
385 if (originB->isUnique() || !isSameSchemeHostPort(originB.get())) | |
386 return false; | |
387 | |
388 return true; | |
389 } | |
390 | |
369 bool SecurityOrigin::isPotentiallyTrustworthy(String& errorMessage) const | 391 bool SecurityOrigin::isPotentiallyTrustworthy(String& errorMessage) const |
370 { | 392 { |
371 ASSERT(m_protocol != "data"); | 393 ASSERT(m_protocol != "data"); |
372 if (SchemeRegistry::shouldTreatURLSchemeAsSecure(m_protocol) || isLocal() || isLocalhost()) | 394 if (SchemeRegistry::shouldTreatURLSchemeAsSecure(m_protocol) || isLocal() || isLocalhost()) |
373 return true; | 395 return true; |
374 | 396 |
375 if (SecurityPolicy::isOriginWhiteListedTrustworthy(*this)) | 397 if (SecurityPolicy::isOriginWhiteListedTrustworthy(*this)) |
376 return true; | 398 return true; |
377 | 399 |
378 errorMessage = "Only secure origins are allowed (see: https://goo.gl/Y0ZkNV) ."; | 400 errorMessage = "Only secure origins are allowed (see: https://goo.gl/Y0ZkNV) ."; |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
553 } | 575 } |
554 | 576 |
555 void SecurityOrigin::transferPrivilegesFrom(PassOwnPtr<PrivilegeData> privilegeD ata) | 577 void SecurityOrigin::transferPrivilegesFrom(PassOwnPtr<PrivilegeData> privilegeD ata) |
556 { | 578 { |
557 m_universalAccess = privilegeData->m_universalAccess; | 579 m_universalAccess = privilegeData->m_universalAccess; |
558 m_canLoadLocalResources = privilegeData->m_canLoadLocalResources; | 580 m_canLoadLocalResources = privilegeData->m_canLoadLocalResources; |
559 m_blockLocalAccessFromLocalOrigin = privilegeData->m_blockLocalAccessFromLoc alOrigin; | 581 m_blockLocalAccessFromLocalOrigin = privilegeData->m_blockLocalAccessFromLoc alOrigin; |
560 } | 582 } |
561 | 583 |
562 } // namespace blink | 584 } // namespace blink |
OLD | NEW |