Skip to content

Commit

Permalink
Test that the exception doesn't get lost in acceptNode.
Browse files Browse the repository at this point in the history
And it turns out that it does get lost. I have no idea where, but I suspect it
is in SpiderMonkey somewhere. I hope the SpiderMonkey upgrade will fix it.
  • Loading branch information
Ms2ger committed Jun 23, 2015
1 parent 5f5f6f8 commit 3ecdc9d
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions dom/traversal/TreeWalker-acceptNode-filter.html
Expand Up @@ -123,33 +123,31 @@
assert_node(walker.firstChild(), { type: Element, id: 'A1' });
}, 'Testing acceptNode callee');

// XXX Looks like Servo is doing something wrong when a callback function throws
test(function()
{
var test_error = { name: "test" };
var walker = document.createTreeWalker(testElement, /*NodeFilter.*/SHOW_ELEMENT,
function(node) {
throw('filter exception');
return /*NodeFilter.*/FILTER_ACCEPT;
throw test_error;
});
assert_throws(null, function () { walker.firstChild(); });
assert_throws(test_error, function () { walker.firstChild(); });
assert_node(walker.currentNode, { type: Element, id: 'root' });
assert_throws(null, function () { walker.nextNode(); });
assert_throws(test_error, function () { walker.nextNode(); });
assert_node(walker.currentNode, { type: Element, id: 'root' });
}, 'Testing with filter function that throws');

// XXX Looks like Servo is doing something wrong when a callback function throws
test(function()
{
var test_error = { name: "test" };
var walker = document.createTreeWalker(testElement, /*NodeFilter.*/SHOW_ELEMENT,
{
acceptNode : function(node) {
throw('filter exception');
return /*NodeFilter.*/FILTER_ACCEPT;
throw test_error;
}
});
assert_throws(null, function () { walker.firstChild(); });
assert_throws(test_error, function () { walker.firstChild(); });
assert_node(walker.currentNode, { type: Element, id: 'root' });
assert_throws(null, function () { walker.nextNode(); });
assert_throws(test_error, function () { walker.nextNode(); });
assert_node(walker.currentNode, { type: Element, id: 'root' });
}, 'Testing with filter object that throws');

Expand Down

0 comments on commit 3ecdc9d

Please sign in to comment.