Repository navigation
Clipboard API: use bless() instead - #37098
marcoscaceres wants to merge 8 commits into
Conversation
|
@marcoscaceres looking at the test results here, it looks like 3 tests have gone missing: The same can be seen for Chrome and Firefox. Can you check what might be going on with this? |
1f238b3 to
e1a04ee
Compare
|
Let's see if the strange missing tests situation corrects itself... not sure why that would happen. |
|
@saschanaz, hopefully better now 🙈 |
saschanaz
left a comment
There was a problem hiding this comment.
Maybe check why lint failed tho.
|
Hehe, I like letting the bots do the work🤖 will check, don’t worry. |
saschanaz
left a comment
There was a problem hiding this comment.
Hmmm wpt.fyi results show regressions for all browsers, can you check that too?
|
(You might want to keep the load event listener inside the current waitForUserActivation?) |
|
Why not just replace the implementation of waitForUserActivation is far more readable in the test - how many people know that test_driver.bless() means the test waits for user activation? I know I wasn't aware of that. See also saschanaz's comment, since keeping waitForUserActivation would make it easier to keep the 'load' listener, and also add workarounds if in the future we find a scenario where |
That adds additional layers of indirection: test ➡️ user-activation.js ➡️ test_driver...
Right, but it's the same problem with
I understand. That should have been caught in review (and it's part of all of us learning what the test_driver API provides). This was caught because it then goes into WebKit's review.
Right, but we should only use something like waitForUserActivation() in cases where bless() doesn't do what we need. The load listener might be a more general issue with the test design, which we hopefully shouldn't need at all. I'll take a look. |
ef38fd5 to
739a448
Compare
|
Ok, so, noting that bless() supports user activation within iframes. The load was using the wait for load on the iframes, but it's less racy to just set that explicitly. I've updated the tests to do that... |
| } | ||
| }); | ||
| </script> | ||
| </html> |
There was a problem hiding this comment.
Don't need this... there's no matching head one either.
|
@saschanaz, @garykac, let me know what you think! Hopefully this captures the intent better. |
e14e1b7 to
a12c1d4
Compare
| await new Promise(resolve => { | ||
| iframe.onload = resolve; | ||
| iframe.src = 'about:blank'; | ||
| }); |
There was a problem hiding this comment.
Hmm? Are we sure loading about:blank is synchronous everywhere? The existing wait code in waitForUserActivation is better IMO.
And we probably should still have a helper function for this.
| const blobInput = new Blob(['test string'], {type: 'text/plain'}); | ||
| const clipboardItemInput = new ClipboardItem({'text/plain': blobInput}); | ||
| await waitForUserActivation(); | ||
| await test_driver.bless("clipboard", null, iframe.contentWindow); |
There was a problem hiding this comment.
Wouldn't this change the test behavior here? Previously it clicked the parent page and now this clicks the iframe. wpt.fyi reports no change though.
And should the intent argument be passed consistently?
|
Ok, closing this as I'm not getting time to go through them properly. |
Replaces
waitForUserActivation()fortest_driver.bless(). They functionally do the same thing, but bless is better for devices where an actual clickable thing needs to be activated.