mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1060642 - Improve display of entries without a title in the Awesomebar. r=mak
--HG-- extra : transplant_source : %E5%0C%03N%1D%99%C4%F3%16MK%C1%E7%88%C5%A7%FE%0D%28%9B
This commit is contained in:
parent
98bedf6b90
commit
aad11360ba
@ -122,6 +122,8 @@ skip-if = os == "linux" || e10s # Bug 1073339 - Investigate autocomplete test un
|
||||
[browser_alltabslistener.js]
|
||||
[browser_autocomplete_a11y_label.js]
|
||||
skip-if = e10s # Bug 1101993 - times out for unknown reasons when run in the dir (works on its own)
|
||||
[browser_autocomplete_no_title.js]
|
||||
skip-if = os == "linux" || e10s # Bug 1073339 - Investigate autocomplete test unreliability on Linux/e10s
|
||||
[browser_autocomplete_autoselect.js]
|
||||
skip-if = os == "linux" || e10s # Bug 1073339 - Investigate autocomplete test unreliability on Linux/e10s
|
||||
[browser_backButtonFitts.js]
|
||||
|
@ -0,0 +1,27 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function* check_title(inputText, expectedTitle) {
|
||||
gURLBar.focus();
|
||||
gURLBar.value = inputText.slice(0, -1);
|
||||
EventUtils.synthesizeKey(inputText.slice(-1) , {});
|
||||
yield promiseSearchComplete();
|
||||
|
||||
ok(gURLBar.popup.richlistbox.children.length > 1, "Should get at least 2 results");
|
||||
let result = gURLBar.popup.richlistbox.children[1];
|
||||
is(result._title.textContent, expectedTitle, "Result title should be as expected");
|
||||
}
|
||||
|
||||
add_task(function*() {
|
||||
// This test is only relevant if UnifiedComplete is enabled.
|
||||
if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete"))
|
||||
return;
|
||||
|
||||
let uri = NetUtil.newURI("http://bug1060642.example.com/beards/are/pretty/great");
|
||||
yield PlacesTestUtils.addVisits([{uri: uri, title: ""}]);
|
||||
|
||||
yield check_title("bug1060642", "bug1060642.example.com");
|
||||
|
||||
gURLBar.popup.hidePopup();
|
||||
yield promisePopupHidden(gURLBar.popup);
|
||||
});
|
@ -1141,9 +1141,6 @@ extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
getService(Components.interfaces.nsITextToSubURI).
|
||||
unEscapeURIForUI("UTF-8", controller.getValueAt(this._currentIndex));
|
||||
|
||||
if (typeof this.input.trimValue == "function")
|
||||
url = this.input.trimValue(url);
|
||||
|
||||
if (this._currentIndex < existingItemsCount) {
|
||||
// re-use the existing item
|
||||
item = this.richlistbox.childNodes[this._currentIndex];
|
||||
@ -1577,6 +1574,12 @@ extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
let title = this.getAttribute("title");
|
||||
let type = this.getAttribute("type");
|
||||
|
||||
let displayUrl = url;
|
||||
|
||||
let input = this.parentNode.parentNode.input;
|
||||
if (typeof input.trimValue == "function")
|
||||
displayUrl = input.trimValue(url);
|
||||
|
||||
let emphasiseTitle = true;
|
||||
let emphasiseUrl = true;
|
||||
|
||||
@ -1602,7 +1605,7 @@ extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
this.setAttribute("actiontype", action.type);
|
||||
|
||||
if (action.type == "switchtab") {
|
||||
url = action.params.url;
|
||||
displayUrl = action.params.url;
|
||||
let desc = this._stringBundle.GetStringFromName("switchToTab");
|
||||
this._setUpDescription(this._action, desc, true);
|
||||
} else if (action.type == "searchengine") {
|
||||
@ -1624,11 +1627,11 @@ extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
}
|
||||
} else if (action.type == "visiturl") {
|
||||
emphasiseUrl = false;
|
||||
url = action.params.url;
|
||||
displayUrl = action.params.url;
|
||||
|
||||
let sourceStr = this._stringBundle.GetStringFromName("visitURL");
|
||||
title = this._generateEmphasisPairs(sourceStr, [
|
||||
[trimURL(url), true],
|
||||
[displayUrl, true],
|
||||
]);
|
||||
}
|
||||
|
||||
@ -1645,7 +1648,7 @@ extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
|
||||
let searchEngine = "";
|
||||
[title, searchEngine] = title.split(TITLE_SEARCH_ENGINE_SEPARATOR);
|
||||
url = this._stringBundle.formatStringFromName("searchWithEngine", [searchEngine], 1);
|
||||
displayUrl = this._stringBundle.formatStringFromName("searchWithEngine", [searchEngine], 1);
|
||||
|
||||
// Remove the "search" substring so that the correct style, if any,
|
||||
// is applied below.
|
||||
@ -1658,7 +1661,7 @@ extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
|
||||
let sourceStr = this._stringBundle.GetStringFromName("visitURL");
|
||||
title = this._generateEmphasisPairs(sourceStr, [
|
||||
[trimURL(url), true],
|
||||
[displayUrl, true],
|
||||
]);
|
||||
|
||||
types.delete("autofill");
|
||||
@ -1728,9 +1731,16 @@ extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
this._typeImage.className = "ac-type-icon" +
|
||||
(type ? " ac-result-type-" + type : "");
|
||||
|
||||
// Show the url as the title if we don't have a title
|
||||
if (title == "")
|
||||
title = url;
|
||||
// Show the domain as the title if we don't have a title.
|
||||
if (title == "") {
|
||||
title = displayUrl;
|
||||
try {
|
||||
let uri = Services.io.newURI(url, null, null);
|
||||
// Not all valid URLs have a domain.
|
||||
if (uri.host)
|
||||
title = uri.host;
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
// Emphasize the matching search terms for the description
|
||||
if (Array.isArray(title))
|
||||
@ -1738,7 +1748,7 @@ extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
else
|
||||
this._setUpDescription(this._title, title, !emphasiseTitle);
|
||||
|
||||
this._setUpDescription(this._url, url, !emphasiseUrl);
|
||||
this._setUpDescription(this._url, displayUrl, !emphasiseUrl);
|
||||
|
||||
// Set up overflow on a timeout because the contents of the box
|
||||
// might not have a width yet even though we just changed them
|
||||
|
Loading…
Reference in New Issue
Block a user