Index: third_party/WebKit/Source/core/html/HTMLIFrameElementSandbox.cpp |
diff --git a/third_party/WebKit/Source/core/html/HTMLIFrameElementSandbox.cpp b/third_party/WebKit/Source/core/html/HTMLIFrameElementSandbox.cpp |
index 8a366af4c5f8544cd8ff28e3241a5478f06b2755..da3ca5a320138e6c7203ad221d2e108429bfc42d 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLIFrameElementSandbox.cpp |
+++ b/third_party/WebKit/Source/core/html/HTMLIFrameElementSandbox.cpp |
@@ -6,37 +6,42 @@ |
namespace blink { |
-HTMLIFrameElementSandbox::HTMLIFrameElementSandbox(DOMTokenListObserver* observer) |
- : DOMTokenList(observer) |
+namespace { |
+ |
+const char* kSupportedTokens[] = { |
+ "allow-forms", |
+ "allow-modals", |
+ "allow-pointer-lock", |
+ "allow-popups", |
+ "allow-popups-to-escape-sandbox", |
+ "allow-same-origin", |
+ "allow-scripts", |
+ "allow-top-navigation" |
+}; |
+ |
+bool IsTokenSupported(const AtomicString& token) |
tkent
2016/06/23 04:57:28
With the current Blink coding style, this should b
raymes
2016/06/27 08:09:50
Done.
|
{ |
+ for (const char* supportedToken : kSupportedTokens) { |
+ if (token == supportedToken) |
+ return true; |
+ } |
+ return false; |
} |
-HTMLIFrameElementSandbox::~HTMLIFrameElementSandbox() |
+} // namespace |
+ |
+HTMLIFrameElementSandbox::HTMLIFrameElementSandbox(DOMTokenListObserver* observer) |
+ : DOMTokenList(observer) |
{ |
} |
-using SandboxSupportedTokens = HashSet<AtomicString>; |
- |
-static SandboxSupportedTokens& supportedTokens() |
+HTMLIFrameElementSandbox::~HTMLIFrameElementSandbox() |
{ |
- DEFINE_STATIC_LOCAL(SandboxSupportedTokens, supportedValues, ()); |
- if (supportedValues.isEmpty()) { |
- supportedValues.add("allow-forms"); |
- supportedValues.add("allow-modals"); |
- supportedValues.add("allow-pointer-lock"); |
- supportedValues.add("allow-popups"); |
- supportedValues.add("allow-popups-to-escape-sandbox"); |
- supportedValues.add("allow-same-origin"); |
- supportedValues.add("allow-scripts"); |
- supportedValues.add("allow-top-navigation"); |
- } |
- |
- return supportedValues; |
} |
bool HTMLIFrameElementSandbox::validateTokenValue(const AtomicString& tokenValue, ExceptionState&) const |
{ |
- return supportedTokens().contains(tokenValue); |
+ return IsTokenSupported(tokenValue); |
} |
} // namespace blink |