Skip to content

Commit d512c26

Browse files
committed
Allow multiple concurrent navigation requests.
It is possible to have multiple concurrent navigation requests when iframes are used, so we cannot just die. Turn the die into an opt-in warning and disallow redirects to set the active_navigation_action as they don't seem to clear correctly.
1 parent fedce8f commit d512c26

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

lib/WWW/WebKit2.pm

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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)