Bug 1302976 part 3 - Not display 'Full Screen' menu item if the document is not allowed to be in fullscreen. r?dao draft
authorXidorn Quan <me@upsuper.org>
Mon, 19 Sep 2016 11:42:10 +1000
changeset 414985 9be1cba4beabdfcf1f9ceffc838a96c93c64450a
parent 414984 9bc53fafe10b30a93a2c2991b1381bbe48b52343
child 531519 ba6190c0ea6b8d2afff69d3e4fec876963d0cc54
push id29768
push userxquan@mozilla.com
push dateMon, 19 Sep 2016 05:02:40 +0000
reviewersdao
bugs1302976
milestone51.0a1
Bug 1302976 part 3 - Not display 'Full Screen' menu item if the document is not allowed to be in fullscreen. r?dao MozReview-Commit-ID: 55otSbg2Wzw
browser/base/content/content.js
browser/base/content/nsContextMenu.js
--- a/browser/base/content/content.js
+++ b/browser/base/content/content.js
@@ -746,17 +746,17 @@ addMessageListener("ContextMenu:MediaCom
       break;
     case "hidecontrols":
       media.removeAttribute("controls");
       break;
     case "showcontrols":
       media.setAttribute("controls", "true");
       break;
     case "fullscreen":
-      if (content.document.fullscreenEnabled)
+      if (media.ownerDocument.fullscreenEnabled)
         media.requestFullscreen();
       break;
   }
 });
 
 addMessageListener("ContextMenu:Canvas:ToBlobURL", (message) => {
   message.objects.target.toBlob((blob) => {
     let blobURL = URL.createObjectURL(blob);
--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -464,17 +464,17 @@ nsContextMenu.prototype = {
     this.showItem("context-media-play",  onMedia && (this.target.paused || this.target.ended));
     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.fullscreenElement == null);
+    this.showItem("context-video-fullscreen", this.onVideo && this.target.ownerDocument.fullscreenEnabled);
     this.showItem("context-media-eme-learnmore", this.onDRMMedia);
     this.showItem("context-media-eme-separator", this.onDRMMedia);
 
     // Disable them when there isn't a valid media source loaded.
     if (onMedia) {
       this.setItemAttr("context-media-playbackrate-050x", "checked", this.target.playbackRate == 0.5);
       this.setItemAttr("context-media-playbackrate-100x", "checked", this.target.playbackRate == 1.0);
       this.setItemAttr("context-media-playbackrate-125x", "checked", this.target.playbackRate == 1.25);