--- a/browser/base/content/test/urlbar/browser_canonizeURL.js
+++ b/browser/base/content/test/urlbar/browser_canonizeURL.js
@@ -1,34 +1,43 @@
-var pairs = [
- ["example", "http://www.example.net/"],
- ["ex-ample", "http://www.ex-ample.net/"],
- [" example ", "http://www.example.net/"],
- [" example/foo ", "http://www.example.net/foo"],
- [" example/foo bar ", "http://www.example.net/foo%20bar"],
- ["example.net", "http://example.net/"],
- ["http://example", "http://example/"],
- ["example:8080", "http://example:8080/"],
- ["ex-ample.foo", "http://ex-ample.foo/"],
- ["example.foo/bar ", "http://example.foo/bar"],
- ["1.1.1.1", "http://1.1.1.1/"],
- ["ftp://example", "ftp://example/"],
- ["ftp.example.bar", "http://ftp.example.bar/"],
- ["ex ample", Services.search.defaultEngine.getSubmission("ex ample", null, "keyword").uri.spec],
+"use strict";
+
+// Accel (Alt or Cmd) + Enter will add a .com suffix.
+// Shift + Enter will add a .net suffix.
+// Accel + Shift + Enter will add a .org suffix.
+const accelKey = { accelKey: true };
+const shiftKey = { shiftKey: true };
+const accelAndShiftKey = { accelKey: true, shiftKey: true };
+
+const tests = [
+ ["example", accelKey, "http://www.example.com/"],
+ ["ex-ample", shiftKey, "http://www.ex-ample.net/"],
+ [" example ", accelAndShiftKey, "http://www.example.org/"],
+ [" example/foo ", accelKey, "http://www.example.com/foo"],
+ [" example/foo bar ", shiftKey, "http://www.example.net/foo%20bar"],
+ ["example.net", accelAndShiftKey, "http://example.net/"],
+ ["http://example", accelKey, "http://example/"],
+ ["example:8080", shiftKey, "http://example:8080/"],
+ ["ex-ample.foo", accelAndShiftKey, "http://ex-ample.foo/"],
+ ["example.foo/bar ", accelKey, "http://example.foo/bar"],
+ ["1.1.1.1", shiftKey, "http://1.1.1.1/"],
+ ["ftp://example", accelAndShiftKey, "ftp://example/"],
+ ["ftp.example.bar", accelKey, "http://ftp.example.bar/"],
+ ["ex ample", shiftKey, Services.search.defaultEngine.getSubmission("ex ample", null, "keyword").uri.spec],
];
add_task(function*() {
// 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] of pairs) {
+ for (let [inputValue, modifierKeys, expectedURL] of tests) {
let promiseLoad = waitForDocLoadAndStopIt(expectedURL);
gURLBar.focus();
gURLBar.inputField.value = inputValue.slice(0, -1);
EventUtils.synthesizeKey(inputValue.slice(-1), {});
- EventUtils.synthesizeKey("VK_RETURN", { shiftKey: true });
+ EventUtils.synthesizeKey("VK_RETURN", modifierKeys);
yield promiseLoad;
}
});