summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/urlbar/browser_canonizeURL.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /browser/base/content/test/urlbar/browser_canonizeURL.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'browser/base/content/test/urlbar/browser_canonizeURL.js')
-rw-r--r--browser/base/content/test/urlbar/browser_canonizeURL.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/browser/base/content/test/urlbar/browser_canonizeURL.js b/browser/base/content/test/urlbar/browser_canonizeURL.js
new file mode 100644
index 000000000..59ab54ca0
--- /dev/null
+++ b/browser/base/content/test/urlbar/browser_canonizeURL.js
@@ -0,0 +1,42 @@
+add_task(function*() {
+ let testcases = [
+ ["example", "http://www.example.net/", { shiftKey: true }],
+ // Check that a direct load is not overwritten by a previous canonization.
+ ["http://example.com/test/", "http://example.com/test/", {}],
+ ["ex-ample", "http://www.ex-ample.net/", { shiftKey: true }],
+ [" example ", "http://www.example.net/", { shiftKey: true }],
+ [" example/foo ", "http://www.example.net/foo", { shiftKey: true }],
+ [" example/foo bar ", "http://www.example.net/foo%20bar", { shiftKey: true }],
+ ["example.net", "http://example.net/", { shiftKey: true }],
+ ["http://example", "http://example/", { shiftKey: true }],
+ ["example:8080", "http://example:8080/", { shiftKey: true }],
+ ["ex-ample.foo", "http://ex-ample.foo/", { shiftKey: true }],
+ ["example.foo/bar ", "http://example.foo/bar", { shiftKey: true }],
+ ["1.1.1.1", "http://1.1.1.1/", { shiftKey: true }],
+ ["ftp://example", "ftp://example/", { shiftKey: true }],
+ ["ftp.example.bar", "http://ftp.example.bar/", { shiftKey: true }],
+ ["ex ample", Services.search.defaultEngine.getSubmission("ex ample", null, "keyword").uri.spec, { shiftKey: true }],
+ ];
+
+ // Disable autoFill for this test, since it could mess up the results.
+ let autoFill = Preferences.get("browser.urlbar.autoFill");
+ Preferences.set("browser.urlbar.autoFill", false);
+ registerCleanupFunction(() => {
+ Preferences.set("browser.urlbar.autoFill", autoFill);
+ });
+
+ for (let [inputValue, expectedURL, options] of testcases) {
+ let promiseLoad = waitForDocLoadAndStopIt(expectedURL);
+ gURLBar.focus();
+ if (Object.keys(options).length > 0) {
+ gURLBar.selectionStart = gURLBar.selectionEnd =
+ gURLBar.inputField.value.length;
+ gURLBar.inputField.value = inputValue.slice(0, -1);
+ EventUtils.synthesizeKey(inputValue.slice(-1), {});
+ } else {
+ gURLBar.textValue = inputValue;
+ }
+ EventUtils.synthesizeKey("VK_RETURN", options);
+ yield promiseLoad;
+ }
+});