-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Custom handlers automation #8267
Custom handlers automation #8267
Conversation
source
Outdated
|
||
<hr> | ||
|
||
<p>The <dfn>current registration automation mode</dfn> tracks what |
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.
What does the "current registration automation mode" belong to? Is it user-agent wide? Window? 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.
My gut feeling is that it should belong to a Browser Context, but I'd appreciate comments and / or suggestions on that regard.
Since this flag/attribute is intended for testing purposes only, and give than we might encourage that the user agent first verify that its handled in an automation context, it makes sense that its indeed associated to a browser 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.
My default suggestion would be Document. I would be surprised if you set this, and then navigated to a totally different page (e.g. on another origin), and the setting persisted.
However, if such browsing context-wide impacts are normal for WebDriver, then maybe browsing context is better.
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.
I admit you are right that is difficult to imagine a scenario where is useful to keep this flag across different Documents. However, many of the currently defined WebDriver commands "happen in the context of either the current browsing context or current top-level browsing context".
Additionally, if I've understood it correctly, the WPT's testdriver,js, which is the JS implementation of the WebDriver client, is expected to operate across different browser context.
I'm not sure whether restricting the use of the "current registration automation mode" to the Document would limit how we could use it to define certain tests.
The Secure Payment Confirmation spec, which inspired me to define this new extension command, doesn't specify where the current-transaction-automation-mode belongs to. I agree we could do better in this PR and specify clearly that this flag is stored either in the current browser context or in its associated active document, whatever we end up agreeing on.
I'd like to get feedback from @jgraham on this regard, but my opinion is still that using the Browser Context is more convenient in this case.
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.
Most current WebDriver commands aren't setting state that persists across navigation, so although they operate at the level of browsing contexts, the action of the command is on the active document in that context.
The exceptions are mostly WebDriver-internal state which is mostly per session (i.e. global). Argably the closest analogue to this feature is the User Prompt handler, which is a global setting which affects what happens when an alert appears. I don't think that's good design, but in the context of WebDriver it makes sense; in particular if the handler was per-document then it wouldn't be possible to reliably setup the handling before an alert appears.
So I think the question is: do you need to handle cases where registerProtocolHandler
is called without user interaction? If not per-document state is probably fine. If you do then it's hard to see how to make that work without the state being global.
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.
At least Chrome, and I believe is Firefox too, require that calls to registerProtocolHandler are done under a transient user activation. Hence, in order to define automated tests we would need to use the test_driver.bless function. You can see some WPT examples in the PR I have for this proposal.
The state we are adding here would only apply under a testing context and only modified via the WebDriver extension command. I agree that its goal is almost the same than the User Prompt Handler; as a matter of fact II tried to implement the automated tests using it, but it only works with simple dialogs so its not an option in this case.
As I commented in the issue where I introduced the proposal, we already have a WebDriver extension command that provides a similar feature, the Set SPC Transaction Mode command. Unfortunately, in that spec it doesn't specify where the state belongs to.
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.
Most current WebDriver commands aren't setting state that persists across navigation, so although they operate at the level of browsing contexts, the action of the command is on the active document in that context.
Based on this comment from @jgraham and @domenic's preference for Document as the owner of this new flag, I'll change the PR to sate it explicitly.
source
Outdated
argument</span>.</p> | ||
</li> | ||
<li> | ||
<p>Set the <span>current registration automation mode</span> to <i>mode</i>.</p> |
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.
Same problem here with what object the current registration automation mode belongs to.
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.
As I said before, I believe this should belong to the browser context.
Thanks for the review. See my comments inline. |
Hi @domenic I pushed some changes, trying to address all the changes requested in the last review. Could you please take another look ? |
source
Outdated
|
||
<hr> | ||
|
||
<p>The <dfn>current registration automation mode</dfn> tracks what |
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.
My default suggestion would be Document. I would be surprised if you set this, and then navigated to a totally different page (e.g. on another origin), and the setting persisted.
However, if such browsing context-wide impacts are normal for WebDriver, then maybe browsing context is better.
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.
OK, mostly editorial stuff, plus the big question of where the current registration mode should be stored, which is still outstanding.
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.
OK. I made a variety of changes in my last few commits to fix remaining errors. Please take a look and let me know if they look reasonable. In that case, we can proceed to merge this.
Hi @domenic, thanks for the reviews and the last edits; they all look good to me. |
Hmm, I realized this doesn't actually have multi-implementer support? I guess you are implementing for Chromium, but you linked to mozilla/standards-positions#685 for Mozilla, which has no replies. Let me know when you have a second implementer interested, and then we can merge. |
Yes, I''ve got some informal support from @jgraham during a meeting to review the WPT RFC , but I agree we should wait until we got explicit support in the position request. There is also an ongoing conversation in the Firefox bug I've filed, but again still not clear support there either. |
There was some recent feedback on the mozilla standard-position request; do you think it'd be enough to move forward ? |
Let's ask: @jgraham, based on your comments there, would you be happy to see this in the HTML Standard? |
FWIW, I'm in conversations with some Firefox devs regarding the implementation of this webdriver extension command in Marionette. |
I'd say if other implementors are happy with this approach then Mozilla are too. |
The PR#8267 [1] for the HTML spec introduced a new WebDriver extension command to allow testing automation for the registerProtocolHandler method of the Custom Handlers API. This CL adds support in ChromeDriver for such extension command. See also the Web Platform Test PR [2] and RFC [3] for further details. The extension command relies on a new CDP command implemented in a different CL [4]. [1] whatwg/html#8267 [2] web-platform-tests/wpt#35792 [3] web-platform-tests/rfcs#121 [4] https://crrev.com/c/4203529 Bug: 1359103 Change-Id: Ifd4385815ab30a40f46c2f083dc9604024060613 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4200660 Reviewed-by: Vladimir Nechaev <nechaev@chromium.org> Commit-Queue: Javier Fernandez <jfernandez@igalia.com> Cr-Commit-Position: refs/heads/main@{#1100968}
This commit adds a new subsection about User Agent Automation in the Custom Handlers section. The purpose of this new subsection is to define a new WebDriver extension command to define auto-replies for the prompt dialog that the spec suggests to offer to the user in order to grant the registration of a new protocol handler.
Fixes #8251.
/index.html ( diff )
/infrastructure.html ( diff )
/references.html ( diff )
/system-state.html ( diff )