Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Mozilla Application Framework in Detail

Editor's Note: This article should be rewritten to describe why use XULRunner to create your own application. Related: XULRunner:What XULRunner Provides, XULRunner Hall of Fame

UI in Mozilla

Mozilla's philosophy of using "the right tool for the right job" is manifested most prominently in the design of the user interface. We provide an XML-based language called XUL for defining the user interface of your application. CSS is used to style these UI's and DTD's are used to localize the textual information - making your application extremely flexible and able to be utilized across the globe. JavaScript, considered by many to be the best scripting language ever designed is ideal for specifying the behavior of your Interface widgets. Where speed is the foremost consideration, we provide C++ libraries with multi-language interfaces for comprehensive, performant access to networking, filesystem, content, rendering, and much more.

What this means to you as the developer is this: you can take advantage of skills you already have with XML or web technologies to design and implement anything from a simple text editor to a comprehensive IDE - complete with all of the interface widgets that you would find in virtually any major application framework.

Another benefit of this standards-based approach to UI development is that your application is cross-platform "out of the box". Imagine not having to re-write your application 3 times, or not supporting a less popular platform simply because you do not have the resources for parallel development!

Image:mafd_mac.jpg   Image:mafd_windows.jpg   Image:mafd_linux.jpg

Unlike many other application frameworks, you are not limited to the widget set we provide, nor limited to the "look and feel" of the native OS. You can create applications using our framework that either have a native look and feel for each OS, or one which is identical on Macs, PC's or Unix operating systems. You may also further enhance the user interface by allowing 3rd parties to develop "themes" for your application. Themes are simply collections of images and CSS which can augment or replace your current UI elements.

Image:mafd_mac.jpg   Image:mafd_macshotclassic.jpg   Image:mafd_macshottoyfactory.jpg

XUL provides an excellent answer for organizations with heterogeneous computing environments. Customized XUL applications with significant business logic can be written once, and used on the range of platforms that exist within the organization. In addition, if the organization maintains sophisticated, interactive websites, it will already possess a wealth of technical expertise that will be relevant for creating XUL applications.

In addition to the technologies already mentioned, we go even further by allowing you to even create your own custom interface widgets. Don't feel limited by the widgets that the framework already contains! XBL (eXtensible Binding Language) allows you to expand your library of interface elements, and even construct your own XML language for defining your UI. For instance imagine that you wanted to create a Chess style game. You could easily create XML elements such as <chessboard> or <chesspiece> and via XBL map these to images and application logic. This is very powerful since you could make improvements to the underlying application logic without having to rewrite the higher level code.

Our platform also can take advantage of other internet standards such as XSLT and RDF. RDF, a core element to the framework, allows you to define dynamic elements in your UI (elements that may change after you have completed the application, such as a "history" menu item). XSLT could be used to translate information from Web Services, RSS, SOAP, or other XML-based languages and convert them into a form that you might display in your user interface.

The Gecko Rendering Engine

Gecko is the revolutionary rendering engine that offers advanced features for Internet browsing anywhere across applications, computing platforms and devices. This innovation in browser technology offers small size, speed and industry leading standards support. Gecko is the premier cross-platform, full-featured, mature and well-tested layout engine available, providing robust and high quality support for a massive array of standards. Its ability to render web content correctly is exceptional. Gecko consists roughly of an HTML parser and XML parser, a DOM implementation, a CSS parser and style system, and the code for CSS-based and HTML-based layout and rendering.

As personal connectivity expands from the desktop computer to new web-enabled products and devices, Gecko is a browser engine that has been designed from the ground up to power a new generation of desktop browsers and browsing devices and to accelerate the growth and development of the next-generation Internet. Small, fast and standards compliant, Gecko is easily embeddable across platforms in browsers, desktop applications and browsing devices and delivers full-functionality browsing to them all. Innovative Gecko Technologies it supports make the development of browsers, applications and devices faster and easier than ever before.

Gecko is the first browser engine ever to deliver the full web standards support that developers have been calling for. This robust standards support for the first time makes it possible to implement powerful web applications with rich user interfaces without using proprietary or platform dependent code. Because Gecko has a cross-platform architecture, is easily embeddable and is open source, it and the rich web applications it supports will be usable on any supported platform or device. This will dramatically reduce the cost and complexity of developing and distributing rich web applications and full-functionality browsing devices that run them. By meeting the needs of developers and companies who are working to provide consumers with new interactive applications, solutions and services, Gecko will become a key catalyst for new growth and innovation and for delivering anytime, anywhere access to millions of new users.

As the heart of a browser, the browser engine software component is responsible for interpreting and rendering the graphics, text and script on the Web. With Gecko, Mozilla has cleanly separated the browser engine component from the rest of the client software so it can be embedded and used to interpret, display and run web content, applications and services on any computing platform or device.

