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
--- 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);