Bug 1408361 - Add ellipsis when truncating received tab URI for display. r=eoger

MozReview-Commit-ID: 4PVX5J59kpM

--HG--
extra : rebase_source : 335cceb4a659e06365339a69a965782bfeaf3be5
This commit is contained in:
Thom Chiovoloni 2018-01-16 12:57:36 -05:00
Родитель 4a22513f27
Коммит a1373c066f
2 изменённых файлов: 16 добавлений и 4 удалений

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

@ -2590,12 +2590,17 @@ BrowserGlue.prototype = {
} else {
title = bundle.GetStringFromName("tabArrivingNotification.title");
}
// Use the page URL as the body. We strip the fragment and query to
// reduce size, and also format it the same way that the url bar would.
body = URIs[0].uri.replace(/[?#].*$/, "");
// Use the page URL as the body. We strip the fragment and query (after
// the `?` and `#` respectively) to reduce size, and also format it the
// same way that the url bar would.
body = URIs[0].uri.replace(/([?#]).*$/, "$1");
let wasTruncated = body.length < URIs[0].uri.length;
if (win.gURLBar) {
body = win.gURLBar.trimValue(body);
}
if (wasTruncated) {
body = bundle.formatStringFromName("singleTabArrivingWithTruncatedURL.body", [body], 1);
}
} else {
title = bundle.GetStringFromName("multipleTabsArrivingNotification.title");
const allSameDevice = URIs.every(URI => URI.clientId == URIs[0].clientId);

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

@ -68,7 +68,8 @@ sendTabToDevice.verify = Verify Your Account…
# LOCALIZATION NOTE (tabArrivingNotification.title, tabArrivingNotificationWithDevice.title,
# multipleTabsArrivingNotification.title, unnamedTabsArrivingNotification2.body,
# unnamedTabsArrivingNotificationMultiple2.body, unnamedTabsArrivingNotificationNoDevice.body)
# unnamedTabsArrivingNotificationMultiple2.body, unnamedTabsArrivingNotificationNoDevice.body,
# singleTabArrivingWithTruncatedURL.body)
# These strings are used in a notification shown when we're opening tab(s) another device sent us to display.
# LOCALIZATION NOTE (tabArrivingNotification.title, tabArrivingNotificationWithDevice.title)
@ -95,3 +96,9 @@ unnamedTabsArrivingNotificationMultiple2.body = #1 tab has arrived from your con
# #1 is the number of tabs received
# This version is used when we don't know any device names.
unnamedTabsArrivingNotificationNoDevice.body = #1 tab has arrived;#1 tabs have arrived
# LOCALIZATION NOTE (singleTabArrivingWithTruncatedURL.body):
# Used when a tab from a remote device arrives but the URL must be truncated.
# Should display the URL with an indication that it's benen truncated.
# %S is the portion of the URL that remains after truncation.
singleTabArrivingWithTruncatedURL.body = %S…