Skip to content

Commit 3776db7

Browse files
author
Jason Carty
committed
Extra test code, within iframe_open.
Unset active_navigation_action if it is set and we are trying to navigate to an about* page and if a failed-with-tls-errors happens within the resource-load-started signal.
1 parent 563d2c2 commit 3776db7

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

lib/WWW/WebKit2.pm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,9 @@ sub init_webkit {
375375
if ($self->view->get_uri =~ s/#.*//r) ne ($action->get_request->get_uri =~ s/#.*//r)
376376
and not $action->is_redirect;
377377
}
378+
else {
379+
$self->active_navigation_action('');
380+
}
378381
}
379382

380383
$decision->use;
@@ -460,6 +463,10 @@ sub handle_resource_request {
460463
$self->active_navigation_action('') if $uri eq $self->active_navigation_action;
461464
delete $self->pending_requests->{"$request"} if defined $self;
462465
});
466+
$resource->signal_connect('failed-with-tls-errors' => sub {
467+
$self->active_navigation_action('') if $uri eq $self->active_navigation_action;
468+
delete $self->pending_requests->{"$request"} if defined $self;
469+
});
463470
}
464471

465472
sub setup_xvfb {

t/iframe_open.t

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,10 @@ $wkit->init;
1818
$wkit->open("$Bin/test/iframe.html");
1919
ok(1, 'opened');
2020

21+
$wkit->click('id=iframeDisplay');
22+
$wkit->active_navigation_action('http://fakewebsite.com');
23+
$wkit->refresh;
24+
$wkit->active_navigation_action('http://fakewebsite.com');
25+
26+
$wkit->click('id=iframeDisplay');
2127
done_testing;

t/test/iframe.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@
1818
<iframe src="about:blank"></iframe>
1919
<iframe src="about:help"></iframe>
2020
<iframe src="about:config"></iframe>
21+
</br>
22+
<button id="iframe_open" onclick="displayIframe()" >click me</button>
23+
</br>
24+
<div id="iframeDisplay"></div>
2125

26+
<script>
27+
function displayIframe() {
28+
document.getElementById("iframeDisplay").innerHTML = "<iframe id=\"test_frame\" src=\"about:blank\"></iframe>";
29+
30+
}
31+
</script>
2232
</body>
2333
</html>

0 commit comments

Comments
 (0)