Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Simon Hausmann (hausmann@kde.org) | 4 * (C) 2000 Simon Hausmann (hausmann@kde.org) |
| 5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 6 * Copyright (C) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved. |
| 7 * Copyright (C) 2009 Ericsson AB. All rights reserved. | 7 * Copyright (C) 2009 Ericsson AB. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 #include "config.h" | 25 #include "config.h" |
| 26 #include "core/html/HTMLIFrameElement.h" | 26 #include "core/html/HTMLIFrameElement.h" |
| 27 | 27 |
| 28 #include "bindings/core/v8/V8DOMActivityLogger.h" | 28 #include "bindings/core/v8/V8DOMActivityLogger.h" |
| 29 #include "core/CSSPropertyNames.h" | 29 #include "core/CSSPropertyNames.h" |
| 30 #include "core/HTMLNames.h" | 30 #include "core/HTMLNames.h" |
| 31 #include "core/frame/UseCounter.h" | 31 #include "core/frame/UseCounter.h" |
| 32 #include "core/html/HTMLDocument.h" | 32 #include "core/html/HTMLDocument.h" |
| 33 #include "core/inspector/ConsoleMessage.h" | 33 #include "core/inspector/ConsoleMessage.h" |
| 34 #include "core/layout/LayoutIFrame.h" | 34 #include "core/layout/LayoutIFrame.h" |
| 35 #include "platform/RuntimeEnabledFeatures.h" | |
| 35 | 36 |
| 36 namespace blink { | 37 namespace blink { |
| 37 | 38 |
| 38 using namespace HTMLNames; | 39 using namespace HTMLNames; |
| 39 | 40 |
| 40 inline HTMLIFrameElement::HTMLIFrameElement(Document& document) | 41 inline HTMLIFrameElement::HTMLIFrameElement(Document& document) |
| 41 : HTMLFrameElementBase(iframeTag, document) | 42 : HTMLFrameElementBase(iframeTag, document) |
| 42 , m_didLoadNonEmptyDocument(false) | 43 , m_didLoadNonEmptyDocument(false) |
|
Yoav Weiss
2015/09/08 09:55:08
m_referrerPolicy should be initialized regardless
| |
| 43 , m_sandbox(DOMSettableTokenList::create(this)) | 44 , m_sandbox(DOMSettableTokenList::create(this)) |
| 44 { | 45 { |
| 45 } | 46 } |
| 46 | 47 |
| 47 DEFINE_NODE_FACTORY(HTMLIFrameElement) | 48 DEFINE_NODE_FACTORY(HTMLIFrameElement) |
| 48 | 49 |
| 49 DEFINE_TRACE(HTMLIFrameElement) | 50 DEFINE_TRACE(HTMLIFrameElement) |
| 50 { | 51 { |
| 51 visitor->trace(m_sandbox); | 52 visitor->trace(m_sandbox); |
| 52 HTMLFrameElementBase::trace(visitor); | 53 HTMLFrameElementBase::trace(visitor); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 if (name == nameAttr) { | 114 if (name == nameAttr) { |
| 114 if (inDocument() && document().isHTMLDocument() && !isInShadowTree()) { | 115 if (inDocument() && document().isHTMLDocument() && !isInShadowTree()) { |
| 115 HTMLDocument& document = toHTMLDocument(this->document()); | 116 HTMLDocument& document = toHTMLDocument(this->document()); |
| 116 document.removeExtraNamedItem(m_name); | 117 document.removeExtraNamedItem(m_name); |
| 117 document.addExtraNamedItem(value); | 118 document.addExtraNamedItem(value); |
| 118 } | 119 } |
| 119 m_name = value; | 120 m_name = value; |
| 120 } else if (name == sandboxAttr) { | 121 } else if (name == sandboxAttr) { |
| 121 m_sandbox->setValue(value); | 122 m_sandbox->setValue(value); |
| 122 UseCounter::count(document(), UseCounter::SandboxViaIFrame); | 123 UseCounter::count(document(), UseCounter::SandboxViaIFrame); |
| 124 } else if (RuntimeEnabledFeatures::referrerPolicyAttributeEnabled() && name == referrerpolicyAttr) { | |
| 125 m_referrerPolicy = ReferrerPolicyDefault; | |
| 126 if (!value.isNull()) | |
| 127 SecurityPolicy::referrerPolicyFromString(value, &m_referrerPolicy); | |
| 123 } else { | 128 } else { |
| 124 HTMLFrameElementBase::parseAttribute(name, value); | 129 HTMLFrameElementBase::parseAttribute(name, value); |
| 125 } | 130 } |
| 126 } | 131 } |
| 127 | 132 |
| 128 bool HTMLIFrameElement::layoutObjectIsNeeded(const ComputedStyle& style) | 133 bool HTMLIFrameElement::layoutObjectIsNeeded(const ComputedStyle& style) |
| 129 { | 134 { |
| 130 return isURLAllowed() && HTMLElement::layoutObjectIsNeeded(style); | 135 return isURLAllowed() && HTMLElement::layoutObjectIsNeeded(style); |
| 131 } | 136 } |
| 132 | 137 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 | 171 |
| 167 void HTMLIFrameElement::valueChanged() | 172 void HTMLIFrameElement::valueChanged() |
| 168 { | 173 { |
| 169 String invalidTokens; | 174 String invalidTokens; |
| 170 setSandboxFlags(m_sandbox->value().isNull() ? SandboxNone : parseSandboxPoli cy(m_sandbox->tokens(), invalidTokens)); | 175 setSandboxFlags(m_sandbox->value().isNull() ? SandboxNone : parseSandboxPoli cy(m_sandbox->tokens(), invalidTokens)); |
| 171 if (!invalidTokens.isNull()) | 176 if (!invalidTokens.isNull()) |
| 172 document().addConsoleMessage(ConsoleMessage::create(OtherMessageSource, ErrorMessageLevel, "Error while parsing the 'sandbox' attribute: " + invalidToke ns)); | 177 document().addConsoleMessage(ConsoleMessage::create(OtherMessageSource, ErrorMessageLevel, "Error while parsing the 'sandbox' attribute: " + invalidToke ns)); |
| 173 setSynchronizedLazyAttribute(sandboxAttr, m_sandbox->value()); | 178 setSynchronizedLazyAttribute(sandboxAttr, m_sandbox->value()); |
| 174 } | 179 } |
| 175 | 180 |
| 181 bool HTMLIFrameElement::referrerPolicyAttribute(ReferrerPolicy* policy) | |
|
Yoav Weiss
2015/09/08 09:55:08
Like I wrote at the caller site, it'd be better to
estark
2015/09/08 14:40:34
Done.
estark
2015/09/08 14:40:34
Done.
| |
| 182 { | |
| 183 if (!RuntimeEnabledFeatures::referrerPolicyAttributeEnabled()) | |
| 184 return false; | |
| 185 | |
| 186 *policy = m_referrerPolicy; | |
| 187 return true; | |
| 176 } | 188 } |
| 189 } | |
| OLD | NEW |