removed race condition possibility from auth cache test & fixed up test errors

This commit is contained in:
Bryan Gilbert 2016-09-15 16:47:05 -04:00
parent 712b1d5ea0
commit 715682c3a8
4 changed files with 40 additions and 22 deletions

View file

@ -1533,7 +1533,7 @@ fn test_if_auth_creds_not_in_url_but_in_cache_it_sets_it() {
password: "test".to_owned(),
};
http_state.auth_cache.write().unwrap().entries.insert(url.origin().clone(), auth_entry);
http_state.auth_cache.write().unwrap().entries.insert(url.origin().clone().ascii_serialization(), auth_entry);
let mut load_data = LoadData::new(LoadContext::Browsing, url, &HttpTest);
load_data.credentials_flag = true;

View file

@ -37479,14 +37479,6 @@
"deleted": [],
"deleted_reftests": {},
"items": {
"testharness": {
"dom/lists/DOMTokenList-Iterable.html": [
{
"path": "dom/lists/DOMTokenList-Iterable.html",
"url": "/dom/lists/DOMTokenList-Iterable.html"
}
]
},
"reftest": {
"http/basic-auth-cache-test.html": [
{
@ -37500,10 +37492,18 @@
"url": "/http/basic-auth-cache-test.html"
}
]
},
"testharness": {
"dom/lists/DOMTokenList-Iterable.html": [
{
"path": "dom/lists/DOMTokenList-Iterable.html",
"url": "/dom/lists/DOMTokenList-Iterable.html"
}
]
}
},
"reftest_nodes": {
"http/reftest-basic-auth-cache-test.html": [
"http/basic-auth-cache-test.html": [
{
"path": "http/basic-auth-cache-test.html",
"references": [

View file

@ -1,6 +1,9 @@
<!doctype html>
<meta charset="utf-8">
<html>
<head>
<meta charset="utf-8">
</head>
<img src="resources/image.png">
<img src="resources/image.png">
</html>

View file

@ -1,15 +1,30 @@
<!doctype html>
<meta charset="utf-8">
<link rel="match" href="basic-auth-cache-test-ref.html">
<html>
<div id="auth"> </div>
<div id="noauth"> </div>
<html id="doc" class="reftest-wait">
<head>
<meta charset="utf-8">
</head>
<link rel="match" href="basic-auth-cache-test-ref.html">
<img id="auth" onload="loadNoAuth()">
<img id="noauth" onload="removeWait()">
<script type="text/javascript">
var authImg = '<img src="http://testuser:testpass@' + window.location.host + '/http/resources/securedimage.py">';
document.getElementById('auth').innerHTML = authImg;
setTimeout(function() {
var noAuthImg = '<img src="http://' + window.location.host + '/http/resources/securedimage.py">';
document.getElementById('noauth').innerHTML = noAuthImg;
}, 100);
function loadAuth() {
var authUrl = 'http://testuser:testpass@' + window.location.host + '/http/resources/securedimage.py';
document.getElementById('auth').src = authUrl;
}
function loadNoAuth() {
var noAuthUrl = 'http://' + window.location.host + '/http/resources/securedimage.py';
document.getElementById('noauth').src = noAuthUrl;
}
function removeWait() {
document.getElementById('doc').className = "";
}
window.onload = loadAuth;
</script>
</html>