Merge pull request #689 from dancek/issue-688
fix #688 and provide a unit test
This commit is contained in:
commit
a702aded62
2 changed files with 9 additions and 1 deletions
|
@ -120,7 +120,7 @@ weechat.filter('DOMfilter', ['$filter', '$sce', function($filter, $sce) {
|
|||
if (node === undefined || node === null) return;
|
||||
node = node.firstChild;
|
||||
while (node) {
|
||||
var nextNode;
|
||||
var nextNode = null;
|
||||
// do not recurse inside links if the filter would create a nested link
|
||||
if (!(createsAnchor && node.tagName === 'A')) {
|
||||
nextNode = process(node);
|
||||
|
|
|
@ -83,5 +83,13 @@ describe('Filters', function() {
|
|||
result = DOMfilterFilter(dom, 'number', 2).$$unwrapTrustedValue();
|
||||
expect(result).toEqual(expected);
|
||||
}));
|
||||
|
||||
it('should never lock up like in bug #688', inject(function(linkyFilter, DOMfilterFilter) {
|
||||
var msg = '#crash http://google.com',
|
||||
linked = linkyFilter(msg),
|
||||
irclinked = DOMfilterFilter(linked, 'irclinky');
|
||||
// With the bug, the DOMfilterFilter call ends up in an infinite loop.
|
||||
// I.e. if we ever got this far, the bug is fixed.
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue