Home > Articles > Home & Office Computing > Home Networking

  • Print
  • + Share This
From the author of

Straightforward Versus Secret Overlay Discovery

Before the overlay system can merge anything, it must work out what files might have content to merge. In the normal case, the <?xul-overlay?> tag is sufficient information to identify the files. But there's an alternate file-discovery system that makes Mozilla smarter than the average bear.

The ordinary file-discovery method is called the top-down method. This method is equivalent to textual inclusion techniques provided by many computer languages. C/C++ has #include, Perl has use and require, and XUL has <?xul-overlay?>. The top-down method gives an application programmer the ability to break a XUL document into a hierarchy of separate files.

The other file-discovery method is called the bottom-up method. The bottom-up method requires that the programmer state in a database any overlay files and the master files into which those overlays should be merged. That database, called overlayinfo, is consulted when the platform first starts up. This method is equivalent to a linking system like make(1) and ld(1) on UNIX. Those tools draw together whatever files are needed for a given task. The overlayinfo database is also similar to the project concept in IDE programming tools like Visual Basic.

The bottom-up method gives an application programmer the ability to add to the content of existing XUL documents without modifying those documents. This is a very powerful feature that lets you, the programmer, add content to other people's applications. A typical use of this system is to add extra menu options to someone else's menu system.

One master document can benefit from both the top-down and bottom-up methods. The example in this article might use either method. If <?xul-overlay?> tags are present, the top-down method is being used. It's not possible to tell by looking at any XUL document whether the bottom-up method is used. You have to look at Mozilla's overlayinfo database instead.

Mozilla-based applications include many overlays, and more can be added. If you do that, you're enhancing that application. Most of the browser experiments at http://www.mozdev.org/ work like this, at least in part. Similarly, existing Mozilla overlays can be added to a new Mozilla application. Either way, this is an example of the reuse of XUL content.

  • + Share This
  • 🔖 Save To Your Account