Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Side by Side Diff: Source/core/html/HTMLIFrameElement.cpp

Issue 1328183002: Implement referrerpolicy attr for iframes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update webexposed tests Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/html/HTMLIFrameElement.h ('k') | Source/core/html/HTMLIFrameElement.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 23 matching lines...) Expand all
34 #include "core/layout/LayoutIFrame.h" 34 #include "core/layout/LayoutIFrame.h"
35 35
36 namespace blink { 36 namespace blink {
37 37
38 using namespace HTMLNames; 38 using namespace HTMLNames;
39 39
40 inline HTMLIFrameElement::HTMLIFrameElement(Document& document) 40 inline HTMLIFrameElement::HTMLIFrameElement(Document& document)
41 : HTMLFrameElementBase(iframeTag, document) 41 : HTMLFrameElementBase(iframeTag, document)
42 , m_didLoadNonEmptyDocument(false) 42 , m_didLoadNonEmptyDocument(false)
43 , m_sandbox(DOMSettableTokenList::create(this)) 43 , m_sandbox(DOMSettableTokenList::create(this))
44 , m_referrerPolicy(ReferrerPolicyDefault)
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);
53 DOMSettableTokenListObserver::trace(visitor); 54 DOMSettableTokenListObserver::trace(visitor);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 ReferrerPolicy HTMLIFrameElement::referrerPolicyAttribute()
182 {
183 return m_referrerPolicy;
176 } 184 }
185 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLIFrameElement.h ('k') | Source/core/html/HTMLIFrameElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698