Skip to content

Commit

Permalink
feat: browsingContext.traverseHistory only for top-level navigables (
Browse files Browse the repository at this point in the history
…#2627)

Align with the spec w3c/webdriver-bidi#770 and
WPT web-platform-tests/wpt#48260

---------

Co-authored-by: browser-automation-bot <133232582+browser-automation-bot@users.noreply.github.com>
  • Loading branch information
sadym-chromium and browser-automation-bot authored Sep 19, 2024
1 parent 72a9929 commit dd0dec5
Show file tree
Hide file tree
Showing 5 changed files with 28 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
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[context.py]
[test_iframe[cross_origin\]]
expected: FAIL

[test_iframe[same_origin\]]
expected: FAIL
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[context.py]
[test_iframe[cross_origin\]]
expected: FAIL

[test_iframe[same_origin\]]
expected: FAIL
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[context.py]
[test_iframe[same_origin\]]
expected: FAIL

[test_iframe[cross_origin\]]
expected: FAIL

0 comments on commit dd0dec5

Please sign in to comment.