Skip to content

Commit a94651a

Browse files
authored
Merge pull request #78 from sorryforthecommit/iframe_navigation
Allow multiple concurrent navigation requests.
2 parents fedce8f + e2ec541 commit a94651a

2 files changed

Lines changed: 22 additions & 7 deletions

File tree

Changes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ Change to how page loading is checked in fire events.
2929

3030
0.124 Thu Oct 1 08:16:00 CET 2020
3131
- error correction for tests when run as root. Use ok in wrong position
32+
33+
0.125 Mon Oct 5 13:15 CET 2020
34+
- allow multiple concurrent navigations (can be caused by iframes) and turn die into opt-in warn

lib/WWW/WebKit2.pm

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ use XSLoader;
5555
use English '-no_match_vars';
5656
use POSIX qw<F_SETFD F_GETFD FD_CLOEXEC>;
5757

58-
our $VERSION = '0.124';
58+
our $VERSION = '0.125';
5959

6060
use constant DOM_TYPE_ELEMENT => 1;
6161
use constant ORDERED_NODE_SNAPSHOT_TYPE => 7;
@@ -268,6 +268,11 @@ has 'active_navigation_action' => (
268268
default => 0,
269269
);
270270

271+
has 'concurrent_active_navigation_warning' => (
272+
is => 'ro',
273+
default => 0,
274+
);
275+
271276
=head2 METHODS
272277
273278
=head3 init
@@ -352,13 +357,20 @@ sub init_webkit {
352357
my ($view, $decision, $type) = @_;
353358
if ($type eq 'navigation-action') {
354359
my $action = $decision->get_navigation_action;
355-
die "Already running a navigation action to " .
356-
$self->active_navigation_action
357-
. " when requested "
358-
. $action->get_navigation_type . ' ' . $action->get_request->get_uri
359-
if $self->active_navigation_action and not $action->is_redirect;
360+
361+
if ($self->concurrent_active_navigation_warning
362+
and $self->active_navigation_action and not $action->is_redirect) {
363+
364+
warn "Already running a navigation action to " .
365+
$self->active_navigation_action
366+
. " when requested "
367+
. $action->get_navigation_type . ' ' . $action->get_request->get_uri;
368+
}
369+
360370
$self->active_navigation_action($action->get_request->get_uri)
361-
if ($self->view->get_uri =~ s/#.*//r) ne ($action->get_request->get_uri =~ s/#.*//r);
371+
if ($self->view->get_uri =~ s/#.*//r) ne ($action->get_request->get_uri =~ s/#.*//r)
372+
and not $action->is_redirect;
373+
362374
}
363375
$decision->use;
364376
return 0;

0 commit comments

Comments
 (0)