Bug 1142123 - Updated strings for checkbox for Camera and Microphone popup notifications. r=pbz,fluent-reviewers,bolsson

Differential Revision: https://phabricator.services.mozilla.com/D210221
This commit is contained in:
abhishekmadan30 2024-05-14 18:22:37 +00:00
parent 93193e35af
commit 18273683a5
4 changed files with 52 additions and 1 deletions

View File

@ -1237,6 +1237,21 @@ function prompt(aActor, aBrowser, aRequest) {
return true;
}
function getRememberCheckboxLabel() {
if (reqVideoInput == "Camera") {
if (reqAudioInput == "Microphone") {
return "webrtc-remember-allow-checkbox-camera-and-microphone";
}
return "webrtc-remember-allow-checkbox-camera";
}
if (reqAudioInput == "Microphone") {
return "webrtc-remember-allow-checkbox-microphone";
}
return "webrtc-remember-allow-checkbox";
}
if (shouldShowAlwaysRemember()) {
// Disable the permanent 'Allow' action if the connection isn't secure, or for
// screen/audio sharing (because we can't guess which window the user wants to
@ -1252,7 +1267,7 @@ function prompt(aActor, aBrowser, aRequest) {
}
options.checkbox = {
label: localization.formatValueSync("webrtc-remember-allow-checkbox"),
label: localization.formatValueSync(getRememberCheckboxLabel()),
checked: principal.isAddonOrExpandedAddonPrincipal,
checkedState: reason
? {

View File

@ -361,6 +361,23 @@ var gTests = [
await promise;
await observerPromise;
let rememberCheckBoxLabel = "Remember this decision";
if (aRequestVideo) {
rememberCheckBoxLabel = "Remember for all cameras";
if (aRequestAudio) {
rememberCheckBoxLabel = "Remember for all cameras and microphones";
}
} else if (aRequestAudio) {
rememberCheckBoxLabel = "Remember for all microphones";
}
is(
PopupNotifications.getNotification("webRTC-shareDevices").options
.checkbox.label,
rememberCheckBoxLabel,
"Correct string used for decision checkbox"
);
is(
elt("webRTC-selectMicrophone").hidden,
!aRequestAudio,

View File

@ -47,6 +47,14 @@ var gTests = [
"webRTC-shareMicrophone-notification-icon",
"anchored to mic icon"
);
is(
PopupNotifications.getNotification("webRTC-shareDevices").options
.checkbox.label,
"Remember for all microphones",
"Correct string used for decision checkbox"
);
checkDeviceSelectors(["microphone"]);
let indicator = promiseIndicatorWindow();
@ -144,6 +152,14 @@ var gTests = [
"webRTC-shareDevices-notification-icon",
"anchored to device icon"
);
is(
PopupNotifications.getNotification("webRTC-shareDevices").options
.checkbox.label,
"Remember for all cameras",
"Correct string used for decision checkbox"
);
checkDeviceSelectors(["camera"]);
let indicator = promiseIndicatorWindow();

View File

@ -208,6 +208,9 @@ webrtc-action-not-now =
##
webrtc-remember-allow-checkbox = Remember this decision
webrtc-remember-allow-checkbox-camera = Remember for all cameras
webrtc-remember-allow-checkbox-microphone = Remember for all microphones
webrtc-remember-allow-checkbox-camera-and-microphone = Remember for all cameras and microphones
webrtc-mute-notifications-checkbox = Mute website notifications while sharing
webrtc-reason-for-no-permanent-allow-screen = { -brand-short-name } can not allow permanent access to your screen.