Branch Coverage

blib/lib/XUL/Gui.pm
Criterion Covered Total %
branch 44 426 10.3


line true false branch
15 0 2 unless (eval { do { require Hash::Util; 'Hash::Util'->import('hv_store'); 1 } })
18 0 0 if ref $_[2]
39 0 3 if @_ == 2 and $_[1] =~ /^(\*|all|)$/
45 2 1 if @_ == 1 or 1 < (@_ = grep({not /^(?: ([\w:!]*) -> \*? ([\w:!]*) | ([\w:!]+::!*) )$/x && 'XUL::Gui'->oo($3 || $2 || $1);} @_))
398 0 4 @_ ? :
406 11 0 @_ ? :
443 0 11 if (isa_object($x))
444 0 22 if not defined $_
0 11 if grep {$_ = '???' if not defined $_;} $x, $_[0]
447 10 1 if ($x =~ /^_?on/ or ref $_[0] ne 'CODE') { }
448 8 2 unless $x eq 'style' and $A{$x} .= (shift()) . ';'
515 1 2 if (%$pkg and not $force)
519 1546 0 $methods ? :
524 2 0 $MOZILLA ? :
527 2 0 $methods ? :
571 0 0 if isa_object($_[$i])
572 0 0 ref $_[$i] eq 'CODE' ? :
576 0 0 if (@_ == 1 and not isa_object($_[0]))
580 0 0 if ($$args{'A'}{'xml'})
738 0 7 if (my $defaults = $defaults{$tag})
741 7 0 $tag ? :
750 3 4 if (my $id = $$self{'A'}{'id'}) { }
752 1 2 if (($$self{'ID'} = $id) =~ /\W/)
759 6 0 if ($tag)
780 0 6 @_ == 1 && !isa_object($_[0]) ? :
885 0 0 $TIED_WIDGETS ? :
888 0 0 $inner ? :
890 0 0 $TIED_WIDGETS ? :
896 0 0 if (ref $v ne 'CODE')
897 0 0 ref $v ? :
907 0 0 unless $THREADS
909 0 0 if $inner
915 0 0 if $setcid
926 0 0 unless isa_object(my $obj = $_[1])
929 0 0 if ($TIED_WIDGETS)
930 0 0 if (my $tied = tied %{$_[1];}) { }
938 0 0 if (exists $$obj{'WIDGET'})
942 0 0 if ($FILL_GENID_OBJECTS or $$obj{'A'}{'id'} and not $$obj{'A'}{'id'} =~ /^xul_\d+$/)
945 0 0 unless isweak $obj
948 0 0 if (exists $$obj{'W'})
960 0 0 unless ($TIED_WIDGETS)
981 0 0 wantarray ? :
1008 0 0 unless $MOZILLA
1010 0 0 wantarray ? :
1018 0 0 $type eq 'open' && wantarray ? :
1042 0 0 wantarray ? :
0 0 defined $res ? :
1057 0 0 isa_object() ? :
1060 0 0 wantarray ? :
1068 0 0 unless my $proto = $$self{'WIDGET'} || $$self{'W'}{'WIDGET'}
1071 0 0 if (@_) { }
1075 0 0 unless ($name)
1082 0 0 if (eval { do { *$glob{'CODE'} == $proto } })
1089 0 0 $$self{'WIDGET'} ? :
0 0 if $name
1093 0 0 unless $$self{'ID'}
1170 0 0 unless $str =~ /[\\\n\r']|[^[:ascii:]]/
1179 0 0 $str =~ /[^[:ascii:]]/ ? :
1194 0 0 unless $MOZILLA
1203 0 0 unless return eval 'package ' . (caller()) . ";$_"
1220 0 1 if (substr($msg, 1, 2) eq 'ET')
1222 0 0 if ($first eq 'S' or $first eq 'G')
1223 0 0 if ((my $check = substr($msg, 3, 1)) eq '(') { }
0 0 elsif ($check eq ';') { }
1232 1 0 unless ($now)
1233 0 1 if $buffered
1234 0 1 if $AUTOBUFFER and $type eq 'SET' and not $cached
1237 0 1 if exists $cache{$msg}
1239 0 1 if (@setbuf)
1243 1 0 unless $cached
1249 0 0 if (defined wantarray or $cached)
1250 0 0 unless ($res = $$res{'CONTENT'}) =~ /^(...) (.*)/s
1253 0 0 $1 eq 'UND' ? :
0 0 $1 eq 'OBJ' ? :
1258 0 0 if ($cached)
1259 0 0 if ($type eq 'SET')
1264 0 0 if $type eq 'GET'
1339 0 0 if (@setbuf)
1358 0 0 unless (--$buffered)
1374 0 0 unless --$cached
1389 0 0 $want ? :
1392 0 0 $want ? :
1409 0 0 if @$args
1455 0 3 unless $n >= 1
1457 0 3 if $n == 1
1462 4 1546 if ($want) { }
1493 1 0 wantarray ? :
1549 0 0 ref $_ ? :
1553 1 0 @_ > 1 ? :
1652 0 0 unless my $name = substr(our $AUTOLOAD, 1 + rindex($XUL::Gui::Object::AUTOLOAD, ':'))
1655 0 0 if (my $method = $self->$can($name))
1656 0 0 if $XUL::Gui::DEBUG
1659 0 0 if ($$self{'NOPROXY'} or not +(shift())->{'ID'})
1664 0 0 if (substr($name, -1) eq '_' and chop $name or @_ or $void)
1666 0 0 if $XUL::Gui::DEBUG > 1
1673 0 0 unless not defined $_ and 'null' or XUL::Gui::isa_object() and do { push @pre, $_->$toJS(undef, $self) if $$_{'DIRTY'}; "ID.$$_{'ID'}" }
1674 0 0 if $$_{'DIRTY'}
1681 0 0 if $XUL::Gui::DEBUG > 2
1692 0 1 unless @_ and &Scalar::Util::reftype($_[0]) eq 'HASH' and $_[0]{'ID'}
1696 1 0 if (@queue == 1)
1702 0 0 unless (defined $$rid{$_})
1708 0 1 if tied %{$_[0];}
1880 0 0 @_ ? :
1895 0 0 @_ ? :
1897 0 0 @_ ? :
1919 0 0 if ($$children[$_] == $child)
1939 0 0 if ($$self{'TAG'} eq 'tabs') { }
1944 0 0 unless $first
1948 0 0 $first ? :
1980 0 0 ref $_ eq 'ARRAY' ? :
0 0 XUL::Gui::isa_object() ? :
2014 0 0 if $AL =~ /^on/
2015 0 0 $AL =~ /^_(.+)/ ? :
2022 0 0 if ($AL =~ /^on/)
2023 0 0 if (ref $new eq 'XUL::Gui::Function') { }
2026 0 0 unless not defined $new or ref $new eq 'CODE'
2028 0 0 $new ? :
2031 0 0 defined $new ? :
2033 0 0 $AL =~ /^_(.+)/ ? :
2068 0 0 unless (shift())->{'silent'}
2074 0 0 unless @{$$self{'content'};}
2084 0 0 if local $XUL::Gui::DEBUG = $$self{'debug'} || $XUL::Gui::DEBUG
2089 0 0 defined $$self{'mozilla'} ? :
0 0 unless local $XUL::Gui::MOZILLA = defined $$self{'mozilla'} ? $$self{'mozilla'} : $XUL::Gui::MOZILLA
2092 0 0 if $XUL::Gui::TESTING
2094 0 0 if $XUL::Gui::DEBUG
2096 0 0 if $$self{'delay'}
2111 0 0 if $$self{'launch'} or $$self{'trusted'}
2118 0 0 eval { do { $self->read_until('main loop:'); 1 } } ? :
2121 0 0 if ($$self{'firefox'})
2129 0 0 if $error and ref $error ne 'XUL::Gui server stopped'
2146 0 0 $stop =~ /:/ ? :
0 0 if $XUL::Gui::DEBUG > 4 and $url ne '/ping'
2149 0 0 if $url eq $stop
2151 0 0 if (my $handler = $$dispatch{$url}) { }
0 0 elsif (my $prefix = $$self{'serve_files'}) { }
2154 0 0 $prefix =~ m[ [\\\/] $ ]x ? :
2156 0 0 if (open my $file, '<', $url) { }
2163 0 0 unless $$run
2168 0 1 if openhandle(pop())
2169 1 0 (caller 2)[3] =~ /([^:]+)$/ ? :
2181 0 0 unless ($header and ($req{'URL'}) = $header =~ /^\s*\w+\s*(\S+)\s*HTTP/)
2182 0 0 $header ? :
2191 0 0 /^\s*content-length\D+(\d+)/i ? :
2192 0 0 if $_
2196 0 0 if $XUL::Gui::DEBUG > 3 and $req{'URL'} ne '/ping'
2198 0 0 if ($$self{'delay'} and $req{'URL'} ne '/ping')
2208 0 0 if $msg eq 'NOOP'
2209 0 0 if ($XUL::Gui::DEBUG > 3)
2211 0 0 $XUL::Gui::DEBUG > 4 ? :
2237 0 0 if $path =~ m[^/(?:client.js|event|ping|exit|perl)?$]
2239 0 0 if $XUL::Gui::DEBUG
2253 0 0 if ($XUL::Gui::MOZILLA) { }
2257 0 0 $$self{'content'}[0]{'TAG'} eq 'window' ? :
2262 0 0 $$self{'content'}[0]{'TAG'} eq 'html:html' ? :
2266 0 0 if ($$_{'TAG'} eq 'html:body')
2271 0 0 unless ($root)
2273 0 0 if ($$self{'content'}[$_]{'TAG'} eq 'html:body')
2288 0 0 $XUL::Gui::MOZILLA ? :
0 0 $XUL::Gui::MOZILLA ? :
2307 0 0 if $XUL::Gui::DEBUG > 1
2311 0 0 if (ref $handler eq 'CODE') { }
2318 0 0 if $XUL::Gui::DEBUG > 1
2321 0 0 unless eval "no strict; package $$self{'caller'}; \$return = do {$$req{'CONTENT'}}; 1"
2326 0 0 if (my(@delay) = splice(@{$$self{'queue'};}))
2327 0 0 if $XUL::Gui::DEBUG > 1
2340 0 0 ref $_ eq 'CODE' ? :
2342 0 0 $shutdown ? :
2343 0 0 if $$self{'run'}
2346 0 0 exists $$self{'dispatch'} ? :
2352 0 0 if ($$self{'default_browser'} or not $XUL::Gui::MOZILLA)
2353 0 0 $^O =~ /darwin/ ? :
0 0 $^O =~ /MSWin/ ? :
2357 0 0 $XUL::Gui::DEBUG ? :
2358 0 0 if system $cmd
2361 0 0 unless (@firefox)
2362 0 0 if /^(:?firefox|iceweasel|xulrunner.*)(?:-bin|\.exe)?$/i and -f $_
2364 0 0 $^O =~ /darwin/ ? :
0 0 $^O =~ /MSWin/ ? :
2366 0 0 if (opendir my $dir, my $path = $_) { }
2374 0 0 if (@firefox) { }
2377 0 0 unless defined $_ and not $_
2383 0 0 if ($$self{'trusted'}) { }
2401 0 0 unless open my $manifest, '>', &$file('chrome chrome.manifest')
2404 0 0 unless open my $boot, '>', &$file('chrome', $base, 'boot.xul')
2409 0 0 if $XUL::Gui::DEBUG > 3
2415 0 0 unless open my $prefs, '>', &$file('defaults preferences prefs.js')
2418 0 0 unless open my $ini, '>', $app = &$file('application.ini')
2429 0 0 if $XUL::Gui::DEBUG > 2
2431 0 0 unless (eval { do { require File::Spec; require File::Temp; $$self{'dir'} = 'File::Temp'->newdir('xulgui_XXXXXX', 'TMPDIR', 1); $$self{'dir'}->unlink_on_destroy(0); my $dirname = $$self{'dir'}->dirname; my $base = ('File::Spec'->splitdir($dirname))[-1]; my($file, $dir) = map({my $method = $_; sub { 'File::Spec'->$method($dirname, split(/\s+/, "@_", 0)); } ;} 'catfile', 'catdir'); (mkdir &$dir($_) or die $!) foreach (('chrome', 'defaults'), "chrome $base", 'defaults preferences'); die $! unless open my $manifest, '>', &$file('chrome chrome.manifest'); print $manifest "content $base file:$base/"; die $! unless open my $boot, '>', &$file('chrome', $base, 'boot.xul'); { BEGIN {${^WARNING_BITS} = "TUUU\025UUUUUUUUUU\025"} local *write = sub { my $self = shift(); my $code = pop(); $self->status("write \n\t" . join("\n\t", split(/\n/, $code, 0))) if $XUL::Gui::DEBUG > 3; $code; } ; print $boot $$self{'dispatch'}{'/'}(); } ; die $! unless open my $prefs, '>', &$file('defaults preferences prefs.js'); print $prefs qq[pref("toolkit.defaultChromeURI", "chrome://$base/content/boot.xul");]; die $! unless open my $ini, '>', $app = &$file('application.ini'); print $ini split(/[\t ]+/, "\n [App]\n Name=$base\n Version=$XUL::Gui::VERSION\n BuildID=$base\n\n [Gecko]\n MinVersion=1.6\n MaxVersion=2.3\n ", 0); $self->status("trusted: $app") if $XUL::Gui::DEBUG > 2; 1 } })
2440 0 0 unless (@firefox)
2448 0 0 if $^O =~ /MSWin/
2449 0 0 $$self{'chrome'} ? :
0 0 $app ? :
2455 0 0 if ($$self{'launch'}) { }
2456 0 0 $XUL::Gui::DEBUG ? :
2458 0 0 if (not $$self{'trusted'} and $^O =~ /darwin/) { }
2492 0 0 unless ($XUL::Gui::MOZILLA)
2848 0 0 unless (defined wantarray)
2855 0 0 blessed $self ? :
2880 0 0 if (exists $$self{'hash'}{$key})
2883 0 0 if $key eq uc $key
2886 0 0 if $_ and %$_ and exists $$_{$key}
2895 0 0 if exists $$self{'hash'}{$key}
2896 0 0 if $key eq uc $key
2898 0 0 if $_ and %$_ and exists $$_{$key}
2913 0 0 if ($want) { }
2914 0 0 if (my($k, $v) = each %{$each[0];})
2915 0 0 if $seen{$k}++
2916 0 0 if $k eq uc $k and $count != @each
2920 0 0 if (defined(my $k = each %{$each[0];}))
2921 0 0 if $seen{$k}++
2922 0 0 if $k eq uc $k and $count != @each