Make new test use local resources only.

This commit is contained in:
Josh Matthews 2016-03-09 12:33:33 -05:00
parent 16096f1a9c
commit d888ed368d
12 changed files with 121 additions and 15 deletions

View file

@ -10,18 +10,14 @@ var t = async_test("Invalid SSL cert noticed");
t.step(function() {
var target = location.href.replace(HTTP_ORIGIN, HTTPS_ORIGIN)
.replace('bad_cert_detected.html',
'resources/origin_helpers.js');
// Servo currently lacks the ability to introspect any content that is blocked
// due to a cert error, so we use a roundabout method to infer that that's happened.
// When the worker has a cert failure, that translates into attempting to evaluate the
// contents of badcert.html as JS, which triggers an exception that currently does not
// propagate to the parent scope. If we _do_ get an error event in the parent scope,
// that means that the cert verification was treated no different than any other
// network error, since we dispatch an error event in that case.
'resources/worker_success.js');
var w = new Worker(target);
w.addEventListener('error', t.unreached_func("cert not detected as invalid"), false);
// We infer that we detected an invalid cert if nothing happens for a few seconds.
setTimeout(function() { t.done() }, 3000);
// If the script executes successfully, it should send a message. That indicates that
// there was no validation failure, which is bad.
w.addEventListener('message', t.unreached_func("cert not detected as invalid"), true);
// When the worker has a cert failure, that translates into an early error that is reported
// to the Worker object.
w.addEventListener('error', t.step_func_done(), true);
});
</script>
</body>

View file

@ -1,5 +1,5 @@
var HTTP_PORT = '{{ports[http][0]}}';
var HTTPS_PORT = '{{ports[https][0]}}';
var ORIGINAL_HOST = '\'{{host}}\'';
var ORIGINAL_HOST = '{{host}}';
var HTTP_ORIGIN = 'http://' + ORIGINAL_HOST + ':' + HTTP_PORT;
var HTTPS_ORIGIN = 'https://' + ORIGINAL_HOST + ':' + HTTPS_PORT;

View file

@ -0,0 +1,5 @@
<html>
<body>
this should be a secure connection
</body>
</html>

View file

@ -0,0 +1 @@
postMessage('load succeeded');

View file

@ -3,8 +3,15 @@
<meta charset=utf-8>
<title>SSL Failure</title>
<link rel=match href=sslfail-ref.html>
<script src="resources/origin_helpers.js?pipe=sub"></script>
</head>
<body>
<iframe src="https://somesite.org/blah"></iframe>
<script>
var iframe = document.createElement('iframe');
document.body.appendChild(iframe);
iframe.src = location.href
.replace(HTTP_ORIGIN, HTTPS_ORIGIN)
.replace('sslfail.html', 'resources/ssl.https.html');
</script>
</body>
</html>