Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC 91: [testdriver] RemoteContext object #91

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions rfcs/testdriver_remote_context.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# RFC 91: `testdriver` RemoteContext object

## Summary

Provide `test_driver.RemoteContext` which is a convenient wrapper over
directing commands to another browsing context.

## Details

Lots of testdriver functions take `context` as a final parameter. This
is used when the test file wants to cause some action to happen in a
different browsing context
e.g. `test_driver.delete_all_cookies(context)`. If a context is being
used repeatedly it's tedious and error-prone to have to keep supplying
the context id explictly. Instead it's more convenient to work with an
object with the context id already correctly bound.

`RemoteContext` is an object that wraps the part of the `test_driver` API
which takes a `context` parameter, and calls the underlying API with
a context set at object creation:

```
let ctx = new test_driver.RemoteContext(frames[0]);
Copy link
Member

@ArthurSonzogni ArthurSonzogni Jul 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Often, there are no frame or WindowProxy for the remote context we want to execute data, accessible from the current context.

For instance, all of COOP is about switching browsing context group. This make the openee and the opener to belong to two group that can't reference each other.

Probably the same for FencedIframe, Prerender, etc...

I would be nice being able to pass a UUID here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do that; it's anything that testdriver can treat as a context, which is basically either a UUID, a window handle, or an element that contains a nested browsing context.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See RFC #88 for details on the proposal there.

ctx.delete_all_cookies()
```

## Risks

As proposed creating the context might be quite verbose. Maybe
`RemoteContext` should be on window instead (or have a shorter name).

This is more code to maintain without adding much additional
functionality.

## References

[PR 29803](https://github.com/web-platform-tests/wpt/pull/29803)
contains a prototype implementation of this.
Comment on lines +37 to +38
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR seems to have been merged without the RemoteContext bit.