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

[WebDriver BiDi] Fix test for window.prompt opened #46441

Merged
merged 3 commits into from
May 24, 2024

Conversation

Lightning00Blade
Copy link
Contributor

In the HTML IDL - https://html.spec.whatwg.org/#the-window-object the function is defined as:
prompt(optional DOMString message = "", optional DOMString default = "");
This means that if no value is passed it get empty string.
I also observed that all values passed to the second parameter get toString(ed) (I think this is the algorithm that does it https://webidl.spec.whatwg.org/#js-DOMString),
Verified this behavior for Chrome, Firefox and Safari.

@lutien
Copy link
Contributor

lutien commented May 23, 2024

I think we probably then have to update the BiDi spec, because now it assumes that defaultValue might be null: https://w3c.github.io/webdriver-bidi/#event-browsingContext-userPromptOpened

@Lightning00Blade
Copy link
Contributor Author

@lutien We need the null check in the spec due to other algorithms (alert, confirm, beforeunload),
not having it send from the HTML spec. And it seems default value value for prompt is always present and String.
So we want the value to be omitted for the other types but our expectation should that it is always set for prompt.

Copy link
Contributor

@lutien lutien left a comment

Choose a reason for hiding this comment

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

@lutien We need the null check in the spec due to other algorithms (alert, confirm, beforeunload), not having it send from the HTML spec. And it seems default value value for prompt is always present and String. So we want the value to be omitted for the other types but our expectation should that it is always set for prompt.

Ah, alright, that sounds reasonable to me. Thanks!

…prompt_opened.py

Co-authored-by: Maksim Sadym <69349599+sadym-chromium@users.noreply.github.com>
@Lightning00Blade Lightning00Blade merged commit a48548e into master May 24, 2024
19 checks passed
@Lightning00Blade Lightning00Blade deleted the webdriver-bidi-fix-default-prompt-tests branch May 24, 2024 11:11
Lightning00Blade added a commit to GoogleChromeLabs/chromium-bidi that referenced this pull request May 24, 2024
Ref: web-platform-tests/wpt#46441, this need to
be merged else test will fail.
Also make the test run in CI.

---------

Signed-off-by: Browser Automation Bot <browser-automation-bot@google.com>
Co-authored-by: Browser Automation Bot <browser-automation-bot@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants