Bug 1609973 - Fix wrong localization string in WebRTCParent.js. r=nhnt11

Instead of correcting the string in the localization file, I use the slightly inconsistent
string in code now, to avoid issues with uplifting.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Johann Hofmann 2020-01-22 12:55:26 +00:00
parent f5684db67c
commit 2d827839ff
2 changed files with 22 additions and 10 deletions

View File

@ -486,7 +486,7 @@ function prompt(aActor, aBrowser, aRequest) {
requestMessages = [
// Individual request types first.
"getUserMedia.shareCameraUnsafeDelegation.message",
"getUserMedia.shareMicrophoneUnsafeDelegation.message",
"getUserMedia.shareMicrophoneUnsafeDelegations.message",
"getUserMedia.shareScreenUnsafeDelegation.message",
"getUserMedia.shareAudioCaptureUnsafeDelegation.message",
// Combinations of the above request types last.

View File

@ -13,16 +13,20 @@ const PromptResult = {
const Perms = Services.perms;
async function promptNoDelegate(aThirdPartyOrgin) {
async function promptNoDelegate(aThirdPartyOrgin, audio = true, video = true) {
// Persistent allowed first party origin
const uri = gBrowser.selectedBrowser.documentURI;
PermissionTestUtils.add(uri, "microphone", Services.perms.ALLOW_ACTION);
PermissionTestUtils.add(uri, "camera", Services.perms.ALLOW_ACTION);
if (audio) {
PermissionTestUtils.add(uri, "microphone", Services.perms.ALLOW_ACTION);
}
if (video) {
PermissionTestUtils.add(uri, "camera", Services.perms.ALLOW_ACTION);
}
// Check that we get a prompt.
const observerPromise = expectObserverCalled("getUserMedia:request");
const promise = promisePopupNotificationShown("webRTC-shareDevices");
await promiseRequestDevice(true, true, "frame4");
await promiseRequestDevice(audio, video, "frame4");
await promise;
await observerPromise;
@ -56,13 +60,19 @@ async function promptNoDelegate(aThirdPartyOrgin) {
);
await observerPromise1;
await observerPromise2;
Assert.deepEqual(
await getMediaCaptureState(),
{ audio: true, video: true },
"expected camera and microphone to be shared"
let state = await getMediaCaptureState();
is(
!!state.audio,
audio,
`expected microphone to be ${audio ? "" : "not"} shared`
);
is(
!!state.video,
video,
`expected camera to be ${video ? "" : "not"} shared`
);
await indicator;
await checkSharingUI({ audio: true, video: true });
await checkSharingUI({ audio, video });
// Cleanup.
await closeStream(false, "frame4");
@ -537,6 +547,8 @@ var gTests = [
"Prompt and display both first party and third party origin in maybe unsafe permission delegation",
run: async function checkPromptNoDelegate() {
await promptNoDelegate("test1.example.com");
await promptNoDelegate("test1.example.com", true, false);
await promptNoDelegate("test1.example.com", false, true);
},
},
{