Skip to content

Commit

Permalink
Throw a TypeError when get_callable_property encounters a value that …
Browse files Browse the repository at this point in the history
…isn't callable.
  • Loading branch information
Ms2ger committed Jun 23, 2015
1 parent 807559d commit 5f5f6f8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions dom/traversal/TreeWalker-acceptNode-filter.html
Expand Up @@ -85,23 +85,21 @@
assert_node(walker.currentNode, { type: Element, id: 'B1' });
}, 'Testing with undefined filter');

// XXX Servo breaks the test when a callback isn't callable
test(function()
{
var walker = document.createTreeWalker(testElement, /*NodeFilter.*/SHOW_ELEMENT, {});
assert_throws(null, function () { walker.firstChild(); });
assert_throws(new TypeError(), function () { walker.firstChild(); });
assert_node(walker.currentNode, { type: Element, id: 'root' });
assert_throws(null, function () { walker.nextNode(); });
assert_throws(new TypeError(), function () { walker.nextNode(); });
assert_node(walker.currentNode, { type: Element, id: 'root' });
}, 'Testing with object lacking acceptNode property');

// XXX Servo breaks the test when a callback isn't callable
test(function()
{
var walker = document.createTreeWalker(testElement, /*NodeFilter.*/SHOW_ELEMENT, { acceptNode: "foo" });
assert_throws(null, function () { walker.firstChild(); });
assert_throws(new TypeError(), function () { walker.firstChild(); });
assert_node(walker.currentNode, { type: Element, id: 'root' });
assert_throws(null, function () { walker.nextNode(); });
assert_throws(new TypeError(), function () { walker.nextNode(); });
assert_node(walker.currentNode, { type: Element, id: 'root' });
}, 'Testing with object with non-function acceptNode property');

Expand Down

0 comments on commit 5f5f6f8

Please sign in to comment.