Open Bug 1470976 Opened 2 years ago Updated 1 year ago

New Session with body "{}" should assume default session config

Categories

(Testing :: geckodriver, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: whimboo, Unassigned)

References

(Blocks 1 open bug, )

Details

The wdspec tests expect that passing a body of `{}` to the New Session command, will actually not create the session. An error of type InvalidArgument has to be returned.

geckodriver internally converts the passed-in empty object to `{"capabilities":{"desiredCapabilities":{}}}`, which then let Marionette successfully create the session.

Here the appropriate wdspec test:

https://dxr.mozilla.org/mozilla-central/rev/681eb7dfa324dd50403c382888929ea8b8b11b00/testing/web-platform/tests/webdriver/tests/new_session/default_values.py#21-23

The spec explains:

https://w3c.github.io/webdriver/#dfn-capabilities-processing

> 1. Let capabilities request be the result of getting the property "capabilities" from parameters.
>
>  1.1 If capabilities request is not a JSON object, return error with error code invalid argument.
`{}` is valid json object
(In reply to David Burns :automatedtester from comment #1)
> `{}` is valid json object

Sure, but that is for the body of the request aka `parameters`. Given the 2 lines from the spec above, `capabilities` would be `null` if geckodriver wouldn't rewrite the JSON data, and as such should return an invalid argument error.

So my question stands, why does geckodriver rewrite it, or what's wrong with the spec.
I would assume these two bodies to be functionally equivalent:

> {}

And:

> {"capabilities": {}}

Currently they are not for the reasons whimboo gives in comment #2.

I will file an issue against the WebDriver specification.
Blocks: webdriver
Summary: New Session with body "{}" has to raise an InvalidArgument error → New Session with body "{}" should assume default session config
Flags: needinfo?(ato)
I’ve filed https://github.com/w3c/webdriver/issues/1306 against the
specification.  I think that geckodriver’s current behaviour, of
accepting "{}" as input to New Session, is the correct behaviour.
We should get the specification issue resolved so that we can resolve
this bug.
You need to log in before you can comment on or make changes to this bug.