Open source and freely available, Gecko is small in size and modular and achieves rendering speed superior to all other browser engines - which makes it perfect for embedding into both desktop applications such as browsers and new devices such as browsing appliances and set top boxes. Supporting Gecko Technologies provide a complete set of resources for efficient development, including full support of web standards, a cross-platform/cross-device user interface language, an extensible architecture and embedding technologies.

With its unprecedented power, speed and standards support, the Gecko browser engine represents a major advance for developers. With Gecko, developers seeking a streamlined way to create and distribute web-based services across multiple platforms and devices can write once to W3C standards and their content and web applications will be accessible from across computing platforms and devices.

Gecko is based on contributions from mozilla.org, the organization chartered with managing Netscape's open source initiative among thousands of Internet developers and participating vendors such as Netscape.

The Gecko browser engine offers several key benefits including:

  • Size: Gecko has been designed to be lean and modular, bringing full-functionality browsing to a variety of new consumer devices. Because it is small,
  • Gecko can be embedded on devices with limited footprints and it minimizes download size for desktop browsers.
  • Speed: Gecko has been designed for speed and is several times faster than previous versions of Internet browsing software.
  • Standards Support: Gecko is the first browser technology to fully implement the latest W3C standards and enables developers to build rich, dynamic web pages and web-based applications that look and run as intended across a variety of platforms and devices. This saves developers time and money while allowing them to deliver state-of-the-art content and web applications. Gecko features full support for open Internet standards such as CSS1, HTML 4.0, DOM1, RDF, XML and JavaScript.
  • Modular, Embeddable: Gecko's modular architecture enables developers to add or remove modules with little effort, fitting the software to the available hardware and adjusting functionality to match product requirements. Gecko is implemented as a collection of XPCOM components that can be easily added or removed. Flexible programming interfaces such as the Web Shell API, the Java wrapper API and the Gecko ActiveX Control make Gecko easily embeddable into applications and devices.
  • Full Browser Functionality: Gecko allows any desktop application as well as new devices, products and appliances to be web-enabled, with complete browser functionality. Supported standards and features include Data Transport Protocols, Multilingual Character Data, Image Data, Java and Plugins.
  • Open Source: Gecko represents the first software release from Netscape and mozilla.org's open source initiative. By harnessing the talent of thousands of developers worldwide, mozilla.org has accelerated Internet software development and increased the quality of the final product, delivering unmatched support for web standards. In addition, independent software developers and corporate Information Technology departments now have complete access to the modular source code and freedom to freely license the source, make changes and build customized versions to accommodate their individual needs.
  • Free: Gecko is free of charge. There is no charge for using the Gecko browser engine or Gecko Technologies, including distributing Gecko inside another product. Furthermore, when embedding Gecko, developers are free to choose what modules to include. There is no requirement for distribution of any other software.

The Necko Network Library

Mozilla's Network library (aka Necko) provides an extensible, platform-independent API for several layers of networking from transport to presentation layers. Its provides a generic and extensible framework for fetching URLs with support for common protocols (http, ftp, file, etc.) and a way to plug in custom protocol handlers. Necko also provides an abstract "file descriptor" interface for low-level data access.

Necko features include support for asynchronous I/O, a generic disk and memory cache service, asynchronous caching DNS resolution, web proxies, and HTTPS. The following architectural diagram depicts Necko and its interaction with subsystems:

Image:mafd_subsystems.png

Necko is powerful, stable and robust, with current development focused on performance and standards-compliance. It has gone through extensive field testing and revision to maximize web site compatibility.

XPCOM, the Cross Platform Component Object Model

The Cross Platform Component Object Model (XPCOM) is one of the main things that makes the Mozilla application environment an actual framework. It is a development environment that provides the following features for the cross-platform software developer:

  • component management
  • file abstraction
  • object message passing
  • memory management

This component object model makes virtually all of the functionality of Gecko available as a series of components, or reusable cross-platform libraries, that can be accessed from the browser or scripted from any Mozilla application. Applications that want to access the various Mozilla XPCOM libraries (networking, security, DOM, etc.) use a special layer of XPCOM called XPConnect, which reflects the library interfaces into JavaScript (or other languages). XPConnect glues the front end to the C++-based components in XPCOM, and it can be extended to include scripting support for other languages: PyXPCOM already offers support for Python, Java is supported by JavaXPCOM, and there are efforts underway to add Perl and Ruby language support for XPConnect.

On the developer side, XPCOM lets you to write components in C++, JavaScript, Python, or other languages for which special bindings have been created, and compile and run those components on dozens of different platforms, including these and others where Mozilla itself is supported:

  • Microsoft Windows
  • GNU/Linux
  • HP-UX
  • AIX
  • Solaris
  • OpenVMS
  • Mac OS X
  • *BSD

