Open Bug 1470976 Opened 2 years ago Updated 1 year ago

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


(Testing :: geckodriver, defect, P3)



(Not tracked)


(Reporter: whimboo, Unassigned)


(Blocks 1 open bug, )


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:

The spec explains:

> 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:

> {}


> {"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 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.