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 #include "core/frame/SubresourceIntegrity.h" | 5 #include "core/frame/SubresourceIntegrity.h" |
6 | 6 |
7 #include "core/HTMLNames.h" | 7 #include "core/HTMLNames.h" |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
10 #include "core/dom/ExecutionContext.h" | 10 #include "core/dom/ExecutionContext.h" |
11 #include "core/frame/UseCounter.h" | 11 #include "core/frame/UseCounter.h" |
12 #include "core/inspector/ConsoleMessage.h" | 12 #include "core/inspector/ConsoleMessage.h" |
13 #include "platform/Crypto.h" | 13 #include "platform/Crypto.h" |
14 #include "platform/loader/fetch/Resource.h" | 14 #include "platform/loader/fetch/Resource.h" |
15 #include "platform/weborigin/KURL.h" | 15 #include "platform/weborigin/KURL.h" |
16 #include "platform/weborigin/SecurityOrigin.h" | 16 #include "platform/weborigin/SecurityOrigin.h" |
| 17 #include "platform/wtf/ASCIICType.h" |
| 18 #include "platform/wtf/Vector.h" |
| 19 #include "platform/wtf/dtoa/utils.h" |
| 20 #include "platform/wtf/text/Base64.h" |
| 21 #include "platform/wtf/text/ParsingUtilities.h" |
| 22 #include "platform/wtf/text/StringUTF8Adaptor.h" |
| 23 #include "platform/wtf/text/WTFString.h" |
17 #include "public/platform/WebCrypto.h" | 24 #include "public/platform/WebCrypto.h" |
18 #include "public/platform/WebCryptoAlgorithm.h" | 25 #include "public/platform/WebCryptoAlgorithm.h" |
19 #include "wtf/ASCIICType.h" | |
20 #include "wtf/Vector.h" | |
21 #include "wtf/dtoa/utils.h" | |
22 #include "wtf/text/Base64.h" | |
23 #include "wtf/text/ParsingUtilities.h" | |
24 #include "wtf/text/StringUTF8Adaptor.h" | |
25 #include "wtf/text/WTFString.h" | |
26 | 26 |
27 namespace blink { | 27 namespace blink { |
28 | 28 |
29 // FIXME: This should probably use common functions with ContentSecurityPolicy. | 29 // FIXME: This should probably use common functions with ContentSecurityPolicy. |
30 static bool IsIntegrityCharacter(UChar c) { | 30 static bool IsIntegrityCharacter(UChar c) { |
31 // Check if it's a base64 encoded value. We're pretty loose here, as there's | 31 // Check if it's a base64 encoded value. We're pretty loose here, as there's |
32 // not much risk in it, and it'll make it simpler for developers. | 32 // not much risk in it, and it'll make it simpler for developers. |
33 return IsASCIIAlphanumeric(c) || c == '_' || c == '-' || c == '+' || | 33 return IsASCIIAlphanumeric(c) || c == '_' || c == '-' || c == '+' || |
34 c == '/' || c == '='; | 34 c == '/' || c == '='; |
35 } | 35 } |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 metadata_set.insert(integrity_metadata.ToPair()); | 417 metadata_set.insert(integrity_metadata.ToPair()); |
418 } | 418 } |
419 | 419 |
420 if (metadata_set.size() == 0 && error) | 420 if (metadata_set.size() == 0 && error) |
421 return kIntegrityParseNoValidResult; | 421 return kIntegrityParseNoValidResult; |
422 | 422 |
423 return kIntegrityParseValidResult; | 423 return kIntegrityParseValidResult; |
424 } | 424 } |
425 | 425 |
426 } // namespace blink | 426 } // namespace blink |
OLD | NEW |