|
1 function test() { |
|
2 waitForExplicitFinish(); |
|
3 gPrefService.setBoolPref("dom.disable_open_during_load", false); |
|
4 |
|
5 var browser = gBrowser.selectedBrowser; |
|
6 browser.addEventListener("load", function () { |
|
7 browser.removeEventListener("load", arguments.callee, true); |
|
8 |
|
9 if (gPrefService.prefHasUserValue("dom.disable_open_during_load")) |
|
10 gPrefService.clearUserPref("dom.disable_open_during_load"); |
|
11 |
|
12 findPopup(); |
|
13 }, true); |
|
14 |
|
15 content.location = |
|
16 "data:text/html,<html><script>popup=open('about:blank','','width=300,height=200')</script>"; |
|
17 } |
|
18 |
|
19 function findPopup() { |
|
20 var enumerator = Services.wm.getEnumerator("navigator:browser"); |
|
21 |
|
22 while (enumerator.hasMoreElements()) { |
|
23 let win = enumerator.getNext(); |
|
24 if (win.content.wrappedJSObject == content.wrappedJSObject.popup) { |
|
25 testPopupUI(win); |
|
26 return; |
|
27 } |
|
28 } |
|
29 |
|
30 throw "couldn't find the popup"; |
|
31 } |
|
32 |
|
33 function testPopupUI(win) { |
|
34 var doc = win.document; |
|
35 |
|
36 ok(win.gURLBar, "location bar exists in the popup"); |
|
37 isnot(win.gURLBar.clientWidth, 0, "location bar is visible in the popup"); |
|
38 ok(win.gURLBar.readOnly, "location bar is read-only in the popup"); |
|
39 isnot(doc.getElementById("Browser:OpenLocation").getAttribute("disabled"), "true", |
|
40 "'open location' command is not disabled in the popup"); |
|
41 |
|
42 let historyButton = doc.getAnonymousElementByAttribute(win.gURLBar, "anonid", |
|
43 "historydropmarker"); |
|
44 is(historyButton.clientWidth, 0, "history dropdown button is hidden in the popup"); |
|
45 |
|
46 EventUtils.synthesizeKey("t", { accelKey: true }, win); |
|
47 is(win.gBrowser.browsers.length, 1, "Accel+T doesn't open a new tab in the popup"); |
|
48 |
|
49 EventUtils.synthesizeKey("w", { accelKey: true }, win); |
|
50 ok(win.closed, "Accel+W closes the popup"); |
|
51 |
|
52 if (!win.closed) |
|
53 win.close(); |
|
54 gBrowser.addTab(); |
|
55 gBrowser.removeCurrentTab(); |
|
56 finish(); |
|
57 } |