OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google, Inc. All rights reserved. | 2 * Copyright (C) 2011 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 * 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 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 if (name == "treat-as-public-address") | 1588 if (name == "treat-as-public-address") |
1589 return DirectiveType::TreatAsPublicAddress; | 1589 return DirectiveType::TreatAsPublicAddress; |
1590 if (name == "upgrade-insecure-requests") | 1590 if (name == "upgrade-insecure-requests") |
1591 return DirectiveType::UpgradeInsecureRequests; | 1591 return DirectiveType::UpgradeInsecureRequests; |
1592 if (name == "worker-src") | 1592 if (name == "worker-src") |
1593 return DirectiveType::WorkerSrc; | 1593 return DirectiveType::WorkerSrc; |
1594 | 1594 |
1595 return DirectiveType::Undefined; | 1595 return DirectiveType::Undefined; |
1596 } | 1596 } |
1597 | 1597 |
1598 bool ContentSecurityPolicy::subsumes(const ContentSecurityPolicy& other) { | 1598 bool ContentSecurityPolicy::subsumes(const ContentSecurityPolicy& other) const { |
1599 if (!m_policies.size() || !other.m_policies.size()) | 1599 if (!m_policies.size() || !other.m_policies.size()) |
1600 return !m_policies.size(); | 1600 return !m_policies.size(); |
1601 // Embedding-CSP must specify only one policy. | 1601 // Embedding-CSP must specify only one policy. |
1602 if (m_policies.size() != 1) | 1602 if (m_policies.size() != 1) |
1603 return false; | 1603 return false; |
1604 | 1604 |
1605 CSPDirectiveListVector otherVector; | 1605 CSPDirectiveListVector otherVector; |
1606 for (const auto& policy : other.m_policies) { | 1606 for (const auto& policy : other.m_policies) { |
1607 if (!policy->isReportOnly()) | 1607 if (!policy->isReportOnly()) |
1608 otherVector.append(policy); | 1608 otherVector.append(policy); |
1609 } | 1609 } |
1610 | 1610 |
1611 return m_policies[0]->subsumes(otherVector); | 1611 return m_policies[0]->subsumes(otherVector); |
1612 } | 1612 } |
1613 | 1613 |
1614 } // namespace blink | 1614 } // namespace blink |
OLD | NEW |