Test that the exception doesn't get lost in acceptNode.

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.
This commit is contained in:
Ms2ger 2015-06-14 17:33:05 +02:00
parent 90a7ef1571
commit 5cc130727f
2 changed files with 16 additions and 10 deletions

View file

@ -0,0 +1,8 @@
[TreeWalker-acceptNode-filter.html]
type: testharness
[Testing with filter function that throws]
expected: FAIL
[Testing with filter object that throws]
expected: FAIL

View file

@ -123,33 +123,31 @@ test(function()
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');