summaryrefslogtreecommitdiffstats
path: root/layout/base/tests/chrome/file_bug1018265.xhtml
blob: a645c325df464e9b22e534cf2c1c8433bbffe381 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1018265
-->
<window title="Mozilla Bug 1018265"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        onload="setTimeout(run, 0);">

  <!-- test code goes here -->
  <script type="application/javascript">
  <![CDATA[

  /** Test for Bug 1018265 **/

  var testcontent = null;

  function run() {
    testcontent = document.getElementById("testcontent");
    shouldHaveTwoNonHiddenContentViewers();
    testcontent.setAttribute("src", "foobarpage");
    setTimeout(errorPageLoaded, 2500)
  }

  function errorPageLoaded() {
    testcontent.addEventListener("pageshow", didGoBack, true);
    setTimeout(function() {testcontent.contentWindow.history.back();}, 0);
  }

  function didGoBack(e) {
    testcontent.removeEventListener("pageshow", didGoBack, true);
    shouldHaveTwoNonHiddenContentViewers();
    window.arguments[0].done();
    window.close();
  }

  function getContentViewer(win) {
    return win.docShell.contentViewer;
  }

  function shouldHaveTwoNonHiddenContentViewers() {
    window.arguments[0].is(getContentViewer(testcontent.contentWindow).isHidden, false, "Top level ContentViewer should not be hidden.");
    window.arguments[0].is(getContentViewer(testcontent.contentWindow.frames[0]).isHidden, false, " Iframe's ContentViewer should not be hidden.");
  }
  ]]>
  </script>

  <browser type="content" id="testcontent" flex="1" src="data:text/html,&lt;iframe&gt;&lt;/iframe&gt;"/>
</window>