- Introduction
- The Processing Instruction Escape Hatch
- Overlay History
- Mozilla Overlay Mechanics
- Straightforward Versus Secret Overlay Discovery
- The Bottom-Up Approach
- Poking Around Inside Mozilla
- Conclusion
The Processing Instruction Escape Hatch
The XML standard says that new tags can be added to any XML document, provided that those tags are of the form <?tagname?>. The new tags are considered to be specific to a particular software application, so they're not portable or widely standardized. Such additional tags are called processing instructions.
<?xul-overlay?> is a processing instruction specific to Mozilla. This processing instruction states: "Merge the contents of a specified document into this document." Mozilla uses this extra XML syntax to start its overlay processing system.
This processing instruction has one special attribute: href. href is always present and is set to the URL of a second XML document. Here's a typical use:
<?xul-overlay href="chrome://test/content/myOverlayxul"?>
When the document containing this processing instruction is loaded by the Mozilla platform (by a browser window), the document named in the href URL will also be loaded, and the two will be joined in a systematic way. The visible result is one final document. This processing instruction can be used as many times and across as many documents as required.
The chrome: URI scheme in this single line of code is a URL specific to Mozilla. It's similar to a file: URL referring to a document on the local disk. The chrome part of Mozilla is a set of install directories where overlays and other information are maintained. It's not absolutely necessary to use chrome: URLs in the <?xul-overlay?> processing instruction, but it's common to do so, and good programming style.
The Mozilla platform only understands <?xul-overlay?> when used in a XUL document. XUL is Mozilla's language for constructing the GUIs of traditional software applications. Mozilla doesn't support <?xul-overlay?> for HTML documents (not yet, at least).