Bug 1545168 - Picture-in-Picture context menu item should be disabled on broken videos. r=jaws
authorMike Conley <mconley@mozilla.com>
Thu, 18 Apr 2019 03:26:14 +0000
changeset 470081 84110efda7165c81b707b3a2b8880b8aa44df7c1
parent 470080 cec2387cbef5532ab7c52fc1d49bd6276bd4eeaf
child 470082 b311c12d8854f0d6fb71d62c7cb15105de43a3bd
push id35888
push useraiakab@mozilla.com
push dateFri, 19 Apr 2019 09:47:45 +0000
treeherdermozilla-central@0160424142d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1545168
milestone68.0a1
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
Bug 1545168 - Picture-in-Picture context menu item should be disabled on broken videos. r=jaws For videos that break after alreading being in Picture-in-Picture, we keep the toggle enabled so that the user can exit Picture-in-Picture. Differential Revision: https://phabricator.services.mozilla.com/D27951
browser/base/content/nsContextMenu.js
--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -710,16 +710,18 @@ nsContextMenu.prototype = {
       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.setItemAttr("context-video-pictureinpicture", "disabled",
+                         !this.onPiPVideo && hasError);
       }
     }
     this.showItem("context-media-sep-commands", onMedia);
   },
 
   initClickToPlayItems() {
     this.showItem("context-ctp-play", this.onCTPPlugin);
     this.showItem("context-ctp-hide", this.onCTPPlugin);