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

Side by Side Diff: third_party/WebKit/Source/core/dom/Element.h

Issue 2531163004: Remove attributes that contain javascript from MHTML (Closed)
Patch Set: Created 4 years 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
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) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2003-2011, 2013, 2014 Apple Inc. All rights reserved. 6 * Copyright (C) 2003-2011, 2013, 2014 Apple Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 virtual void accessKeyAction(bool /*sendToAnyEvent*/) {} 469 virtual void accessKeyAction(bool /*sendToAnyEvent*/) {}
470 470
471 virtual bool isURLAttribute(const Attribute&) const { return false; } 471 virtual bool isURLAttribute(const Attribute&) const { return false; }
472 virtual bool isHTMLContentAttribute(const Attribute&) const { return false; } 472 virtual bool isHTMLContentAttribute(const Attribute&) const { return false; }
473 bool isJavaScriptURLAttribute(const Attribute&) const; 473 bool isJavaScriptURLAttribute(const Attribute&) const;
474 virtual bool isSVGAnimationAttributeSettingJavaScriptURL( 474 virtual bool isSVGAnimationAttributeSettingJavaScriptURL(
475 const Attribute&) const { 475 const Attribute&) const {
476 return false; 476 return false;
477 } 477 }
478 478
479 // Returns true is the given attribute is an event handler.
Łukasz Anforowicz 2016/11/29 18:59:55 typo: s/is/if/
jianli 2016/11/30 00:46:26 Done.
480 // We consider an event handler any attribute that begins with "on".
481 // It is a simple solution that has the advantage of not requiring any
482 // code or configuration change if a new event handler is defined.
483 static inline bool isEventHandlerAttribute(const Attribute& attribute) {
Łukasz Anforowicz 2016/11/29 18:59:55 Shouldn't this be a method of Attribute? (Law of
jianli 2016/11/30 00:46:26 Found out we have more cases to cover. Indeed the
484 return attribute.name().namespaceURI().isNull() &&
Łukasz Anforowicz 2016/11/29 18:59:55 Will this work when attributes are qualified with
jianli 2016/11/30 00:46:26 I am not an expert on this. Could tkent comment on
tkent 2016/11/30 08:10:17 All of HTML attributes have no namespace. An attr
485 attribute.name().localName().startsWith("on");
486 }
487
479 virtual bool isLiveLink() const { return false; } 488 virtual bool isLiveLink() const { return false; }
480 KURL hrefURL() const; 489 KURL hrefURL() const;
481 490
482 KURL getURLAttribute(const QualifiedName&) const; 491 KURL getURLAttribute(const QualifiedName&) const;
483 KURL getNonEmptyURLAttribute(const QualifiedName&) const; 492 KURL getNonEmptyURLAttribute(const QualifiedName&) const;
484 493
485 virtual const AtomicString imageSourceURL() const; 494 virtual const AtomicString imageSourceURL() const;
486 virtual Image* imageContents() { return nullptr; } 495 virtual Image* imageContents() { return nullptr; }
487 496
488 virtual void focus(const FocusParams& = FocusParams()); 497 virtual void focus(const FocusParams& = FocusParams());
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 #define DECLARE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ 1161 #define DECLARE_ELEMENT_FACTORY_WITH_TAGNAME(T) \
1153 static T* create(const QualifiedName&, Document&) 1162 static T* create(const QualifiedName&, Document&)
1154 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ 1163 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \
1155 T* T::create(const QualifiedName& tagName, Document& document) { \ 1164 T* T::create(const QualifiedName& tagName, Document& document) { \
1156 return new T(tagName, document); \ 1165 return new T(tagName, document); \
1157 } 1166 }
1158 1167
1159 } // namespace blink 1168 } // namespace blink
1160 1169
1161 #endif // Element_h 1170 #endif // Element_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | third_party/WebKit/Source/web/WebFrameSerializer.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698