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

How do you concatenate an "undefined" URL prefix? #1867

Open
gsnedders opened this issue Dec 17, 2024 · 0 comments
Open

How do you concatenate an "undefined" URL prefix? #1867

gsnedders opened this issue Dec 17, 2024 · 0 comments

Comments

@gsnedders
Copy link
Member

https://w3c.github.io/webdriver/#dfn-url-prefix defines "URL prefix" to be (ECMAScript's) undefined or a path-absolute URL (an Infra string).

Then in match a request we look at the "concatenation of the URL prefix and the entry's URI template" (step 2) and the "concatenation of URL prefix with entry's URI template" (step 7).

If "URL prefix" is undefined, how is it intended to concatenate them?

Given it's an ECMAScript value, my first assumption would be that we'd use ECMAScript's Addition Operator, then e.g. for a URI template of /session we'd get undefined/session, which for HTTP/1.1 is not a valid request-target.

Also potentially surprising is behaviour if the "URL prefix" is something ending in "/", for example "/". In this case, concatenating the URL prefix and the entry's URI template for a URI template of session would result in //session.

Given ChromeDriver, GeckoDriver, and SafariDriver all expect URLs such as http://localhost:1234/session (and fail given http://localhost:1234//session), this implies the "URL prefix" is actually the empty string in all three cases — which isn't clearly allowed per spec. It would be valid per spec if we defined concatenating undefined to coerce undefined to the empty string, but we don't. That said, it's unclear what we gain by defining it to be undefined rather than the empty string?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant