Backed out 2 changesets (bug 1535760, bug 1535748) for ESlint failure at browser_contextMenu.js:66:11. CLOSED TREE
authorBrindusan Cristian <cbrindusan@mozilla.com>
Thu, 21 Mar 2019 04:35:52 +0200
changeset 465319 44b24f15fe27443916ee0d680332f76e93a3840f
parent 465318 54057e1121b5459ec697bf480a46676d8fc1bff9
child 465320 ca62b3a8471fbd1a7bad8dbe956f0deb16c16c91
push id35736
push userncsoregi@mozilla.com
push dateThu, 21 Mar 2019 10:40:08 +0000
treeherdermozilla-central@5cac2c92926e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1535760, 1535748
milestone68.0a1
backs out8ab3c856b9c2868e75263ba66e27d1cb4b396fa5
a9a01b1c9e3a089c37a4342412b2160b8513ad8e
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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)
browser/actors/ContextMenuChild.jsm
browser/app/profile/firefox.js
browser/base/content/browser-context.inc
browser/base/content/nsContextMenu.js
browser/base/content/test/general/browser_contextmenu.js
browser/locales/en-US/chrome/browser/browser.dtd
modules/libpref/init/all.js
toolkit/actors/moz.build
toolkit/components/moz.build
toolkit/components/pictureinpicture/tests/browser.ini
toolkit/components/pictureinpicture/tests/browser_contextMenu.js
toolkit/modules/ActorManagerParent.jsm
toolkit/themes/shared/media/videocontrols.css
--- a/browser/actors/ContextMenuChild.jsm
+++ b/browser/actors/ContextMenuChild.jsm
@@ -742,17 +742,16 @@ class ContextMenuChild extends ActorChil
     context.linkURL             = "";
     context.linkURI             = null;
 
     context.onAudio             = false;
     context.onCanvas            = false;
     context.onCompletedImage    = false;
     context.onCTPPlugin         = false;
     context.onDRMMedia          = false;
-    context.onPiPVideo          = false;
     context.onEditable          = false;
     context.onImage             = false;
     context.onKeywordField      = false;
     context.onLink              = false;
     context.onLoadedImage       = false;
     context.onMailtoLink        = false;
     context.onMozExtLink        = false;
     context.onNumeric           = false;
