Harnessing the Mozilla Platform
Brian King
(Best viewed in fullscreen mode (F11) with maximum horizontal space)
Introduction
- Web Applications are becoming widely deployed.
- Lines being blurred between Client and Server (Web) applications.
- Mozilla:
- Uses proven Web technologies
- Runtime interpretation of non-compiled languages such as XUL, JavaScript and CSS
- (D)HTML falls short in the UI space (e.g. context menus, tabs, ...)
- Cross-platform rich client application development
- Viable alternative to the more costly development cycle of traditional software development
Development Platform
- XPFE - Cross-Platform Front End
- Widget Toolkit (XUL/XBL)
- Style (CSS) and Implementation (JavaScript, RDF)
- Component Architecture - XPCOM
2,000+ of XPCOM interfaces available:
- Cross Platform - "Write once, run anywhere"
- Win, Max OS 9/OS X, Linux, HP UX, FreeBSD, OS/2 ...(see ports page)
XPFE Layer Model
XUL - Benefits
- Of Language:
- Separation of content, functionality and style
- Cross-platform
- l10n enabled - Easily localisable
- To Developers:
- Uses technologies that are familiar
- No compilation
- Quick Prototyping / Faster development time
- Promotes Customisability - themes, locales
XUL Features
- Widgets and Controls
- Box Model - boxes, grids, stacks
- Window, Dialog, Page, Wizard
- Buttons, Menus, Tabs, ...
- Tabular data - Tree, Listbox
- Content widgets - (tab)browser, iframe and editor
- Templates
- Hierarchal structures displaying data collected from RDF datasources
- Overlays
- Modularisation of code in separate files
- *New* Dynamic Overlays pulled in after document load.
document.loadOverlay(file, observer);
XBL
- Extensible Bindings Language
- 'Bind/Attach' content, layout and behaviour to new widget
- New widgets + extending existing ones
- Still in development - 2.0 spec currently being written.
XBL Example
<binding id="mySidebarTabs"
extends="chrome://global/content/bindings/tabbox.xml#tabs">
<content>
<xul:hbox aID="row1">
<children includes="tabupper" />
</xul:hbox>
<xul:hbox aID="row2">
<children includes="tablower" />
</xul:hbox>
</content>
<implementation>
// Method and properties go here
</implementation>
</binding>
XBL Model
Accompanying Technologies
- JavaScript
- CSS
- XUL Overlays
- RDF
- XUL Templates
XPCOM
- Cross-Platform Component Object Model
- Components in theoretically any language - currently implementations in JavaScript, C++, and
Python (PyXPCOM)
- XPConnect - "Scriptable" IDL interfaces
Localisation
- Infrastructure for multiple-locale applications
- DTD Entities (.dtd) and String Bundles (.properties)
- Menu items, buttons, statusbar, Help files, ... anything that is visible
- Language Packs for UI customisation
- Language switching via global preferences:
general.useragent.locale
Web Services and More...
- Web Services
- XMLHttpRequest
- XML-RPC
- SOAP (sketchy)
- Extras
Mozilla Architecture Diagram
(Click for larger version)
Software Installation
- XPInstall
- XPI file format
- One click install
- APIs for writing installation scripts in JavaScript
- Handles installation, registration ...
- Used for language packs, software add-ons, toolbars ...
- Extension Manager
- RDF install file (install.rdf)
- Built-in UI
- Functionality - Uninstall, Disable
- Access to extension Options
- Version control and built-in Update system
- Custom Installer
Deployment
- Extensions:
- Browser/Mail add-ons, Themes, Language packs
- Require an install script (install.js, install.rdf)
- Auto Update built into the EM
-
- Distributions:
- Building from source required
- Packaged with installer
- Which Branch Tag to use?
- Stable releases are the best for production
- Use trunk for latest features and bug fixes
XULRunner 1 (1.9)
- Bootstrap XPCOM+XUL applications - GRE (Gecko Runtime Environment)
- Customisable executable name, icons, profile directory, and more
- Uses the latest toolkit
- Built-in Installer (eventually)
- Still in early development stages, but maturing all the time. Only stable developer releases.
XULRunner 3
Application Structure
XULRunner 4
Entry Point
- The application has to know where to start...
- Options
- In Preferences
pref("toolkit.defaultChromeURI", "chrome://openkiosk/content/go.xul");
- Override the default command line handler with your own.
XULRunner 5
application.ini
The application will not install without this file which containes meta information.
[App]
Vendor=My Company
Name=mycoolapp
Version=1.0
BuildID=20051123
Copyright=Copyright (c) 2005 My Company
[Gecko]
MinVersion=1.8
MaxVersion=1.9a1
XULRunner 6
Registering the GRE
xulrunner -register-global
This updates the registry on Windows (
HKLM\Software\mozilla.org\GRE), and writes to
/etc/gre.d on Linux.
XULRunner 7
Deployment 1 - Launching from Flat Structure
xulrunner /path/to/my/application/application.ini
This will launch the application directly from where it is unpacked on the system.
XULRunner 8
Deployment 2 : -install-app
Linux : ./xulrunner -install-app /path/to/my/application.xpi
Installed to /usr/lib/<vendor>/<appname>/
Mac : /Library/Frameworks/XUL.framework/xulrunner-bin -install-app /path/to/my/application.xpi
Installed to /Applications/<vendor>/<Appname>
Windows : xulrunner.exe -install-app /path/to/my/application.xpi
Installed to c:\Program Files\<vendor>\<appname>\
XULRunner Demo
Demo of Deploying and Running a XULRunner Application (Open Kiosk)
Problems with the Platform
- *Perceived* high barrier of entry
- Large and daunting code base
- Dispersed documentation (now improving)
- Lack of IDE
- Sketchy support in some areas (e.g. SOAP)
- Browser/Mail bugs take priority over 'Platform' bugs
Advantages of the Platform
- Quick prototyping
- Separation of content, style and functionality
- Standards Support
- Access to 2,000+ XPCOM interfaces
- Growing Tool Set (Bugzilla, LXR, DOM Inspector, JavaScript Debugger, Dev Tools on mozdev.org such
as fastcomponent and xpistubs, ...)
- Flexible licensing (MPL/LGPL/GPL tri-license)
- Active (and helpful) developer community
Projects
- MDG:
- Customised Distros (Linspire)
- Semantic Web / Deal Workflow (Angelsoft)
- Toolbars (Netscape 7.1+, EarthLink)
- Kiosk Browsers (Brooklyn Museum)
- Handwriting Recognition Interface - HRI (Codehost)
- Themes
-
- Elsewhere: