Closed Bug 1218144 Opened 9 years ago Closed 11 months ago

Context menu entry "View image info" should select the image automatically

Categories

(Firefox :: Page Info Window, defect)

defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: 08xjcec48, Assigned: aryx)

References

Details

(Keywords: regression)

Attachments

(2 files)

Attached image "View image info" bug
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:42.0) Gecko/20100101 Firefox/42.0 Build ID: 20151022152545 Steps to reproduce: 1. Open the direct link to an image: https://upload.wikimedia.org/wikipedia/commons/5/55/Firefox_40_on_Windows_10.png 2. Right-click on it 3. Pick the "View image info" option Actual results: Firefox now shows another address (chrome://global/skin/media/imagedoc-darknoise.png) besides the opened image, and I need to click on the proper address to finally see the image info. Expected results: "View image info" should open the info to that image alone, and not display "chrome://global/skin/media/imagedoc-darknoise.png".
Summary: Image context menu "View image info" shows chrome://global/skin/media/imagedoc-darknoise.png → Image context menu entry "View image info" shows chrome://global/skin/media/imagedoc-darknoise.png
Attachment #8678530 - Attachment description: Untitled-1.png → "View image info" bug.
Attachment #8678530 - Attachment filename: Untitled-1.png → view_image_info_bug.png
Attachment #8678530 - Attachment description: "View image info" bug. → "View image info" bug
Listing the background image there is likely correct (think about a tab with content from within an extension), but at least the image in the foreground should be selected.
Status: UNCONFIRMED → NEW
Component: Untriaged → Page Info Window
Ever confirmed: true
Summary: Image context menu entry "View image info" shows chrome://global/skin/media/imagedoc-darknoise.png → context menu entry "View image info" should show/select image if in image viewer mode, not chrome://global/skin/media/imagedoc-darknoise.png
Blocks: 1040947
Has Regression Range: --- → yes
Has STR: --- → yes
Keywords: regression
OS: Unspecified → All
Hardware: Unspecified → x86_64
Version: 42 Branch → 48 Branch
Hardware: x86_64 → All
Version: 48 Branch → 51 Branch
Assignee: nobody → aryx.bugmail
Status: NEW → ASSIGNED
What happened here: The information of the image on which the context menu got used always uses the image element's title attribute as imageText, or if it doesn't find it the alt attribute: https://dxr.mozilla.org/mozilla-central/rev/16effd5b21ab03629feca04b5b83911bb757394c/browser/base/content/content.js#1039-1047 When the information for all the images (which will be used by the Media tab of the Page Info window) gets collected, imageText only gets set if it's not a background image (doesn't apply for View Image Info) and neither an SVGImageElement nor an ImageDocument: https://dxr.mozilla.org/mozilla-central/rev/16effd5b21ab03629feca04b5b83911bb757394c/browser/base/content/content.js#1252-1263 But for the View Image page, it's an ImageDocument, so matching in the Page Info window fails: https://dxr.mozilla.org/mozilla-central/rev/16effd5b21ab03629feca04b5b83911bb757394c/browser/base/content/pageinfo/pageInfo.js#1069
Comment on attachment 8839247 [details] Bug 1218144 - also select image in Page Info window when opened from View Image page. https://reviewboard.mozilla.org/r/113940/#review117924 Sorry for the delay here; I was on PTO most of last week. ::: browser/base/content/content.js:1043 (Diff revision 1) > > getImageInfo(imageElement) { > let imageInfo = null; > if (imageElement) { > + let imageText; > + if (!(imageElement instanceof content.SVGImageElement) && The fix looks reasonable, but I think we need a short comment here to explain why this test matters, or it's likely someone may regress this in the future. Also, is there any chance you could add test coverage for this? http://searchfox.org/mozilla-central/source/browser/base/content/test/general/browser_bug517902.js can be used as inspiration (although we'll need to tweak this test a bit in bug 1326910).
Attachment #8839247 - Flags: review?(florian)
This might still be more of a feedback request. The passes here but if it would be great if you can advice on two issues: 1) For the first context menu, I have to call |hidePopup()| - awaitPopupHidden doesn't work like for the second one. How should this be done? 2) How does one handle the Page Info window opening and loading async? Services.ww.registerNotification works, but a yield BrowserTestUtils(aSubject, "load") got ignored. It loads about:blank first, so one has to wait for that xul one.
Flags: needinfo?(florian)
Comment on attachment 8839247 [details] Bug 1218144 - also select image in Page Info window when opened from View Image page. https://reviewboard.mozilla.org/r/113940/#review119600 Thanks for adding the test! Does the SVG case not matter enough to be covered too? ::: browser/base/content/test/pageinfo/browser_viewImageInfo_from_viewImagePage.js:10 (Diff revision 2) > + let pageSource = encodeURI("data:text/html," + > + "<style type='text/css'>%23test-image,%23not-test-image {background-image: url('about:logo?c');}</style>" + > + "<img src='about:logo?b' height=300 width=350 alt=2 id='not-test-image'>" + > + "<img src='about:logo?b' height=300 width=350 alt=2>" + > + "<img src='about:logo?a' height=200 width=250>" + > + "<img id='showContextMenu' src='about:logo?b' height=200 width=250 alt=1>" + I would make this url unique, so that the test really verifies the right image has been selected in the list. Eg. about:logo?d or about:logo?context
Attachment #8839247 - Flags: review?(florian) → review+
(In reply to Sebastian Hengst [:aryx][:archaeopteryx] (needinfo on intermittent or backout) from comment #7) Ah, I didn't see this comment before looking at the patch. > This might still be more of a feedback request. The passes here but if it > would be great if you can advice on two issues: > > 1) For the first context menu, I have to call |hidePopup()| - > awaitPopupHidden doesn't work like for the second one. How should this be > done? I was surprised by this hidePopup in the code, but if it works reliably, that's good enough for an r+ IMHO. I would have tried a synthesizeMouseAtCenter call instead of the .click(). > 2) How does one handle the Page Info window opening and loading async? > Services.ww.registerNotification works, but a yield > BrowserTestUtils(aSubject, "load") got ignored. It loads about:blank first, > so one has to wait for that xul one. Other tests seem to use the page-info-dialog-loaded notification: http://searchfox.org/mozilla-central/source/browser/base/content/test/general/browser_pageInfo.js#15 (btw, this test seems a good candidate to be moved to the new folder you created).
Flags: needinfo?(florian)
Version: 51 Branch → 57 Branch
Version: 57 Branch → 58 Branch
Version: 58 Branch → 59 Branch
Version: 59 Branch → 60 Branch
Version: 60 Branch → 61 Branch
Version: 61 Branch → 62 Branch
Version: 62 Branch → 63 Branch
Version: 63 Branch → 64 Branch
Version: 64 Branch → 65 Branch
Version: 65 Branch → 66 Branch
Version: 66 Branch → 67 Branch
Version: 67 Branch → 68 Branch
Summary: context menu entry "View image info" should show/select image if in image viewer mode, not chrome://global/skin/media/imagedoc-darknoise.png → Context menu entry "View image info" should select the image automatically
Version: 68 Branch → 69 Branch
Version: 69 Branch → 70 Branch
Version: 70 Branch → 71 Branch
Version: 71 Branch → 72 Branch
Version: 72 Branch → 73 Branch
Version: 73 Branch → 74 Branch
Version: 74 Branch → 76 Branch
Version: 76 Branch → 77 Branch
Version: 77 Branch → 78 Branch
Version: 78 Branch → 80 Branch
Version: 80 Branch → Firefox 81
Version: Firefox 81 → Firefox 82
Version: Firefox 82 → Firefox 83
Version: Firefox 83 → Firefox 84
Version: Firefox 84 → Trunk

"View Image Info" was removed from the context menu in Fx87 by bug 1690029. So I think this request is obsolete now, unless there is a change of course.

This problem also happens if you open the Page info / More information dialog from the main menu or the address bar padlock and then click on the Media tab.

Severity: normal → S3
Status: ASSIGNED → RESOLVED
Closed: 11 months ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: