OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2013 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 16 matching lines...) Expand all Loading... |
27 #include "config.h" | 27 #include "config.h" |
28 #include "core/dom/SandboxFlags.h" | 28 #include "core/dom/SandboxFlags.h" |
29 | 29 |
30 #include "core/html/parser/HTMLParserIdioms.h" | 30 #include "core/html/parser/HTMLParserIdioms.h" |
31 #include "wtf/text/StringBuilder.h" | 31 #include "wtf/text/StringBuilder.h" |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 SandboxFlags parseSandboxPolicy(const String& policy, String& invalidTokensError
Message) | 35 SandboxFlags parseSandboxPolicy(const String& policy, String& invalidTokensError
Message) |
36 { | 36 { |
37 const bool shouldFoldCase = false; | 37 SpaceSplitString policyTokens(AtomicString(policy), SpaceSplitString::Should
NotFoldCase); |
38 SpaceSplitString policyTokens(AtomicString(policy), shouldFoldCase); | |
39 return parseSandboxPolicy(policyTokens, invalidTokensErrorMessage); | 38 return parseSandboxPolicy(policyTokens, invalidTokensErrorMessage); |
40 } | 39 } |
41 | 40 |
42 SandboxFlags parseSandboxPolicy(const SpaceSplitString& policy, String& invalidT
okensErrorMessage) | 41 SandboxFlags parseSandboxPolicy(const SpaceSplitString& policy, String& invalidT
okensErrorMessage) |
43 { | 42 { |
44 // http://www.w3.org/TR/html5/the-iframe-element.html#attr-iframe-sandbox | 43 // http://www.w3.org/TR/html5/the-iframe-element.html#attr-iframe-sandbox |
45 // Parse the unordered set of unique space-separated tokens. | 44 // Parse the unordered set of unique space-separated tokens. |
46 SandboxFlags flags = SandboxAll; | 45 SandboxFlags flags = SandboxAll; |
47 unsigned length = policy.size(); | 46 unsigned length = policy.size(); |
48 unsigned numberOfTokenErrors = 0; | 47 unsigned numberOfTokenErrors = 0; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 tokenErrors.appendLiteral(" are invalid sandbox flags."); | 81 tokenErrors.appendLiteral(" are invalid sandbox flags."); |
83 else | 82 else |
84 tokenErrors.appendLiteral(" is an invalid sandbox flag."); | 83 tokenErrors.appendLiteral(" is an invalid sandbox flag."); |
85 invalidTokensErrorMessage = tokenErrors.toString(); | 84 invalidTokensErrorMessage = tokenErrors.toString(); |
86 } | 85 } |
87 | 86 |
88 return flags; | 87 return flags; |
89 } | 88 } |
90 | 89 |
91 } | 90 } |
OLD | NEW |