There are two issues in this function: 1) If "type" is not set you'll get back null and then trying to call indexOf on it will throw. 2) You'd be better off detecting an image by going through nsIImageLoadingContent and looking for an actual image hanging off the node. #1 is extremely bad -- it makes very broken context menus come up (think every single item enabled). You can test with the testcase (and patch) in bug 122685
I meant bug 185714 (as the dependencies say).
Created attachment 147520 [details] Testcase that needs no patches This breaks today's seamonkey build; no need for patch from bug 185714 or anything.
This was fixed in bug 196380.