Bug 1602691 - Remove trimValue and textRunsMaxLen hooks from autocomplete-richlistitem.js. r=mak

Differential Revision: https://phabricator.services.mozilla.com/D56518

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Dão Gottwald 2019-12-10 10:50:35 +00:00
Родитель b7b7af4e8f
Коммит 647685dd70
1 изменённых файлов: 2 добавлений и 27 удалений

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

@ -403,10 +403,6 @@
this.setAttribute("title", title);
this.setAttribute("text", this.getAttribute("ac-text"));
let popup = this.parentNode.parentNode;
let titleLooksLikeUrl = false;
let displayUrl = originalUrl;
let type = this.getAttribute("originaltype");
let types = new Set(type.split(/\s+/));
// Remove types that should ultimately not be in the `type` string.
@ -414,19 +410,11 @@
type = [...types][0] || "";
this.setAttribute("type", type);
let input = popup.input;
if (typeof input.trimValue == "function") {
displayUrl = input.trimValue(displayUrl);
}
displayUrl = this._unescapeUrl(displayUrl);
// For performance reasons we may want to limit the displayUrl size.
if (popup.textRunsMaxLen && displayUrl) {
displayUrl = displayUrl.substr(0, popup.textRunsMaxLen);
}
let displayUrl = this._unescapeUrl(originalUrl);
this.setAttribute("displayurl", displayUrl);
// Show the domain as the title if we don't have a title.
let titleLooksLikeUrl = false;
if (!title) {
titleLooksLikeUrl = true;
try {
@ -448,21 +436,8 @@
}
if (Array.isArray(title)) {
// For performance reasons we may want to limit the title size.
if (popup.textRunsMaxLen) {
title.forEach(t => {
// Limit all the even items.
for (let i = 0; i < t.length; i += 2) {
t[i] = t[i].substr(0, popup.textRunsMaxLen);
}
});
}
this._setUpEmphasisedSections(this._titleText, title);
} else {
// For performance reasons we may want to limit the title size.
if (popup.textRunsMaxLen && title) {
title = title.substr(0, popup.textRunsMaxLen);
}
this._setUpDescription(this._titleText, title);
}
this._setUpDescription(this._urlText, displayUrl);