Closed Bug 1325850 Opened 3 years ago Closed 8 months ago

Need automated tests of nsIContentIterator

Categories

(Core :: DOM: Core & HTML, task, P3)

task

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(2 files)

nsIContentIterator initializes its member with complicated logic. On the other hand, it's not tested so many cases. However, we've found some bugs in some edge cases. So, for reducing the risk of touching the implementation, we should have automated tests for this.

I think that we should make nsIContentIterator scriptable and its instance creatable with nsIDOMWIndowUtils.
Priority: -- → P3
I think I can fix this by new-year vacation.
Assignee: nobody → masayuki
Status: NEW → ASSIGNED
OS: Unspecified → All
Hardware: Unspecified → All
And I think that we shouldn't make nsIContentIterator scriptable directly because we already have some methods which take non-scriptable concrete classes for improving its performance.  So, I think that there should be nsIScriptableContentIterator and its implementation should be simple delegator for nsIContentIterator.
The concrete classes of nsIContentIterator are enough complicated, but they
are not tested simply.  Therefore, it's dangerous to touch them even if we
meed bugs of them.  Additionally, it's used in some hot paths, therefore,
I'd like to keep them simple as far as possible.

Therefore, this patch creates a mediator class between script and each
nsIContentIterator instance.  So, this change shouldn't affect any of
actual behavior nor performance.
nsContentIterator in post-order collects nodes starting from deepest first
child to next siblings and parents.  I.e., collecting end points (i.e.,
"close tag" if element node).  This is tested by
test_content_iterator_post_order.html.

nsContentIterator in pre-order collects nodes starting from most ancestor to
last deepest child node.  I.e., collecting start points (i.e., "open tag" if
element node).  This is tested by test_content_iterator_pre_order.html.

nsContentSubtreeIterator collects most ancestor nodes which are selected
entirely by specified range or positions.  This is tested by
test_content_iterator_subtree.html

I.e., all of them start with "test_content_iterator_" for making find easier.
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/7cf2438bcd34
part 1: Create ScriptableContentIterator to make each concrete class of nsIContentIterator scriptable r=smaug
https://hg.mozilla.org/integration/autoland/rev/154121847683
part 2: Add automated tests for nsIContentIterator concrete classes r=smaug
https://hg.mozilla.org/mozilla-central/rev/7cf2438bcd34
https://hg.mozilla.org/mozilla-central/rev/154121847683
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
Component: DOM → DOM: Core & HTML
Type: defect → task
You need to log in before you can comment on or make changes to this bug.