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

[rb][BiDi] Add Script module commands and types #12082

Open
wants to merge 5 commits into
base: trunk
Choose a base branch
from

Conversation

TamsilAmani
Copy link
Contributor

Description

Add script module commands and types

Motivation and Context

Implement script module commands and types as described in https://w3c.github.io/webdriver-bidi/#module-script.
The majority of classes and interfaces are mapping the common data types as described in https://w3c.github.io/webdriver-bidi/#data-types.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@TamsilAmani TamsilAmani requested a review from titusfortner May 22, 2023 18:26
@TamsilAmani
Copy link
Contributor Author

I have to add one more test for this parameter. I will add it shortly. Also, the work for add/remove preload script will be pushed in a separate PR.

@titusfortner titusfortner requested a review from p0deje May 22, 2023 19:53
Copy link
Member

@p0deje p0deje left a comment

Choose a reason for hiding this comment

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

That's quite a lot of code, any chance we could avoid all the type mapping and just rely on native Ruby types? I understand that not every type exists, but I am not sure when those would be needed as-is? For instance, is there any reason why someone would prefer a returned EvaluateResultException object instead of raised Ruby exception? The latter allows leveraging regular Ruby being ... rescue .. ned to handle exceptions, rather than check for the returned object class.

@titusfortner
Copy link
Member

Yeah, this is a lot of strict typing for Ruby. There is no compile time error checking, so there's less need for all the "enums" and type wrappers. Unless it needs to be processed, it's probably better to just return things as Hashes.

@TamsilAmani
Copy link
Contributor Author

Ok. So I'll try to remove custom-defined classes/objects where possible. I am inclined to go with what is mentioned in w3c spec hence creating those classes. I will push the commit with relevant changes soon. Thank you @titusfortner and @p0deje

@TamsilAmani
Copy link
Contributor Author

@p0deje @titusfortner
Changes made as per the suggestions. Now I am giving the response to the user as it is. No wrapping into object for now.

Copy link
Member

@titusfortner titusfortner left a comment

Choose a reason for hiding this comment

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

Ruby shouldn't be enforcing types this way. We need a better approach for it

@diemol
Copy link
Member

diemol commented Jul 12, 2024

Are we ever merging this?

@diemol diemol added the I-stale Applied to issues that become stale, and eventually closed. label Jul 12, 2024
@aguspe aguspe added the C-rb label Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-rb I-stale Applied to issues that become stale, and eventually closed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants