summaryrefslogtreecommitdiffstats
path: root/browser/components/urlbar/tests/browser/browser_userTypedValue.js
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/urlbar/tests/browser/browser_userTypedValue.js')
-rw-r--r--browser/components/urlbar/tests/browser/browser_userTypedValue.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/browser/components/urlbar/tests/browser/browser_userTypedValue.js b/browser/components/urlbar/tests/browser/browser_userTypedValue.js
new file mode 100644
index 0000000000..8319b37962
--- /dev/null
+++ b/browser/components/urlbar/tests/browser/browser_userTypedValue.js
@@ -0,0 +1,46 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+function test() {
+ const URI = TEST_BASE_URL + "file_userTypedValue.html";
+ window.browserDOMWindow.openURI(
+ makeURI(URI),
+ null,
+ Ci.nsIBrowserDOMWindow.OPEN_NEWTAB,
+ Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL,
+ Services.scriptSecurityManager.getSystemPrincipal()
+ );
+
+ is(gBrowser.userTypedValue, URI, "userTypedValue matches test URI");
+ is(gURLBar.value, URI, "location bar value matches test URI");
+
+ gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
+ gBrowser.removeCurrentTab({ skipPermitUnload: true });
+ is(
+ gBrowser.userTypedValue,
+ URI,
+ "userTypedValue matches test URI after switching tabs"
+ );
+ is(
+ gURLBar.value,
+ URI,
+ "location bar value matches test URI after switching tabs"
+ );
+
+ waitForExplicitFinish();
+ BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
+ is(
+ gBrowser.userTypedValue,
+ null,
+ "userTypedValue is null as the page has loaded"
+ );
+ is(
+ gURLBar.value,
+ URI,
+ "location bar value matches test URI as the page has loaded"
+ );
+
+ gBrowser.removeCurrentTab({ skipPermitUnload: true });
+ finish();
+ });
+}