Skip to content

Conversation

@yezhizhen
Copy link
Member

@yezhizhen yezhizhen commented Nov 21, 2025

I wanted to implement implicit wait for other commands, such as send key/element clear/click. But the current trait bound, parameters, and logic are way too tight and specific.

Testing: This should not change existing behaviour.

@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 21, 2025
Copy link
Member Author

@yezhizhen yezhizhen left a comment

Choose a reason for hiding this comment

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

Dear reviewers,

Please just check the first commit. The change is large because of fmt.

Best,
Euclid

@yezhizhen yezhizhen marked this pull request as draft November 21, 2025 09:28
@yezhizhen yezhizhen marked this pull request as ready for review November 21, 2025 09:38
where
T: for<'de> Deserialize<'de> + Serialize,
callback: impl Fn() -> Result<T, WebDriverError>,
can_early_return: impl Fn(&T) -> bool,
Copy link
Member

Choose a reason for hiding this comment

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

Hrm. Another option here to simplify things is to make it so that callback is callback: impl Fn() -> Result<Option<T>, WebDriverError> and ignore None results. That should give you more flexibility with how you implement the callback because it could also depend on some other kind of state in a more straight-forward way.

Copy link
Member Author

Choose a reason for hiding this comment

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

Make sense!

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried a while. It seems Option is hard in this case. But bool make things easy.

@yezhizhen yezhizhen force-pushed the make-implicit-general branch 2 times, most recently from 0d2706f to 168469b Compare November 21, 2025 13:50
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
@yezhizhen yezhizhen force-pushed the make-implicit-general branch from 168469b to 0e22d4b Compare November 21, 2025 13:51
where
T: for<'de> Deserialize<'de> + Serialize,
{
callback: impl Fn() -> Result<(bool, T), WebDriverError>,
Copy link
Member Author

Choose a reason for hiding this comment

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

Putting bool first to avoid potential cloning of T.

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Nov 21, 2025
@mrobinson mrobinson changed the title webdriver: Genearlize implicit_wait webdriver: Generalize implicit_wait Nov 21, 2025
@yezhizhen yezhizhen added this pull request to the merge queue Nov 22, 2025
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 22, 2025
Merged via the queue into servo:main with commit 35f9a0d Nov 22, 2025
33 checks passed
@yezhizhen yezhizhen deleted the make-implicit-general branch November 22, 2025 05:05
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants