LWN.net Logo

Advertisement

E-Commerce & credit card processing - the Open Source way!

Advertise here

Firefox Extension Issues

By Forrest Cook
October 31, 2007

The Firefox 2 web browser is undoubtedly one of the most important applications running on the Linux desktop. Your author has been running Firefox for many years now. It is generally user friendly, the features that it has are useful, normally it doesn't get in the way of the user and crashes are rare. The Linux desktop would clearly not be the same without it.

One exception to this generally happy situation involves the handling of non-standard audio and video formats. Take, for example, the extremely common mp3 audio format. For reference, we'll be working with the Firefox version 2.0.0.8 on Ubuntu 7.10, both current releases. Firefox on Ubuntu is set up to use Totem, a GNOME movie player for playing mp3 files. Unfortunately, across quite a few releases of Ubuntu, your author has never had any luck getting Totem to play an mp3 file, clicking on an mp3 link causes Totem to fire up, then it simply freezes.

If you don't mind having a bit of closed-source software on your machine, RealPlayer 10 is a basic mp3 player with a simple GUI control panel that can be connected to Firefox. Here's how the installation was performed: the RealPlayer10GOLD.bin file was downloaded to a user directory, the downloaded file was executed, then the realplay command was executed manually in order to answer the installation and license questions. The libstdc++5 package had to be installed for realplay to run. Once realplay was initialized, things got more complicated. It was necessary to become root, visit the /usr/lib/firefox/plugins/ directory, remove the default libtotem files and restart Firefox. Downloading an mp3 file caused Firefox to display a popup window that prompted the user to select an appropriate player. The appropriate player was selected and things now worked. This process is easy the second time around, but a lot of digging through documentation was required initially.

Now, lets say you want to watch a new Hot Tuna video on You Tube. This case is a bit easier than setting Firefox up to play mp3 files. You Tube directed the browser to the Adobe Flash Player Download Center. The software was downloaded, unzipped and extracted with tar. The flashplayer-installer command was executed and it put a copy of libflashplayer.so in the ~/.mozilla/plugins directory, the plugins directory may require manual creation. Firefox was restarted and Hot Tuna played.

Another example of a common browser plugin is Java. It can be interesting to look at weather radar on the US NEXRAD network. If you click on the Loop buttons, Firefox will tell you that it needs to have Java installed. Unlike older versions, this version of Firefox/Ubuntu brought up a menu for choosing Sun's Java or GCJ. GCJ was chosen and seemed to install correctly, but was not able to display the radar movie. Once installed, removal of the faulty GCJ became a mystery. Installing the Sun Java manually seemed to overwrite the correct links, although the GCJ files are still sitting on the system in some unknown location, taking up disk space. The new magic only seems to work the first time Java needs to be installed.

The Java software was found on the Sun Microsystems Download Center for Java(TM) SE Runtime Environment 6 Update 3. Java was downloaded and the jre-6u3-linux-i586.bin file was executed. The installation/license questions had to be answered and the software was installed. Again, it was necessary to go to the ~/.mozilla/plugins directory and make a symbolic link back to the installed jre/jre1.6.0_03/plugin/i386/ns7/libjavaplugin_oji.so file. Not something your grandmother would want to do. Firefox was restarted and the radar movies work.

These examples may not be the most optimal solutions, but they were effective for achieving the desired results. To get the above three plugins running, it was necessary to modify either the system-wide or user-specific plugin directories. In one case, symbolic links were used to point to the installed libraries, in another case the library was copied directly. There does not seem to be any kind of standard technique in use.

Firefox has an internal about:plugins URL to display the plugin list. On one test machine, the plugin list was missing any entry for realplayer, but the player was installed and functioning. Unlike the about:config URL, there is no way to modify anything shown in about:plugins.

It seems like the adding of plugins should be possible using the Firefox menus. Clicking on Edit->Preferences->Content->File Types [Manage] brings up the Download Actions window, but that window seems to be crippled. There is no "Add" button, only a "Change Action" button that works on a limited number of pre-defined file extensions. There is no MP3 or JAVA extension to be found. Again, the list of plugins does not show everything installed.

Some of the plugin confusion is likely the result of different methods used by the various plugin software writers. However, that is likely caused by having too many ways to do one thing. This section of Firefox really looks like it could use a code review. Some work on simplifying the interface and the addition of some basic features would go a long way toward improving the end user experience. Managing plugins under Firefox really should be a lot easier to do.


