|
1 const goodURL = "http://mochi.test:8888/"; |
|
2 const badURL = "http://mochi.test:8888/whatever.html"; |
|
3 |
|
4 function test() { |
|
5 waitForExplicitFinish(); |
|
6 |
|
7 gBrowser.selectedTab = gBrowser.addTab(goodURL); |
|
8 gBrowser.selectedBrowser.addEventListener("load", onload, true); |
|
9 } |
|
10 |
|
11 function onload() { |
|
12 gBrowser.selectedBrowser.removeEventListener("load", onload, true); |
|
13 |
|
14 is(gURLBar.value, gURLBar.trimValue(goodURL), "location bar reflects loaded page"); |
|
15 |
|
16 typeAndSubmit(badURL); |
|
17 is(gURLBar.value, gURLBar.trimValue(badURL), "location bar reflects loading page"); |
|
18 |
|
19 gBrowser.contentWindow.stop(); |
|
20 is(gURLBar.value, gURLBar.trimValue(goodURL), "location bar reflects loaded page after stop()"); |
|
21 gBrowser.removeCurrentTab(); |
|
22 |
|
23 gBrowser.selectedTab = gBrowser.addTab("about:blank"); |
|
24 is(gURLBar.value, "", "location bar is empty"); |
|
25 |
|
26 typeAndSubmit(badURL); |
|
27 is(gURLBar.value, gURLBar.trimValue(badURL), "location bar reflects loading page"); |
|
28 |
|
29 gBrowser.contentWindow.stop(); |
|
30 is(gURLBar.value, gURLBar.trimValue(badURL), "location bar reflects stopped page in an empty tab"); |
|
31 gBrowser.removeCurrentTab(); |
|
32 |
|
33 finish(); |
|
34 } |
|
35 |
|
36 function typeAndSubmit(value) { |
|
37 gBrowser.userTypedValue = value; |
|
38 URLBarSetURI(); |
|
39 gURLBar.handleCommand(); |
|
40 } |