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

Unified Diff: Source/core/html/HTMLMetaElement-in.cpp

Issue 132563006: CSP 1.1: <meta> delivery should be ignored outside <head>. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase. Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/frame/ContentSecurityPolicy.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLMetaElement-in.cpp
diff --git a/Source/core/html/HTMLMetaElement-in.cpp b/Source/core/html/HTMLMetaElement-in.cpp
index 00eb4dc73b691830815b16b12ebd112df2208617..f63a6f834ff1d3ca965cb4912eb1d4b076adc737 100644
--- a/Source/core/html/HTMLMetaElement-in.cpp
+++ b/Source/core/html/HTMLMetaElement-in.cpp
@@ -443,6 +443,18 @@ Node::InsertionNotificationRequest HTMLMetaElement::insertedInto(ContainerNode*
return InsertionDone;
}
+static bool inDocumentHead(HTMLMetaElement* element)
+{
+ if (!element->inDocument())
+ return false;
+
+ for (Element* current = element; current; current = current->parentElement()) {
+ if (current->hasTagName(HTMLNames::headTag))
+ return true;
+ }
+ return false;
+}
+
void HTMLMetaElement::process()
{
if (!inDocument())
@@ -468,9 +480,10 @@ void HTMLMetaElement::process()
// Get the document to process the tag, but only if we're actually part of DOM
// tree (changing a meta tag while it's not in the tree shouldn't have any effect
// on the document).
+
const AtomicString& httpEquivValue = fastGetAttribute(http_equivAttr);
if (!httpEquivValue.isEmpty())
- document().processHttpEquiv(httpEquivValue, contentValue);
+ document().processHttpEquiv(httpEquivValue, contentValue, inDocumentHead(this));
}
const AtomicString& HTMLMetaElement::content() const
« no previous file with comments | « Source/core/frame/ContentSecurityPolicy.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698