The flexibility to reuse the XPCOM components from the Gecko library and develop new components that run on different platforms can make your application development faster, more productive, and easier to maintain. The networking library, for example, is a set of XPCOM components that can be accessed and used by any Mozilla application. File I/O, security, password management, and profiles are also separate XPCOM components that you can use in your own application development.

Other Features of XPCOM:

  • XPIDL, a language for defining interfaces in a language-neutral way and the XPIDL compiler can create header files, binary type libraries, documentation, and even generate stub C++ code for your component implementations. Tools including various XPCOM manager interfaces, smart pointers, special string classes, and an extensive collection of macros that make your C++ implementations easy to write and extend.
  • A special base class, <tt>nsISupports</tt>, that helps manage object lifetime and reference counting.
  • Sample component implementations you can extend and learn from.
  • Documentation.

Web Services

Mozilla includes built-in support for popular web services standards XML-RPC, SOAP, and WSDL as well as a simple XMLHttpRequest object similar to the one in IE. All services are available from JavaScript code, which allows even simple XUL+JS applications to take advantage of them.

Mozilla's XML-RPC support includes synchronous and asynchronous requesting and downloading of data from a server. Its SOAP support is broad and includes.... Mozilla has introductory support for WSDL...

Mozilla engineers have written and are in the process of refining a new security model for web services that will ease the deployment of applications using web services while maintaining the security of sites inside the user's firewall.

More Information

XPInstall, Mozilla's Cross Platform Installation Technology

One of the many things that makes the Mozilla platform easy for both users and developers is that applications can be installed, extended, or upgraded with simple web page links. The technology that makes this possible, XPInstall, allows application developers to write JavaScript installations that manage special cross-platform installation archives (called XPIs, or "zippies"), in which packages such as new skins for the browser, patches, browser extensions, new Gecko-based applications, and third party standalone applications are stored.

XPInstall makes it easy to write both simple installation scripts and complex installations that check versions, log installation data to the local system, execute other installers, and update the appropriate registry settings. It is often used to install Mozilla-based applications and browser add-ons, but can just as easily be used to create installations for third party software that use the browser as a delivery device on any platform.

MozDev is just one place where this cross-platform installation technology is used to provide a simple installation and registration facilities for Mozilla application developers. The mozblog application hosted at mozdev.org, for example, uses XPInstall to make several different versions available simultaneously as updates are made and the browser itself advances versions.

The XPInstall API makes the following functionality available as high-level JavaScript objects:

  • An install trigger that initiates installations
  • Windows registry access
  • Mozilla registration interfaces for registering new Mozilla software
  • Facilities for detecting and maintaining application versions
  • High-level objects for manipulating local directories and files
  • Complete reference documentation, including useful example installations

The following snippet from an XPInstall installation gives you some idea about how easy it is to write cross-platform installations that use the Mozilla browser:

// Register chrome
registerChrome(PACKAGE | DELAYED_CHROME, getFolder("Chrome","xmlterm.jar"), "content/xmlterm/");
registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","xmlterm.jar"), "skin/modern/xmlterm/");
registerChrome(LOCALE | DELAYED_CHROME, getFolder("Chrome","xmlterm.jar"), "locale/en-US/xmlterm/");

if (getLastError() == SUCCESS)
    performInstall();
else {
   alert("Error detected: "+getLastError());
   cancelInstall();
}

Other Features

  • a Resource Description Framework (RDF) parser with support for creating RDF graphs programmatically or by parsing files, compositing multiple sources into a single RDF graph, querying and manipulating graphs, and populating XUL widgets (trees, menus, etc.) with graph data;
  • an XSLT/XPath processor;
  • Scalable Vector Graphics (SVG) rendering with support for a usable subset of the standard including all basic shapes, beziers, stroking and filling with opacity, and much of the DOM;
  • MathML rendering;
  • an ECMA-262 Edition 3-compliant JavaScript engine;
  • Java integration with a bridge to XPCOM, a Java DOM API, the Open JVM Integration (OJI) facility, a Java Webclient API, and Java plug-ins;
  • NSPR, a runtime engine that provides platform-independence (across over a dozen platforms) for non-GUI operating system facilities with support for threads, thread synchronization, normal file and network I/O, interval timing and calendar time, basic memory management (malloc and free) and shared library linking;
  • PSM, a set of libraries that perform cryptographic operations including setting up an SSL connection, object signing and signature verification, certificate management (including issuance and revocation), other common PKI functions, and S/MIME support;
  • an SQL support that provides the ability to set up data sources, query a database, and retrieve results as JavaScript objects or RDF data sources; and
  • an API for Directory Services via the Lightweight Directory Access Protocol (LDAP).

Original Document Information

Document Tags and Contributors

 Contributors to this page: teoli, kohei.yoshino, Nickolay, Andreas Wuest
 Last updated by: kohei.yoshino,