|
1 function test() { |
|
2 waitForExplicitFinish(); |
|
3 // test the main (normal) browser window |
|
4 testCustomize(window, testChromeless); |
|
5 } |
|
6 |
|
7 function testChromeless() { |
|
8 // test a chromeless window |
|
9 var newWin = openDialog(getBrowserURL(), "_blank", |
|
10 "chrome,dialog=no,location=yes,toolbar=no", "about:blank"); |
|
11 ok(newWin, "got new window"); |
|
12 |
|
13 whenDelayedStartupFinished(newWin, function () { |
|
14 // Check that the search bar is hidden |
|
15 var searchBar = newWin.BrowserSearch.searchBar; |
|
16 ok(searchBar, "got search bar"); |
|
17 |
|
18 var searchBarBO = searchBar.boxObject; |
|
19 is(searchBarBO.width, 0, "search bar hidden"); |
|
20 is(searchBarBO.height, 0, "search bar hidden"); |
|
21 |
|
22 testCustomize(newWin, function () { |
|
23 newWin.close(); |
|
24 finish(); |
|
25 }); |
|
26 }); |
|
27 } |
|
28 |
|
29 function testCustomize(aWindow, aCallback) { |
|
30 var fileMenu = aWindow.document.getElementById("file-menu"); |
|
31 ok(fileMenu, "got file menu"); |
|
32 is(fileMenu.disabled, false, "file menu initially enabled"); |
|
33 |
|
34 openToolbarCustomizationUI(function () { |
|
35 // Can't use the property, since the binding may have since been removed |
|
36 // if the element is hidden (see bug 422590) |
|
37 is(fileMenu.getAttribute("disabled"), "true", |
|
38 "file menu is disabled during toolbar customization"); |
|
39 |
|
40 closeToolbarCustomizationUI(onClose, aWindow); |
|
41 }, aWindow); |
|
42 |
|
43 function onClose() { |
|
44 is(fileMenu.getAttribute("disabled"), "false", |
|
45 "file menu is enabled after toolbar customization"); |
|
46 |
|
47 if (aCallback) |
|
48 aCallback(); |
|
49 } |
|
50 } |