Bug 1360279 - Typing in the location bar after a keyword causes the heuristic result icon to flicker. r=florian

MozReview-Commit-ID: 4ZXCLN7Lf2i

--HG--
extra : rebase_source : 46843f78fd2af57781d3a3987d61b5b24c2cdc18
This commit is contained in:
Marco Bonardo 2017-04-28 12:14:13 +02:00
Родитель 66ed3e9795
Коммит 27b8634437
1 изменённых файлов: 17 добавлений и 14 удалений

Просмотреть файл

@ -257,8 +257,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
"resource://gre/modules/TelemetryStopwatch.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Preferences",
"resource://gre/modules/Preferences.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Sqlite",
@ -536,7 +534,7 @@ XPCOMUtils.defineLazyGetter(this, "Prefs", () => {
// Preloaded Sites related
function PreloadedSite(url, title) {
this.uri = NetUtil.newURI(url);
this.uri = Services.io.newURI(url);
this.title = title;
this._matchTitle = title.toLowerCase();
this._hasWWW = this.uri.host.startsWith("www.");
@ -1368,20 +1366,25 @@ Search.prototype = {
return false;
}
let style = (this._enableActions ? "action " : "") + "keyword";
let actionURL = PlacesUtils.mozActionURI("keyword", {
url,
input: this._originalSearchString,
postData,
});
let value = this._enableActions ? actionURL : url;
let style = "keyword";
let value = url;
if (this._enableActions) {
style = "action " + style;
value = PlacesUtils.mozActionURI("keyword", {
url,
input: this._originalSearchString,
postData,
});
}
// The title will end up being "host: queryString"
let comment = entry.url.host;
this._addMatch({
value,
comment,
icon: "page-icon:" + url,
// Don't use the url with replaced strings, since the icon doesn't change
// but the string does, it may cause pointless icon flicker on typing.
icon: "page-icon:" + entry.url.href,
style,
frecency: FRECENCY_DEFAULT });
return true;
@ -1404,8 +1407,8 @@ Search.prototype = {
// * If the protocol differs we should not match. For example if the user
// searched https we should not return http.
try {
let prefixURI = NetUtil.newURI(this._strippedPrefix + match.token);
let finalURI = NetUtil.newURI(match.url);
let prefixURI = Services.io.newURI(this._strippedPrefix + match.token);
let finalURI = Services.io.newURI(match.url);
if (prefixURI.scheme != finalURI.scheme)
return false;
} catch (e) {}
@ -1527,7 +1530,7 @@ Search.prototype = {
icon = "page-icon:" + url;
} else {
icon = PlacesUtils.favicons
.getFaviconLinkForIcon(NetUtil.newURI(icon)).spec;
.getFaviconLinkForIcon(Services.io.newURI(icon)).spec;
}
let match = {