Bug 1239708: Improve awesomebar autofill. Part 3: Front-end changes. r?mak
MozReview-Commit-ID: 8AR11dVfIVn
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -291,17 +291,16 @@ pref("browser.urlbar.clickSelectsAll", t
#ifdef UNIX_BUT_NOT_MAC
pref("browser.urlbar.doubleClickSelectsAll", true);
#else
pref("browser.urlbar.doubleClickSelectsAll", false);
#endif
// Control autoFill behavior
pref("browser.urlbar.autoFill", true);
-pref("browser.urlbar.autoFill.typed", true);
pref("browser.urlbar.speculativeConnect.enabled", true);
// 0: Match anywhere (e.g., middle of words)
// 1: Match on word boundaries and then try matching anywhere
// 2: Match only on word boundaries (e.g., after / or .)
// 3: Match at the beginning of the url or title
pref("browser.urlbar.matchBehavior", 1);
pref("browser.urlbar.filter.javascript", true);
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -2301,20 +2301,16 @@ file, You can obtain one at http://mozil
// connect to the intended site as a performance optimization.
if (!this.input.gotResultForCurrentQuery &&
this.input.speculativeConnectEnabled &&
!this.input.inPrivateContext &&
this.input.mController.matchCount > 0) {
let firstStyle = this.input.mController.getStyleAt(0);
if (firstStyle.includes("autofill")) {
let uri = this.input.mController.getFinalCompleteValueAt(0);
- // "http" will be stripped out, but other scheme won't.
- if (!uri.includes("://")) {
- uri = "http://" + uri;
- }
this.maybeSetupSpeculativeConnect(uri);
} else if (firstStyle.includes("searchengine") &&
this.input.browserSearchSuggestEnabled &&
this.input.urlbarSearchSuggestEnabled) {
// Preconnect to the current search engine only if the search
// suggestions are enabled.
let engine = Services.search.currentEngine;
engine.speculativeConnect({window,
--- a/toolkit/content/widgets/autocomplete.xml
+++ b/toolkit/content/widgets/autocomplete.xml
@@ -985,28 +985,33 @@
if (this._currentIndex >= matchCount) {
break;
}
let item;
let reusable = false;
let itemExists = this._currentIndex < existingItemsCount;
let originalValue, originalText, originalType;
- let value = controller.getValueAt(this._currentIndex);
+ let style = controller.getStyleAt(this._currentIndex);
+ let value =
+ style &&
+ style.includes("autofill") &&
+ style.includes("heuristic") ?
+ controller.getFinalCompleteValueAt(this._currentIndex) :
+ controller.getValueAt(this._currentIndex);
let label = controller.getLabelAt(this._currentIndex);
let comment = controller.getCommentAt(this._currentIndex);
- let style = controller.getStyleAt(this._currentIndex);
let image = controller.getImageAt(this._currentIndex);
// trim the leading/trailing whitespace
let trimmedSearchString = controller.searchString.replace(/^\s+/, "").replace(/\s+$/, "");
if (itemExists) {
item = this.richlistbox.childNodes[this._currentIndex];
- // Url may be a modified version of value, see _adjustACItem().
+ // Url may be a modified version of value, see _adjustAcItem().
originalValue = item.getAttribute("url") || item.getAttribute("ac-value");
originalText = item.getAttribute("ac-text");
originalType = item.getAttribute("originaltype");
// The styles on the list which have different <content> structure and overrided
// _adjustAcItem() are unreusable.
const UNREUSEABLE_STYLES = [
"autofill-profile",