mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
f495a11892
--HG-- extra : rebase_source : b376fd42a37c8b92389b43fac2e253a8466c3349
82 lines
2.7 KiB
HTML
82 lines
2.7 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=599295
|
|
-->
|
|
<head>
|
|
<title>Test for Bug 599295</title>
|
|
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
|
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
|
</head>
|
|
<body>
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=599295">Mozilla Bug 599295</a>
|
|
<style type="text/css">
|
|
#link1 a { -moz-user-select:none; }
|
|
</style>
|
|
<div id="link1"><a href="http://www.mozilla.org/">link1</a></div>
|
|
<div id="link2"><a href="http://www.mozilla.org/">link2</a></div>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none">
|
|
|
|
</div>
|
|
<pre id="test">
|
|
<script type="application/javascript">
|
|
|
|
/** Test for Bug 599295 **/
|
|
|
|
/* Do not allow a response to a CONNECT method, used to establish an
|
|
SSL tunnel over an HTTP proxy, to contain a redirect */
|
|
|
|
const BinaryInputStream =
|
|
Components.Constructor("@mozilla.org/binaryinputstream;1",
|
|
"nsIBinaryInputStream",
|
|
"setInputStream");
|
|
var listener = {
|
|
_httpstatus : 0,
|
|
|
|
onStartRequest: function(request, context) {
|
|
request.QueryInterface(Components.interfaces.nsIHttpChannel);
|
|
_httpstatus = request.responseStatus;
|
|
},
|
|
|
|
onDataAvailable: function(request, context, stream, offset, count) {
|
|
new BinaryInputStream(stream).readByteArray(count);
|
|
},
|
|
|
|
onStopRequest: function(request, context, status) {
|
|
/* testing here that the redirect was not followed. If it was followed
|
|
we would see a http status of 200 and status of NS_OK */
|
|
|
|
is(_httpstatus, 302, "http status 302");
|
|
is(status, Components.results.NS_ERROR_CONNECTION_REFUSED, "raised refused");
|
|
SimpleTest.finish();
|
|
}
|
|
};
|
|
|
|
function runTest() {
|
|
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
|
getService(Components.interfaces.nsIIOService);
|
|
var uri = ios.newURI("https://redirproxy.example.com/test", "", null);
|
|
var channel = ios.newChannelFromURI(uri);
|
|
|
|
/* Previously, necko would allow a 302 as part of a CONNECT response
|
|
if the LOAD_DOCUMENT_URI flag was set and the original document
|
|
URI had not yet been changed. */
|
|
|
|
channel.loadFlags |= Components.interfaces.nsIChannel.LOAD_DOCUMENT_URI;
|
|
channel.QueryInterface(Components.interfaces.nsIHttpChannelInternal);
|
|
channel.documentURI = uri;
|
|
channel.asyncOpen(listener, null);
|
|
}
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
SimpleTest.waitForFocus(runTest);
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|
|
|