OLD | NEW |
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 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
(...skipping 4375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4386 document->updateLayoutTreeIfNeeded(); | 4386 document->updateLayoutTreeIfNeeded(); |
4387 return frame->editor().command(commandName, CommandFromDOM); | 4387 return frame->editor().command(commandName, CommandFromDOM); |
4388 } | 4388 } |
4389 | 4389 |
4390 bool Document::execCommand(const String& commandName, bool, const String& value,
ExceptionState& exceptionState) | 4390 bool Document::execCommand(const String& commandName, bool, const String& value,
ExceptionState& exceptionState) |
4391 { | 4391 { |
4392 if (!isHTMLDocument() && !isXHTMLDocument()) { | 4392 if (!isHTMLDocument() && !isXHTMLDocument()) { |
4393 exceptionState.throwDOMException(InvalidStateError, "execCommand is only
supported on HTML documents."); | 4393 exceptionState.throwDOMException(InvalidStateError, "execCommand is only
supported on HTML documents."); |
4394 return false; | 4394 return false; |
4395 } | 4395 } |
| 4396 if (focusedElement() && isHTMLTextFormControlElement(*focusedElement())) |
| 4397 UseCounter::count(*this, UseCounter::ExecCommandOnInputOrTextarea); |
4396 | 4398 |
4397 // We don't allow recursive |execCommand()| to protect against attack code. | 4399 // We don't allow recursive |execCommand()| to protect against attack code. |
4398 // Recursive call of |execCommand()| could be happened by moving iframe | 4400 // Recursive call of |execCommand()| could be happened by moving iframe |
4399 // with script triggered by insertion, e.g. <iframe src="javascript:..."> | 4401 // with script triggered by insertion, e.g. <iframe src="javascript:..."> |
4400 // <iframe onload="...">. This usage is valid as of the specification | 4402 // <iframe onload="...">. This usage is valid as of the specification |
4401 // although, it isn't common use case, rather it is used as attack code. | 4403 // although, it isn't common use case, rather it is used as attack code. |
4402 static bool inExecCommand = false; | 4404 static bool inExecCommand = false; |
4403 if (inExecCommand) { | 4405 if (inExecCommand) { |
4404 String message = "We don't execute document.execCommand() this time, bec
ause it is called recursively."; | 4406 String message = "We don't execute document.execCommand() this time, bec
ause it is called recursively."; |
4405 addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessage
Level, message)); | 4407 addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessage
Level, message)); |
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5906 #ifndef NDEBUG | 5908 #ifndef NDEBUG |
5907 using namespace blink; | 5909 using namespace blink; |
5908 void showLiveDocumentInstances() | 5910 void showLiveDocumentInstances() |
5909 { | 5911 { |
5910 Document::WeakDocumentSet& set = Document::liveDocumentSet(); | 5912 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
5911 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5913 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
5912 for (Document* document : set) | 5914 for (Document* document : set) |
5913 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5915 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
5914 } | 5916 } |
5915 #endif | 5917 #endif |
OLD | NEW |