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

Unified Diff: Source/WebCore/dom/Element.cpp

Issue 14297020: Merge 147281 "Cross-Origin copy&paste / drag&drop allowing XSS v..." (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/1453/
Patch Set: Created 7 years, 8 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/WebCore/dom/Element.h ('k') | Source/WebCore/html/HTMLFrameElementBase.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/dom/Element.cpp
===================================================================
--- Source/WebCore/dom/Element.cpp (revision 148876)
+++ Source/WebCore/dom/Element.cpp (working copy)
@@ -1039,29 +1039,18 @@
return attribute.name().namespaceURI().isNull() && attribute.name().localName().startsWith("on");
}
-bool Element::isJavaScriptURLAttribute(const Attribute& attribute)
+bool Element::isJavaScriptURLAttribute(const Attribute& attribute) const
{
- if (!isURLAttribute(attribute))
- return false;
- if (!protocolIsJavaScript(stripLeadingAndTrailingHTMLSpaces(attribute.value())))
- return false;
- return true;
+ return isURLAttribute(attribute) && protocolIsJavaScript(stripLeadingAndTrailingHTMLSpaces(attribute.value()));
}
-bool Element::isJavaScriptAttribute(const Attribute& attribute)
+void Element::stripScriptingAttributes(Vector<Attribute>& attributeVector) const
{
- if (isEventHandlerAttribute(attribute))
- return true;
- if (isJavaScriptURLAttribute(attribute))
- return true;
- return false;
-}
-
-void Element::stripJavaScriptAttributes(Vector<Attribute>& attributeVector)
-{
size_t destination = 0;
for (size_t source = 0; source < attributeVector.size(); ++source) {
- if (isJavaScriptAttribute(attributeVector[source]))
+ if (isEventHandlerAttribute(attributeVector[source])
+ || isJavaScriptURLAttribute(attributeVector[source])
+ || isHTMLContentAttribute(attributeVector[source]))
continue;
if (source != destination)
« no previous file with comments | « Source/WebCore/dom/Element.h ('k') | Source/WebCore/html/HTMLFrameElementBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698