summaryrefslogtreecommitdiffstats
path: root/docshell/test/browser/browser_uriFixupAlternateRedirects.js
blob: f5a00a2df3e140a47efd816863452fd86ff2b9cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"use strict";

const REDIRECTURL = "http://www.example.com/browser/docshell/test/browser/redirect_to_example.sjs"

add_task(function* () {
  let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank");
  gURLBar.value = REDIRECTURL;
  gURLBar.select();
  let errorPageLoaded = BrowserTestUtils.waitForErrorPage(tab.linkedBrowser);
  EventUtils.sendKey("return");
  yield errorPageLoaded;
  let [contentURL, originalURL] = yield ContentTask.spawn(tab.linkedBrowser, null, () => {
    return [
      content.document.documentURI,
      content.document.mozDocumentURIIfNotForErrorPages.spec,
    ];
  });
  info("Page that loaded: " + contentURL);
  ok(contentURL.startsWith("about:neterror?"), "Should be on an error page");
  originalURL = new URL(originalURL);
  is(originalURL.host, "example", "Should be an error for http://example, not http://www.example.com/");

  yield BrowserTestUtils.removeTab(tab);
});