gecko/content/media/test/redirect.sjs
Chris Pearce c7317b404d Bug 564720 - Refactor media tests to be backend independent were possible. r=roc
--HG--
rename : content/media/test/test_play.html => content/media/test/test_play_events.html
rename : content/media/test/test_progress2.html => content/media/test/test_progress.html
rename : content/media/test/test_onloadedmetadata.html => content/media/test/test_replay_metadata.html
rename : content/media/test/test_wav_trunc_seek.html => content/media/test/test_seek_out_of_range.html
rename : content/media/test/test_bug495319.html => content/media/test/test_timeupdate_small_files.html
rename : content/media/test/test_bug486646.html => content/media/test/test_video_to_canvas.html
2010-05-31 10:02:06 +12:00

26 lines
844 B
JavaScript

// Return file content for the first request with a given key.
// All subsequent requests return a redirect to a different-origin resource.
function handleRequest(request, response)
{
var params = request.queryString.split('&');
var domain = null;
var file = null;
var allowed = false;
for (var i=0; i<params.length; i++) {
var kv = params[i].split('=');
if (kv.length == 1 && kv[0] == 'allowed') {
allowed = true;
} else if (kv.length == 2 && kv[0] == 'file') {
file = kv[1];
} else if (kv.length == 2 && kv[0] == 'domain') {
domain = kv[1];
}
}
response.setStatusLine(request.httpVersion, 303, "See Other");
response.setHeader("Location", "http://" + domain + "/tests/content/media/test/" + (allowed ? "allowed.sjs?" : "") + file);
response.setHeader("Content-Type", "text/html");
}