Closed Bug 496832 Opened 15 years ago Closed 15 years ago

Disable media entries in context menu when media source is invalid

Categories

(Firefox :: Menus, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
Firefox 3.6a1
Tracking Status
status1.9.1 --- .2-fixed

People

(Reporter: pascalc, Assigned: Dolske)

References

Details

(Keywords: regression, testcase, verified1.9.1)

Attachments

(1 file, 2 obsolete files)

1/ Go to the test case attached to this bug. It contains an image with a wrong link, a video with a wrong link and a video with a correct link.

2/ right click on the second square which is the video with the wrong link, select 'copy url"

Expected result:
Same behaviour as for the image tag, the url is copied to the clipboard

Actual result:
Nothing is copied, this feature works only if the url is correct
Attached file testcase (obsolete) —
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2a1pre) Gecko/20090607 Minefield/3.6a1pre

Regression range is: http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=884a5c12182a&tochange=73c3f66ec28f
Blocks: 464158
Component: General → Video/Audio
OS: Linux → All
Product: Firefox → Core
QA Contact: general → video.audio
Hardware: x86 → All
Version: 3.5 Branch → Trunk
Flags: blocking1.9.1?
Keywords: regression, testcase
The context menu uses the element's currentSrc attribute when copying the URL.  This attribute is only set after a valid media source has selected, so you can't rely on the value of it before receiving the first progress event (not sure if anything more appropriate fires when currentSrc becomes valid, a quick skim of the spec didn't reveal anything), nor when the resource selection algorithm fails to find a valid media source.

Using currentSrc is the correct thing to do once it becomes valid, since the media element may have selected any one of a number of possible sources.

It's not clear to me what the right behaviour is when currentSrc isn't valid.  Maybe we should just disable the "Copy URL" menu item?
When the URL is pointing to a faulty resource, copying the URL becomes a diagnostic sort of thing. This doesn't block the release of Firefox 3.5.

As for comment 3, if we can't actually make the menuItem do anything here, then yes, it should be disabled.
Flags: wanted1.9.1.x?
Flags: blocking1.9.2?
Flags: blocking1.9.1?
Flags: blocking1.9.1-
Assignee: nobody → dolske
Summary: <video> tag, If url of video is not correct, the context menu "copy url" item does not copy → Disable media entries in context menu when media source is invalid
Target Milestone: --- → mozilla1.9.2a1
Attached patch Patch v.1 (obsolete) — Splinter Review
This disables various context menu media entries when there are problems.

1) The entries that deal with a URL (copy/send/view) are disabled when no URL is available. I also added a fallback to use .src when .currentSrc isn't set... This allows using these commands on <video src="bad.avi">. I don't *think* it's possible to have to have .src and <source> trying to load different things... The spec seems to say that the src attribute should override any <source> that might be present. I think the only time this could even matter, though, is early on in the initial load.

2) The entries that deal with controlling the media (play/mute/show-controls) are disabled when the video is in an error state. I'm a little unsure of how non-recoverable errors are (eg, should "play" restart a video that ended because it was corrupted?), but I guess we already hide the controls when an error happens, so it's consistent with that.
Attachment #383219 - Flags: review?(gavin.sharp)
Component: Video/Audio → Menus
Flags: blocking1.9.2?
Flags: blocking1.9.1-
Product: Core → Firefox
QA Contact: video.audio → menus
Target Milestone: mozilla1.9.2a1 → ---
Comment on attachment 383219 [details] [diff] [review]
Patch v.1

>diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js

>+    if (onMedia) {
>+      this.setItemAttr("context-media-play",  "disabled", (this.target.error != null));

Use a temporary for (error != null)?

>-        this.mediaURL = this.target.currentSrc;
>+        this.mediaURL = this.target.currentSrc || this.target.src;

When is currentSrc empty but src not, out of curiosity?
Attachment #383219 - Flags: review?(gavin.sharp) → review+
(In reply to comment #8)
> When is currentSrc empty but src not, out of curiosity?

Nevermind, re-read comment 5.

We should be able to test this right?
Added tests and fixed nits.

Pushed http://hg.mozilla.org/mozilla-central/rev/d420c721e863
Status: NEW → RESOLVED
Closed: 15 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → Firefox 3.6a1
I'd like to land this in 3.5.1. Safe and understood patch, context menu has existing tests and added more for this specific change.
Attachment #382061 - Attachment is obsolete: true
Attachment #383219 - Attachment is obsolete: true
Attachment #387793 - Flags: approval1.9.1.1?
Comment on attachment 387793 [details] [diff] [review]
Patch v.2 (checked in)

a1912=beltzner
Attachment #387793 - Flags: approval1.9.1.1? → approval1.9.1.2+
Flags: wanted1.9.1.x?
Verified fixed on trunk and 1.9.1 with builds on all platforms like:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2a1pre) Gecko/20090722 Minefield/3.6a1pre (.NET CLR 3.5.30729) ID:20090722042136

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.2pre) Gecko/20090729 Shiretoko/3.5.2pre (.NET CLR 3.5.30729) ID:20090729045022
Status: RESOLVED → VERIFIED
Keywords: verified1.9.1
Blocks: 593576
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: