--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -467,17 +467,17 @@ nsContextMenu.prototype = {
var onMedia = (this.onVideo || this.onAudio);
// Several mutually exclusive items... play/pause, mute/unmute, show/hide
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.showItem("context-media-showcontrols", onMedia && !this.target.controls);
- this.showItem("context-media-hidecontrols", 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);
var statsShowing = this.onVideo && this.target.mozMediaStatisticsShowing;
this.showItem("context-video-showstats", this.onVideo && this.target.controls && !statsShowing);
this.showItem("context-video-hidestats", this.onVideo && this.target.controls && statsShowing);
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.
--- a/browser/base/content/test/general/browser_contextmenu.js
+++ b/browser/base/content/test/general/browser_contextmenu.js
@@ -23,16 +23,22 @@ add_task(function* test_setup() {
Services.scriptloader.loadSubScript(contextmenu_common, this);
yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
let doc = content.document;
let videoIframe = doc.querySelector("#test-video-in-iframe");
let video = videoIframe.contentDocument.querySelector("video");
video.pause();
yield ContentTaskUtils.waitForCondition(() => video.paused, "iframe video should be paused");
+
+ let audioIframe = doc.querySelector("#test-audio-in-iframe");
+ // media documents always use a <video> tag.
+ let audio = audioIframe.contentDocument.querySelector("video");
+ audio.pause();
+ yield ContentTaskUtils.waitForCondition(() => audio.paused, "iframe audio should be paused");
});
});
let plainTextItems;
add_task(function* test_plaintext() {
plainTextItems = ["context-navigation", null,
["context-back", false,
"context-forward", false,
@@ -257,16 +263,46 @@ add_task(function* test_video_in_iframe(
"context-saveframe", true,
"---", null,
"context-printframe", true,
"---", null,
"context-viewframeinfo", true], null]
);
});
+add_task(function* test_audio_in_iframe() {
+ yield test_contextmenu("#test-audio-in-iframe",
+ ["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-150x", true,
+ "context-media-playbackrate-200x", true], null,
+ "---", null,
+ "context-copyaudiourl", true,
+ "---", null,
+ "context-saveaudio", true,
+ "context-sendaudio", true,
+ "frame", null,
+ ["context-showonlythisframe", true,
+ "context-openframeintab", true,
+ "context-openframe", true,
+ "---", null,
+ "context-reloadframe", true,
+ "---", null,
+ "context-bookmarkframe", true,
+ "context-saveframe", true,
+ "---", null,
+ "context-printframe", true,
+ "---", null,
+ "context-viewframeinfo", true], null]
+ );
+});
+
add_task(function* test_image_in_iframe() {
yield test_contextmenu("#test-image-in-iframe",
["context-viewimage", true,
"context-copyimage-contents", true,
"context-copyimage", true,
"---", null,
"context-saveimage", true,
"context-sendimage", true,