XUL

From HandWiki
Revision as of 21:03, 6 February 2024 by Nautica (talk | contribs) (update)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Short description: User interface markup language
XUL
ParadigmDeclarative (markup language)
DeveloperMozilla Foundation
Implementation languageC++
PlatformGecko
OSCross-platform
LicenseMPL
Filename extensions.xul
MIME type: application/vnd.mozilla.xul+xml
Websitehttps://wiki.mozilla.org/XUL:Home_Page
Major implementations
Mozilla
Influenced by
HTML, XML

XUL (/ˈzl/ ZOOL), which stands for XML User Interface Language, is a user interface markup language developed by Mozilla. XUL is an XML dialect for writing graphical user interfaces, enabling developers to write user interface elements in a manner similar to web pages.

XUL applications rely on the Mozilla codebase or a fork of it. The most prominent example is the Firefox web browser. However, Mozilla has reduced the usage of XUL in Firefox after their rewrite of the browser engine in version 57.[1][2] This resulted in the removal of add-on customization. Firefox originally permitted add-ons to extensively alter its user interface, but this capability was removed in 2017 and replaced with the less-permissive WebExtensions API.[3][4] Several forks of Firefox retain support for XUL and XUL-based add-ons. Waterfox maintains a fork of the Mozilla codebase for the Waterfox Classic browser.[5] The Pale Moon browser,[6] Basilisk browser,[7] Hyperbola operating system,[8] and several smaller projects collectively use and maintain the Unified XUL Platform (UXP) implementation.

History

The Periodic Table of XUL Elements is a reference extension designed to demonstrate XUL's capabilities.

XUL was devised at Netscape in 1997 as part of the development effort that eventually became the Mozilla codebase.[9] XUL is similar to web technologies implemented by the Gecko rendering engine. When XUL was introduced, it added features beyond the then standard HTML 4. It was designed as an expansion of HTML to be used with applications rather than documents.[10]

XUL was used by various Mozilla projects, forks of Mozilla projects, and projects closely related to Mozilla. Some software projects like Zotero began as Mozilla Firefox extensions and used XULRunner to become standalone desktop applications. In the early 2000s there was some interest in using XUL by other parties, including Amazon,[11] but those have switched over to HTML5.[1][2] The features of HTML5 that made web applications possible, also made much of XUL redundant.[10]

Mozilla released Firefox 57, also known as Firefox Quantum, in 2017. As part of this, Firefox finished transitioning to a multi-process architecture. Although XUL add-ons worked in this architecture, they created large performance problems. Because of this, Mozilla removed support for legacy add-ons, including the use of custom XUL code.[3][4] Mozilla switched extensions over to Google's HTML5-based WebExtensions format. In 2017, Firefox still included 289 XUL bindings for native browser components. By the end of 2019, Mozilla had removed all XUL files from their mozilla-central codebase.[12][1][2]

When Mozilla removed support from Firefox, there were still several applications using XUL. Mozilla began gradually removing XUL support from their email client, Thunderbird. They released Thunderbird 78 without support for XUL-based extensions in 2020.[13] The SeaMonkey internet suite chose to re-implement XUL for the Firefox Quantum codebase and the suite's development has subsequently slowed. The Pale Moon developers forked Mozilla's entire Firefox 52 ESR codebase to create the Unified XUL Platform (UXP) for their Goanna rendering engine. UXP maintains the traditional XUL capabilities.[14] As a result, Pale Moon and other UXP applications have remained single-process but extensible.[15]

Usage

XUL can only be used with the Mozilla codebase (or a fork of it) because the Gecko engine does the XUL rendering.[16]

Application programmers need to define a XUL interface as three discrete sets of components:

  1. Content: the XUL document(s), whose elements define the layout of the user interface
  2. Skin: the CSS and image files, which define the appearance of an application
  3. Locale: the files containing user-visible strings for easy software localization

XUL defines a wide range of elements, which roughly belong to the following types:

  • Top-level elements: window, page, dialog, wizard, etc.
  • Widgets: label, button, text box, list box, combo box, radio button, check box, tree, menu, toolbar, group box, tab box, color-picker, spacer, splitter, etc.
  • Box model: box, grid, stack, deck, etc.
  • Events and scripts: script, command, key, broadcaster, observer, etc.
  • Data source: template, rule, etc.
  • Others: overlay, iframe, browser, editor, etc.

The default behavior of XUL widgets can be altered with XBL bindings.

Example

This example shows three buttons stacked on top of each other in a vertical box container:[17]

Boxes-ex1.png
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>

