Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lib/WWW/WebKit2.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand All @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
22 changes: 22 additions & 0 deletions t/iframe_open.t
Original file line number Diff line number Diff line change
@@ -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;
33 changes: 33 additions & 0 deletions t/test/iframe.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<style>
iframe {
width: 200px;
height: 200px;
}
</style>

<script>
</script>
</head>
<body>

<div>beautiful testpage</div>

<iframe src="about:blank"></iframe>
<iframe src="about:help"></iframe>
<iframe src="about:config"></iframe>
</br>
<button id="iframe_open" onclick="displayIframe()" >click me</button>
</br>
<div id="iframeDisplay"></div>

<script>
function displayIframe() {
document.getElementById("iframeDisplay").innerHTML = "<iframe id=\"test_frame\" src=\"about:blank\"></iframe>";

}
</script>
</body>
</html>