Backed out 2 changesets (bug 1535760, bug 1535748) for ESlint failure at browser_contextMenu.js:66:11. CLOSED TREE

Backed out changeset 8ab3c856b9c2 (bug 1535748)
Backed out changeset a9a01b1c9e3a (bug 1535760)
This commit is contained in:
Brindusan Cristian 2019-03-21 04:35:52 +02:00
Родитель 44f8fe46e4
Коммит 327ca02963
13 изменённых файлов: 47 добавлений и 170 удалений

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

@ -747,7 +747,6 @@ class ContextMenuChild extends ActorChild {
context.onCompletedImage = false;
context.onCTPPlugin = false;
context.onDRMMedia = false;
context.onPiPVideo = false;
context.onEditable = false;
context.onImage = false;
context.onKeywordField = false;
@ -872,10 +871,6 @@ class ContextMenuChild extends ActorChild {
context.onDRMMedia = true;
}
if (context.target.isCloningElementVisually) {
context.onPiPVideo = true;
}
// Firefox always creates a HTMLVideoElement when loading an ogg file
// directly. If the media is actually audio, be smarter and provide a
// context menu with audio operations.

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

@ -1512,6 +1512,10 @@ pref("media.autoplay.block-webaudio", true);
pref("media.autoplay.block-webaudio", false);
#endif
#ifdef NIGHTLY_BUILD
pref("media.videocontrols.picture-in-picture.enabled", false);
#endif
// Play with different values of the decay time and get telemetry,
// 0 means to randomize (and persist) the experiment value in users' profiles,
// -1 means no experiment is run and we use the preferred value for frecency (6h)

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

@ -176,10 +176,10 @@
label="&leaveDOMFullScreen.label;"
oncommand="gContextMenu.leaveDOMFullScreen();"/>
#ifdef NIGHTLY_BUILD
<!-- Don't forget to add a properly localized label and access key
before letting this ride up to beta. -->
<menuitem id="context-video-pictureinpicture"
accesskey="&pictureInPicture.accesskey;"
label="&pictureInPicture.label;"
type="checkbox"
label="Picture in Picture"
oncommand="gContextMenu.mediaCommand('pictureinpicture');"/>
#endif
<menuseparator id="context-media-sep-commands"/>

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

@ -215,7 +215,6 @@ nsContextMenu.prototype = {
this.onCompletedImage = context.onCompletedImage;
this.onCTPPlugin = context.onCTPPlugin;
this.onDRMMedia = context.onDRMMedia;
this.onPiPVideo = context.onPiPVideo;
this.onEditable = context.onEditable;
this.onImage = context.onImage;
this.onKeywordField = context.onKeywordField;
@ -679,7 +678,7 @@ nsContextMenu.prototype = {
this.showItem("context-media-showcontrols", onMedia && !this.target.controls);
this.showItem("context-media-hidecontrols", this.target.controls && (this.onVideo || (this.onAudio && !this.inSyntheticDoc)));
this.showItem("context-video-fullscreen", this.onVideo && !this.target.ownerDocument.fullscreen);
{
if (AppConstants.NIGHTLY_BUILD) {
let shouldDisplay = Services.prefs.getBoolPref("media.videocontrols.picture-in-picture.enabled") &&
this.onVideo &&
!this.target.ownerDocument.fullscreen;
@ -714,7 +713,6 @@ nsContextMenu.prototype = {
let canSaveSnapshot = !this.onDRMMedia && this.target.readyState >= this.target.HAVE_CURRENT_DATA;
this.setItemAttr("context-video-saveimage", "disabled", !canSaveSnapshot);
this.setItemAttr("context-video-fullscreen", "disabled", hasError);
this.setItemAttr("context-video-pictureinpicture", "checked", this.onPiPVideo);
}
}
this.showItem("context-media-sep-commands", onMedia);

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

@ -196,52 +196,25 @@ add_task(async function test_canvas() {
});
add_task(async function test_video_ok() {
await SpecialPowers.pushPrefEnv({
set: [["media.videocontrols.picture-in-picture.enabled", true]],
});
await test_contextmenu("#test-video-ok",
["context-media-play", true,
"context-media-mute", true,
"context-media-playbackrate", null,
["context-media-play", true,
"context-media-mute", true,
"context-media-playbackrate", null,
["context-media-playbackrate-050x", true,
"context-media-playbackrate-100x", true,
"context-media-playbackrate-125x", true,
"context-media-playbackrate-150x", true,
"context-media-playbackrate-200x", true], null,
"context-media-loop", true,
"context-media-hidecontrols", true,
"context-video-fullscreen", true,
"context-video-pictureinpicture", true,
"---", null,
"context-viewvideo", true,
"context-copyvideourl", true,
"---", null,
"context-savevideo", true,
"context-video-saveimage", true,
"context-sendvideo", true,
]
);
await SpecialPowers.popPrefEnv();
await test_contextmenu("#test-video-ok",
["context-media-play", true,
"context-media-mute", true,
"context-media-playbackrate", null,
["context-media-playbackrate-050x", true,
"context-media-playbackrate-100x", true,
"context-media-playbackrate-125x", true,
"context-media-playbackrate-150x", true,
"context-media-playbackrate-200x", true], null,
"context-media-loop", true,
"context-media-hidecontrols", true,
"context-video-fullscreen", true,
"---", null,
"context-viewvideo", true,
"context-copyvideourl", true,
"---", null,
"context-savevideo", true,
"context-video-saveimage", true,
"context-sendvideo", true,
"context-media-loop", true,
"context-media-hidecontrols", true,
"context-video-fullscreen", true,
"---", null,
"context-viewvideo", true,
"context-copyvideourl", true,
"---", null,
"context-savevideo", true,
"context-video-saveimage", true,
"context-sendvideo", true,
]
);
});

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

@ -252,12 +252,6 @@ These should match what Safari and other Apple applications use on OS X Lion. --
<!ENTITY leaveDOMFullScreen.label "Exit Full Screen">
<!ENTITY leaveDOMFullScreen.accesskey "u">
<!-- LOCALIZATION NOTE (pictureInPicture.label, pictureInPicture.accesskey):
these two strings are used when right-clicking on a video in the
content area when the Picture-in-Picture feature is enabled. -->
<!ENTITY pictureInPicture.label "Picture-in-Picture">
<!ENTITY pictureInPicture.accesskey "u">
<!-- LOCALIZATION NOTE (pointerlockWarning.beforeDomain.label,
pointerlockWarning.afterDomain.label): these two strings are used
respectively before and after the domain requiring pointerlock.

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

@ -444,8 +444,6 @@ pref("media.peerconnection.sdp.rust.enabled", false);
pref("media.peerconnection.sdp.rust.compare", false);
#endif
pref("media.videocontrols.picture-in-picture.enabled", false);
pref("media.webrtc.debug.trace_mask", 0);
pref("media.webrtc.debug.multi_log", false);
pref("media.webrtc.debug.log_file", "");

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

@ -28,7 +28,6 @@ FINAL_TARGET_FILES.actors += [
'FindBarChild.jsm',
'FinderChild.jsm',
'KeyPressEventModelCheckerChild.jsm',
'PictureInPictureChild.jsm',
'PopupBlockingChild.jsm',
'PrintingChild.jsm',
'PurgeSessionHistoryChild.jsm',
@ -41,3 +40,8 @@ FINAL_TARGET_FILES.actors += [
'WebNavigationChild.jsm',
'ZoomChild.jsm',
]
if CONFIG['NIGHTLY_BUILD']:
FINAL_TARGET_FILES.actors += [
'PictureInPictureChild.jsm',
]

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

@ -49,7 +49,6 @@ DIRS += [
'passwordmgr',
'perf',
'perfmonitoring',
'pictureinpicture',
'places',
'processsingleton',
'promiseworker',
@ -88,6 +87,9 @@ if CONFIG['MOZ_BUILD_APP'] != 'mobile/android':
if CONFIG['NS_PRINTING']:
DIRS += ['printing']
if CONFIG['NIGHTLY_BUILD']:
DIRS += ['pictureinpicture']
if CONFIG['BUILD_CTYPES']:
DIRS += ['ctypes']

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

@ -8,6 +8,5 @@ prefs =
media.videocontrols.picture-in-picture.enabled=true
[browser_cannotTriggerFromContent.js]
[browser_contextMenu.js]
[browser_closeTab.js]
[browser_showMessage.js]

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

@ -1,95 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Opens up the content area context menu on a video loaded in a
* browser.
*
* @param {Element} browser The <xul:browser> hosting the <video>
*
* @param {String} videoID The ID of the video to open the context
* menu with.
*
* @returns Promise
* @resolves With the context menu DOM node once opened.
*/
async function openContextMenu(browser, videoID) {
let contextMenu = document.getElementById("contentAreaContextMenu");
let popupShownPromise =
BrowserTestUtils.waitForEvent(contextMenu, "popupshown");
await BrowserTestUtils.synthesizeMouseAtCenter("#" + videoID,
{ type: "contextmenu", button: 2}, browser);
await popupShownPromise;
return contextMenu;
}
/**
* Closes the content area context menu.
*
* @param {Element} contextMenu The content area context menu opened with
* openContextMenu.
*
* @returns Promise
* @resolves With undefined
*/
async function closeContextMenu(contextMenu) {
let popupHiddenPromise =
BrowserTestUtils.waitForEvent(contextMenu, "popuphidden");
contextMenu.hidePopup();
await popupHiddenPromise;
}
/**
* Tests that the Picture-in-Picture context menu is correctly updated
* based on the Picture-in-Picture state of the video.
*/
add_task(async () => {
for (let videoID of ["with-controls", "no-controls"]) {
info(`Testing ${videoID} case.`);
await BrowserTestUtils.withNewTab({
url: TEST_PAGE,
gBrowser,
}, async browser => {
let menuItem = document.getElementById("context-video-pictureinpicture");
let menu = await openContextMenu(browser, videoID);
Assert.ok(!menuItem.hidden, "Should show Picture-in-Picture menu item.");
Assert.equal(menuItem.getAttribute("checked"), "false",
"Picture-in-Picture should be unchecked.");
await closeContextMenu(menu);
let pipWin = await triggerPictureInPicture(browser, videoID);
ok(pipWin, "Got Picture-in-Picture window.");
let videoIsCloning = ContentTask.spawn(browser, videoID, async (videoID) => {
let video = content.document.getElementById(videoID);
await ContentTaskUtils.waitForCondition(() => {
return video.isCloningElementVisually;
}, "Video has started being cloned.");
});
menu = await openContextMenu(browser, videoID);
Assert.ok(!menuItem.hidden, "Should show Picture-in-Picture menu item.");
Assert.equal(menuItem.getAttribute("checked"), "true",
"Picture-in-Picture should be checked.");
await closeContextMenu(menu);
let videoNotCloning = ContentTask.spawn(browser, videoID, async (videoID) => {
let video = content.document.getElementById(videoID);
await ContentTaskUtils.waitForCondition(() => {
return !video.isCloningElementVisually;
}, "Video has stopped being cloned.");
});
pipWin.close();
await videoNotCloning;
menu = await openContextMenu(browser, videoID);
Assert.ok(!menuItem.hidden, "Should show Picture-in-Picture menu item.");
Assert.equal(menuItem.getAttribute("checked"), "false",
"Picture-in-Picture should be unchecked.");
await closeContextMenu(menu);
});
}
});

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

@ -97,6 +97,7 @@ var EXPORTED_SYMBOLS = ["ActorManagerParent"];
const {ExtensionUtils} = ChromeUtils.import("resource://gre/modules/ExtensionUtils.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
const {DefaultMap} = ExtensionUtils;
@ -216,19 +217,6 @@ let ACTORS = {
},
},
PictureInPicture: {
child: {
module: "resource://gre/actors/PictureInPictureChild.jsm",
events: {
"MozTogglePictureInPicture": {capture: true},
},
messages: [
"PictureInPicture:SetupPlayer",
],
},
},
PopupBlocking: {
child: {
module: "resource://gre/actors/PopupBlockingChild.jsm",
@ -360,6 +348,21 @@ let ACTORS = {
},
};
if (AppConstants.NIGHTLY_BUILD) {
ACTORS.PictureInPicture = {
child: {
module: "resource://gre/actors/PictureInPictureChild.jsm",
events: {
"MozTogglePictureInPicture": {capture: true},
},
messages: [
"PictureInPicture:SetupPlayer",
],
},
};
}
class ActorSet {
constructor(group, actorSide) {
this.group = group;

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

@ -424,6 +424,7 @@
background-image: url(chrome://global/skin/media/error.png);
}
%ifdef NIGHTLY_BUILD
.statusIcon[type="pictureInPicture"] {
min-width: 84px;
min-height: 84px;
@ -432,6 +433,7 @@
fill: #fff;
stroke: #fff;
}
%endif
/* Overlay Play button */
.clickToPlay {