Open Bug 1791813 Opened 3 years ago Updated 2 years ago

Provide a better error message when cookie creation fails because domain is a TLD

Categories

(Remote Protocol :: Marionette, task, P3)

Default
task

Tracking

(Not tracked)

People

(Reporter: jdescottes, Unassigned)

References

Details

See https://github.com/mozilla/geckodriver/issues/2026

I think the behavior of geckodriver/marionette/firefox is ok here. Using AddCookie with a domain=httpbin.org will attempt to create a "domain" cookie for "httpbin.org", meaning with "Domain=.httpbin.org". This fails because httpbin.org is considered as an effective TLD.

However the error message is very cryptic: "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsICookieManager.add]"

And it's possible that the user only passed "domain" in order to create a cookie with a "Domain" value set to "httpbin.org", and not really to create a "domain cookie". This should be achieved simply by omitting the domain value.

It might be difficult to provide a more actionable error message at the moment, because we get a generic error from Services.cookies.add. If we had a more specific error message we could guide the user, eg "httpbin.org is an effective TLD and domain cookies cannot be created for TLDs. If you wish to create a cookie with Domain=httpbin.org, you can omit the domain parameter"

Priority: -- → P3
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.