The Browser Den


Project Tamarin - Adobe's contribution to Mozilla

Friday 10th November 2006
Not very much has been written about Project Tamarin yet, it's a significant donation of code from Adobe to Mozilla. The code that has been donated is the ActionScript Virtual Machine which is used in Flash 9 and will continue to be used in later editions of Flash.

Although in effect part of Flash has been open sourced it is important to remember that it's only the scripting component that has been opened. To play Flash in future versions of Mozilla software you'll still need the Flash plugin which is a disadvantage to those who don't run on a platform that flash is supported.

What Tamarin brings to Mozilla is a "just in time" (JIT) JavaScript Virtual Machine that supports the forthcoming ECMAScript 4 language (aka JavaScript 2). ECMAScript is the standardisation of various scripting languages often grouped together as JavaScript but under different names by different vendors (e.g. Microsoft JScript, Macromedia (Adobe) ActionScript, and Coldfusion's cfscript). In this article I'll use JavaScript when referring specifically to Mozilla uses of ECMAScript and ActionScript when referring to the Flash scripting engine. As Tamarin is open sourced and available under the standard Mozilla tri-licence (GPL, LGPL and MPL) this means that it stands a good chance to be the reference implementation of ECMAScript 4 and can be used in other software that requires a scripting ability.

Tamarin is expected to make its Mozilla debut with Mozilla 2. Mozilla 2 is not actually a product release but is the version of the underlying framework. Mozilla 2 is not expected to be ready by 2008 at the earliest. Firefox 3 will be based on the Mozilla 1.9 framework, it is not sure at this time which Firefox release will use the Mozilla 2 framework. As well as the improved scripting engine Mozilla 2 will feature a host of other improvements to the backend which should both improve performance and code maintainability.

The main performance advantages will be noticed in AJAX based web sites and may even speed up XUL based interfaces where they're dependant on heavy use of JavaScript. The improved performance of JavaScript execution under Tamarin combined with the higher average specification of machines in use in 2008 will open up many more possibilities for web based applications that are not currently practical. Also the new features in ECMAScript 4 will also open up new possibilities to developers.

Adobe and Mozilla Corporation employees will be actively contributing to this code base and the intention is to use the same code both in Flash and Mozilla. Other companies will be able to use this code as they see fit so it could be possible that we see Tamarin used in a variety of other applications and perhaps other web browsers too.

On the Mozilla side the plan is to integrate to code with SpiderMonkey which is Mozilla's current JavaScript implementation that is written in C. This is needed because Tamarin is not a drop-in replacement for SpiderMonkey as it provides necessary features that are not available in Tamarin. The combined SpiderMonkey with integrated Tamarin should not have any problems with old JavaScript and should show a performance boost for most. However, skilled scripters are sure to find ways of optimising performance to get even more gains. As this, and other Mozilla 2 works, are going to be significant changes then they'll undergo extensive testing before a version of Firefox is released that used any of the Mozilla 2 framework. This will mean plenty of time to learn performance enhancing scripting skills.

Overall, this code donation is excellent news for Mozilla, it will improve performance and will hopefully assist in even more advanced web applications than we're seeing now. The code is the largest donation that Mozilla has received apart from the initial Netscape source code release in 1998, however, most of that Netscape code was scrapped and rewritten so hopefully we'll get more use out of this code.

Of course, it's unlikely to have been 100% kindness that prompted this decision from Adobe, they will benefit from the extra assistance of the Mozilla contributors, they will probably make Tamarin the de facto ECMAScript 4 implementation and they'll get a fix to their code not being 64-bit clean at the moment (one reason why there's no native Flash player for 64 bit x86-64 machines). On the downside for them, they'll lose some of their own productivity while bringing the Mozilla contributors up to speed.

I've seen some theories on the Internet suggest that part of the deal with Adobe was to remove the native SVG support from Firefox effectively reducing the competition for Flash. This sounds highly unlikely and even if it did happen remember that the Mozilla codebase is open so it can easily be forked and a version with SVG restored could be reproduced. But I doubt that would happen, doing so would destroy a lot of goodwill in the community and Mozilla depends on their supporters. In fact any scripting improvements brought by Tamarin would benefit SVG that's manipulated by JavaScript. The only way I could see them removing SVG support would be if Adobe ever decided to open source the Flash player but even then I could imagine that this would not be a popular move as SVG is an open standard.

Browser Den Blogs

The comments written here are based on my understanding of the Tamarin project and this is subject to change in the future. Nothing in this article should be considered official although it is as accurate to the best of my knowledge