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

Unified Diff: Source/core/dom/Document.cpp

Issue 1155353002: Throw DOMException when invoked Document::execCommand on non-{X,}HTML documents (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add test Created 5 years, 7 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
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 42bcc89466e3fed4f2b67f9947c25ad6623ec05b..8ab8ad07e2f97f2033d1b5add2bc0d162b1e4b7f 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -4249,6 +4249,9 @@ static Editor::Command command(Document* document, const String& commandName)
bool Document::execCommand(const String& commandName, bool, const String& value)
{
+ if (!isHTMLDocument() && !isXHTMLDocument())
+ return false;
+
// We don't allow recursive |execCommand()| to protect against attack code.
// Recursive call of |execCommand()| could be happened by moving iframe
// with script triggered by insertion, e.g. <iframe src="javascript:...">

Powered by Google App Engine
This is Rietveld 408576698