|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 // Tests find bar auto-close behavior |
|
5 |
|
6 let newTab, iframe; |
|
7 |
|
8 function test() { |
|
9 waitForExplicitFinish(); |
|
10 newTab = gBrowser.addTab("about:blank"); |
|
11 newTab.linkedBrowser.addEventListener("DOMContentLoaded", |
|
12 prepareTestFindBarStaysOpenOnSubdocumentLocationChange, false); |
|
13 newTab.linkedBrowser.contentWindow.location = "http://example.com/browser/" + |
|
14 "browser/base/content/test/general/test_bug628179.html"; |
|
15 } |
|
16 |
|
17 function prepareTestFindBarStaysOpenOnSubdocumentLocationChange() { |
|
18 newTab.linkedBrowser.removeEventListener("DOMContentLoaded", |
|
19 prepareTestFindBarStaysOpenOnSubdocumentLocationChange, false); |
|
20 |
|
21 gFindBar.open(); |
|
22 |
|
23 iframe = newTab.linkedBrowser.contentDocument.getElementById("iframe"); |
|
24 iframe.addEventListener("load", |
|
25 testFindBarStaysOpenOnSubdocumentLocationChange, false); |
|
26 iframe.src = "http://example.org/"; |
|
27 } |
|
28 |
|
29 function testFindBarStaysOpenOnSubdocumentLocationChange() { |
|
30 iframe.removeEventListener("load", |
|
31 testFindBarStaysOpenOnSubdocumentLocationChange, false); |
|
32 |
|
33 ok(!gFindBar.hidden, "the Find bar isn't hidden after the location of a " + |
|
34 "subdocument changes"); |
|
35 |
|
36 gFindBar.close(); |
|
37 gBrowser.removeTab(newTab); |
|
38 finish(); |
|
39 } |
|
40 |