michael@0: const goodURL = "http://mochi.test:8888/"; michael@0: const badURL = "http://mochi.test:8888/whatever.html"; michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: gBrowser.selectedTab = gBrowser.addTab(goodURL); michael@0: gBrowser.selectedBrowser.addEventListener("load", onload, true); michael@0: } michael@0: michael@0: function onload() { michael@0: gBrowser.selectedBrowser.removeEventListener("load", onload, true); michael@0: michael@0: is(gURLBar.value, gURLBar.trimValue(goodURL), "location bar reflects loaded page"); michael@0: michael@0: typeAndSubmit(badURL); michael@0: is(gURLBar.value, gURLBar.trimValue(badURL), "location bar reflects loading page"); michael@0: michael@0: gBrowser.contentWindow.stop(); michael@0: is(gURLBar.value, gURLBar.trimValue(goodURL), "location bar reflects loaded page after stop()"); michael@0: gBrowser.removeCurrentTab(); michael@0: michael@0: gBrowser.selectedTab = gBrowser.addTab("about:blank"); michael@0: is(gURLBar.value, "", "location bar is empty"); michael@0: michael@0: typeAndSubmit(badURL); michael@0: is(gURLBar.value, gURLBar.trimValue(badURL), "location bar reflects loading page"); michael@0: michael@0: gBrowser.contentWindow.stop(); michael@0: is(gURLBar.value, gURLBar.trimValue(badURL), "location bar reflects stopped page in an empty tab"); michael@0: gBrowser.removeCurrentTab(); michael@0: michael@0: finish(); michael@0: } michael@0: michael@0: function typeAndSubmit(value) { michael@0: gBrowser.userTypedValue = value; michael@0: URLBarSetURI(); michael@0: gURLBar.handleCommand(); michael@0: }