| 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..6e5e9cb6c7d35b0564a1a130096fa6e26866d7d2 100644
|
| --- a/third_party/WebKit/Source/core/html/HTMLIFrameElementSandbox.cpp
|
| +++ b/third_party/WebKit/Source/core/html/HTMLIFrameElementSandbox.cpp
|
| @@ -4,39 +4,59 @@
|
|
|
| #include "core/html/HTMLIFrameElementSandbox.h"
|
|
|
| +#include "core/html/HTMLIFrameElement.h"
|
| +
|
| 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)
|
| {
|
| + for (const char* supportedToken : kSupportedTokens) {
|
| + if (token == supportedToken)
|
| + return true;
|
| + }
|
| + return false;
|
| }
|
|
|
| -HTMLIFrameElementSandbox::~HTMLIFrameElementSandbox()
|
| +} // namespace
|
| +
|
| +HTMLIFrameElementSandbox::HTMLIFrameElementSandbox(HTMLIFrameElement* element)
|
| + : DOMTokenList(this)
|
| + , m_element(element)
|
| {
|
| }
|
|
|
| -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;
|
| +DEFINE_TRACE(HTMLIFrameElementSandbox)
|
| +{
|
| + visitor->trace(m_element);
|
| + DOMTokenList::trace(visitor);
|
| + DOMTokenListObserver::trace(visitor);
|
| }
|
|
|
| bool HTMLIFrameElementSandbox::validateTokenValue(const AtomicString& tokenValue, ExceptionState&) const
|
| {
|
| - return supportedTokens().contains(tokenValue);
|
| + return isTokenSupported(tokenValue);
|
| +}
|
| +
|
| +void HTMLIFrameElementSandbox::valueWasSet()
|
| +{
|
| + m_element->sandboxValueWasSet();
|
| }
|
|
|
| } // namespace blink
|
|
|