Bug 148257 - Fix passing null / undefined as NodeFilter parameter for createNodeIterator() / createTreeWalker()
Summary: Fix passing null / undefined as NodeFilter parameter for createNodeIterator()...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on: 148238
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-20 16:01 PDT by Chris Dumez
Modified: 2015-08-20 20:05 PDT (History)
4 users (show)

See Also:


Attachments
Patch (4.90 KB, patch)
2015-08-20 16:04 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (4.97 KB, patch)
2015-08-20 17:01 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2015-08-20 16:01:51 PDT
Fix passing null / undefined as NodeFilter parameter for createNodeIterator() / createTreeWalker(). It is supposed to be translated into a *null* NodeFilter. However, WebKit currently constructs a new NodeFilter.

Chrome and Firefox do not create a NodeFilter in this case.

Test Suite:
http://w3c-test.org/dom/traversal/NodeIterator.html
http://w3c-test.org/dom/traversal/TreeWalker.html
Comment 1 Chris Dumez 2015-08-20 16:04:13 PDT
Created attachment 259513 [details]
Patch
Comment 2 Chris Dumez 2015-08-20 17:01:27 PDT
Created attachment 259530 [details]
Patch
Comment 3 Chris Dumez 2015-08-20 17:03:15 PDT
Comment on attachment 259530 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=259530&action=review

> Source/WebCore/bindings/js/JSNodeFilterCustom.cpp:43
> +    if (!value.isObject())

NodeFilter can be implemented as a JavaScript object. This is why we have a custom toWrapped() and we create a NodeFilter from that object. 
However, if we are not passed an object, we should simply return null instead of constructing a NodeFilter.
Comment 4 WebKit Commit Bot 2015-08-20 20:05:12 PDT
Comment on attachment 259530 [details]
Patch

Clearing flags on attachment: 259530

Committed r188745: <http://trac.webkit.org/changeset/188745>
Comment 5 WebKit Commit Bot 2015-08-20 20:05:18 PDT
All reviewed patches have been landed.  Closing bug.