Commit 33cdf43a authored by mkwst@chromium.org's avatar mkwst@chromium.org

Add a new IGNORE_EXCEPTION helper to ignore ExceptionCodes when they are expected but uninteresting

https://bugs.webkit.org/show_bug.cgi?id=108771

Reviewed by Eric Seidel.

In cases where the ExceptionCode passed into a function is completely
ignored, this patch replaces it with a new IGNORE_EXCEPTION macro. This
makes our expectations about possible exceptions (or lack thereof)
explicit, rather than relying on implicit assumptions about whether a
variable is intentionally uninitialized or not. It also removes
knowledge about the internals of ExceptionCodes (that they're currently
ints, for instance) from code that shouldn't care, which will help with
future refactorings.

The implementation is entirely based upon ASSERT_NO_EXCEPTION, and
shouldn't have any visible effect on the web. As long as all the
current tests pass, we're good.

* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::dispatchEvent):
(WebCore::IDBRequest::uncaughtExceptionInEventHandler):
* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::stop):
* Modules/websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::processBuffer):
* dom/Document.cpp:
(WebCore::Document::processHttpEquiv):
* dom/ExceptionCodePlaceholder.h:
(WebCore):
* dom/Node.cpp:
(WebCore::Node::normalize):
* dom/Text.cpp:
(WebCore::Text::replaceWholeText):
* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::insertDictatedText):
* editing/AppendNodeCommand.cpp:
(WebCore::AppendNodeCommand::doApply):
(WebCore::AppendNodeCommand::doUnapply):
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::insertNewDefaultParagraphElementAt):
* editing/DeleteFromTextNodeCommand.cpp:
(WebCore::DeleteFromTextNodeCommand::doUnapply):
* editing/Editor.cpp:
(WebCore::dispatchEditableContentChangedEvents):
(WebCore::Editor::applyEditingStyleToElement):
* editing/EditorCommand.cpp:
(WebCore::executeFormatBlock):
* editing/FormatBlockCommand.cpp:
(WebCore::FormatBlockCommand::elementForFormatBlockCommand):
* editing/InsertIntoTextNodeCommand.cpp:
(WebCore::InsertIntoTextNodeCommand::doApply):
(WebCore::InsertIntoTextNodeCommand::doUnapply):
* editing/InsertListCommand.cpp:
(WebCore::InsertListCommand::doApplyForSingleParagraph):
* editing/InsertNodeBeforeCommand.cpp:
(WebCore::InsertNodeBeforeCommand::doApply):
(WebCore::InsertNodeBeforeCommand::doUnapply):
* editing/RemoveCSSPropertyCommand.cpp:
(WebCore::RemoveCSSPropertyCommand::doApply):
(WebCore::RemoveCSSPropertyCommand::doUnapply):
* editing/RemoveNodeCommand.cpp:
(WebCore::RemoveNodeCommand::doApply):
(WebCore::RemoveNodeCommand::doUnapply):
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
* editing/TextIterator.cpp:
(WebCore::TextIterator::getLocationAndLengthFromRange):
* editing/WrapContentsInDummySpanCommand.cpp:
(WebCore::WrapContentsInDummySpanCommand::executeApply):
(WebCore::WrapContentsInDummySpanCommand::doUnapply):
* editing/htmlediting.cpp:
(WebCore::comparePositions):
* editing/markup.cpp:
(WebCore::highestAncestorToWrapMarkup):
* html/FTPDirectoryDocument.cpp:
(WebCore::FTPDirectoryDocumentParser::appendEntry):
(WebCore::FTPDirectoryDocumentParser::createTDForFilename):
(WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate):
(WebCore::FTPDirectoryDocumentParser::createBasicDocument):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::rewind):
(WebCore::HTMLMediaElement::returnToRealtime):
(WebCore::HTMLMediaElement::playInternal):
(WebCore::HTMLMediaElement::percentLoaded):
(WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
(WebCore::HTMLMediaElement::mediaPlayerDurationChanged):
(WebCore::HTMLMediaElement::applyMediaFragmentURI):
* html/HTMLOutputElement.cpp:
(WebCore::HTMLOutputElement::setTextContentInternal):
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::remove):
* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::createTHead):
(WebCore::HTMLTableElement::deleteTHead):
(WebCore::HTMLTableElement::createTFoot):
(WebCore::HTMLTableElement::deleteTFoot):
(WebCore::HTMLTableElement::createCaption):
(WebCore::HTMLTableElement::deleteCaption):
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::setDefaultValue):
* html/ImageDocument.cpp:
(WebCore::ImageDocument::createDocumentStructure):
* html/InputType.cpp:
(WebCore::InputType::stepUpFromRenderer):
* html/MediaController.cpp:
(MediaController::bringElementUpToSpeed):
(MediaController::asyncEventTimerFired):
* html/MediaDocument.cpp:
(WebCore::MediaDocumentParser::createDocumentStructure):
(WebCore::MediaDocument::replaceMediaElementTimerFired):
* html/PluginDocument.cpp:
(WebCore::PluginDocumentParser::createDocumentStructure):
* html/RangeInputType.cpp:
(WebCore::RangeInputType::handleKeydownEvent):
* html/TimeRanges.cpp:
(TimeRanges::contain):
(TimeRanges::nearest):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::drawImageFromRect):
* html/shadow/MediaControlElementTypes.cpp:
(WebCore::MediaControlSeekButtonElement::seekTimerFired):
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlPanelElement::setPosition):
(WebCore::MediaControlPanelElement::resetPosition):
(WebCore::MediaControlStatusDisplayElement::update):
(WebCore::MediaControlRewindButtonElement::defaultEventHandler):
(WebCore::MediaControlTimelineElement::defaultEventHandler):
* html/shadow/MediaControls.cpp:
(WebCore::MediaControls::updateCurrentTimeDisplay):
(WebCore::MediaControls::createTextTrackDisplay):
* html/shadow/MediaControlsApple.cpp:
(WebCore::MediaControlsApple::updateCurrentTimeDisplay):
* html/shadow/MediaControlsBlackBerry.cpp:
(WebCore::MediaControlEmbeddedPanelElement::setPosition):
(WebCore::MediaControlEmbeddedPanelElement::resetPosition):
(WebCore::MediaControlFullscreenTimelineElement::defaultEventHandler):
(WebCore::MediaControlsBlackBerry::updateCurrentTimeDisplay):
* html/shadow/MediaControlsChromium.cpp:
(WebCore::MediaControlsChromium::updateCurrentTimeDisplay):
* html/track/InbandTextTrack.cpp:
(WebCore::InbandTextTrack::addGenericCue):
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList):
* inspector/InspectorHistory.cpp:
(WebCore::InspectorHistory::markUndoableState):
* inspector/InspectorResourceAgent.cpp:
(WebCore::InspectorResourceAgent::replayXHR):
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected):
* page/DOMWindow.cpp:
(WebCore::didAddStorageEventListener):
* page/DragController.cpp:
(WebCore::documentFragmentFromDragData):
* page/EventHandler.cpp:
(WebCore::EventHandler::dispatchDragEvent):
(WebCore::EventHandler::keyEvent):
(WebCore::EventHandler::handleTextInputEvent):
* page/Page.cpp:
(WebCore::Page::findStringMatchingRanges):
* platform/efl/RenderThemeEfl.cpp:
(WebCore::RenderThemeEfl::paintMediaSliderTrack):
* platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
(WebCore::MediaPlayerPrivate::percentLoaded):
* platform/gtk/RenderThemeGtk.cpp:
(WebCore::RenderThemeGtk::paintMediaSliderTrack):
* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::getDataSelection):
(WebCore::documentFragmentWithImageResource):
(WebCore::Pasteboard::documentFragment):
* platform/mac/WebVideoFullscreenHUDWindowController.mm:
(-[WebVideoFullscreenHUDWindowController setCurrentTime:]):
(-[WebVideoFullscreenHUDWindowController setVolume:]):
* platform/qt/RenderThemeQt.cpp:
(WebCore::RenderThemeQt::paintMediaSliderTrack):
* rendering/RenderNamedFlowThread.cpp:
(WebCore::RenderNamedFlowThread::getRanges):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintMediaSliderTrack):
* svg/SVGTRefElement.cpp:
(WebCore::SVGTRefElement::detachTarget):
* xml/XMLTreeViewer.cpp:
(WebCore::XMLTreeViewer::transformDocumentToTreeView):
* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLDocumentParser::endElementNs):
* xml/parser/XMLDocumentParserQt.cpp:
(WebCore::XMLDocumentParser::parseEndElement):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@142271 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 11b6ae6f
2013-02-08 Mike West <mkwst@chromium.org>
Add a new IGNORE_EXCEPTION helper to ignore ExceptionCodes when they are expected but uninteresting
https://bugs.webkit.org/show_bug.cgi?id=108771
Reviewed by Eric Seidel.
In cases where the ExceptionCode passed into a function is completely
ignored, this patch replaces it with a new IGNORE_EXCEPTION macro. This
makes our expectations about possible exceptions (or lack thereof)
explicit, rather than relying on implicit assumptions about whether a
variable is intentionally uninitialized or not. It also removes
knowledge about the internals of ExceptionCodes (that they're currently
ints, for instance) from code that shouldn't care, which will help with
future refactorings.
The implementation is entirely based upon ASSERT_NO_EXCEPTION, and
shouldn't have any visible effect on the web. As long as all the
current tests pass, we're good.
* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::dispatchEvent):
(WebCore::IDBRequest::uncaughtExceptionInEventHandler):
* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::stop):
* Modules/websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::processBuffer):
* dom/Document.cpp:
(WebCore::Document::processHttpEquiv):
* dom/ExceptionCodePlaceholder.h:
(WebCore):
* dom/Node.cpp:
(WebCore::Node::normalize):
* dom/Text.cpp:
(WebCore::Text::replaceWholeText):
* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::insertDictatedText):
* editing/AppendNodeCommand.cpp:
(WebCore::AppendNodeCommand::doApply):
(WebCore::AppendNodeCommand::doUnapply):
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::insertNewDefaultParagraphElementAt):
* editing/DeleteFromTextNodeCommand.cpp:
(WebCore::DeleteFromTextNodeCommand::doUnapply):
* editing/Editor.cpp:
(WebCore::dispatchEditableContentChangedEvents):
(WebCore::Editor::applyEditingStyleToElement):
* editing/EditorCommand.cpp:
(WebCore::executeFormatBlock):
* editing/FormatBlockCommand.cpp:
(WebCore::FormatBlockCommand::elementForFormatBlockCommand):
* editing/InsertIntoTextNodeCommand.cpp:
(WebCore::InsertIntoTextNodeCommand::doApply):
(WebCore::InsertIntoTextNodeCommand::doUnapply):
* editing/InsertListCommand.cpp:
(WebCore::InsertListCommand::doApplyForSingleParagraph):
* editing/InsertNodeBeforeCommand.cpp:
(WebCore::InsertNodeBeforeCommand::doApply):
(WebCore::InsertNodeBeforeCommand::doUnapply):
* editing/RemoveCSSPropertyCommand.cpp:
(WebCore::RemoveCSSPropertyCommand::doApply):
(WebCore::RemoveCSSPropertyCommand::doUnapply):
* editing/RemoveNodeCommand.cpp:
(WebCore::RemoveNodeCommand::doApply):
(WebCore::RemoveNodeCommand::doUnapply):
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
* editing/TextIterator.cpp:
(WebCore::TextIterator::getLocationAndLengthFromRange):
* editing/WrapContentsInDummySpanCommand.cpp:
(WebCore::WrapContentsInDummySpanCommand::executeApply):
(WebCore::WrapContentsInDummySpanCommand::doUnapply):
* editing/htmlediting.cpp:
(WebCore::comparePositions):
* editing/markup.cpp:
(WebCore::highestAncestorToWrapMarkup):
* html/FTPDirectoryDocument.cpp:
(WebCore::FTPDirectoryDocumentParser::appendEntry):
(WebCore::FTPDirectoryDocumentParser::createTDForFilename):
(WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate):
(WebCore::FTPDirectoryDocumentParser::createBasicDocument):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::rewind):
(WebCore::HTMLMediaElement::returnToRealtime):
(WebCore::HTMLMediaElement::playInternal):
(WebCore::HTMLMediaElement::percentLoaded):
(WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
(WebCore::HTMLMediaElement::mediaPlayerDurationChanged):
(WebCore::HTMLMediaElement::applyMediaFragmentURI):
* html/HTMLOutputElement.cpp:
(WebCore::HTMLOutputElement::setTextContentInternal):
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::remove):
* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::createTHead):
(WebCore::HTMLTableElement::deleteTHead):
(WebCore::HTMLTableElement::createTFoot):
(WebCore::HTMLTableElement::deleteTFoot):
(WebCore::HTMLTableElement::createCaption):
(WebCore::HTMLTableElement::deleteCaption):
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::setDefaultValue):
* html/ImageDocument.cpp:
(WebCore::ImageDocument::createDocumentStructure):
* html/InputType.cpp:
(WebCore::InputType::stepUpFromRenderer):
* html/MediaController.cpp:
(MediaController::bringElementUpToSpeed):
(MediaController::asyncEventTimerFired):
* html/MediaDocument.cpp:
(WebCore::MediaDocumentParser::createDocumentStructure):
(WebCore::MediaDocument::replaceMediaElementTimerFired):
* html/PluginDocument.cpp:
(WebCore::PluginDocumentParser::createDocumentStructure):
* html/RangeInputType.cpp:
(WebCore::RangeInputType::handleKeydownEvent):
* html/TimeRanges.cpp:
(TimeRanges::contain):
(TimeRanges::nearest):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::drawImageFromRect):
* html/shadow/MediaControlElementTypes.cpp:
(WebCore::MediaControlSeekButtonElement::seekTimerFired):
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlPanelElement::setPosition):
(WebCore::MediaControlPanelElement::resetPosition):
(WebCore::MediaControlStatusDisplayElement::update):
(WebCore::MediaControlRewindButtonElement::defaultEventHandler):
(WebCore::MediaControlTimelineElement::defaultEventHandler):
* html/shadow/MediaControls.cpp:
(WebCore::MediaControls::updateCurrentTimeDisplay):
(WebCore::MediaControls::createTextTrackDisplay):
* html/shadow/MediaControlsApple.cpp:
(WebCore::MediaControlsApple::updateCurrentTimeDisplay):
* html/shadow/MediaControlsBlackBerry.cpp:
(WebCore::MediaControlEmbeddedPanelElement::setPosition):
(WebCore::MediaControlEmbeddedPanelElement::resetPosition):
(WebCore::MediaControlFullscreenTimelineElement::defaultEventHandler):
(WebCore::MediaControlsBlackBerry::updateCurrentTimeDisplay):
* html/shadow/MediaControlsChromium.cpp:
(WebCore::MediaControlsChromium::updateCurrentTimeDisplay):
* html/track/InbandTextTrack.cpp:
(WebCore::InbandTextTrack::addGenericCue):
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList):
* inspector/InspectorHistory.cpp:
(WebCore::InspectorHistory::markUndoableState):
* inspector/InspectorResourceAgent.cpp:
(WebCore::InspectorResourceAgent::replayXHR):
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected):
* page/DOMWindow.cpp:
(WebCore::didAddStorageEventListener):
* page/DragController.cpp:
(WebCore::documentFragmentFromDragData):
* page/EventHandler.cpp:
(WebCore::EventHandler::dispatchDragEvent):
(WebCore::EventHandler::keyEvent):
(WebCore::EventHandler::handleTextInputEvent):
* page/Page.cpp:
(WebCore::Page::findStringMatchingRanges):
* platform/efl/RenderThemeEfl.cpp:
(WebCore::RenderThemeEfl::paintMediaSliderTrack):
* platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
(WebCore::MediaPlayerPrivate::percentLoaded):
* platform/gtk/RenderThemeGtk.cpp:
(WebCore::RenderThemeGtk::paintMediaSliderTrack):
* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::getDataSelection):
(WebCore::documentFragmentWithImageResource):
(WebCore::Pasteboard::documentFragment):
* platform/mac/WebVideoFullscreenHUDWindowController.mm:
(-[WebVideoFullscreenHUDWindowController setCurrentTime:]):
(-[WebVideoFullscreenHUDWindowController setVolume:]):
* platform/qt/RenderThemeQt.cpp:
(WebCore::RenderThemeQt::paintMediaSliderTrack):
* rendering/RenderNamedFlowThread.cpp:
(WebCore::RenderNamedFlowThread::getRanges):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintMediaSliderTrack):
* svg/SVGTRefElement.cpp:
(WebCore::SVGTRefElement::detachTarget):
* xml/XMLTreeViewer.cpp:
(WebCore::XMLTreeViewer::transformDocumentToTreeView):
* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLDocumentParser::endElementNs):
* xml/parser/XMLDocumentParserQt.cpp:
(WebCore::XMLDocumentParser::parseEndElement):
2013-02-08 Vsevolod Vlasov <vsevik@chromium.org>
Web Inspector: Introduce workspace provider/project type, encapsulate uri creation in SimpleWorkspaceProvider.
......@@ -35,6 +35,7 @@
#include "EventListener.h"
#include "EventNames.h"
#include "EventQueue.h"
#include "ExceptionCodePlaceholder.h"
#include "IDBBindingUtilities.h"
#include "IDBCursorWithValue.h"
#include "IDBDatabase.h"
......@@ -494,8 +495,7 @@ bool IDBRequest::dispatchEvent(PassRefPtr<Event> event)
// doesn't receive a second error) and before deactivating (which might trigger commit).
if (event->type() == eventNames().errorEvent && dontPreventDefault && !m_requestAborted) {
m_transaction->setError(m_error, m_errorMessage);
ExceptionCode unused;
m_transaction->abort(unused);
m_transaction->abort(IGNORE_EXCEPTION);
}
// If this was the last request in the transaction's list, it may commit here.
......@@ -516,8 +516,7 @@ void IDBRequest::uncaughtExceptionInEventHandler()
{
if (m_transaction && !m_requestAborted) {
m_transaction->setError(DOMError::create(IDBDatabaseException::getErrorName(IDBDatabaseException::AbortError)), "Uncaught exception in event handler.");
ExceptionCode unused;
m_transaction->abort(unused);
m_transaction->abort(IGNORE_EXCEPTION);
}
}
......
......@@ -30,6 +30,7 @@
#include "EventException.h"
#include "EventQueue.h"
#include "ExceptionCodePlaceholder.h"
#include "IDBDatabase.h"
#include "IDBDatabaseException.h"
#include "IDBEventDispatcher.h"
......@@ -423,8 +424,7 @@ void IDBTransaction::stop()
ActiveDOMObject::stop();
m_contextStopped = true;
ExceptionCode unused;
abort(unused);
abort(IGNORE_EXCEPTION);
}
void IDBTransaction::enqueueEvent(PassRefPtr<Event> event)
......
......@@ -37,6 +37,7 @@
#include "Blob.h"
#include "CookieJar.h"
#include "Document.h"
#include "ExceptionCodePlaceholder.h"
#include "FileError.h"
#include "FileReaderLoader.h"
#include "Frame.h"
......@@ -426,8 +427,8 @@ bool WebSocketChannel::processBuffer()
InspectorInstrumentation::didReceiveWebSocketHandshakeResponse(m_document, m_identifier, m_handshake->serverHandshakeResponse());
if (!m_handshake->serverSetCookie().isEmpty()) {
if (cookiesEnabled(m_document)) {
ExceptionCode ec; // Exception (for sandboxed documents) ignored.
m_document->setCookie(m_handshake->serverSetCookie(), ec);
// Exception (for sandboxed documents) ignored.
m_document->setCookie(m_handshake->serverSetCookie(), IGNORE_EXCEPTION);
}
}
// FIXME: handle set-cookie2.
......
......@@ -68,6 +68,7 @@
#include "EventListener.h"
#include "EventNames.h"
#include "ExceptionCode.h"
#include "ExceptionCodePlaceholder.h"
#include "FlowThreadController.h"
#include "FocusController.h"
#include "FormController.h"
......@@ -2846,8 +2847,8 @@ void Document::processHttpEquiv(const String& equiv, const String& content)
} else if (equalIgnoringCase(equiv, "set-cookie")) {
// FIXME: make setCookie work on XML documents too; e.g. in case of <html:meta .....>
if (isHTMLDocument()) {
ExceptionCode ec; // Exception (for sandboxed documents) ignored.
static_cast<HTMLDocument*>(this)->setCookie(content, ec);
// Exception (for sandboxed documents) ignored.
static_cast<HTMLDocument*>(this)->setCookie(content, IGNORE_EXCEPTION);
}
} else if (equalIgnoringCase(equiv, "content-language"))
setContentLanguage(content);
......
......@@ -58,6 +58,8 @@ inline ExceptionCodePlaceholder::ExceptionCodePlaceholder(ExceptionCode code)
class IgnorableExceptionCode : public ExceptionCodePlaceholder {
};
#define IGNORE_EXCEPTION ::WebCore::IgnorableExceptionCode()
#if ASSERT_DISABLED
#define ASSERT_NO_EXCEPTION ::WebCore::IgnorableExceptionCode()
......
......@@ -59,6 +59,7 @@
#include "EventListener.h"
#include "EventNames.h"
#include "ExceptionCode.h"
#include "ExceptionCodePlaceholder.h"
#include "FocusEvent.h"
#include "Frame.h"
#include "FrameView.h"
......@@ -609,8 +610,7 @@ void Node::normalize()
if (!text->length()) {
// Care must be taken to get the next node before removing the current node.
node = NodeTraversal::nextPostOrder(node.get());
ExceptionCode ec;
text->remove(ec);
text->remove(IGNORE_EXCEPTION);
continue;
}
......@@ -622,17 +622,15 @@ void Node::normalize()
// Remove empty text nodes.
if (!nextText->length()) {
ExceptionCode ec;
nextText->remove(ec);
nextText->remove(IGNORE_EXCEPTION);
continue;
}
// Both non-empty text nodes. Merge them.
unsigned offset = text->length();
ExceptionCode ec;
text->appendData(nextText->data(), ec);
text->appendData(nextText->data(), IGNORE_EXCEPTION);
document()->textNodesMerged(nextText.get(), offset);
nextText->remove(ec);
nextText->remove(IGNORE_EXCEPTION);
}
node = NodeTraversal::nextPostOrder(node.get());
......
......@@ -23,6 +23,7 @@
#include "Text.h"
#include "ExceptionCode.h"
#include "ExceptionCodePlaceholder.h"
#include "NodeRenderingContext.h"
#include "RenderCombineText.h"
#include "RenderText.h"
......@@ -156,11 +157,10 @@ PassRefPtr<Text> Text::replaceWholeText(const String& newText, ExceptionCode&)
RefPtr<Text> protectedThis(this); // Mutation event handlers could cause our last ref to go away
RefPtr<ContainerNode> parent = parentNode(); // Protect against mutation handlers moving this node during traversal
ExceptionCode ignored = 0;
for (RefPtr<Node> n = startText; n && n != this && n->isTextNode() && n->parentNode() == parent;) {
RefPtr<Node> nodeToRemove(n.release());
n = nodeToRemove->nextSibling();
parent->removeChild(nodeToRemove.get(), ignored);
parent->removeChild(nodeToRemove.get(), IGNORE_EXCEPTION);
}
if (this != endText) {
......@@ -168,17 +168,17 @@ PassRefPtr<Text> Text::replaceWholeText(const String& newText, ExceptionCode&)
for (RefPtr<Node> n = nextSibling(); n && n != onePastEndText && n->isTextNode() && n->parentNode() == parent;) {
RefPtr<Node> nodeToRemove(n.release());
n = nodeToRemove->nextSibling();
parent->removeChild(nodeToRemove.get(), ignored);
parent->removeChild(nodeToRemove.get(), IGNORE_EXCEPTION);
}
}
if (newText.isEmpty()) {
if (parent && parentNode() == parent)
parent->removeChild(this, ignored);
parent->removeChild(this, IGNORE_EXCEPTION);
return 0;
}
setData(newText, ignored);
setData(newText, IGNORE_EXCEPTION);
return protectedThis.release();
}
......
......@@ -33,6 +33,7 @@
#include "EditCommand.h"
#include "EditorClient.h"
#include "Event.h"
#include "ExceptionCodePlaceholder.h"
#include "FloatQuad.h"
#include "Frame.h"
#include "FrameView.h"
......@@ -707,8 +708,7 @@ bool AlternativeTextController::insertDictatedText(const String& text, const Vec
RefPtr<TextEvent> event = TextEvent::createForDictation(m_frame->document()->domWindow(), text, dictationAlternatives);
event->setUnderlyingEvent(triggeringEvent);
ExceptionCode ec;
target->dispatchEvent(event, ec);
target->dispatchEvent(event, IGNORE_EXCEPTION);
return event->defaultHandled();
}
......
......@@ -28,6 +28,7 @@
#include "AXObjectCache.h"
#include "Document.h"
#include "ExceptionCodePlaceholder.h"
#include "htmlediting.h"
namespace WebCore {
......@@ -58,9 +59,8 @@ void AppendNodeCommand::doApply()
{
if (!m_parent->rendererIsEditable() && m_parent->attached())
return;
ExceptionCode ec;
m_parent->appendChild(m_node.get(), ec, true /* lazyAttach */);
m_parent->appendChild(m_node.get(), IGNORE_EXCEPTION, true /* lazyAttach */);
if (AXObjectCache::accessibilityEnabled())
sendAXTextChangedIgnoringLineBreaks(m_node.get(), AXObjectCache::AXTextInserted);
......@@ -75,8 +75,7 @@ void AppendNodeCommand::doUnapply()
if (AXObjectCache::accessibilityEnabled())
sendAXTextChangedIgnoringLineBreaks(m_node.get(), AXObjectCache::AXTextDeleted);
ExceptionCode ec;
m_node->remove(ec);
m_node->remove(IGNORE_EXCEPTION);
}
#ifndef NDEBUG
......
......@@ -35,6 +35,7 @@
#include "DocumentFragment.h"
#include "DocumentMarkerController.h"
#include "EditorInsertAction.h"
#include "ExceptionCodePlaceholder.h"
#include "Frame.h"
#include "HTMLElement.h"
#include "HTMLNames.h"
......@@ -895,8 +896,7 @@ void CompositeEditCommand::removePlaceholderAt(const Position& p)
PassRefPtr<Node> CompositeEditCommand::insertNewDefaultParagraphElementAt(const Position& position)
{
RefPtr<Element> paragraphElement = createDefaultParagraphElement(document());
ExceptionCode ec;
paragraphElement->appendChild(createBreakElement(document()), ec);
paragraphElement->appendChild(createBreakElement(document()), IGNORE_EXCEPTION);
insertNodeAt(paragraphElement, position);
return paragraphElement.release();
}
......
......@@ -26,6 +26,7 @@
#include "config.h"
#include "DeleteFromTextNodeCommand.h"
#include "Document.h"
#include "ExceptionCodePlaceholder.h"
#include "AXObjectCache.h"
#include "Text.h"
......@@ -68,9 +69,8 @@ void DeleteFromTextNodeCommand::doUnapply()
if (!m_node->rendererIsEditable())
return;
ExceptionCode ec;
m_node->insertData(m_offset, m_text, ec);
m_node->insertData(m_offset, m_text, IGNORE_EXCEPTION);
if (AXObjectCache::accessibilityEnabled())
document()->axObjectCache()->nodeTextChangeNotification(m_node.get(), AXObjectCache::AXTextInserted, m_offset, m_text);
......
......@@ -46,6 +46,7 @@
#include "EditorClient.h"
#include "EventHandler.h"
#include "EventNames.h"
#include "ExceptionCodePlaceholder.h"
#include "FocusController.h"
#include "Frame.h"
#include "FrameTree.h"
......@@ -769,11 +770,10 @@ void Editor::outdent()
static void dispatchEditableContentChangedEvents(Element* startRoot, Element* endRoot)
{
ExceptionCode ec;
if (startRoot)
startRoot->dispatchEvent(Event::create(eventNames().webkitEditableContentChangedEvent, false, false), ec);
startRoot->dispatchEvent(Event::create(eventNames().webkitEditableContentChangedEvent, false, false), IGNORE_EXCEPTION);
if (endRoot && endRoot != startRoot)
endRoot->dispatchEvent(Event::create(eventNames().webkitEditableContentChangedEvent, false, false), ec);
endRoot->dispatchEvent(Event::create(eventNames().webkitEditableContentChangedEvent, false, false), IGNORE_EXCEPTION);
}
void Editor::appliedEditing(PassRefPtr<CompositeEditCommand> cmd)
......@@ -2680,10 +2680,9 @@ void Editor::applyEditingStyleToElement(Element* element) const
// Mutate using the CSSOM wrapper so we get the same event behavior as a script.
CSSStyleDeclaration* style = static_cast<StyledElement*>(element)->style();
ExceptionCode ec;
style->setPropertyInternal(CSSPropertyWordWrap, "break-word", false, ec);
style->setPropertyInternal(CSSPropertyWebkitNbspMode, "space", false, ec);
style->setPropertyInternal(CSSPropertyWebkitLineBreak, "after-white-space", false, ec);
style->setPropertyInternal(CSSPropertyWordWrap, "break-word", false, IGNORE_EXCEPTION);
style->setPropertyInternal(CSSPropertyWebkitNbspMode, "space", false, IGNORE_EXCEPTION);
style->setPropertyInternal(CSSPropertyWebkitLineBreak, "after-white-space", false, IGNORE_EXCEPTION);
}
// Searches from the beginning of the document if nothing is selected.
......
......@@ -38,6 +38,7 @@
#include "EditorClient.h"
#include "Event.h"
#include "EventHandler.h"
#include "ExceptionCodePlaceholder.h"
#include "FormatBlockCommand.h"
#include "Frame.h"
#include "FrameView.h"
......@@ -442,9 +443,8 @@ static bool executeFormatBlock(Frame* frame, Event*, EditorCommandSource, const
if (tagName[0] == '<' && tagName[tagName.length() - 1] == '>')
tagName = tagName.substring(1, tagName.length() - 2);
ExceptionCode ec;
String localName, prefix;
if (!Document::parseQualifiedName(tagName, prefix, localName, ec))
if (!Document::parseQualifiedName(tagName, prefix, localName, IGNORE_EXCEPTION))
return false;
QualifiedName qualifiedTagName(prefix, localName, xhtmlNamespaceURI);
......
......@@ -27,6 +27,7 @@
#include "Element.h"
#include "FormatBlockCommand.h"
#include "Document.h"
#include "ExceptionCodePlaceholder.h"
#include "htmlediting.h"
#include "HTMLElement.h"
#include "HTMLNames.h"
......@@ -100,8 +101,7 @@ Element* FormatBlockCommand::elementForFormatBlockCommand(Range* range)
if (!range)
return 0;
ExceptionCode ec;
Node* commonAncestor = range->commonAncestorContainer(ec);
Node* commonAncestor = range->commonAncestorContainer(IGNORE_EXCEPTION);
while (commonAncestor && !isElementForFormatBlock(commonAncestor))
commonAncestor = commonAncestor->parentNode();
......
......@@ -28,6 +28,7 @@
#include "AXObjectCache.h"
#include "Document.h"
#include "ExceptionCodePlaceholder.h"
#include "RenderText.h"
#include "Settings.h"
#include "Text.h"
......@@ -60,8 +61,7 @@ void InsertIntoTextNodeCommand::doApply()
renderText->momentarilyRevealLastTypedCharacter(m_offset + m_text.length() - 1);
}
ExceptionCode ec;
m_node->insertData(m_offset, m_text, ec);
m_node->insertData(m_offset, m_text, IGNORE_EXCEPTION);
if (AXObjectCache::accessibilityEnabled())
document()->axObjectCache()->nodeTextChangeNotification(m_node.get(), AXObjectCache::AXTextInserted, m_offset, m_text);
......@@ -76,8 +76,7 @@ void InsertIntoTextNodeCommand::doUnapply()
if (AXObjectCache::accessibilityEnabled())
document()->axObjectCache()->nodeTextChangeNotification(m_node.get(), AXObjectCache::AXTextDeleted, m_offset, m_text);
ExceptionCode ec;
m_node->deleteData(m_offset, m_text.length(), ec);
m_node->deleteData(m_offset, m_text.length(), IGNORE_EXCEPTION);
}
#ifndef NDEBUG
......
......@@ -27,6 +27,7 @@
#include "Element.h"
#include "InsertListCommand.h"
#include "DocumentFragment.h"
#include "ExceptionCodePlaceholder.h"
#include "htmlediting.h"
#include "HTMLElement.h"
#include "HTMLNames.h"
......@@ -232,11 +233,10 @@ void InsertListCommand::doApplyForSingleParagraph(bool forceCreateList, const Qu
// Restore the start and the end of current selection if they started inside listNode
// because moveParagraphWithClones could have removed them.
ExceptionCode ec;
if (rangeStartIsInList && newList)
currentSelection->setStart(newList, 0, ec);
currentSelection->setStart(newList, 0, IGNORE_EXCEPTION);
if (rangeEndIsInList && newList)
currentSelection->setEnd(newList, lastOffsetInNode(newList.get()), ec);
currentSelection->setEnd(newList, lastOffsetInNode(newList.get()), IGNORE_EXCEPTION);
setEndingSelection(VisiblePosition(firstPositionInNode(newList.get())));
......
......@@ -28,6 +28,7 @@
#include "AXObjectCache.h"
#include "Document.h"
#include "ExceptionCodePlaceholder.h"
#include "htmlediting.h"
namespace WebCore {
......@@ -54,8 +55,7 @@ void InsertNodeBeforeCommand::doApply()
return;
ASSERT(parent->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable));
ExceptionCode ec;
parent->insertBefore(m_insertChild.get(), m_refChild.get(), ec, true /* lazyAttach */);
parent->insertBefore(m_insertChild.get(), m_refChild.get(), IGNORE_EXCEPTION, true /* lazyAttach */);
if (AXObjectCache::accessibilityEnabled())
document()->axObjectCache()->nodeTextChangeNotification(m_insertChild.get(), AXObjectCache::AXTextInserted, 0, m_insertChild->nodeValue());
......@@ -70,8 +70,7 @@ void InsertNodeBeforeCommand::doUnapply()
if (AXObjectCache::accessibilityEnabled())
document()->axObjectCache()->nodeTextChangeNotification(m_insertChild.get(), AXObjectCache::AXTextDeleted, 0, m_insertChild->nodeValue());
ExceptionCode ec;
m_insertChild->remove(ec);
m_insertChild->remove(IGNORE_EXCEPTION);
}
#ifndef NDEBUG
......
......@@ -27,6 +27,7 @@
#include "RemoveCSSPropertyCommand.h"
#include "CSSStyleDeclaration.h"
#include "ExceptionCodePlaceholder.h"
#include "StylePropertySet.h"
#include <wtf/Assertions.h>
......@@ -48,15 +49,13 @@ void RemoveCSSPropertyCommand::doApply()
m_important = style->propertyIsImportant(m_property);
// Mutate using the CSSOM wrapper so we get the same event behavior as a script.
ExceptionCode ec;
// Setting to null string removes the property. We don't have internal version of removeProperty.
m_element->style()->setPropertyInternal(m_property, String(), false, ec);