mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Make SSL cert verification errors work again. Add a horrible, no-good, very bad regression test.
This commit is contained in:
parent
50be4bb09e
commit
5e123df7a7
4 changed files with 63 additions and 20 deletions
|
@ -4559,6 +4559,12 @@
|
|||
"url": "/_mozilla/mozilla/MouseEvent.html"
|
||||
}
|
||||
],
|
||||
"mozilla/bad_cert_detected.html": [
|
||||
{
|
||||
"path": "mozilla/bad_cert_detected.html",
|
||||
"url": "/_mozilla/mozilla/bad_cert_detected.html"
|
||||
}
|
||||
],
|
||||
"mozilla/blob.html": [
|
||||
{
|
||||
"path": "mozilla/blob.html",
|
||||
|
@ -9622,4 +9628,4 @@
|
|||
"rev": null,
|
||||
"url_base": "/_mozilla/",
|
||||
"version": 2
|
||||
}
|
||||
}
|
||||
|
|
28
tests/wpt/mozilla/tests/mozilla/bad_cert_detected.html
Normal file
28
tests/wpt/mozilla/tests/mozilla/bad_cert_detected.html
Normal file
|
@ -0,0 +1,28 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/origin_helpers.js?pipe=sub"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
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.
|
||||
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);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,5 @@
|
|||
var HTTP_PORT = '{{ports[http][0]}}';
|
||||
var HTTPS_PORT = '{{ports[https][0]}}';
|
||||
var ORIGINAL_HOST = '\'{{host}}\'';
|
||||
var HTTP_ORIGIN = 'http://' + ORIGINAL_HOST + ':' + HTTP_PORT;
|
||||
var HTTPS_ORIGIN = 'https://' + ORIGINAL_HOST + ':' + HTTPS_PORT;
|
Loading…
Add table
Add a link
Reference in a new issue