@@ -867,20 +866,16 @@ class ContextMenuChild extends ActorChil
       if (this._isMediaURLReusable(mediaURL)) {
         context.mediaURL = mediaURL;
       }
 
       if (this._isProprietaryDRM()) {
         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.
       if (context.target.readyState >= context.target.HAVE_METADATA &&
           (context.target.videoWidth == 0 || context.target.videoHeight == 0)) {
         context.onAudio = true;
       } else {
         context.onVideo = true;
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1507,16 +1507,20 @@ pref("media.autoplay.default", 0); // 0=
 
 #ifdef NIGHTLY_BUILD
 // Block WebAudio from playing automatically.
 pref("media.autoplay.block-webaudio", true);
 #else
 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)
 pref("browser.cache.frecency_experiment", 0);
 
 pref("browser.translation.detectLanguage", false);
 pref("browser.translation.neverForLanguages", "");
 // Show the translation UI bits, like the info bar, notification icon and preferences.
--- a/browser/base/content/browser-context.inc
+++ b/browser/base/content/browser-context.inc
@@ -171,20 +171,20 @@
                 accesskey="&videoFullScreen.accesskey;"
                 label="&videoFullScreen.label;"
                 oncommand="gContextMenu.mediaCommand('fullscreen');"/>
       <menuitem id="context-leave-dom-fullscreen"
                 accesskey="&leaveDOMFullScreen.accesskey;"
                 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"/>
       <menuitem id="context-reloadimage"
                 label="&reloadImageCmd.label;"
                 accesskey="&reloadImageCmd.accesskey;"
                 oncommand="gContextMenu.reloadImage();"/>
       <menuitem id="context-viewimage"
--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -210,17 +210,16 @@ nsContextMenu.prototype = {
     this.linkURL             = context.linkURL;
     this.linkURI             = this.getLinkURI(); // can't send; regenerate
 
     this.onAudio             = context.onAudio;
     this.onCanvas            = context.onCanvas;
     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;
     this.onLink              = context.onLink;
     this.onLoadedImage       = context.onLoadedImage;
     this.onMailtoLink        = context.onMailtoLink;
     this.onMozExtLink        = context.onMozExtLink;
     this.onNumeric           = context.onNumeric;
@@ -674,17 +673,17 @@ nsContextMenu.prototype = {
     this.showItem("context-media-pause", onMedia && !this.target.paused && !this.target.ended);
     this.showItem("context-media-mute", onMedia && !this.target.muted);
     this.showItem("context-media-unmute", onMedia && this.target.muted);
     this.showItem("context-media-playbackrate", onMedia && this.target.duration != Number.POSITIVE_INFINITY);
     this.showItem("context-media-loop", onMedia);
     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;
       this.showItem("context-video-pictureinpicture", shouldDisplay);
     }
     this.showItem("context-media-eme-learnmore", this.onDRMMedia);
     this.showItem("context-media-eme-separator", this.onDRMMedia);
 
@@ -709,17 +708,16 @@ nsContextMenu.prototype = {
       this.setItemAttr("context-media-playbackrate-150x", "disabled", hasError);
       this.setItemAttr("context-media-playbackrate-200x", "disabled", hasError);
       this.setItemAttr("context-media-showcontrols", "disabled", hasError);
       this.setItemAttr("context-media-hidecontrols", "disabled", hasError);
       if (this.onVideo) {
         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);
   },
 
   initClickToPlayItems() {
     this.showItem("context-ctp-play", this.onCTPPlugin);
     this.showItem("context-ctp-hide", this.onCTPPlugin);
--- a/browser/base/content/test/general/browser_contextmenu.js
+++ b/browser/base/content/test/general/browser_contextmenu.js
@@ -191,62 +191,35 @@ add_task(async function test_canvas() {
      "context-selectall",    true,
     ], {
       maybeScreenshotsPresent: true,
     }
   );
 });
 
 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,
     ]
   );
 });
 
 add_task(async function test_audio_in_video() {
   await test_contextmenu("#test-audio-in-video",
     ["context-media-play",         true,
      "context-media-mute",         true,
--- a/browser/locales/en-US/chrome/browser/browser.dtd
+++ b/browser/locales/en-US/chrome/browser/browser.dtd
@@ -247,22 +247,16 @@ These should match what Safari and other
 <!-- LOCALIZATION NOTE (exitDOMFullscreen.button,
      exitDOMFullscreenMac.button): the "escape" button on PC keyboards
      is uppercase, while on Mac keyboards it is lowercase -->
 <!ENTITY exitDOMFullscreen.button "Exit Full Screen (Esc)">
 <!ENTITY exitDOMFullscreenMac.button "Exit Full Screen (esc)">
 <!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.
      Localizers can use one of them, or both, to better adapt this
      sentence to their language. -->
 <!ENTITY pointerlockWarning.beforeDomain.label "">
 <!ENTITY pointerlockWarning.afterDomain.label "has control of your pointer. Press Esc to take back control.">
 <!ENTITY pointerlockWarning.generic.label "This document has control of your pointer. Press Esc to take back control.">
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -439,18 +439,16 @@ pref("media.peerconnection.dtmf.enabled"
 #ifdef NIGHTLY_BUILD
 pref("media.peerconnection.sdp.rust.enabled", true);
 pref("media.peerconnection.sdp.rust.compare", true);
 #else
 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", "");
 pref("media.webrtc.debug.aec_dump_max_size", 4194304); // 4MB
 
 pref("media.navigator.video.default_width",0);  // adaptive default
 pref("media.navigator.video.default_height",0); // adaptive default
 pref("media.peerconnection.video.enabled", true);
--- a/toolkit/actors/moz.build
+++ b/toolkit/actors/moz.build
@@ -23,21 +23,25 @@ FINAL_TARGET_FILES.actors += [
     'AutoplayChild.jsm',
     'BrowserChild.jsm',
     'ControllersChild.jsm',
     'DateTimePickerChild.jsm',
     'ExtFindChild.jsm',
     'FindBarChild.jsm',
     'FinderChild.jsm',
     'KeyPressEventModelCheckerChild.jsm',
-    'PictureInPictureChild.jsm',
     'PopupBlockingChild.jsm',
     'PrintingChild.jsm',
     'PurgeSessionHistoryChild.jsm',
     'SelectChild.jsm',
     'SelectionSourceChild.jsm',
     'ThumbnailsChild.jsm',
     'UAWidgetsChild.jsm',
     'UnselectedTabHoverChild.jsm',
     'WebChannelChild.jsm',
     'WebNavigationChild.jsm',
     'ZoomChild.jsm',
 ]
+
+if CONFIG['NIGHTLY_BUILD']:
+    FINAL_TARGET_FILES.actors += [
+        'PictureInPictureChild.jsm',
+    ]
--- a/toolkit/components/moz.build
+++ b/toolkit/components/moz.build
@@ -44,17 +44,16 @@ DIRS += [
     'mediasniffer',
     'mozintl',
     'mozprotocol',
     'osfile',
     'parentalcontrols',
     'passwordmgr',
     'perf',
     'perfmonitoring',
-    'pictureinpicture',
     'places',
     'processsingleton',
     'promiseworker',
     'prompts',
     'protobuf',
     'reader',
     'remotebrowserutils',
     'remotepagemanager',
@@ -83,16 +82,19 @@ DIRS += [
 ]
 
 if CONFIG['MOZ_BUILD_APP'] != 'mobile/android':
     DIRS += ['narrate'];
 
     if CONFIG['NS_PRINTING']:
         DIRS += ['printing']
 
+    if CONFIG['NIGHTLY_BUILD']:
+        DIRS += ['pictureinpicture']
+
 if CONFIG['BUILD_CTYPES']:
     DIRS += ['ctypes']
 
 if CONFIG['MOZ_XUL']:
     DIRS += ['autocomplete', 'printingui', 'satchel']
 
 if CONFIG['MOZ_TOOLKIT_SEARCH']:
     DIRS += ['search']
--- a/toolkit/components/pictureinpicture/tests/browser.ini
+++ b/toolkit/components/pictureinpicture/tests/browser.ini
@@ -3,11 +3,10 @@ support-files =
   head.js
   test-page.html
   test-video.mp4
 
 prefs =
   media.videocontrols.picture-in-picture.enabled=true
 
 [browser_cannotTriggerFromContent.js]
-[browser_contextMenu.js]
 [browser_closeTab.js]
 [browser_showMessage.js]
deleted file mode 100644
--- a/toolkit/components/pictureinpicture/tests/browser_contextMenu.js
+++ /dev/null
@@ -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);
-    });
-  }
-});
--- a/toolkit/modules/ActorManagerParent.jsm
+++ b/toolkit/modules/ActorManagerParent.jsm
@@ -92,16 +92,17 @@
  * If Fission is being simulated, and an actor needs to receive events from
  * sub-frames, it must use "allFrames".
  */
 
 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;
 
 let ACTORS = {
   AudioPlayback: {
     child: {
       module: "resource://gre/actors/AudioPlaybackChild.jsm",
       messages: [
@@ -211,29 +212,16 @@ let ACTORS = {
         "DOM:Manifest:FireAppInstalledEvent",
         "DOM:ManifestObtainer:Obtain",
         "DOM:WebManifest:fetchIcon",
         "DOM:WebManifest:hasManifestLink",
       ],
     },
   },
 
-  PictureInPicture: {
-    child: {
-      module: "resource://gre/actors/PictureInPictureChild.jsm",
-      events: {
-        "MozTogglePictureInPicture": {capture: true},
-      },
-
-      messages: [
-        "PictureInPicture:SetupPlayer",
-      ],
-    },
-  },
-
   PopupBlocking: {
     child: {
       module: "resource://gre/actors/PopupBlockingChild.jsm",
       events: {
         "DOMPopupBlocked": {capture: true},
       },
     },
   },
@@ -355,16 +343,31 @@ let ACTORS = {
       messages: [
         "FullZoom",
         "TextZoom",
       ],
     },
   },
 };
 
+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;
     this.actorSide = actorSide;
 
     this.actors = new Map();
     this.events = [];
     this.messages = new DefaultMap(() => []);
--- a/toolkit/themes/shared/media/videocontrols.css
+++ b/toolkit/themes/shared/media/videocontrols.css
@@ -419,24 +419,26 @@
 }
 
 .statusIcon[type="error"] {
   min-width: 70px;
   min-height: 60px;
   background-image: url(chrome://global/skin/media/error.png);
 }
 
+%ifdef NIGHTLY_BUILD
 .statusIcon[type="pictureInPicture"] {
   min-width: 84px;
   min-height: 84px;
   background-image: url(chrome://global/skin/media/pictureinpicture.svg);
   -moz-context-properties: fill, stroke;
   fill: #fff;
   stroke: #fff;
 }
+%endif
 
 /* Overlay Play button */
 .clickToPlay {
   min-width: var(--clickToPlay-size);
   min-height: var(--clickToPlay-size);
   border-radius: 50%;
   background-image: url(chrome://global/skin/media/playButton.svg);
   background-repeat: no-repeat;