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

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

Issue 256013002: Make NodeIterator.detach() a no-op (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Take feedback into consideration Created 6 years, 8 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
« no previous file with comments | « Source/core/dom/NodeIterator.h ('k') | Source/core/dom/NodeIterator.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/NodeIterator.cpp
diff --git a/Source/core/dom/NodeIterator.cpp b/Source/core/dom/NodeIterator.cpp
index 1a2e05605203cff8fcefca6b56e3ecaea3a7f131..6a0f76abeb7c6a178e5bff8f60a874101c45007b 100644
--- a/Source/core/dom/NodeIterator.cpp
+++ b/Source/core/dom/NodeIterator.cpp
@@ -29,6 +29,7 @@
#include "core/dom/Document.h"
#include "core/dom/ExceptionCode.h"
#include "core/dom/NodeTraversal.h"
+#include "core/frame/UseCounter.h"
namespace WebCore {
@@ -74,7 +75,6 @@ bool NodeIterator::NodePointer::moveToPrevious(Node* root)
NodeIterator::NodeIterator(PassRefPtr<Node> rootNode, unsigned whatToShow, PassRefPtr<NodeFilter> filter)
: NodeIteratorBase(rootNode, whatToShow, filter)
, m_referenceNode(root(), true)
- , m_detached(false)
{
ScriptWrappable::init(this);
root()->document().attachNodeIterator(this);
@@ -87,11 +87,6 @@ NodeIterator::~NodeIterator()
PassRefPtr<Node> NodeIterator::nextNode(ExceptionState& exceptionState)
{
- if (m_detached) {
- exceptionState.throwDOMException(InvalidStateError, "The iterator is detached.");
- return nullptr;
- }
-
RefPtr<Node> result;
m_candidateNode = m_referenceNode;
@@ -116,11 +111,6 @@ PassRefPtr<Node> NodeIterator::nextNode(ExceptionState& exceptionState)
PassRefPtr<Node> NodeIterator::previousNode(ExceptionState& exceptionState)
{
- if (m_detached) {
- exceptionState.throwDOMException(InvalidStateError, "The iterator is detached.");
- return nullptr;
- }
-
RefPtr<Node> result;
m_candidateNode = m_referenceNode;
@@ -145,9 +135,7 @@ PassRefPtr<Node> NodeIterator::previousNode(ExceptionState& exceptionState)
void NodeIterator::detach()
{
- root()->document().detachNodeIterator(this);
- m_detached = true;
- m_referenceNode.node.clear();
+ // This is now a no-op as per the DOM specification.
}
void NodeIterator::nodeWillBeRemoved(Node& removedNode)
@@ -158,7 +146,6 @@ void NodeIterator::nodeWillBeRemoved(Node& removedNode)
void NodeIterator::updateForNodeRemoval(Node& removedNode, NodePointer& referenceNode) const
{
- ASSERT(!m_detached);
ASSERT(root()->document() == removedNode.document());
// Iterator is not affected if the removed node is the reference node and is the root.
« no previous file with comments | « Source/core/dom/NodeIterator.h ('k') | Source/core/dom/NodeIterator.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698