Skip to content

Commit

Permalink
fix: browsingContext.traverseHistory only for top-level navigables
Browse files Browse the repository at this point in the history
  • Loading branch information
sadym-chromium committed Sep 19, 2024
1 parent 72a9929 commit 5c006b3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/bidiMapper/modules/context/BrowsingContextProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ export class BrowsingContextProcessor {
`No browsing context with id ${params.context}`
);
}
if (!context.isTopLevelContext()) {
throw new InvalidArgumentException(
'Traversing history is only supported on the top-level context'
);
}
await context.traverseHistory(params.delta);
return {};
}
Expand Down
11 changes: 11 additions & 0 deletions tests/browsing_context/test_traverse_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ async def traverse_history(websocket, context_id, delta):
})


@pytest.mark.asyncio
async def test_traverse_history_iframe(websocket, iframe_id):
with pytest.raises(
Exception,
match=str({
"error": "invalid argument",
"message": "Traversing history is only supported on the top-level context"
})):
await traverse_history(websocket, iframe_id, 0)


async def assert_href_equals(websocket, href):
response = await read_JSON_message(websocket)
assert response["params"]["url"] == href
Expand Down

0 comments on commit 5c006b3

Please sign in to comment.