зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1337682 - CanonizeURL feature may override the next load of the current URL. r=adw
MozReview-Commit-ID: ATdFsSXstZz --HG-- extra : rebase_source : 618777421e2acfbfe54332aa685332d96967d7c6
This commit is contained in:
Родитель
1e34f705c0
Коммит
3078535c01
|
@ -1,21 +1,23 @@
|
|||
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],
|
||||
];
|
||||
|
||||
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);
|
||||
|
@ -23,12 +25,16 @@ add_task(function*() {
|
|||
Preferences.set("browser.urlbar.autoFill", autoFill);
|
||||
});
|
||||
|
||||
for (let [inputValue, expectedURL] of pairs) {
|
||||
for (let [inputValue, expectedURL, options] of testcases) {
|
||||
let promiseLoad = waitForDocLoadAndStopIt(expectedURL);
|
||||
gURLBar.focus();
|
||||
gURLBar.inputField.value = inputValue.slice(0, -1);
|
||||
EventUtils.synthesizeKey(inputValue.slice(-1), {});
|
||||
EventUtils.synthesizeKey("VK_RETURN", { shiftKey: true });
|
||||
if (Object.keys(options).length > 0) {
|
||||
gURLBar.inputField.value = inputValue.slice(0, -1);
|
||||
EventUtils.synthesizeKey(inputValue.slice(-1), {});
|
||||
} else {
|
||||
gURLBar.textValue = inputValue;
|
||||
}
|
||||
EventUtils.synthesizeKey("VK_RETURN", options);
|
||||
yield promiseLoad;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1153,6 +1153,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||
this.maybeCanonizeURL(event, this.value);
|
||||
let rv = this.mController.handleEnter(false, event);
|
||||
this.handleEnterInstance = null;
|
||||
this.popup.overrideValue = null;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -1832,6 +1833,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||
if (this.input.mController.searchString == searchString) {
|
||||
this.input.maybeCanonizeURL(event, searchString);
|
||||
this.input.mController.handleEnter(false, event);
|
||||
this.overrideValue = null;
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
@ -1853,7 +1855,6 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||
// the default -1 value. Then handleEnter will know it should not
|
||||
// delay the action, cause a result wont't ever arrive.
|
||||
this.input.controller.setInitiallySelectedIndex(0);
|
||||
this.overrideValue = null;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче