diff --git a/lib/WWW/WebKit2.pm b/lib/WWW/WebKit2.pm index 7b246d1..3c3f80e 100644 --- a/lib/WWW/WebKit2.pm +++ b/lib/WWW/WebKit2.pm @@ -361,8 +361,7 @@ sub init_webkit { my $action = $decision->get_navigation_action; my $action_uri = $action->get_request->get_uri; - unless ($action_uri eq 'about:blank') { - + unless ($action_uri =~ m/\A about:/x) { if ($self->concurrent_active_navigation_warning and $self->active_navigation_action and not $action->is_redirect) { @@ -376,6 +375,9 @@ sub init_webkit { if ($self->view->get_uri =~ s/#.*//r) ne ($action->get_request->get_uri =~ s/#.*//r) and not $action->is_redirect; } + else { + $self->active_navigation_action(''); + } } $decision->use; @@ -461,6 +463,10 @@ sub handle_resource_request { $self->active_navigation_action('') if $uri eq $self->active_navigation_action; delete $self->pending_requests->{"$request"} if defined $self; }); + $resource->signal_connect('failed-with-tls-errors' => sub { + $self->active_navigation_action('') if $uri eq $self->active_navigation_action; + delete $self->pending_requests->{"$request"} if defined $self; + }); } sub setup_xvfb { diff --git a/t/iframe_open.t b/t/iframe_open.t new file mode 100644 index 0000000..42b336e --- /dev/null +++ b/t/iframe_open.t @@ -0,0 +1,22 @@ +use strict; +use warnings; +use utf8; + +use Test::More; +use lib 'lib'; +use FindBin qw($Bin $RealBin); +use lib "$Bin/../../Gtk3-WebKit2/lib"; +use URI; +use WWW::WebKit2; + +#Running tests as root will sometimes spawn an X11 that cannot be closed automatically and leave the test hanging +plan skip_all => 'Tests run as root may hang due to X11 server not closing.' unless $>; + +my $wkit = WWW::WebKit2->new(xvfb => 1); +$wkit->init; + +$wkit->open("$Bin/test/iframe.html"); +ok(1, 'opened'); + +$wkit->click('id=iframeDisplay'); +done_testing; diff --git a/t/test/iframe.html b/t/test/iframe.html new file mode 100644 index 0000000..4c9c2b0 --- /dev/null +++ b/t/test/iframe.html @@ -0,0 +1,33 @@ + + + + + + + + + +
beautiful testpage
+ + + + +
+ +
+
+ + + +