Commit d15dbe65 authored by mkwst@chromium.org's avatar mkwst@chromium.org

Use IGNORE_EXCEPTION for initialized, but unused, ExceptionCodes.

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

Reviewed by Darin Adler.

The monster patch in http://wkbug.com/108771 missed an entire class of
ignored exceptions. It only dealt with call sites that never initialized
the ExceptionCode variable, on the assumption that only such call sites
would ignore the variable's value.

That was a flawed assumption: a large number of sites that initialize the
ExceptionCode to 0 ignore it regardless. This patch deals with the
almost-as-large set of callsites that initialize the variable, pass it to
a function, and then never touch it again.

* Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::forceClose):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::ariaSelectedTextRange):
(WebCore::AccessibilityRenderObject::visiblePositionForIndex):
(WebCore::AccessibilityRenderObject::indexForVisiblePosition):
* accessibility/atk/WebKitAccessibleInterfaceText.cpp:
(getSelectionOffsetsForObject):
* accessibility/atk/WebKitAccessibleUtil.cpp:
(selectionBelongsToObject):
* dom/Node.cpp:
(WebCore::Node::textRects):
* editing/DeleteButtonController.cpp:
(WebCore::DeleteButtonController::hide):
* editing/EditingStyle.cpp:
(WebCore::EditingStyle::styleAtSelectionStart):
* editing/Editor.cpp:
(WebCore::Editor::canDeleteRange):
(WebCore::Editor::pasteAsPlainText):
(WebCore::Editor::pasteAsFragment):
(WebCore::Editor::shouldDeleteRange):
(WebCore::Editor::dispatchCPPEvent):
(WebCore::Editor::setComposition):
(WebCore::Editor::advanceToNextMisspelling):
(WebCore::isFrameInRange):
* editing/EditorCommand.cpp:
(WebCore::expandSelectionToGranularity):
* editing/MergeIdenticalElementsCommand.cpp:
(WebCore::MergeIdenticalElementsCommand::doApply):
* editing/SplitElementCommand.cpp:
(WebCore::SplitElementCommand::doUnapply):
* editing/SplitTextNodeCommand.cpp:
(WebCore::SplitTextNodeCommand::doApply):
* editing/TextCheckingHelper.cpp:
(WebCore::expandToParagraphBoundary):
(WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar):
(WebCore::TextCheckingHelper::isUngrammatical):
(WebCore::TextCheckingHelper::guessesForMisspelledOrUngrammaticalRange):
* editing/TextInsertionBaseCommand.cpp:
(WebCore::dispatchBeforeTextInsertedEvent):
(WebCore::canAppendNewLineFeedToSelection):
* editing/TextIterator.cpp:
(WebCore::findPlainText):
* editing/htmlediting.cpp:
(WebCore::extendRangeToWrappingNodes):
(WebCore::isNodeVisiblyContainedWithin):
* editing/visible_units.cpp:
(WebCore::nextBoundary):
* html/FileInputType.cpp:
(WebCore::FileInputType::createShadowSubtree):
* html/HTMLKeygenElement.cpp:
(WebCore::HTMLKeygenElement::HTMLKeygenElement):
* html/HTMLScriptElement.cpp:
(WebCore::HTMLScriptElement::setText):
* html/HTMLTitleElement.cpp:
(WebCore::HTMLTitleElement::setText):
* html/HTMLTrackElement.cpp:
(WebCore::HTMLTrackElement::didCompleteLoad):
* html/RangeInputType.cpp:
(WebCore::RangeInputType::createShadowSubtree):
* html/SearchInputType.cpp:
(WebCore::SearchInputType::createShadowSubtree):
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::createShadowSubtree):
* html/track/TextTrackList.cpp:
(TextTrackList::asyncEventTimerFired):
* inspector/DOMPatchSupport.cpp:
(WebCore::DOMPatchSupport::patchDocument):
* inspector/InspectorDatabaseAgent.cpp:
(WebCore):
* inspector/InspectorFileSystemAgent.cpp:
(WebCore):
* page/DOMSelection.cpp:
(WebCore::DOMSelection::addRange):
* page/DragController.cpp:
(WebCore::DragController::dispatchTextInputEventFor):
* page/EventHandler.cpp:
(WebCore::EventHandler::dispatchMouseEvent):
(WebCore::EventHandler::handleTouchEvent):
* page/FrameActionScheduler.cpp:
(WebCore::EventFrameAction::fire):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
* svg/SVGDocument.cpp:
(WebCore::SVGDocument::dispatchZoomEvent):
(WebCore::SVGDocument::dispatchScrollEvent):
* svg/SVGLength.cpp:
(WebCore::SVGLength::SVGLength):
(WebCore::SVGLength::value):
* xml/parser/XMLDocumentParser.cpp:
(WebCore::XMLDocumentParser::exitText):
* xml/parser/XMLDocumentParserQt.cpp:
(WebCore::XMLDocumentParser::parse):
(WebCore::XMLDocumentParser::startDocument):
(WebCore::XMLDocumentParser::parseCharacters):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@142375 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 5b19d6ed
2013-02-09 Mike West <mkwst@chromium.org>
Use IGNORE_EXCEPTION for initialized, but unused, ExceptionCodes.
https://bugs.webkit.org/show_bug.cgi?id=109295
Reviewed by Darin Adler.
The monster patch in http://wkbug.com/108771 missed an entire class of
ignored exceptions. It only dealt with call sites that never initialized
the ExceptionCode variable, on the assumption that only such call sites
would ignore the variable's value.
That was a flawed assumption: a large number of sites that initialize the
ExceptionCode to 0 ignore it regardless. This patch deals with the
almost-as-large set of callsites that initialize the variable, pass it to
a function, and then never touch it again.
* Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::forceClose):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::ariaSelectedTextRange):
(WebCore::AccessibilityRenderObject::visiblePositionForIndex):
(WebCore::AccessibilityRenderObject::indexForVisiblePosition):
* accessibility/atk/WebKitAccessibleInterfaceText.cpp:
(getSelectionOffsetsForObject):
* accessibility/atk/WebKitAccessibleUtil.cpp:
(selectionBelongsToObject):
* dom/Node.cpp:
(WebCore::Node::textRects):
* editing/DeleteButtonController.cpp:
(WebCore::DeleteButtonController::hide):
* editing/EditingStyle.cpp:
(WebCore::EditingStyle::styleAtSelectionStart):
* editing/Editor.cpp:
(WebCore::Editor::canDeleteRange):
(WebCore::Editor::pasteAsPlainText):
(WebCore::Editor::pasteAsFragment):
(WebCore::Editor::shouldDeleteRange):
(WebCore::Editor::dispatchCPPEvent):
(WebCore::Editor::setComposition):
(WebCore::Editor::advanceToNextMisspelling):
(WebCore::isFrameInRange):
* editing/EditorCommand.cpp:
(WebCore::expandSelectionToGranularity):
* editing/MergeIdenticalElementsCommand.cpp:
(WebCore::MergeIdenticalElementsCommand::doApply):
* editing/SplitElementCommand.cpp:
(WebCore::SplitElementCommand::doUnapply):
* editing/SplitTextNodeCommand.cpp:
(WebCore::SplitTextNodeCommand::doApply):
* editing/TextCheckingHelper.cpp:
(WebCore::expandToParagraphBoundary):
(WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar):
(WebCore::TextCheckingHelper::isUngrammatical):
(WebCore::TextCheckingHelper::guessesForMisspelledOrUngrammaticalRange):
* editing/TextInsertionBaseCommand.cpp:
(WebCore::dispatchBeforeTextInsertedEvent):
(WebCore::canAppendNewLineFeedToSelection):
* editing/TextIterator.cpp:
(WebCore::findPlainText):
* editing/htmlediting.cpp:
(WebCore::extendRangeToWrappingNodes):
(WebCore::isNodeVisiblyContainedWithin):
* editing/visible_units.cpp:
(WebCore::nextBoundary):
* html/FileInputType.cpp:
(WebCore::FileInputType::createShadowSubtree):
* html/HTMLKeygenElement.cpp:
(WebCore::HTMLKeygenElement::HTMLKeygenElement):
* html/HTMLScriptElement.cpp:
(WebCore::HTMLScriptElement::setText):
* html/HTMLTitleElement.cpp:
(WebCore::HTMLTitleElement::setText):
* html/HTMLTrackElement.cpp:
(WebCore::HTMLTrackElement::didCompleteLoad):
* html/RangeInputType.cpp:
(WebCore::RangeInputType::createShadowSubtree):
* html/SearchInputType.cpp:
(WebCore::SearchInputType::createShadowSubtree):
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::createShadowSubtree):
* html/track/TextTrackList.cpp:
(TextTrackList::asyncEventTimerFired):
* inspector/DOMPatchSupport.cpp:
(WebCore::DOMPatchSupport::patchDocument):
* inspector/InspectorDatabaseAgent.cpp:
(WebCore):
* inspector/InspectorFileSystemAgent.cpp:
(WebCore):
* page/DOMSelection.cpp:
(WebCore::DOMSelection::addRange):
* page/DragController.cpp:
(WebCore::DragController::dispatchTextInputEventFor):
* page/EventHandler.cpp:
(WebCore::EventHandler::dispatchMouseEvent):
(WebCore::EventHandler::handleTouchEvent):
* page/FrameActionScheduler.cpp:
(WebCore::EventFrameAction::fire):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
* svg/SVGDocument.cpp:
(WebCore::SVGDocument::dispatchZoomEvent):
(WebCore::SVGDocument::dispatchScrollEvent):
* svg/SVGLength.cpp:
(WebCore::SVGLength::SVGLength):
(WebCore::SVGLength::value):
* xml/parser/XMLDocumentParser.cpp:
(WebCore::XMLDocumentParser::exitText):
* xml/parser/XMLDocumentParserQt.cpp:
(WebCore::XMLDocumentParser::parse):
(WebCore::XMLDocumentParser::startDocument):
(WebCore::XMLDocumentParser::parseCharacters):
2013-02-09 Stephen White <senorblanco@chromium.org>
[skia] Fix memory management in SkiaImageFilterBuilder and friends.
......@@ -262,9 +262,8 @@ PassRefPtr<IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* cont
void IDBDatabase::forceClose()
{
ExceptionCode ec = 0;
for (TransactionMap::const_iterator::Values it = m_transactions.begin().values(), end = m_transactions.end().values(); it != end; ++it)
(*it)->abort(ec);
(*it)->abort(IGNORE_EXCEPTION);
this->close();
}
......
......@@ -1392,10 +1392,9 @@ PlainTextRange AccessibilityRenderObject::ariaSelectedTextRange() const
if (!node)
return PlainTextRange();
ExceptionCode ec = 0;
VisibleSelection visibleSelection = selection();
RefPtr<Range> currentSelectionRange = visibleSelection.toNormalizedRange();
if (!currentSelectionRange || !currentSelectionRange->intersectsNode(node, ec))
if (!currentSelectionRange || !currentSelectionRange->intersectsNode(node, IGNORE_EXCEPTION))
return PlainTextRange();
int start = indexForVisiblePosition(visibleSelection.start());
......@@ -1864,9 +1863,8 @@ VisiblePosition AccessibilityRenderObject::visiblePositionForIndex(int index) co
if (index <= 0)
return VisiblePosition(firstPositionInOrBeforeNode(node), DOWNSTREAM);
ExceptionCode ec = 0;
RefPtr<Range> range = Range::create(m_renderer->document());
range->selectNodeContents(node, ec);
range->selectNodeContents(node, IGNORE_EXCEPTION);
CharacterIterator it(range.get());
it.advance(index - 1);
return VisiblePosition(Position(it.range()->endContainer(), it.range()->endOffset(), Position::PositionIsOffsetInAnchor), UPSTREAM);
......@@ -1890,10 +1888,9 @@ int AccessibilityRenderObject::indexForVisiblePosition(const VisiblePosition& po
if (indexPosition.isNull() || highestEditableRoot(indexPosition, HasEditableAXRole) != node)
return 0;
ExceptionCode ec = 0;
RefPtr<Range> range = Range::create(m_renderer->document());
range->setStart(node, 0, ec);
range->setEnd(indexPosition, ec);
range->setStart(node, 0, IGNORE_EXCEPTION);
range->setEnd(indexPosition, IGNORE_EXCEPTION);
#if PLATFORM(GTK)
// We need to consider replaced elements for GTK, as they will be
......
......@@ -480,7 +480,6 @@ static void getSelectionOffsetsForObject(AccessibilityObject* coreObject, Visibl
// We need to find the exact start and end positions in the
// selected node that intersects the selection, to later on get
// the right values for the effective start and end offsets.
ExceptionCode ec = 0;
Position nodeRangeStart;
Position nodeRangeEnd;
Node* node = coreObject->node();
......@@ -491,7 +490,7 @@ static void getSelectionOffsetsForObject(AccessibilityObject* coreObject, Visibl
// nodeRangeStart to that position, otherwise to the selection's
// start position (it would belong to the node anyway).
Node* firstLeafNode = node->firstDescendant();
if (selRange->isPointInRange(firstLeafNode, 0, ec))
if (selRange->isPointInRange(firstLeafNode, 0, IGNORE_EXCEPTION))
nodeRangeStart = firstPositionInOrBeforeNode(firstLeafNode);
else
nodeRangeStart = selRange->startPosition();
......@@ -501,7 +500,7 @@ static void getSelectionOffsetsForObject(AccessibilityObject* coreObject, Visibl
// nodeRangeEnd to that position, otherwise to the selection's
// end position (it would belong to the node anyway).
Node* lastLeafNode = node->lastDescendant();
if (selRange->isPointInRange(lastLeafNode, lastOffsetInNode(lastLeafNode), ec))
if (selRange->isPointInRange(lastLeafNode, lastOffsetInNode(lastLeafNode), IGNORE_EXCEPTION))
nodeRangeEnd = lastPositionInOrAfterNode(lastLeafNode);
else
nodeRangeEnd = selRange->endPosition();
......
......@@ -164,8 +164,7 @@ bool selectionBelongsToObject(AccessibilityObject* coreObject, VisibleSelection&
// node is actually inside the region, at least partially.
Node* node = coreObject->node();
Node* lastDescendant = node->lastDescendant();
ExceptionCode ec = 0;
return (range->intersectsNode(node, ec)
return (range->intersectsNode(node, IGNORE_EXCEPTION)
&& (range->endContainer() != node || range->endOffset())
&& (range->startContainer() != lastDescendant || range->startOffset() != lastOffsetInNode(lastDescendant)));
}
......
......@@ -2617,8 +2617,7 @@ void Node::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
void Node::textRects(Vector<IntRect>& rects) const
{
RefPtr<Range> range = Range::create(document());
WebCore::ExceptionCode ec = 0;
range->selectNodeContents(const_cast<Node*>(this), ec);
range->selectNodeContents(const_cast<Node*>(this), IGNORE_EXCEPTION);
range->textRects(rects);
}
......
......@@ -320,9 +320,8 @@ void DeleteButtonController::hide()
m_outlineElement = 0;
m_buttonElement = 0;
ExceptionCode ec = 0;
if (m_containerElement && m_containerElement->parentNode())
m_containerElement->parentNode()->removeChild(m_containerElement.get(), ec);
m_containerElement->parentNode()->removeChild(m_containerElement.get(), IGNORE_EXCEPTION);
if (m_target) {
if (m_wasStaticPositioned)
......
......@@ -1223,8 +1223,7 @@ PassRefPtr<EditingStyle> EditingStyle::styleAtSelectionStart(const VisibleSelect
// and find the background color of the common ancestor.
if (shouldUseBackgroundColorInEffect && (selection.isRange() || hasTransparentBackgroundColor(style->m_mutableStyle.get()))) {
RefPtr<Range> range(selection.toNormalizedRange());
ExceptionCode ec = 0;
if (PassRefPtr<CSSValue> value = backgroundColorInEffect(range->commonAncestorContainer(ec)))
if (PassRefPtr<CSSValue> value = backgroundColorInEffect(range->commonAncestorContainer(IGNORE_EXCEPTION)))
style->setProperty(CSSPropertyBackgroundColor, value->cssText());
}
......
......@@ -263,8 +263,7 @@ bool Editor::canDeleteRange(Range* range) const
if (!startContainer->rendererIsEditable() || !endContainer->rendererIsEditable())
return false;
ExceptionCode ec;
if (range->collapsed(ec)) {
if (range->collapsed(IGNORE_EXCEPTION)) {
VisiblePosition start(range->startPosition(), DOWNSTREAM);
VisiblePosition previous = start.previous();
// FIXME: We sometimes allow deletions at the start of editable roots, like when the caret is in an empty list item.
......@@ -345,8 +344,7 @@ void Editor::pasteAsPlainText(const String& pastingText, bool smartReplace)
Node* target = findEventTargetFromSelection();
if (!target)
return;
ExceptionCode ec = 0;
target->dispatchEvent(TextEvent::createForPlainTextPaste(m_frame->document()->domWindow(), pastingText, smartReplace), ec);
target->dispatchEvent(TextEvent::createForPlainTextPaste(m_frame->document()->domWindow(), pastingText, smartReplace), IGNORE_EXCEPTION);
}
void Editor::pasteAsFragment(PassRefPtr<DocumentFragment> pastingFragment, bool smartReplace, bool matchStyle)
......@@ -354,8 +352,7 @@ void Editor::pasteAsFragment(PassRefPtr<DocumentFragment> pastingFragment, bool
Node* target = findEventTargetFromSelection();
if (!target)
return;
ExceptionCode ec = 0;
target->dispatchEvent(TextEvent::createForFragmentPaste(m_frame->document()->domWindow(), pastingFragment, smartReplace, matchStyle), ec);
target->dispatchEvent(TextEvent::createForFragmentPaste(m_frame->document()->domWindow(), pastingFragment, smartReplace, matchStyle), IGNORE_EXCEPTION);
}
void Editor::pasteAsPlainTextBypassingDHTML()
......@@ -439,8 +436,7 @@ PassRefPtr<Range> Editor::selectedRange()
bool Editor::shouldDeleteRange(Range* range) const
{
ExceptionCode ec;
if (!range || range->collapsed(ec))
if (!range || range->collapsed(IGNORE_EXCEPTION))
return false;
if (!canDeleteRange(range))
......@@ -650,9 +646,8 @@ bool Editor::dispatchCPPEvent(const AtomicString &eventType, ClipboardAccessPoli
RefPtr<Clipboard> clipboard = newGeneralClipboard(policy, m_frame);
ExceptionCode ec = 0;
RefPtr<Event> evt = ClipboardEvent::create(eventType, true, true, clipboard);
target->dispatchEvent(evt, ec);
target->dispatchEvent(evt, IGNORE_EXCEPTION);
bool noDefaultProcessing = evt->defaultPrevented();
if (noDefaultProcessing && policy == ClipboardWritable) {
Pasteboard* pasteboard = Pasteboard::generalPasteboard();
......@@ -1415,8 +1410,7 @@ void Editor::setComposition(const String& text, SetCompositionMode mode)
Node* target = m_frame->document()->focusedNode();
if (target) {
RefPtr<CompositionEvent> event = CompositionEvent::create(eventNames().compositionendEvent, m_frame->document()->domWindow(), text);
ExceptionCode ec = 0;
target->dispatchEvent(event, ec);
target->dispatchEvent(event, IGNORE_EXCEPTION);
}
// If text is empty, then delete the old composition here. If text is non-empty, InsertTextCommand::input
......@@ -1486,9 +1480,8 @@ void Editor::setComposition(const String& text, const Vector<CompositionUnderlin
else
event = CompositionEvent::create(eventNames().compositionendEvent, m_frame->document()->domWindow(), text);
}
ExceptionCode ec = 0;
if (event.get())
target->dispatchEvent(event, ec);
target->dispatchEvent(event, IGNORE_EXCEPTION);
}
// If text is empty, then delete the old composition here. If text is non-empty, InsertTextCommand::input
......@@ -1565,8 +1558,6 @@ void Editor::learnSpelling()
void Editor::advanceToNextMisspelling(bool startBeforeSelection)
{
ExceptionCode ec = 0;
// The basic approach is to search in two phases - from the selection end to the end of the doc, and
// then we wrap and search from the doc start to (approximately) where we started.
......@@ -1600,14 +1591,14 @@ void Editor::advanceToNextMisspelling(bool startBeforeSelection)
return;
Position rangeCompliantPosition = position.parentAnchoredEquivalent();
spellingSearchRange->setStart(rangeCompliantPosition.deprecatedNode(), rangeCompliantPosition.deprecatedEditingOffset(), ec);
spellingSearchRange->setStart(rangeCompliantPosition.deprecatedNode(), rangeCompliantPosition.deprecatedEditingOffset(), IGNORE_EXCEPTION);
startedWithSelection = false; // won't need to wrap
}
// topNode defines the whole range we want to operate on
Node* topNode = highestEditableRoot(position);
// FIXME: lastOffsetForEditing() is wrong here if editingIgnoresContent(highestEditableRoot()) returns true (e.g. a <table>)
spellingSearchRange->setEnd(topNode, lastOffsetForEditing(topNode), ec);
spellingSearchRange->setEnd(topNode, lastOffsetForEditing(topNode), IGNORE_EXCEPTION);
// If spellingSearchRange starts in the middle of a word, advance to the next word so we start checking
// at a word boundary. Going back by one char and then forward by a word does the trick.
......@@ -1618,7 +1609,7 @@ void Editor::advanceToNextMisspelling(bool startBeforeSelection)
// else we were already at the start of the editable node
}
if (spellingSearchRange->collapsed(ec))
if (spellingSearchRange->collapsed(IGNORE_EXCEPTION))
return; // nothing to search in
// Get the spell checker if it is available
......@@ -1643,7 +1634,7 @@ void Editor::advanceToNextMisspelling(bool startBeforeSelection)
String foundItem;
RefPtr<Range> firstMisspellingRange;
if (unifiedTextCheckerEnabled()) {
grammarSearchRange = spellingSearchRange->cloneRange(ec);
grammarSearchRange = spellingSearchRange->cloneRange(IGNORE_EXCEPTION);
foundItem = TextCheckingHelper(client(), spellingSearchRange).findFirstMisspellingOrBadGrammar(isGrammarCheckingEnabled(), isSpelling, foundOffset, grammarDetail);
if (isSpelling) {
misspelledWord = foundItem;
......@@ -1656,12 +1647,12 @@ void Editor::advanceToNextMisspelling(bool startBeforeSelection)
misspelledWord = TextCheckingHelper(client(), spellingSearchRange).findFirstMisspelling(misspellingOffset, false, firstMisspellingRange);
#if USE(GRAMMAR_CHECKING)
grammarSearchRange = spellingSearchRange->cloneRange(ec);
grammarSearchRange = spellingSearchRange->cloneRange(IGNORE_EXCEPTION);
if (!misspelledWord.isEmpty()) {
// Stop looking at start of next misspelled word
CharacterIterator chars(grammarSearchRange.get());
chars.advance(misspellingOffset);
grammarSearchRange->setEnd(chars.range()->startContainer(), chars.range()->startOffset(), ec);
grammarSearchRange->setEnd(chars.range()->startContainer(), chars.range()->startOffset(), IGNORE_EXCEPTION);
}
if (isGrammarCheckingEnabled())
......@@ -1672,12 +1663,12 @@ void Editor::advanceToNextMisspelling(bool startBeforeSelection)
// If we found neither bad grammar nor a misspelled word, wrap and try again (but don't bother if we started at the beginning of the
// block rather than at a selection).
if (startedWithSelection && !misspelledWord && !badGrammarPhrase) {
spellingSearchRange->setStart(topNode, 0, ec);
spellingSearchRange->setStart(topNode, 0, IGNORE_EXCEPTION);
// going until the end of the very first chunk we tested is far enough
spellingSearchRange->setEnd(searchEndNodeAfterWrap, searchEndOffsetAfterWrap, ec);
spellingSearchRange->setEnd(searchEndNodeAfterWrap, searchEndOffsetAfterWrap, IGNORE_EXCEPTION);
if (unifiedTextCheckerEnabled()) {
grammarSearchRange = spellingSearchRange->cloneRange(ec);
grammarSearchRange = spellingSearchRange->cloneRange(IGNORE_EXCEPTION);
foundItem = TextCheckingHelper(client(), spellingSearchRange).findFirstMisspellingOrBadGrammar(isGrammarCheckingEnabled(), isSpelling, foundOffset, grammarDetail);
if (isSpelling) {
misspelledWord = foundItem;
......@@ -1690,12 +1681,12 @@ void Editor::advanceToNextMisspelling(bool startBeforeSelection)
misspelledWord = TextCheckingHelper(client(), spellingSearchRange).findFirstMisspelling(misspellingOffset, false, firstMisspellingRange);
#if USE(GRAMMAR_CHECKING)
grammarSearchRange = spellingSearchRange->cloneRange(ec);
grammarSearchRange = spellingSearchRange->cloneRange(IGNORE_EXCEPTION);
if (!misspelledWord.isEmpty()) {
// Stop looking at start of next misspelled word
CharacterIterator chars(grammarSearchRange.get());
chars.advance(misspellingOffset);
grammarSearchRange->setEnd(chars.range()->startContainer(), chars.range()->startOffset(), ec);
grammarSearchRange->setEnd(chars.range()->startContainer(), chars.range()->startOffset(), IGNORE_EXCEPTION);
}
if (isGrammarCheckingEnabled())
......@@ -2794,8 +2785,7 @@ static bool isFrameInRange(Frame* frame, Range* range)
bool inRange = false;
for (HTMLFrameOwnerElement* ownerElement = frame->ownerElement(); ownerElement; ownerElement = ownerElement->document()->ownerElement()) {
if (ownerElement->document() == range->ownerDocument()) {
ExceptionCode ec = 0;
inRange = range->intersectsNode(ownerElement, ec);
inRange = range->intersectsNode(ownerElement, IGNORE_EXCEPTION);
break;
}
}
......
......@@ -214,8 +214,7 @@ static bool expandSelectionToGranularity(Frame* frame, TextGranularity granulari
RefPtr<Range> newRange = selection.toNormalizedRange();
if (!newRange)
return false;
ExceptionCode ec = 0;
if (newRange->collapsed(ec))
if (newRange->collapsed(IGNORE_EXCEPTION))
return false;
RefPtr<Range> oldRange = frame->selection()->selection().toNormalizedRange();
EAffinity affinity = frame->selection()->affinity();
......
......@@ -47,17 +47,15 @@ void MergeIdenticalElementsCommand::doApply()
m_atChild = m_element2->firstChild();
ExceptionCode ec = 0;
Vector<RefPtr<Node> > children;
for (Node* child = m_element1->firstChild(); child; child = child->nextSibling())
children.append(child);
size_t size = children.size();
for (size_t i = 0; i < size; ++i)
m_element2->insertBefore(children[i].release(), m_atChild.get(), ec);
m_element2->insertBefore(children[i].release(), m_atChild.get(), IGNORE_EXCEPTION);
m_element1->remove(ec);
m_element1->remove(IGNORE_EXCEPTION);
}
void MergeIdenticalElementsCommand::doUnapply()
......
......@@ -86,17 +86,15 @@ void SplitElementCommand::doUnapply()
RefPtr<Node> refChild = m_element2->firstChild();
ExceptionCode ec = 0;
size_t size = children.size();
for (size_t i = 0; i < size; ++i)
m_element2->insertBefore(children[i].get(), refChild.get(), ec);
m_element2->insertBefore(children[i].get(), refChild.get(), IGNORE_EXCEPTION);
// Recover the id attribute of the original element.
if (m_element1->hasAttribute(HTMLNames::idAttr))
m_element2->setAttribute(HTMLNames::idAttr, m_element1->getAttribute(HTMLNames::idAttr));
m_element1->remove(ec);
m_element1->remove(IGNORE_EXCEPTION);
}
void SplitElementCommand::doReapply()
......
......@@ -54,8 +54,7 @@ void SplitTextNodeCommand::doApply()
if (!parent || !parent->rendererIsEditable())
return;
ExceptionCode ec = 0;
String prefixText = m_text2->substringData(0, m_offset, ec);
String prefixText = m_text2->substringData(0, m_offset, IGNORE_EXCEPTION);
if (prefixText.isEmpty())
return;
......
......@@ -101,8 +101,7 @@ static void findMisspellings(TextCheckerClient* client, const UChar* text, int s
static PassRefPtr<Range> expandToParagraphBoundary(PassRefPtr<Range> range)
{
ExceptionCode ec = 0;
RefPtr<Range> paragraphRange = range->cloneRange(ec);
RefPtr<Range> paragraphRange = range->cloneRange(IGNORE_EXCEPTION);
setStart(paragraphRange.get(), startOfParagraph(range->startPosition()));
setEnd(paragraphRange.get(), endOfParagraph(range->endPosition()));
return paragraphRange;
......@@ -298,7 +297,6 @@ String TextCheckingHelper::findFirstMisspellingOrBadGrammar(bool checkGrammar, b
String firstFoundItem;
String misspelledWord;
String badGrammarPhrase;
ExceptionCode ec = 0;
// Initialize out parameters; these will be updated if we find something to return.
outIsSpelling = true;
......@@ -311,7 +309,7 @@ String TextCheckingHelper::findFirstMisspellingOrBadGrammar(bool checkGrammar, b
// Expand the search range to encompass entire paragraphs, since text checking needs that much context.
// Determine the character offset from the start of the paragraph to the start of the original search range,
// since we will want to ignore results in this area.
RefPtr<Range> paragraphRange = m_range->cloneRange(ec);
RefPtr<Range> paragraphRange = m_range->cloneRange(IGNORE_EXCEPTION);
setStart(paragraphRange.get(), startOfParagraph(m_range->startPosition()));
int totalRangeLength = TextIterator::rangeLength(paragraphRange.get());
setEnd(paragraphRange.get(), endOfParagraph(m_range->startPosition()));
......@@ -527,8 +525,7 @@ bool TextCheckingHelper::isUngrammatical(Vector<String>& guessesVector) const
if (!m_client)
return false;
ExceptionCode ec;
if (!m_range || m_range->collapsed(ec))
if (!m_range || m_range->collapsed(IGNORE_EXCEPTION))
return false;
// Returns true only if the passed range exactly corresponds to a bad grammar detail range. This is analogous
......@@ -573,11 +570,10 @@ Vector<String> TextCheckingHelper::guessesForMisspelledOrUngrammaticalRange(bool
return Vector<String>();
Vector<String> guesses;
ExceptionCode ec;
misspelled = false;
ungrammatical = false;
if (!m_client || !m_range || m_range->collapsed(ec))
if (!m_client || !m_range || m_range->collapsed(IGNORE_EXCEPTION))
return guesses;
// Expand the range to encompass entire paragraphs, since text checking needs that much context.
......
......@@ -62,9 +62,8 @@ String dispatchBeforeTextInsertedEvent(const String& text, const VisibleSelectio
if (Node* startNode = selectionForInsertion.start().containerNode()) {
if (startNode->rootEditableElement()) {
// Send BeforeTextInsertedEvent. The event handler will update text if necessary.
ExceptionCode ec = 0;
RefPtr<BeforeTextInsertedEvent> evt = BeforeTextInsertedEvent::create(text);
startNode->rootEditableElement()->dispatchEvent(evt, ec);
startNode->rootEditableElement()->dispatchEvent(evt, IGNORE_EXCEPTION);
newText = evt->text();
}
}
......@@ -78,8 +77,7 @@ bool canAppendNewLineFeedToSelection(const VisibleSelection& selection)
return false;
RefPtr<BeforeTextInsertedEvent> event = BeforeTextInsertedEvent::create(String("\n"));
ExceptionCode ec = 0;
node->dispatchEvent(event, ec);
node->dispatchEvent(event, IGNORE_EXCEPTION);
return event->text().length();
}
......
......@@ -2601,8 +2601,7 @@ static size_t findPlainText(CharacterIterator& it, const String& target, FindOpt
if (buffer.needsMoreContext()) {
RefPtr<Range> startRange = it.range();
RefPtr<Range> beforeStartRange = startRange->ownerDocument()->createRange();
ExceptionCode ec = 0;
beforeStartRange->setEnd(startRange->startContainer(), startRange->startOffset(), ec);
beforeStartRange->setEnd(startRange->startContainer(), startRange->startOffset(), IGNORE_EXCEPTION);
for (SimplifiedBackwardsTextIterator backwardsIterator(beforeStartRange.get()); !backwardsIterator.atEnd(); backwardsIterator.advance()) {
buffer.prependContext(backwardsIterator.characters(), backwardsIterator.length());
if (!buffer.needsMoreContext())
......
......@@ -558,8 +558,7 @@ PassRefPtr<Range> extendRangeToWrappingNodes(PassRefPtr<Range> range, const Rang
ASSERT(range);
ASSERT(maximumRange);
ExceptionCode ec = 0;
Node* ancestor = range->commonAncestorContainer(ec);// find the cloeset common ancestor
Node* ancestor = range->commonAncestorContainer(IGNORE_EXCEPTION); // Find the closest common ancestor.
Node* highestNode = 0;
// traverse through ancestors as long as they are contained within the range, content-editable, and below rootNode (could be =0).
while (ancestor && ancestor->rendererIsEditable() && isNodeVisiblyContainedWithin(ancestor, maximumRange) && ancestor != rootNode) {
......@@ -572,7 +571,7 @@ PassRefPtr<Range> extendRangeToWrappingNodes(PassRefPtr<Range> range, const Rang
// Create new range with the highest editable node contained within the range
RefPtr<Range> extendedRange = Range::create(range->ownerDocument());
extendedRange->selectNode(highestNode, ec);
extendedRange->selectNode(highestNode, IGNORE_EXCEPTION);
return extendedRange.release();
}
......@@ -1134,8 +1133,7 @@ bool isNodeVisiblyContainedWithin(Node* node, const Range* selectedRange)
ASSERT(node);
ASSERT(selectedRange);
// If the node is inside the range, then it surely is contained within
ExceptionCode ec = 0;
if (selectedRange->compareNode(node, ec) == Range::NODE_INSIDE)
if (selectedRange->compareNode(node, IGNORE_EXCEPTION) == Range::NODE_INSIDE)
return true;
bool startIsVisuallySame = visiblePositionBeforeNode(node) == selectedRange->startPosition();
......
......@@ -539,10 +539,9 @@ static VisiblePosition nextBoundary(const VisiblePosition& c, BoundarySearchFunc
Vector<UChar, 1024> string;
unsigned prefixLength = 0;
ExceptionCode ec = 0;
if (requiresContextForWordBoundary(c.characterAfter())) {
RefPtr<Range> backwardsScanRange(d->createRange());
backwardsScanRange->setEnd(start.deprecatedNode(), start.deprecatedEditingOffset(), ec);
backwardsScanRange->setEnd(start.deprecatedNode(), start.deprecatedEditingOffset(), IGNORE_EXCEPTION);
SimplifiedBackwardsTextIterator backwardsIterator(backwardsScanRange.get());
while (!backwardsIterator.atEnd()) {
const UChar* characters = backwardsIterator.characters();
......@@ -556,8 +555,8 @@ static VisiblePosition nextBoundary(const VisiblePosition& c, BoundarySearchFunc
}
}
searchRange->selectNodeContents(boundary, ec);
searchRange->setStart(start.deprecatedNode(), start.deprecatedEditingOffset(), ec);
searchRange->selectNodeContents(boundary, IGNORE_EXCEPTION);
searchRange->setStart(start.deprecatedNode(), start.deprecatedEditingOffset(), IGNORE_EXCEPTION);
TextIterator it(searchRange.get(), TextIteratorEmitsCharactersBetweenAllVisiblePositions);
unsigned next = 0;
bool inTextSecurityMode = start.deprecatedNode() && start.deprecatedNode()->renderer() && start.deprecatedNode()->renderer()->style()->textSecurity() != TSNONE;
......
......@@ -302,8 +302,7 @@ bool FileInputType::isFileUpload() const
void FileInputType::createShadowSubtree()
{
ASSERT(element()->shadow());
ExceptionCode ec = 0;
element()->userAgentShadowRoot()->appendChild(element()->multiple() ? UploadButtonElement::createForMultiple(element()->document()): UploadButtonElement::create(element()->document()), ec);
element()->userAgentShadowRoot()->appendChild(element()->multiple() ? UploadButtonElement::createForMultiple(element()->document()): UploadButtonElement::create(element()->document()), IGNORE_EXCEPTION);
}
void FileInputType::disabledAttributeChanged()
......
......@@ -75,14 +75,13 @@ inline HTMLKeygenElement::HTMLKeygenElement(const QualifiedName& tagName, Docume
getSupportedKeySizes(keys);
RefPtr<HTMLSelectElement> select = KeygenSelectElement::create(document);
ExceptionCode ec = 0;
for (size_t i = 0; i < keys.size(); ++i) {
RefPtr<HTMLOptionElement> option = HTMLOptionElement::create(document);
select->appendChild(option, ec);
option->appendChild(Text::create(document, keys[i]), ec);
select->appendChild(option, IGNORE_EXCEPTION);
option->appendChild(Text::create(document, keys[i]), IGNORE_EXCEPTION);
}
ensureUserAgentShadowRoot()->appendChild(select, ec);
ensureUserAgentShadowRoot()->appendChild(select, IGNORE_EXCEPTION);
}
PassRefPtr<HTMLKeygenElement> HTMLKeygenElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
......
......@@ -83,18 +83,17 @@ void HTMLScriptElement::setText(const String &value)
{
RefPtr<Node> protectFromMutationEvents(this);
ExceptionCode ec = 0;
int numChildren = childNodeCount();
if (numChildren == 1 && firstChild()->isTextNode()) {
toText(firstChild())->setData(value, ec);
toText(firstChild())->setData(value, IGNORE_EXCEPTION);
return;
}
if (numChildren > 0)
removeChildren();
appendChild(document()->createTextNode(value.impl()), ec);
appendChild(document()->createTextNode(value.impl()), IGNORE_EXCEPTION);