(Log in to post comments)

Firefox Extension Issues

Posted Oct 31, 2007 22:14 UTC (Wed) by jwb (subscriber, #15467) [Link]

For what it's worth, MP3 and Java in the browser both worked perfectly on a fresh installation
of Ubuntu 7.10 x86.  Flash installed itself from the Firefox plugin finder.  I didn't have to
touch any symlinks.

Firefox Extension Issues

Posted Oct 31, 2007 23:34 UTC (Wed) by jimparis (subscriber, #38647) [Link]

You should try to avoid browsing to random websites to install applications like that.  It
goes around the distribution's packaging system and is almost certain to cause problems with
upgrades in the future.

Distros usually offer packages for this.  For example, for flash, just install the
"flashplugin-nonfree" package.  For Java, install "sun-java6-plugin".  On Debian, that just
works, and I presume Ubuntu is the similar.

Firefox Extension Issues

Posted Nov 1, 2007 2:17 UTC (Thu) by tajyrink (subscriber, #2750) [Link]

Actually, Ubuntu 7.10's Firefox has the ubufox extension that offers Flash (Adobe's or Gnash),
Java etc. when needed inside Firefox, from the repositories. I'm not sure why the writer
didn't get that dialog in Youtube, instead getting redirected to Adobe's manual downloading
site. Probably depends on the site, and too hasty redirection scripts override
Firefox's/Ubuntu's own mechanism of offering plugins.

For Java it seemed to work, though GCJ's webplugin doesn't work that well, yet. Icedtea
snapshot is available in Ubuntu, but I'd guess the ubufox doesn't install it since Icedtea
landed in Ubuntu 7.10 about a week before the release.

A good point is that ubufox doesn't yet provide deinstallation, instead the user should find
the plugins via ordinary package management, by eg. going to Applications->Add/Remove... and
writing "plugin" in the search field.

Firefox Extension Issues

Posted Nov 2, 2007 16:25 UTC (Fri) by MenTaLguY (subscriber, #21879) [Link]

It's worth nothing that Ubuntu Gutsy has a sun-java6-plugin package which you may want to
install instead of the GCJ one.

Firefox Extension Issues

Posted Nov 1, 2007 10:55 UTC (Thu) by cook (editor, #4) [Link]

>For example, for flash, just install the
>"flashplugin-nonfree" package.  For Java, install "sun-java6-plugin".  On >Debian, that just
>works, and I presume Ubuntu is the similar.

Interesting, I'll give that a try.
It begs the question of how a novice user would know to do that
when they visit youtube or NEXRAD and get pointed in another
direction.

Firefox must know we're talking about it, for the first time in
months, it crashed while I was typing this.  At least there's
the restore session capability.

Firefox Extension Issues

Posted Nov 1, 2007 12:40 UTC (Thu) by madscientist (subscriber, #16861) [Link]

If you visit a site with flash and you don't have a flash plugin available, then the 7.10
version of Ubuntu Firefox will offer to download and install the Ubuntu plugin.  I've seen
this work: you get a nice little dialog asking you if you want to use the non-free Adobe
plugin, or the new GNU flash plugin.  It then asks for your password (for sudo) and installs
using the graphical installer.  All is goodness and magic.

Similarly, when I tried to play an mp3 file using gstreamer, it detected that I didn't have
the right codecs etc and offered to install them for me.  All was goodness there as well.

Unfortunately, all is not ALWAYS goodness.  In the flash plugin case, the problem is that some
websites can detect that you don't have the correct plugin and if they do, they'll throw up
their OWN "install flash" site; that's what YouTube does and that's what you ran into.  This
obviously does not use Ubuntu's package installer, since you're installing from Adobe.  It's
not clear how Ubuntu could solve this, because Firefox makes a request for the page and the
page that comes back makes no mention of wanting to run a flash applet; rather it contains a
button to install flash from Adobe.  Maybe Firefox could be set to "cheat" and reply that it
does have flash available, even if that plugin was not installed, so that servers would serve
up flash content rather than suggesting you install the plugin.  The bad news is that probably
75% of the flash-enabled sites I use now have this special "install the plugin" code.  I
actually had to wander the web for quite a while looking for sites that contained flash but
DIDN'T have this special handling, so I could see the new Firefox automatic plugin install.

For the mp3 case, the problem is not all applications are properly enabled.  Gstreamer is,
but, for example, I moved over all my music files into my new account and open Rhythmbox to
scan them all before I installed the mp3 support.  The Ogg files were detected just fine but
rather than noticing my mp3 files would need a new codec and offering to install it, Rhythmbox
just marked them all as "failed".  This is unfortunate, but you have to start somewhere.  I'm
sure the Ubuntu folks are working on getting more tools integrated with the auto-install
features.

Firefox Extension Issues

Posted Nov 1, 2007 13:30 UTC (Thu) by kleptog (subscriber, #1183) [Link]

Well, somewhere along the way the site is able to detect whether you have flash or not. Unless
the browser advertises flash with every request, at some point it needs to query the client.
At that point the popup can appear.

So where does it go wrong?

Firefox Extension Issues

Posted Nov 1, 2007 13:45 UTC (Thu) by madscientist (subscriber, #16861) [Link]

I'm sure I don't know the details: I'm a system level programmer kind of guy.  All this web
stuff makes my head hurt.  It's possible that the server just asks a general question about
what MIME types the client can support (without saying it's specifically interested in flash),
or maybe (more likely) the test is coded in Javascript and there's no direct request that the
browser can interpret.

Maybe it's just not realistically possible to fix this problem.  But it seems that the browser
faking out everyone (including javascript) to say that there is a flash plugin available (at
least, perhaps, until someone explicitly decides to not download it?) might work, as I
mentioned above.

Firefox Extension Issues

Posted Nov 1, 2007 17:21 UTC (Thu) by intgr (subscriber, #39733) [Link]

Most sites simply use the <embed> tag which also contains an URL to the plug-in's download site -- this gets interpreted by the browser, and the browser generates a big "install plug-in" button. The Ubuntu plugin probably recognizes the missing plug-in and pops up instead of Firefox's own plug-in handler. The HTML would look something like:

<embed src="foobar.swf" ...
pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">

But then there are some nasty sites (such as YouTube) which explicitly call JavaScript to find out whether the browser supports Flash, and manually create an URL from within JavaScript code — they don't even let the browser know that the site wants to use Flash.

The only thing the browser can do is to lie to the JavaScript check, or simply intercept the JavaScript call on the assumption that the site actually does want Flash when it's calling this function. Neither are elegant, both

To NoScript users, the frustrating thing about the latter kind is that these sites frequently require JavaScript — just to detect whether Flash is installed — the sites are non-functional even though they could perfectly do without JS.

Firefox Extension Issues

Posted Nov 1, 2007 18:57 UTC (Thu) by madscientist (subscriber, #16861) [Link]

I suspected it was something like that.  Bummer.  My only comments are (1) my completely
subjective experience actually shows that MOST sites are using some kind of JS code to check
for flash these days, and much fewer are using the embed tag (maybe I'm just frequenting the
larger, more "official" sites); and (2) it seems most sites using JS to check this are also
using JS in other places so having this blocked with noscript (which I do use and love!) is
not much more of an issue.

Firefox Extension Issues

Posted Nov 1, 2007 4:18 UTC (Thu) by Thue (subscriber, #14277) [Link]

As I understand it, right now Firefox is running plugins in the main firefox process. This has
the unfortunate consequences that
-If the plugin crashes, it is in effect the whole Firefox process which crashes.
-If the plugin freezes, it is the whole Firefox process which freezes.

Konqueror handles this much more elegantly, by running extensions in a seperate thread.

Firefox Extension Issues

Posted Nov 1, 2007 6:58 UTC (Thu) by hjb (subscriber, #25523) [Link]

I doubt this helps except you meant processes rather than threads.

Firefox Extension Issues

Posted Nov 1, 2007 9:43 UTC (Thu) by johnkarp (guest, #39285) [Link]

Unfortunately, konqueror uses threads, at least in 3.5. When the kpdf 
embedded viewer crashes, as it does, you lose the entire browser as well.

Firefox Extension Issues

Posted Nov 1, 2007 11:43 UTC (Thu) by yokem_55 (guest, #10498) [Link]

I believe you are confusing netscape plugins and kpart components that get loaded. In the case
of kpdf, yes, the kpdf part operates as an in process component, but in the case of an
netscape plugin, they get loaded and run in the nspluginview process and get displayed via
dcop into the browser window. 

Firefox Extension Issues

Posted Nov 9, 2007 12:58 UTC (Fri) by Sutoka (guest, #43890) [Link]

yokem_55 is correct, netscape plugins are ran via nspluginviewer (which 
allowed a neat trick of using the 32bit version on a 64bit system to 
easily run 32bit plugins in a 64bit browser).

Unfortunately, it's still possible (or was in the past) for Flash to 
misbehave very badly and freeze the Konqueror process or even crash it 
(I'm not sure I've seen it crash because of Flash since around when Flash9 
was released, I'm not sure if thats thanks to Konqueror being improved or 
Flash or both though). In the case where Flash (or any other plugin) 
freezes Konqueror, I've always been able to unfreeze Konqueror by simply 
killing the nspluginviewer process.

IIRC, Konqueror was designed that way to prevent the plugin's main loop 
from conflicting with Konqueror's and causing all sorts of nasty 
situations.

Firefox Extension Issues - a Thank You note

Posted Nov 1, 2007 7:31 UTC (Thu) by TxtEdMacs (subscriber, #5983) [Link]

First off: I run Ubuntu, however, a few versions back (desktop 6.06) and I also use Mozilla's
version of Firefox that I install myself.  Indeed, I have been experimenting lighty with the
[stable] alpha versions of the upcoming version 3, since alpha 1.0.

I have noticed, with some irritation, some web sites claim I need to install the most recent
Flash application version 9.  It's there in the plugins directory right under the main firefox
directory, what's the problem?  Other sites see Flash without any difficulty.  It was your
mentioning of ./.mozilla/plugins/ where I saw I had deactivated the older flash versions.
Hence, I loaded Flash 9 there too.  It will be interesting to see if some of these sites begin
to work.

I encounter the same problem with java runtime and I have tired of reinstalling it to no
avail.  I might try your route, if I can find where some of the installations landed.  More
likely that I will upgrade, but probably to 7.04 on anther drive.  I absolutely do not want to
lose the option of running four sessions, that I have read was reduced to only two on the
desktop in later versions.

It was also nice to learn of the about:plugins though for now it has only read only use.  I
have been busy playing with web site coding, so Firefox is a quickie tool, hence, I have not
noticed the changes and additions.

One comment, it seems obvious that Mozilla's focus is on the Windows users of Firefox.  That
is the impression I had when I participated on some of the testing that led to versions 1.5
and 2.0.  I have noticed that the Linux version seems to have lost some functionality.
Nonetheless, the Linux Firefox browser has become more stable.  For example, I no longer see
the browser taking nearly 100% of the memory with the resultant crash or temporary lockups I
encounter routinely with version 1.5.  Moreover, when I had time, sites that crashed the
Windows version had no ill effects upon my machine.  It [Linux Ff] still may eat more memory
than it should, however, my crashes now are when my machine is shut down with the browser
running so that I can recover the couple of hundred tabs I run routinely.

I do not remember reading any of your contributions previously, I shall watch for what you
write in the future.

Thanks.

Don't be afraid to upgrade to newer Ubuntu

Posted Nov 2, 2007 0:25 UTC (Fri) by speedster1 (subscriber, #8143) [Link]

>More likely that I will upgrade, but probably to 7.04 on anther drive.  I absolutely do not
want to lose the option of running four sessions, that I have read was reduced to only two on
the desktop in later versions.

By "sessions" are you referring to the number of workspaces available on the Gnome "workspace
switcher" applet? If so, then don't worry about the newer Ubuntu versions -- it is only the
_default_ number of workspaces that changed. You can still right click on the switcher applet
and set your preferences to get back your four workspaces!

Firefox Extension Issues

Posted Nov 2, 2007 4:09 UTC (Fri) by ekj (subscriber, #1524) [Link]

If mp3 is a "nonstandard" audio-format, what then, pray tell, is a "standard" audio-format ?

Yes. I'm aware of the patent-issues. They are however orthogonal to if the format is a
/standard/ or not.

"Here's a bad way of installing a bad plugin, thereby bypassing and possibly breaking
package-management" is also not worthy of Lwn. I can't imagine many distributions today don't
have a nonbroken way of supporting mp3 playback. Certainly not many distributions likely to be
used by the novice.

Next we'll be getting Automatix-recommendations :-/

Firefox Extension Issues

Posted Nov 3, 2007 9:42 UTC (Sat) by maney (subscriber, #12630) [Link]

I have to agree that this article was quite disappointing - not for talking about the real issues that can and do cause problems for users, but for suggesting substandard solutions for them. Almost everything discussed here is available in proper packages for Gutsy, but many of them come from non-default repositories, and the number and relative obscurity of some of them is itself a bit of a problem.

multiverse contains the flashplugin-nonfree that everyone wants for youtube and all those other web sites where content (and games) require flash. There too you will find a variety of java packages - run time environments or SDKs in several flavors. The multiverse repository's config lines are included in the stock sources.list but commented out. Being still of the CLI persuasion at least for sysadminly things, that's how I usually handle this, but I'm pretty sure there's an easy bunny to click in the GUI package tool to enable it.

I'm less sure about mp3, since I installed the vlc package, which I've found much more useful than either totem or rhythymplayer, though the latter at least does seem to work for some things sometimes in Gutsy, a big improvement over my first impression of it from a few years back. Anyway, as best I can recall I just installed VLC (in the universe repository, enabled by default) and did the dance of choosing an alternate handler program with firefox once to make it use vlc rather than totem. Yes, that could be simpler...

That leaves realplayer, which I also consider essential, if only because there are a few old-time radio sites my wife dotes on which require it. In previous releases Canonical has made a realplayer package available in what used to be called the commercial repository, but the name got changed to partner sometime after Dapper. This one can be hard to find! I don't recall now how I stumbled across it; the link I have saved is to the raw repository at archive.canonical.com. Unfortunately, the only package in the Gutsy section is opera, so last weekend I pulled the source package for realplayer and rebuilt it in Gutsy for my own local use. This is actually pretty simple.... if you've used dpkg-buildpackage a few times before :-( (for earlier releases, commercial/partner has included realplayer, vmware packages, and other interesting stuff)

Another non-standard (modulo the Gutsy repositories) program that I consider necessary is good ol' acroread. These days you have to discover the Medibuntu site to get this prepackaged. While you're there you'll find all sorts of things of poentially dubious legality (due to patents, crypto import or use restrictions, etc.) in at least some parts of this crazy world. IBM's java packages, mplayer, lots and lots of codecs...

Firefox Extension Issues

Posted Nov 9, 2007 5:45 UTC (Fri) by Cato (subscriber, #7643) [Link]

The article should be significantly updated - there is no reason on Ubuntu 7.10 not to use the
repositories, and 7.10 has made huge strides in making it really easy for new users to
automatically be prompted to install packages from repositories for Flash, Java, etc.

The only issue is JavaScript sites that detect Flash is not available and force a download.
Perhaps privoxy (in the Ubuntu universe repository) could help here, as it can do site-specific
flagging and editing of JavaScript, and is easily updated as sites change?

It's also a surprise to see mention in LWN of installing packages from scratch not
repositories, without at least pointing to checkinstall, auto-apt, or similar.

Firefox Extension Issues

Posted Nov 5, 2007 1:57 UTC (Mon) by wingo (subscriber, #26929) [Link]

Are the editors planning to do more proprietary software integration pieces in the future? I
am surprised that Mr. Cook suggests installing the proprietary RealPlayer software *just to
play mp3s*.

Surely what the free software community needs is fewer binary blobs embedded in our web
browers, not more. Cf. the large number of security vulnerabilities for RealPlayer reported on
the security page. "Just Works", indeed.

Firefox Extension Issues

Posted Nov 5, 2007 2:22 UTC (Mon) by wingo (subscriber, #26929) [Link]

As a practical suggestion for future topics:
http://fedoraproject.org/wiki/Interviews/CodecBuddy

Firefox Extension Issues

Posted Nov 5, 2007 2:31 UTC (Mon) by NAR (subscriber, #1313) [Link]

Interestingly (or not?) I've experienced the very same problems (albeit on Debian, not on
Ubuntu) as our editor. OK, I didn't need realplayer for MP3, I needed it to see some videos,
but I still ended up downloading stuff from adobe.com, real.com, sun.com and creating
symlinks, etc. However, my experience with Ubuntu is much better, it automatically downloaded
codecs, got the flash plugin, etc.

Firefox Extension Issues

Posted Nov 6, 2007 16:56 UTC (Tue) by jmmans (subscriber, #34995) [Link]

One of the complexities is certainly that installing a plugin requires priviledged access to
the system.  It is not at all clear why this is the case and it would make managing things
much easier -- the about:plugins could be made editable, for example.  


Copyright © 2007, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds