summaryrefslogtreecommitdiff
path: root/browser/base/content/test/browser_findbarClose.js
blob: 7a4ff5470693e7020c5997438567ba07aa1085b3 (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
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

// Tests find bar auto-close behavior

let newTab, iframe;

function test() {
  waitForExplicitFinish();
  newTab = gBrowser.addTab("about:blank");
  newTab.linkedBrowser.addEventListener("DOMContentLoaded",
    prepareTestFindBarStaysOpenOnSubdocumentLocationChange, false);
  newTab.linkedBrowser.contentWindow.location = "http://example.com/browser/" +
    "browser/base/content/test/test_bug628179.html";
}

function prepareTestFindBarStaysOpenOnSubdocumentLocationChange() {
  newTab.linkedBrowser.removeEventListener("DOMContentLoaded",
    prepareTestFindBarStaysOpenOnSubdocumentLocationChange, false);

  gFindBar.open();

  iframe = newTab.linkedBrowser.contentDocument.getElementById("iframe");
  iframe.addEventListener("load",
    testFindBarStaysOpenOnSubdocumentLocationChange, false);
  iframe.src = "http://example.org/";
}

function testFindBarStaysOpenOnSubdocumentLocationChange() {
  iframe.removeEventListener("load",
    testFindBarStaysOpenOnSubdocumentLocationChange, false);

  ok(!gFindBar.hidden, "the Find bar isn't hidden after the location of a " +
     "subdocument changes");

  gFindBar.close();
  gBrowser.removeTab(newTab);
  finish();
}