w3c / w3c/webdriver

How do you concatenate an "undefined" URL prefix?

Open
#1,867 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug clarification
Dominant language
HTML
Stars
718
Forks
228
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the URL prefix definition and the “match a request” steps 2 and 7 in the WebDriver specification, then compare them with ECMAScript’s Addition Operator and HTTP request-target requirements. Check the stated ChromeDriver, GeckoDriver, and SafariDriver behavior. Done means the specification clearly defines the prefix value and concatenation behavior, including trailing-slash cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.