Backout 12d1d626759c (bug 747215), 11b16556248e (bug 738484) for xpcshell failures on all platforms

This commit is contained in:
Ed Morley 2012-05-03 10:17:42 +01:00
Родитель 3f9a1e49ab
Коммит ea252d7724
5 изменённых файлов: 5 добавлений и 59 удалений

Просмотреть файл

@ -419,8 +419,6 @@ nsHttpChannel::HandleAsyncRedirect()
rv = AsyncProcessRedirection(mResponseHead->Status());
if (NS_FAILED(rv)) {
PopRedirectAsyncFunc(&nsHttpChannel::ContinueHandleAsyncRedirect);
// TODO: if !DoNotRender3xxBody(), render redirect body instead.
// But first we need to cache 3xx bodies (bug 748510)
ContinueHandleAsyncRedirect(rv);
}
}
@ -1101,16 +1099,8 @@ nsHttpChannel::ProcessResponse()
if (NS_FAILED(rv)) {
PopRedirectAsyncFunc(&nsHttpChannel::ContinueProcessResponse);
LOG(("AsyncProcessRedirection failed [rv=%x]\n", rv));
// don't cache failed redirect responses.
if (mCacheEntry)
mCacheEntry->Doom();
if (DoNotRender3xxBody(rv)) {
mStatus = rv;
DoNotifyListener();
} else {
rv = ContinueProcessResponse(rv);
}
}
break;
case 304:
rv = ProcessNotModified();
@ -3563,6 +3553,8 @@ nsHttpChannel::AsyncProcessRedirection(PRUint32 redirectType)
if (mRedirectionLimit == 0) {
LOG(("redirection limit reached!\n"));
// this error code is fatal, and should be conveyed to our listener.
Cancel(NS_ERROR_REDIRECT_LOOP);
return NS_ERROR_REDIRECT_LOOP;
}
@ -3575,6 +3567,7 @@ nsHttpChannel::AsyncProcessRedirection(PRUint32 redirectType)
if (NS_FAILED(rv)) {
LOG(("Invalid URI for redirect: Location: %s\n", location));
Cancel(NS_ERROR_CORRUPTED_CONTENT);
return NS_ERROR_CORRUPTED_CONTENT;
}

Просмотреть файл

@ -288,10 +288,6 @@ private:
(tmpHost1 == tmpHost2));
}
inline static bool DoNotRender3xxBody(nsresult rv) {
return rv == NS_ERROR_REDIRECT_LOOP || rv == NS_ERROR_CORRUPTED_CONTENT;
}
private:
nsCOMPtr<nsISupports> mSecurityInfo;
nsCOMPtr<nsICancelable> mProxyRequest;

Просмотреть файл

@ -128,7 +128,7 @@ ChannelListener.prototype = {
onStopRequest: function(request, context, status) {
try {
var success = Components.isSuccessCode(status);
if (!this._got_onstartrequest)
if (!this._got_onstartrequest && success)
do_throw("onStopRequest without onStartRequest event!");
if (this._got_onstoprequest)
do_throw("Got second onStopRequest event!");

Просмотреть файл

@ -1,42 +0,0 @@
do_load_httpd_js();
/*
* Test whether we fail bad URIs in HTTP redirect as CORRUPTED_CONTENT.
*/
var httpServer = null;
var BadRedirectPath = "/BadRedirect";
var BadRedirectURI = "http://localhost:4444" + BadRedirectPath;
function make_channel(url, callback, ctx) {
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
return ios.newChannel(url, "", null);
}
function BadRedirectHandler(metadata, response)
{
response.setStatusLine(metadata.httpVersion, 301, "Moved");
// '>' in URI will fail to parse: we should not render response
response.setHeader("Location", 'http://localhost:4444>BadRedirect', false);
}
function checkFailed(request, buffer)
{
do_check_eq(request.status, Components.results.NS_ERROR_CORRUPTED_CONTENT);
httpServer.stop(do_test_finished);
}
function run_test()
{
httpServer = new nsHttpServer();
httpServer.registerPathHandler(BadRedirectPath, BadRedirectHandler);
httpServer.start(4444);
var chan = make_channel(BadRedirectURI);
chan.asyncOpen(new ChannelListener(checkFailed, null, CL_EXPECT_FAILURE),
null);
do_test_pending();
}

Просмотреть файл

@ -164,7 +164,6 @@ skip-if = os == "win"
[test_redirect_failure.js]
[test_redirect_passing.js]
[test_redirect_loop.js]
[test_redirect_baduri.js]
[test_reentrancy.js]
[test_reopen.js]
[test_resumable_channel.js]