-
Notifications
You must be signed in to change notification settings - Fork 70
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
jgraham
wants to merge
1
commit into
master
Choose a base branch
from
testdriver_remote_context
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]); | ||
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This PR seems to have been merged without the |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.