webdriver: Improve error reporting for Cookie Addition#43690
webdriver: Improve error reporting for Cookie Addition#43690TimvdLippe merged 4 commits intoservo:mainfrom
Conversation
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
|
🤖 Opened new upstream WPT pull request (web-platform-tests/wpt#58773) with upstreamable changes. |
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
4bc9340 to
84c6d2a
Compare
yezhizhen
left a comment
There was a problem hiding this comment.
Bug with spec again. All browsers behave like what we implements in this PR.
| // If cookie domain is not equal to session's current browsing context's | ||
| // active document's domain, return error with error code invalid cookie domain. | ||
| (false, Some(_)) => Err(ErrorStatus::InvalidCookieDomain), |
There was a problem hiding this comment.
Actually the spec says "invalid argument" for this. However, all browsers do InvalidCookieDomain.
The definition of InvalidCookieDomain is: An illegal attempt was made to set a cookie under a different domain than the current page. This makes sense, and we should fix spec to throw "invalid cookie domain" instead of "argument".
Another proof is, the new test I added but reverted fails for all other browsers:
def test_add_cookie_with_domain_not_matching_current_domain(session, url):
session.url = url("/common/blank.html")
new_cookie = {
"name": "hello",
"value": "world",
"domain": "example.com",
"path": "/",
"httpOnly": False,
"secure": False
}
response = add_cookie(session, new_cookie)
assert_error(response, "invalid argument")|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#58773). |
|
✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#58773) title and body. |
|
🔨 Triggering try run (#23596269609) for Linux (WPT) |
|
✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#58773) title and body. |
|
✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#58773) title and body. |
|
Test results for linux-wpt from try job (#23596269609): Flaky unexpected result (24)
Stable unexpected results that are known to be intermittent (23)
|
|
✨ Try run (#23596269609) succeeded. |
Improve the error reporting for cookie addition.
Most notably, when
There is a bug with spec: #43690 (comment).
We fix spec in w3c/webdriver#1955 and
make sure Servo behaves consistently with other browsers.
Testing: Added one test for invalid expiry time. New passing with existing.