Backed out changeset 0e60cc940997 (bug 1772339) for causing failures at browser_keyboardShortcut.js. CLOSED TREE

This commit is contained in:
Butkovits Atila 2022-07-15 21:42:23 +03:00
parent 580833a166
commit 06d063b4c9
5 changed files with 14 additions and 201 deletions

View File

@ -5,9 +5,6 @@
const { PictureInPicture } = ChromeUtils.import(
"resource://gre/modules/PictureInPicture.jsm"
);
const { ShortcutUtils } = ChromeUtils.import(
"resource://gre/modules/ShortcutUtils.jsm"
);
const { DeferredTask } = ChromeUtils.import(
"resource://gre/modules/DeferredTask.jsm"
);
@ -159,12 +156,6 @@ let Player = {
let playPauseBtn = document.getElementById("playpause");
playPauseBtn.focus({ focusVisible: false });
let closeButton = document.getElementById("close");
let closeShortcut = document.getElementById("closeShortcut");
document.l10n.setAttributes(closeButton, "pictureinpicture-close-cmd", {
shortcut: ShortcutUtils.prettifyShortcut(closeShortcut),
});
// Set the specific remoteType and browsingContextGroupID to use for the
// initial about:blank load. The combination of these two properties will
// ensure that the browser loads in the same process as our originating
@ -799,9 +790,7 @@ let Player = {
this._isPlaying = isPlaying;
this.controls.classList.toggle("playing", isPlaying);
const playButton = document.getElementById("playpause");
let strId = isPlaying
? `pictureinpicture-pause-cmd`
: `pictureinpicture-play-cmd`;
let strId = "pictureinpicture-" + (isPlaying ? "pause" : "play");
document.l10n.setAttributes(playButton, strId);
},
@ -822,14 +811,8 @@ let Player = {
this._isMuted = isMuted;
this.controls.classList.toggle("muted", isMuted);
const audioButton = document.getElementById("audio");
let strId = isMuted
? `pictureinpicture-unmute-cmd`
: `pictureinpicture-mute-cmd`;
let shortcutId = isMuted ? "unMuteShortcut" : "muteShortcut";
let shortcut = document.getElementById(shortcutId);
document.l10n.setAttributes(audioButton, strId, {
shortcut: ShortcutUtils.prettifyShortcut(shortcut),
});
let strId = "pictureinpicture-" + (isMuted ? "unmute" : "mute");
document.l10n.setAttributes(audioButton, strId);
},
/**

View File

@ -27,9 +27,6 @@
</xul:commandset>
<xul:keyset>
<xul:key id="closeShortcut" keycode="VK_W" modifiers="accel"/>
<xul:key id="muteShortcut" keycode="↓" modifiers="accel"/>
<xul:key id="unMuteShortcut" keycode="↑" modifiers="accel"/>
#ifndef XP_MACOSX
<xul:key data-l10n-id="picture-in-picture-toggle-shortcut" command="View:PictureInPicture" modifiers="accel,shift"/>
<xul:key data-l10n-id="picture-in-picture-toggle-shortcut-alt" command="View:PictureInPicture" modifiers="accel,shift"/>
@ -48,18 +45,18 @@
#ifdef XP_MACOSX
mac="true"
#endif
data-l10n-id="pictureinpicture-close-cmd"
data-l10n-id="pictureinpicture-close"
tabindex="3"/>
<div id="controls-bottom">
<button id="unpip" class="control-item" data-l10n-id="pictureinpicture-unpip-cmd" tabindex="2"></button>
<button id="unpip" class="control-item" data-l10n-id="pictureinpicture-unpip" tabindex="2"></button>
<div class="gap"></div>
<button id="playpause" class="control-item" tabindex="1"
data-l10n-id="pictureinpicture-pause-cmd"/>
data-l10n-id="pictureinpicture-pause"/>
<div class="gap" hidden="true"></div>
<button id="audio" class="control-item" hidden="true" tabindex="1"
data-l10n-id="pictureinpicture-mute-cmd"/>
data-l10n-id="pictureinpicture-mute"/>
<div class="gap subtitles" hidden="true"></div>
<button id="closed-caption" class="control-item closed-caption subtitles" hidden="true" data-l10n-id="pictureinpicture-subtitles-cmd" tabindex="1"></button>
<button id="closed-caption" class="control-item closed-caption subtitles" hidden="true" tabindex="1"></button>
<div id="settings" class="hide">
<div class="panel">
<div class="box">

View File

@ -46,7 +46,6 @@ prefs =
[browser_contextMenu.js]
skip-if = os == "linux" && bits == 64 && os_version == "18.04" # Bug 1569205
[browser_conflictingPips.js]
[browser_controlsHover.js]
[browser_cornerSnapping.js]
run-if = os == "mac"
[browser_closePlayer.js]

View File

@ -1,151 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Tests functionality for the hover states of the various controls for the Picture-in-Picture
* video window.
*/
add_task(async () => {
let videoID = "with-controls";
await BrowserTestUtils.withNewTab(
{
url: TEST_PAGE,
gBrowser,
},
async browser => {
let waitForVideoEvent = eventType => {
return BrowserTestUtils.waitForContentEvent(browser, eventType, true);
};
await ensureVideosReady(browser);
await SpecialPowers.spawn(browser, [videoID], async videoID => {
await content.document.getElementById(videoID).play();
});
// Open the video in PiP
let pipWin = await triggerPictureInPicture(browser, videoID);
ok(pipWin, "Got Picture-in-Picture window.");
const l10n = new Localization(
["toolkit/pictureinpicture/pictureinpicture.ftl"],
true
);
let [
close,
play,
unmute,
unpip,
subtitles,
pause,
mute,
] = l10n.formatMessagesSync([
{
id: "pictureinpicture-close-cmd",
args: {
shortcut: ShortcutUtils.prettifyShortcut(
pipWin.document.getElementById("closeShortcut")
),
},
},
{ id: "pictureinpicture-play-cmd" },
{
id: "pictureinpicture-unmute-cmd",
args: {
shortcut: ShortcutUtils.prettifyShortcut(
pipWin.document.getElementById("unMuteShortcut")
),
},
},
{ id: "pictureinpicture-unpip-cmd" },
{ id: "pictureinpicture-subtitles-cmd" },
{ id: "pictureinpicture-pause-cmd" },
{
id: "pictureinpicture-mute-cmd",
args: {
shortcut: ShortcutUtils.prettifyShortcut(
pipWin.document.getElementById("muteShortcut")
),
},
},
]);
let closeButton = pipWin.document.getElementById("close");
let playPauseButton = pipWin.document.getElementById("playpause");
let unpipButton = pipWin.document.getElementById("unpip");
let muteUnmuteButton = pipWin.document.getElementById("audio");
let subtitlesButton = pipWin.document.getElementById("closed-caption");
// checks hover title for close button
await pipWin.document.l10n.translateFragment(closeButton);
Assert.equal(
close.attributes[1].value,
closeButton.title,
"The close button title matches Fluent string"
);
// checks hover title for play button
await pipWin.document.l10n.translateFragment(playPauseButton);
Assert.equal(
pause.attributes[1].value,
playPauseButton.title,
"The play button title matches Fluent string"
);
// checks hover title for unpip button
await pipWin.document.l10n.translateFragment(unpipButton);
Assert.equal(
unpip.attributes[1].value,
unpipButton.title,
"The unpip button title matches Fluent string"
);
// checks hover title for subtitles button
await pipWin.document.l10n.translateFragment(subtitlesButton);
Assert.equal(
subtitles.attributes[1].value,
subtitlesButton.title,
"The subtitles button title matches Fluent string"
);
// checks hover title for unmute button
await pipWin.document.l10n.translateFragment(muteUnmuteButton);
Assert.equal(
mute.attributes[1].value,
muteUnmuteButton.title,
"The Unmute button title matches Fluent string"
);
// Pause the video
let pausedPromise = waitForVideoEvent("pause");
EventUtils.synthesizeMouseAtCenter(playPauseButton, {}, pipWin);
await pausedPromise;
ok(await isVideoPaused(browser, videoID), "The video is paused.");
// checks hover title for pause button
await pipWin.document.l10n.translateFragment(playPauseButton);
Assert.equal(
play.attributes[1].value,
playPauseButton.title,
"The pause button title matches Fluent string"
);
// Mute the video
let mutedPromise = waitForVideoEvent("volumechange");
EventUtils.synthesizeMouseAtCenter(muteUnmuteButton, {}, pipWin);
await mutedPromise;
ok(await isVideoMuted(browser, videoID), "The audio is muted.");
// checks hover title for mute button
await pipWin.document.l10n.translateFragment(muteUnmuteButton);
Assert.equal(
unmute.attributes[1].value,
muteUnmuteButton.title,
"The mute button title matches Fluent string"
);
}
);
});

View File

@ -4,36 +4,21 @@
pictureinpicture-player-title = Picture-in-Picture
## Variables:
## $shortcut (String) - Keyboard shortcut to execute the command.
pictureinpicture-pause-cmd =
pictureinpicture-pause =
.aria-label = Pause
.title = Pause (Spacebar)
pictureinpicture-play-cmd =
pictureinpicture-play =
.aria-label = Play
.title = Play (Spacebar)
pictureinpicture-mute-cmd =
pictureinpicture-mute =
.aria-label = Mute
.title = Mute ({ $shortcut })
pictureinpicture-unmute-cmd =
pictureinpicture-unmute =
.aria-label = Unmute
.title = Unmute ({ $shortcut })
pictureinpicture-unpip-cmd =
pictureinpicture-unpip =
.aria-label = Send back to tab
.title = Back to tab
pictureinpicture-close-cmd =
pictureinpicture-close =
.aria-label = Close
.title = Close ({ $shortcut })
pictureinpicture-subtitles-cmd =
.aria-label = Subtitles
.title = Subtitles
##
pictureinpicture-subtitles-label = Subtitles