Skip to content

Commit 520544f

Browse files
feat: do not fail navigation command if was canceled by another navigation
1 parent a72f893 commit 520544f

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/bidiMapper/modules/context/BrowsingContextImpl.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,9 +1033,11 @@ export class BrowsingContextImpl {
10331033

10341034
if (result instanceof NavigationResult) {
10351035
if (
1036-
// TODO: check after decision on the spec is done:
1037-
// https://github.com/w3c/webdriver-bidi/issues/799.
1038-
result.eventName === NavigationEventName.NavigationAborted ||
1036+
// If the navigation was committed and then another navigation started, the
1037+
// command should be considered as successfully finished.
1038+
// Details:
1039+
// * https://github.com/w3c/webdriver-bidi/issues/763
1040+
// * https://github.com/w3c/webdriver-bidi/issues/799
10391041
result.eventName === NavigationEventName.NavigationFailed
10401042
) {
10411043
throw new UnknownErrorException(result.message ?? 'unknown exception');

tests/browsing_context/test_navigate.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ async def test_browsingContext_navigateWaitInteractive_redirect(
4545
assert messages == [
4646
AnyExtending({
4747
'id': command_id,
48-
'error': 'unknown error',
49-
'message': 'navigation canceled by concurrent navigation',
50-
'type': 'error',
48+
'result': {
49+
'navigation': 'stable_0',
50+
'url': initial_url
51+
},
52+
'type': 'success',
5153
}),
5254
{
5355
'method': 'browsingContext.navigationAborted',

0 commit comments

Comments
 (0)