OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CSPSource_h | 5 #ifndef CSPSource_h |
6 #define CSPSource_h | 6 #define CSPSource_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/frame/csp/ContentSecurityPolicy.h" | 9 #include "core/frame/csp/ContentSecurityPolicy.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 bool matches(const KURL&, | 31 bool matches(const KURL&, |
32 ResourceRequest::RedirectStatus = | 32 ResourceRequest::RedirectStatus = |
33 ResourceRequest::RedirectStatus::NoRedirect) const; | 33 ResourceRequest::RedirectStatus::NoRedirect) const; |
34 | 34 |
35 // Returns true if this CSPSource subsumes the other, as defined by the | 35 // Returns true if this CSPSource subsumes the other, as defined by the |
36 // algorithm at https://w3c.github.io/webappsec-csp/embedded/#subsume-policy | 36 // algorithm at https://w3c.github.io/webappsec-csp/embedded/#subsume-policy |
37 bool subsumes(CSPSource*); | 37 bool subsumes(CSPSource*); |
38 // Retrieve the most restrictive information from the two CSPSources if | 38 // Retrieve the most restrictive information from the two CSPSources if |
39 // isSimilar is true for the two. Otherwise, return nullptr. | 39 // isSimilar is true for the two. Otherwise, return nullptr. |
40 CSPSource* intersect(CSPSource*); | 40 CSPSource* intersect(CSPSource*); |
| 41 // Returns true if the first list subsumes the second, as defined by the |
| 42 // algorithm at |
| 43 // https://w3c.github.io/webappsec-csp/embedded/#subsume-source-list |
| 44 static bool firstSubsumesSecond(HeapVector<Member<CSPSource>>, |
| 45 HeapVector<Member<CSPSource>>); |
41 | 46 |
42 DECLARE_TRACE(); | 47 DECLARE_TRACE(); |
43 | 48 |
44 private: | 49 private: |
45 FRIEND_TEST_ALL_PREFIXES(CSPSourceTest, IsSimilar); | 50 FRIEND_TEST_ALL_PREFIXES(CSPSourceTest, IsSimilar); |
46 FRIEND_TEST_ALL_PREFIXES(SourceListDirectiveTest, GetIntersectCSPSources); | 51 FRIEND_TEST_ALL_PREFIXES(SourceListDirectiveTest, GetIntersectCSPSources); |
47 | 52 |
48 bool schemeMatches(const String&) const; | 53 bool schemeMatches(const String&) const; |
49 bool hostMatches(const String&) const; | 54 bool hostMatches(const String&) const; |
50 bool pathMatches(const String&) const; | 55 bool pathMatches(const String&) const; |
51 // Protocol is necessary to determine default port if it is zero. | 56 // Protocol is necessary to determine default port if it is zero. |
52 bool portMatches(int port, const String& protocol) const; | 57 bool portMatches(int port, const String& protocol) const; |
53 bool isSchemeOnly() const; | 58 bool isSchemeOnly() const; |
54 bool isSimilar(CSPSource* other); | 59 bool isSimilar(CSPSource* other); |
55 | 60 |
56 Member<ContentSecurityPolicy> m_policy; | 61 Member<ContentSecurityPolicy> m_policy; |
57 String m_scheme; | 62 String m_scheme; |
58 String m_host; | 63 String m_host; |
59 int m_port; | 64 int m_port; |
60 String m_path; | 65 String m_path; |
61 | 66 |
62 WildcardDisposition m_hostWildcard; | 67 WildcardDisposition m_hostWildcard; |
63 WildcardDisposition m_portWildcard; | 68 WildcardDisposition m_portWildcard; |
64 }; | 69 }; |
65 | 70 |
66 } // namespace blink | 71 } // namespace blink |
67 | 72 |
68 #endif | 73 #endif |
OLD | NEW |