Reinstate active flag for iterators
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Aug 2017 13:04:39 +0000 (13:04 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Aug 2017 13:04:39 +0000 (13:04 +0000)
commit528885e57d5e3cba1c44b5739094a79294c3420a
treedc652e62990b5f6fc56608c171edc6c14ef3c2e4
parent966aad93e4972e54ad3e7e05e4f04fb101778c07
Reinstate active flag for iterators
https://bugs.webkit.org/show_bug.cgi?id=175312

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

Resync WPT tests from upstream to gain test coverage.

* web-platform-tests/dom/traversal/NodeIterator-expected.txt:
* web-platform-tests/dom/traversal/NodeIterator.html:
* web-platform-tests/dom/traversal/TreeWalker-expected.txt:
* web-platform-tests/dom/traversal/TreeWalker.html:

Source/WebCore:

NodeIterator / TreeWalker should no longer allow recursive filters
after the following change to the DOM specification:
- https://github.com/whatwg/dom/pull/359

This patch aligns our behavior with the latest specification.

No new tests, updated existing tests.

* dom/NodeIterator.cpp:
(WebCore::NodeIterator::nextNode):
(WebCore::NodeIterator::previousNode):
Note that we now also call m_candidateNode.clear() before returning an
exception. This was a pre-existing bug that we failed to do so in the
exception case but it became more obvious after this change now that
we throw. This was causing traversal/moz-bug559526.html to fail
otherwise (the filter was called one too many times). The test case
is passing in Firefox (The filter is called 4 times and they throw
each time).

* dom/Traversal.cpp:
(WebCore::NodeIteratorBase::NodeIteratorBase):
(WebCore::NodeIteratorBase::acceptNode):
* dom/Traversal.h:
* dom/TreeWalker.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@220453 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/dom/traversal/NodeIterator-expected.txt
LayoutTests/imported/w3c/web-platform-tests/dom/traversal/NodeIterator.html
LayoutTests/imported/w3c/web-platform-tests/dom/traversal/TreeWalker-expected.txt
LayoutTests/imported/w3c/web-platform-tests/dom/traversal/TreeWalker.html
LayoutTests/traversal/moz-bug559526-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/dom/NodeIterator.cpp
Source/WebCore/dom/Traversal.cpp
Source/WebCore/dom/Traversal.h
Source/WebCore/dom/TreeWalker.cpp