blob: d0e8ee9f3d920147a5b659d7caa42b5342996ddb [file] [log] [blame]
function NewXHR(url) {
var r = new XMLHttpRequest"GET", url);
return r;
function SignalSuccess() {
document.location = "title3.html";
function SignalFailure() {
document.location = "title1.html";
function CreateDummyRequest() {
dummy_request = NewXHR("http://mock.http/title2.html");
dummy_request.onload = SignalSuccess;
function RedirectFailed() {
// Good, the redirect was blocked by WebKit.
// We also care that the underlying network stack does not send the redirect.
// We cannot detect that from JS, but our test harness is designed to detect
// that (see ResourceDispatcherTest::CrossOriginRedirectBlocked). Before
// calling SignalSuccess, we want to allow the browser time to notice a request
// to follow the redirect if one should exist. To do that, we just need to
// make another network request.
// The setTimeout call is intended to delay CreateDummyRequest so that any
// processing associated with the current "error" handler completes.
setTimeout(CreateDummyRequest, 0);
function RedirectSucceeded() {
// Oops, the redirect should have been denied!
// Kick off a request that will attempt a cross-origin redirect.
request = NewXHR("http://mock.http/redirect-to-title2.html");
request.onerror = RedirectFailed;
request.onload = RedirectSucceeded;