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, ...)
- AJAX is filling some of the spaces, but not all of them.
- 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)
Toolkit - 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.
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
JavaXPCOM - Java applications can access XPCOM objects, and XPCOM can access any Java class that implements an XPCOM interface.
i18n and l10n
- Excellent internationalisation support
- 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
Web Services and More...
- Web Services
- XMLHttpRequest
- XML-RPC
- SOAP (sketchy)
- Extras
- Database support (PostgreSQL, MySQL)
- New storage model on trunk for 'Places' - using SQLite
- XSLT
- XPath
- MathML
- "Web ready"
Mozilla Architecture Diagram
(Click for larger version)
Cairo Graphics
SVG and Canvas, using Cairo libraries
Now default toolkit on Linux and Windows
--enable-default-toolkit=cairo-gtk2
XULRunner - What Is?
- Bootstrap XPCOM+XUL applications - GRE (Gecko Runtime Environment)
- Customisable executable name, icons, profile directory, and more
- Uses the latest toolkit
- Stable developer releases available
Application Structure
marup
|
---------- application.ini
|
---------- chrome.manifest
|
---------- chrome
|
---------- components
|
---------- defaults
|
---------- preferences
application.ini
The application will not install without this file which containes meta information.
[App]
Vendor=My Company
Name=mycoolapp
Version=1.0
BuildID=20060425
Copyright=Copyright (c) 2005 My Company
[Gecko]
MinVersion=1.8
MaxVersion=1.9a1
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.
Registering the GRE
xulrunner -register-global
This writes to /etc/gre.d on Linux, or updates the registry on Windows (HKLM\Software\mozilla.org\GRE).
Modules
What is shipped with XULRunner? : ...
- Gecko features: XPCOM, networking, rendering engine, XUL, SVG, XSLT, XML Extras, history, accessibility...
- UI Features: Extension Manager, Find Toolbar, ...
- Embedding APIs: cross-platform embedding, JavaXPCOM, gtkmozembed (Linux only), activex (Windows only)... (Some of these are not complete)
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.
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>\
Extension Manager
- One click install
- RDF install file (install.rdf)
- Built-in UI
- Features - Uninstall, Disable, Options, ..
- Version control and built-in Update system
The Mozilla Platform
- Each application has it's own user profile generated
- Runs in it's own process space
- Ensures peaceful co-existence of multiple Mozilla applications
Future Directions
Roadmap:
- 1.8.1 concurrent with the release of Firefox 2 (early Q3 2006)
- XULRunner 1.9 : first production release, shipped by Firefox 3 (Q1 2007)
Worthy Goals:
- Stable APIs
- Installer
- Development Tools
- Versioning system
XULRunner Demo
Demo of a XULRunner Application
(Marela Uploader)
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
The Mozilla Desktop