Branch Coverage

blib/lib/HTML/TagFilter.pm
Criterion Covered Total %
branch 124 160 77.5


line true false branch
325 5 5 if delete $$config{'strip_comments'}
334 8 2 unless $$config{'allow'} or $$config{'deny'}
335 0 10 unless $$config{'allow'} or $$config{'deny'}
341 1 9 if delete $$config{'log_rejects'}
342 0 10 if delete $$config{'echo'}
343 10 0 unless delete $$config{'skip_xss_protection'}
344 8 2 unless delete $$config{'skip_entification'} or delete $$config{'skip_ltgt_entification'}
345 8 2 unless delete $$config{'skip_mailto_entification'}
346 1 9 if delete $$config{'verbose'}
355 5 55 if ($sub and ref $sub eq 'CODE') { }
368 22 168 if ($sub and ref $sub eq 'CODE') { }
168 0 elsif ($sub) { }
373 0 22 if ($@) { }
6 16 elsif ($response) { }
496 0 24 unless $text
500 24 0 unless $$self{'_settings'}{'echo'}
518 0 24 unless $output
533 1 1 unless defined $$self{'_log'}
536 0 1 if wantarray
540 2 4 if ($$_{'attribute'}) { }
542 0 2 if $$_{'reason'} eq 'url'
559 4 30 unless $self->tag_ok(lc $tagname)
561 0 30 unless $tagname
565 9 9 unless $self->attribute_ok(@data) and $self->url_ok(@data)
579 4 23 unless $self->tag_ok(lc $tagname)
581 2 21 unless $tagname
599 0 79 unless $$self{'_settings'}{'xss'}
600 6 73 unless $$self{'_settings'}{'ent'}
619 0 82 if @_
620 73 9 if exists $$self{'_settings'}{'charmap'}
637 0 136 unless @_ and defined $_[0]
638 0 136 if ($$self{'_settings'}{'echo'}) { }
653 0 17 if @_
665 9 8 unless $self->logging
682 8 53 unless $ok
688 4 57 unless $tagname and $self->has_rules
689 2 55 if $self->_check('_denies', 'attributes', $tagname, 'all')
690 6 49 unless $self->has_allow_rules
691 47 2 if $self->_check('_allows', 'tags', $tagname)
704 5 13 unless $ok
710 0 18 unless $tagname and $attribute and $self->has_rules
711 1 17 if $self->_check('_denies', 'attributes', $tagname, 'any')
712 0 17 if $self->_check('_denies', 'values', $tagname, 'all')
713 0 17 if $self->_check('_denies', 'values', $tagname, $attribute, 'any')
714 0 17 if $self->_check('_denies', 'values', $tagname, $attribute, $value)
715 0 17 unless $self->has_allow_rules
716 0 17 if $self->_check('_allows', 'attributes', $tagname, 'any')
717 0 17 if $self->_check('_allows', 'values', 'any', $attribute, 'any')
718 0 17 if $self->_check('_allows', 'values', 'any', $attribute, $value)
719 12 5 if $self->_check('_allows', 'values', $tagname, $attribute, 'any')
720 1 4 if $self->_check('_allows', 'values', $tagname, $attribute, $value)
733 4 9 unless $ok
739 0 13 unless $$self{'_settings'}{'xss'}
740 6 7 unless $self->_is_risky($attribute)
741 1 6 if $self->xss_allow_local_links and $value =~ m[^\.*/]s || !($value =~ /:/s)
742 2 4 if grep {$value =~ /^$_:/s;} $self->xss_permitted_protocols
750 0 9 unless $$self{'_settings'}{'xss'}
753 2 7 if $attribute eq 'href'
767 1 1 unless $$self{'_settings'}{'mailto'}
768 0 1 unless $address =~ /^mailto:(.*)/
780 0 248 unless (@russian_dolls)
786 0 467 unless (ref $deepref eq 'HASH')
790 185 282 unless $$deepref{$_}
810 9 1 if ($tagset and ref $tagset eq 'HASH' and %$tagset) { }
826 1 9 if ($tagset and ref $tagset eq 'HASH' and %$tagset) { }
842 75 4 if $self->has_allow_rules or $self->has_deny_rules
854 132 19 if $$self{'_allows'} and %{$$self{'_allows'};}
866 9 4 if $$self{'_denies'} and %{$$self{'_denies'};}
888 0 10 unless (ref $tagset eq 'HASH')
892 0 10 unless keys %$tagset
898 128 99 if ($att eq 'none')
904 82 17 unless defined $$tagset{$tag}{$att} and @{$$tagset{$tag}{$att};}
946 0 13 if @_
947 7 6 if $$self{'_xss_att'}
961 0 6 if @_
962 2 4 if $$self{'_xss_stems'}
976 0 7 if @_
977 2 5 if defined $$self{'_xss_local'}
991 1 0 if $$self{'_error'}
1000 0 1 if $$self{'_settings'}{'verbose'}