Silverlight 2 (beta 2) and Firefox 3... so happy together...
If you've been holding off on using Silverlight 2 or Firefox 3 because they weren't playing well together, it's safe to come out now. One of the best "undocumented" features in Silverlight 2 Beta 2 is that it now works with Firefox 3.
I've been following this issue on Bugzilla (Bug 421217) for a few months. It reads innocently enough: "NPRuntime object reference counting is violated by NPObjWrapperPluginDestroyedCallback causing Silverlight 2.0 beta: crashes when closing tab/window [@ JS_SetPrivate - NPObjWrapperPluginDestroyedCallback]". Here's what that means in plain English:
You could view Silverlight 2 (Beta 1) objects in Firefox 3, but when you closed the tab, it would crash the entire browser process.
There's a lot of back and forth on the Bugzilla thread. It appears that something changed in the way that Firefox disposes objects on the move from Firefox 2 to 3, as Wilco Bauwer's comment indicates:
...the problem is that we're calling ReleaseObject from a call to DeallocateObject (which is called by FF). Apparently FF3's ReleaseObject implementation crashes when an object is passed in that FF3 believes to be dead. The reason why we do this is related to how reference counting works in FF2. In our experience, FF2 calls DeallocateObject on our NPObjects when *it* no longer references that NPObject. It ignores the reference count.
The Firefox team clearly didn't want to be bothered with this issue, despite the fact that it was near the top of the list of topcrash bugs for Firefox 3. After a bit of back and forth, it was apparent that the Silverlight team would be the ones making modifications so that they'd handle both Firefox 2 and 3's different behaviors. So we've been waiting on a Silverlight 2 update for it to run Firefox 3. That didn't prevent the (futile) flurry of questions on every Firefox 3 release: "Does this one work with Silverlight 2?"
So we're good now. Silverlight 2 Beta 2 works on Firefox 3.
But, about that crashy thing...
Note that Wilco raised some questions for the Firefox team which don't really sound like they've been solved:
For us it's important that the reference counting rules are followed strictly for our NPObjects, because we allow you to pass them from one plugin to another. Unless we'd rip out our entire HTML/JS bridge, this would be an easy way for developers to write apps that crash a browser or cause other type of unexpected behavior.
And it's not a Silverlight specific issue. As I read the Bugzilla thread Firefox 3 has kind of broken reference counting in a way that makes it easy for any plugin to (accidentally or maliciously) crash the browser by calling ReleaseObject on a null or destroyed object. That seems like a problem, because Firefox 2, Safari (and all other WebKit based browsers), Opera, and IE apparently implement the Netscape Plugin API in a way that respects reference counting, and now Firefox 3 no longer follows that. Presumably Silverlight's doing some internal reference counting or checking to work around this issue, and anyone else that wants to write a plugin that allows for communication between instances in a page (or communication with other plugins on a page) will need to do the same. I guess it's not my problem, and clearly the Firefox team has decided it's not theirs, either.