imported patch fix-tests

This commit is contained in:
Dan Witte 2010-08-13 21:18:05 -07:00
parent f6f1960f9e
commit b2630233ec

View File

@ -214,23 +214,24 @@ function run_test() {
// Authentication (no password; working resume) // Authentication (no password; working resume)
// (should not give us any data) // (should not give us any data)
// XXX skip all authentication tests for now, as they're busted on e10s (bug 587146) // XXX skip authentication tests on e10s (bug 587146)
try { // nsIXULRuntime is not available in some configurations. try { // nsIXULRuntime is not available in some configurations.
let processType = Components.classes["@mozilla.org/xre/runtime;1"]. let processType = Components.classes["@mozilla.org/xre/runtime;1"].
getService(Components.interfaces.nsIXULRuntime).processType; getService(Components.interfaces.nsIXULRuntime).processType;
if (processType == Components.interfaces.nsIXULRuntime.PROCESS_TYPE_DEFAULT) { if (processType != Components.interfaces.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
// 404 page (same content length as real content)
var chan = make_channel("http://localhost:4444/range"); var chan = make_channel("http://localhost:4444/range");
chan.nsIResumableChannel.resumeAt(1, entityID); chan.nsIResumableChannel.resumeAt(1, entityID);
chan.nsIHttpChannel.setRequestHeader("X-Need-Auth", "true", false); chan.nsIHttpChannel.setRequestHeader("X-Want-404", "true", false);
chan.asyncOpen(new ChannelListener(test_auth_nopw, null, CL_EXPECT_FAILURE), null); chan.asyncOpen(new ChannelListener(test_404, null, CL_EXPECT_FAILURE), null);
return;
} }
} catch (e) { } } catch (e) { }
// 404 page (same content length as real content)
var chan = make_channel("http://localhost:4444/range"); var chan = make_channel("http://localhost:4444/range");
chan.nsIResumableChannel.resumeAt(1, entityID); chan.nsIResumableChannel.resumeAt(1, entityID);
chan.nsIHttpChannel.setRequestHeader("X-Want-404", "true", false); chan.nsIHttpChannel.setRequestHeader("X-Need-Auth", "true", false);
chan.asyncOpen(new ChannelListener(test_404, null, CL_EXPECT_FAILURE), null); chan.asyncOpen(new ChannelListener(test_auth_nopw, null, CL_EXPECT_FAILURE), null);
} }
function test_auth_nopw(request, data, ctx) { function test_auth_nopw(request, data, ctx) {
@ -285,22 +286,11 @@ function run_test() {
do_check_eq(request.status, NS_ERROR_ENTITY_CHANGED); do_check_eq(request.status, NS_ERROR_ENTITY_CHANGED);
do_check_eq(request.nsIHttpChannel.responseStatus, 416); do_check_eq(request.nsIHttpChannel.responseStatus, 416);
// XXX skip redirect/resume tests, as they're busted on e10s (bug 587165) // Redirect + successful resume
try { // nsIXULRuntime is not available in some configurations. var chan = make_channel("http://localhost:4444/redir");
let processType = Components.classes["@mozilla.org/xre/runtime;1"]. chan.nsIHttpChannel.setRequestHeader("X-Redir-To", "http://localhost:4444/range", false);
getService(Components.interfaces.nsIXULRuntime).processType; chan.nsIResumableChannel.resumeAt(1, entityID);
if (processType == Components.interfaces.nsIXULRuntime.PROCESS_TYPE_DEFAULT) { chan.asyncOpen(new ChannelListener(test_redir_resume, null), null);
// Redirect + successful resume
var chan = make_channel("http://localhost:4444/redir");
chan.nsIHttpChannel.setRequestHeader("X-Redir-To", "http://localhost:4444/range", false);
chan.nsIResumableChannel.resumeAt(1, entityID);
chan.asyncOpen(new ChannelListener(test_redir_resume, null), null);
} else {
httpserver.stop(do_test_finished);
}
} catch (e) {
httpserver.stop(do_test_finished);
}
} }
function test_redir_resume(request, data, ctx) { function test_redir_resume(request, data, ctx) {