Month: December 2006

WPF is the coolest thing an MFC programmer has ever seen. Of course, developers who have been working with declarative markups (HTML, SVG, XUL or Laszlo) and RAD form builders (Delphi and VB) are not hyperventilating. Sure, its nice that Microsoft has introduced a development platform that is actually easy to use, but such platforms have been around a while. Now, WPF/E is ready to take rich internet application (RIA) development by storm. Its not the first (XUL, Flash, Flex and Laszlo are not betas), but Microsoft’s entry is not to be taken lightly.

The WPF/E hype and the quest for a non-Adobe SVG viewer in Internet Explorer (IE) made me to start to wonder what it would take to get Mozilla’s platform running in IE. Turns out, it’s easier than I thought:

Mark control “Safe” or Tweak IE’s security.(You can register and mark the control safe using this patch)

Done!

This could even be made easier (zero steps) by creating a CAB file for XULRunner and adding code to the Mozilla ActiveX control to mark itself “safe”.

Control Setup using Patch

Unzip the patch files to wherever you installed XULRunner. If you just installed XUL Explorer, XULRunner is in a subfolder.

Execute “mozactivex-reg.bat”

For those of you wondering about the “patch”. It simply registers the Mozilla ActiveX control and then adds 2 registry keys to the control that tell Windows that the Mozilla control is “Safe for initialization” and “Safe for scripting”. See this Microsoft page for more information.

XUL/E Samples
These samples can be run in Firefox (any platform) and IE (windows). Make sure you have installed and configured the Mozilla ActiveX control. The difference between these links and the ones on a previous post is that these are displayed using a special “viewer” HTML page.

A large part of my job at Mozilla is trying to make life easier for extension developers. In order to do my best, I need to understand the pains of extension developers. Up to now, I have been writing various types of extensions myself (sidebars, statusbars and components) to try to understand what an extension developer goes through. I even download extensions just to look at the code, trying to find comments like “hack” or “sucks”. But really, that’s not enough. So now I am asking extension developers directly:

What can Mozilla do to make writing extensions easier?

The title of this post mentions hacks, but I am interested in all aspects of extension development:

Tutorials

Installation / Updating

Using frozen XPCOM interfaces/ components/ services

Intergating into Firefox/ Thunderbird UI code

Protecting against version to version breakage

Documented best practices (or lack of)

Anything else (extension related)

Feel free to leave comments on this post (preferred) or send to mark dot finkle at gmail dot com

I thought I’d pull together some simple XUL examples you could load into XUL Explorer. It might help you get started using XUL Explorer. It may also help first-timers begin to see how XUL can be used to create a UI. Sometimes starting from scratch can be a hurdle.

Note: These are simply XUL files and if you’re using Firefox (or another XUL enabled browser), clicking the links will open the files in the browser instead of downloading to your machine. Right-click on the links and pick “Save Link As…” to save them to your machine.

Starting to learn a new platform can be daunting. Especially, when it is as big as the Mozilla platform. The XUL tutorial and reference were exactly what I needed to start learning. However, I quickly found myself wanting to experiment with little XUL snippets just to see what they looked like at runtime. Or, I’d want to try applying some CSS to the elements. I decided to build a XULRunner application that provided a simple way to experiment with XUL. It also gave me a good hands-on project I could use to really start learning the platform.

The result is XUL Explorer. It’s a simple editor that can preview XUL on a tab or in a separate popup window. It has a list of code snippets (small fragments of XUL or JavaScript) that can be quickly inserted into the editor. The XUL can be load and saved to files. The JavaScript Error Console is available to help debug problems. The help menu is hooked to XUL information on MDC. There is even a simple “keyword” help lookup for XUL elements.

I made an install (Windows only) that includes XULRunner 1.8.0.4, so you have everything you need to start using it. I am working on Mac and Linux installs too, but for now you can download the source. I did not package the source into JAR files. I wanted the code to be easy to access, in case anyone wants to see how it works or show me better ways of doing things.

The next thing you may need is small code snippets to help show you how to do common things. Things you probably already know how to do in another language or framework. You just need to know how to do it with XUL, JavaScript and XPCOM. You should definitely check out the Code Snippets section on the MDC. There is also an Example Code section on Mozillazine.

If there is something you want to know how to do, but it’s not on the MDC yet, let me know. Also, for any of you experienced Mozilla developers out there, go check out the code snippets and please add some of your own. Just keep the code snippet short and sweet, we’re not writing a full sample extension or application. If you do want to write a large sample extension or application, create a full blown tutorial.