Bug 1800576 — Site permission consent flow should describe the nature of the add-on in the first panel. r=rpl,flod

Differential Revision: https://phabricator.services.mozilla.com/D162069
This commit is contained in:
Bobby Holley 2022-11-15 19:15:28 +00:00
Родитель a07e8ff8eb
Коммит f76ebbd777
3 изменённых файлов: 22 добавлений и 21 удалений

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

@ -640,8 +640,19 @@ var gXPInstallObserver = {
progressNotification.remove();
}
// The informational content differs somewhat for site permission
// add-ons. AOM no longer supports installing multiple addons,
// so the array handling here is vestigial.
let isSitePermissionAddon = installInfo.installs.every(
({ addon }) => addon?.type === lazy.SITEPERMS_ADDON_TYPE
);
let hasHost = !!options.displayURI;
if (hasHost) {
if (isSitePermissionAddon) {
messageString = gNavigatorBundle.getString(
"sitePermissionInstallFirstPrompt.header"
);
} else if (hasHost) {
messageString = gNavigatorBundle.getFormattedString(
"xpinstallPromptMessage.header",
["<>"]
@ -667,17 +678,9 @@ var gXPInstallObserver = {
message.firstChild.remove();
}
// The informational content differs somewhat for site permission
// add-ons. AOM no longer supports installing multiple addons,
// so the array handling here is vestigial.
let isSitePermissionAddon = installInfo.installs.every(
({ addon }) => addon?.type === lazy.SITEPERMS_ADDON_TYPE
);
if (isSitePermissionAddon) {
message.textContent = gNavigatorBundle.getFormattedString(
"sitePermissionsInstallPromptMessage.message",
[options.name]
message.textContent = gNavigatorBundle.getString(
"sitePermissionInstallFirstPrompt.message"
);
} else if (hasHost) {
let text = gNavigatorBundle.getString(

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

@ -39,11 +39,14 @@ xpinstallPromptMessage.dontAllow=Dont Allow
xpinstallPromptMessage.dontAllow.accesskey=D
xpinstallPromptMessage.neverAllow=Never Allow
xpinstallPromptMessage.neverAllow.accesskey=N
# LOCALIZATION NOTE (sitePermissionsInstallPromptMessage.message)
# LOCALIZATION NOTE (sitePermissionInstallFirstPrompt.header)
# This message is shown when a SitePermissionsAddon install is triggered, i.e. when the
# website calls sensitive APIs (e.g. navigator.requestMIDIAccess).
# %S is the hostname of the site the add-on is being installed from.
sitePermissionsInstallPromptMessage.message=This add-on gives the site extra privileges that could allow it to steal your data or attack your computer. Only continue if you trust this site.
sitePermissionInstallFirstPrompt.header=This site is requesting access to your devices. Device access can be enabled by installing an add-on.
# LOCALIZATION NOTE (sitePermissionInstallFirstPrompt.message)
# This message is shown when a SitePermissionsAddon install is triggered, i.e. when the
# website calls sensitive APIs (e.g. navigator.requestMIDIAccess).
sitePermissionInstallFirstPrompt.message=This add-on could be used to steal your data or attack your computer. Only continue if you trust this site.
# Accessibility Note:
# Be sure you do not choose an accesskey that is used elsewhere in the active context (e.g. main menu bar, submenu of the warning popup button)

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

@ -77,17 +77,12 @@ add_task(async function testRequestMIDIAccess() {
);
is(
installPopupHeader.textContent,
gNavigatorBundle.getFormattedString("xpinstallPromptMessage.header", [
testPageHost,
]),
gNavigatorBundle.getString("sitePermissionInstallFirstPrompt.header"),
"First popup has expected header text"
);
is(
installPopupMessage.textContent,
gNavigatorBundle.getFormattedString(
"sitePermissionsInstallPromptMessage.message",
[testPageHost]
),
gNavigatorBundle.getString("sitePermissionInstallFirstPrompt.message"),
"First popup has expected message"
);