<window id="vbox example" title="Example 3...."
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  <layout>
    <button id="yes1" label="Yes"/>
    <button id="no1" label="No"/>
    <button id="maybe1" label="Maybe"/>
  </layout>
</window>

Ghostbusters reference

The villain of the 1984 film Ghostbusters was the fictional deity Zuul who possesses the character Dana Barrett and declares: "There is no Dana. There is only Zuul."[18] The creators of XUL, which is pronounced the same as Zuul, made the slogan "There is no data. There is only XUL!", part of which became the XML namespace.[19]

References

  1. 1.0 1.1 1.2 Hirsch, Jared (2 September 2018). "Life After XUL". Mozilla. https://developer.mozilla.org/en-US/docs/Mozilla/Tech/Life_After_XUL:_Building_Firefox_Interfaces_with_HTML. 
  2. 2.0 2.1 2.2 "Problems with XUL". https://mozilla.github.io/firefox-browser-architecture/text/0003-problems-with-xul.html. 
  3. 3.0 3.1 "Firefox 57.0, See All New Features, Updates and Fixes". 14 November 2017. https://www.mozilla.org/en-US/firefox/57.0/releasenotes/. 
  4. 4.0 4.1 Kev Needham (2015-08-21). "The Future of Developing Firefox Add-ons". https://blog.mozilla.org/addons/2015/08/21/the-future-of-developing-firefox-add-ons/. 
  5. Kontos, Alex (2018-04-28). "Waterfox, Its Legacy and Looking to the Future". https://blog.waterfoxproject.org/waterfox-its-legacy-and-looking-to-the-future. 
  6. "Pale Moon future roadmap". Moonchild Productions. 23 March 2022. https://www.palemoon.org/roadmap.shtml. 
  7. Brinkmann, Martin (2017-11-17). "Pale Moon team releases first version of Basilisk browser". Ghacks Technology News. https://www.ghacks.net/2017/11/17/pale-moon-team-releases-first-version-of-basilisk-browser/. 
  8. Iceweasel-UXP project page
  9. Jorge O. Castro (2004-06-15). "Ars Technica sits down with Scott Collins from Mozilla.org". Ars Technica. https://arstechnica.com/information-technology/2004/06/collins-interview/2/. 
  10. 10.0 10.1 Teller, David (Aug 20, 2020). "Why Did Mozilla Remove XUL Add-ons?". https://yoric.github.io/post/why-did-mozilla-remove-xul-addons/. 
  11. King, Brian (2003-02-05). "Remote Application Development with Mozilla, Part 2: A Case Study of the Mozilla Amazon Browser (MAB)". Oreillynet. http://www.oreillynet.com/pub/a/mozilla/2003/05/02/casestudy2.html. "The Mozilla Amazon Browser is an interesting case study for a number of reasons. First, it's a working prototype application, not an example constructed solely for the purpose of demonstrating the technology. Second, it exercises many areas of Mozilla's support for remote development and thus shows off the capabilities, potential, and limitations of remote XUL applications. Finally, it demonstrates Mozilla's support for web services, an important emerging technology for web application development." 
  12. Grinstead, Brian (16 December 2019). "Firefox/XUL and XBL Replacement". https://wiki.mozilla.org/Firefox/XUL_and_XBL_Replacement. 
  13. "Adapt to Changes in Thunderbird 69-78". 2022. https://developer.thunderbird.net/add-ons/updating/tb78/changes. 
  14. Straver, Markus (2 November 2017). "UXP vs goanna". https://forum.palemoon.org/viewtopic.php?f=62&t=17213. "The plan is to switch Pale Moon over from our current platform to UXP (long-term plans) because a developed and maintained XUL-based platform is the only way a XUL application (like Pale Moon) has any chance of surviving without falling into obsolescence, with Mozilla abandoning this technology. That has been the main reason why I decided to start on this platform to begin with! Regardless, the platform will not be solely developed for Pale Moon's potential future use, it is developed for any future XUL application that will otherwise be dead in the water. Basically we're taking over the torch from Mozilla in developing and maintaining a platform for XUL applications of any kind; Mozilla should not be seen as "upstream" because it isn't." 
  15. Tobin, Matt. "There is only XUL". http://thereisonlyxul.org/. 
  16. "Gecko FAQ | MDN". https://developer.mozilla.org/en-US/docs/Gecko/FAQ. 
  17. "The Box Model - Mozilla | MDN". 2017-12-09. https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/Tutorial/The_Box_Model. 
  18. "Ghostbusters - There Is No Dana, Only ZUUL". https://www.youtube.com/watch?v=lg7MAacSPNM. 
  19. "Mozilla XML Namespace". https://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul.