Auto merge of #27655 - ghostd:xhr-user-pass-priority, r=jdm

Fix wrong priority for XHR username/password

Fix the wrong priority between the username/password from the URL and the username/password from the 'open' call

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #24953

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2020-09-21 13:04:15 -04:00 committed by GitHub
commit 0d5e4b9037
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 15 deletions

View file

@ -390,8 +390,9 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
if parsed_url.host().is_some() {
if let Some(user_str) = username {
parsed_url.set_username(&user_str.0).unwrap();
let password = password.as_ref().map(|pass_str| &*pass_str.0);
parsed_url.set_password(password).unwrap();
}
if let Some(pass_str) = password {
parsed_url.set_password(Some(&pass_str.0)).unwrap();
}
}

View file

@ -1,13 +0,0 @@
[send-authentication-competing-names-passwords.htm]
[XMLHttpRequest user/pass options: pass in URL, user in open()]
expected: FAIL
[XMLHttpRequest user/pass options: user in URL, pass in open()]
expected: FAIL
[XMLHttpRequest user/pass options: user/pass in URL; user in open()]
expected: FAIL
[XMLHttpRequest user/pass options: user/pass in URL; pass in open()]
expected: FAIL