Open Bug 242906 Opened 16 years ago Updated 10 years ago

No context menu for images embedded using an EMBED element

Categories

(Camino Graveyard :: Toolbars & Menus, defect, minor)

PowerPC
macOS
defect
Not set
minor

Tracking

(Not tracked)

People

(Reporter: bugmail, Unassigned)

References

Details

(Keywords: testcase)

Attachments

(2 files)

2004050308 (v0.8b) sometimes shows the wrong contextual menu on images embedded
using an OBJECT or EMBED element.

In the testcase, the IMG element always shows the correct contextual menu. The
OBJECT and EMBED examples, however, sometimes show Frame options in addition to
the Image menu items, and sometimes the default Page contextual menu is shown.

I have not yet determined how to reliably reproduce this. Note that crasher bug
181158 occurred during testing for this bug, and initially I was looking at
Camino’s behavior related to bug 185714.
Attached file HTML testcase
One possible reproduction method is to load the testcase and access the
contextual menu on the examples from bottom to top, then top to bottom. You
should see a different contextual menu on the OBJECT and EMBED examples before
clicking the IMG example than after. (That is, contextual-click 5-4-3-2-1-2-3-4-5.)
Keywords: testcase
Summary: Camino sometimes shows the wrong contextual menu on images embedded using an OBJECT or EMBED element → Camino sometimes shows the wrong contextual menu on images embedded using an OBJ ECT or EMBED element
Target Milestone: --- → Camino1.0
Looking at http://autosport-atlas.com/ for another bug, I ctrl-clicked the top
banner add [gif], selected View Image, then went back and did the same with the
right sidebar ads [swf]; ctrl-clicking on them and selecting View Image showed
me the gif from the top of the page.

See also bug 192276, ctrl-click on plugin shows browser CM, and bug 183586,
crashing when trying to ctrl-click on a plugin.
I can reproduce the "page contextual menu" on OBJECT/EMBED every time once I
ctrl-click on the whitespace somewhere to display the page CM.  Every subsequent
ctrl-click on the OBJECTs/EMBEDs then shows the page CM until I ctrl-click on
the IMG (which always shows the correct menu) "resets" the CM (then ctrl-click
on the  OBJECTs/EMBEDs shows the same CM as clicking on the IMG).

I haven't seen the frame options recently, though.
What happens here is that when you context-click on a plugin, we use whatever
context menu was shown last, because we don't get the "onShowContextMenu" which
gives us the flags and dom node.
Status: NEW → ASSIGNED
It turns out that nsDocShellTreeOwner is preventing the propagation of the
onShowContextMenu for embeds, objects and applets here:

http://lxr.mozilla.org/mozilla/source/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp#1718

but the widget code doesn't know that.

Firefox somehow manages to figure out if an <embed> contains an image, and shows
the image context menu in that case. That happens here, I think:

http://lxr.mozilla.org/mozilla/source/browser/base/content/browser.js#4216
Assignee: pinkerton → sfraser_bugs
Status: ASSIGNED → NEW
> Firefox somehow manages to figure out if an <embed> contains an image

Note that Firefox does not use nsDocShellTreeOwner.cpp...  yet.

As for the rest, why are we consuming that event here?  The <object> code should
be doing so itself as needed (and does, last I checked).  So could we just
remove the code at
http://lxr.mozilla.org/mozilla/source/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp#1718
without breaking things?
Depends on: 181158
After fixing bug 181158, we'll just show the page context menu for
objects/embeds that don't have their own menu. nsDocShellOwner is not smart
enough to figure out of the contents of the <embed> are an image, say.
Severity: normal → minor
Status: NEW → ASSIGNED
Summary: Camino sometimes shows the wrong contextual menu on images embedded using an OBJ ECT or EMBED element → Camino shows the page context menu on images embedded using an OBJ ECT or EMBED element
> nsDocShellOwner is not smart enough

I'd be perfectly happy to make it smarter if we have an outline of things it
gets wrong.  Do all embedding apps basically rely on the logic in here instead
of having their own context menu logic?
(In reply to comment #10)
> > nsDocShellOwner is not smart enough
> 
> I'd be perfectly happy to make it smarter if we have an outline of things it
> gets wrong.  Do all embedding apps basically rely on the logic in here instead
> of having their own context menu logic?

Yes, they rely on the flags passed to
http://lxr.mozilla.org/mozilla/source/embedding/browser/webBrowser/nsIContextMenuListener.idl

though they are given the DOM node, so they could grovel the DOM if they wanted to.
Hmm.. we can't actually change this code, because the interface is frozen and
explicitly documents what all the flags mean.  :(

Perhaps it's time for an nsIContextMenuListener2?  Except we have that already,
and it has the same shortcomings... luckily, it's not frozen.  But perhaps we
should just go ahead and freeze it as-is if it's being used and create
nsIContextMenuListener3 that actually passes over useful information and doesn't
document itself into a hole by associating its flags with particular HTML node
types?  Note that neither nsIContextMenuListener nor nsIContextMenuListener2 is
very useful for XML of any sort except perhaps XHTML -- it completely ignores
non-HTML nodes.
Target Milestone: Camino1.0 → Camino1.2
Something's regressed since comment 9; we now (1.0.1rc/1.8.0.3 and trunk) don't get any CM on any of the testcase samples except the plain image one.
OS: Mac OS X 10.2 → Mac OS X 10.3
QA Contact: toolbars
Summary: Camino shows the page context menu on images embedded using an OBJ ECT or EMBED element → Camino shows the page context menu on images embedded using an OBJECT or EMBED element
Summary: Camino shows the page context menu on images embedded using an OBJECT or EMBED element → Camino shows the page context menu (or no context menu) on images embedded using an OBJECT or EMBED element
Target Milestone: Camino1.6 → ---
Updating summary to reflect current trunk behavior; OBJECT now works correctly, but the two cases when EMBED is innermost still show no menu.
Assignee: sfraser_bugs → nobody
Status: ASSIGNED → NEW
Summary: Camino shows the page context menu (or no context menu) on images embedded using an OBJECT or EMBED element → No context menu for images embedded using an EMBED element
You need to log in before you can comment on or make changes to this bug.