1 const gHttpTestRoot = "http://example.com/browser/dom/base/test/";
3 add_task(async function () {
5 var xhr = new XMLHttpRequest();
7 observe(aSubject, aTopic, aData) {
9 var channel = aSubject.QueryInterface(Ci.nsIHttpChannel);
10 channel.getResponseHeader("Location");
14 statusTexts.push(xhr.statusText);
18 Services.obs.addObserver(observer, "http-on-examine-response");
19 await new Promise(resolve => {
20 xhr.addEventListener("load", function () {
21 statusTexts.push(this.statusText);
22 is(statusTexts[0], "", "Empty statusText value for HTTP 302");
23 is(statusTexts[1], "OK", "OK statusText value for the redirect.");
26 xhr.open("GET", gHttpTestRoot + "file_bug1011748_redirect.sjs", true);
30 Services.obs.removeObserver(observer, "http-on-examine-response");