Cover image for Netscape Mozilla source code guide
Netscape Mozilla source code guide
Stanek, William R.
Personal Author:
Publication Information:
Foster City, CA : Netscape Press, 1999.
Physical Description:
xxvi, 428 pages ; 24 cm ; 1 cd rom.
General Note:
Includes index.
Title Subject:
Format :


Call Number
Material Type
Home Location
Item Holds
QA76.625 .S73 1999 TEXT Adult Non-Fiction Central Closed Stacks

On Order



Netscape?? Mozilla?(TM) source code guide All the Techniques You Need to Put Mozilla to Work Mozilla, the open source version of Netscape Communicator, is an indispensable resource if you want to develop custom Internet applications. But Mozilla is also dauntingly complex, with over 50 separate modules comprising more than 30 million lines of code. This unique guide, developed in collaboration with Netscape Communications, provides a lucid overview of each Mozilla module -- and shows you step by step how to harness the cross-platform power of this versatile Internet application. Working Solutions for Internet Development Challenges
* Understand the legal ground rules that govern the use of Mozilla code
* Master key Mozilla concepts such as virtual interfaces, interface identifiers, factories, repositories, and linked libraries
* Grasp how each Mozilla module is organized, named, and used
* Get up to speed on powerful Mozilla development tools such as CVS, Bonsai, Tinderbox, and Bugzilla
* Learn step-by-step programming techniques for customizing the Mozilla back end and front end
* Discover how to build Mozilla source on a Windows, Macintosh, or Unix platform
* Join the Mozilla open source movement -- and stay in touch through, newsletters, and online discussion groups
Published and technically reviewed with the authorization and collaboration of Netscape Communications Corporation Bonus CD-ROM includes:
* Source code for Mozilla
* Additional open source modules
* Mozilla developer tools System Requirements: Windows system running Windows 95/98 or Windows NT/2000; Microsoft Visual C++ version 5.0 or later; Perl5 for win32; Macintosh running MacOS 8.5 and MetroWerks CodeWarrior Pro 4.1 or later; Unix or Linux system with Perl 5 and a C/C++ compiler, such as egcs version 1.1.1 or gcc version 2.7.2

Author Notes

William R. Stanek, a veteran programmer, project manager, and trainer, is the executive director of Virtual Press and the founder of Global Internet Solutions. He contributes to PC Magazine and is the author of several bestselling books, including Web Publishing Unleashed and Windows NT Server 4.0 Administrator's Pocket Consultant. He spent two years mastering the intricacies of Mozilla in order to write this book.

Table of Contents

Prefacep. ix
Acknowledgmentsp. xiii
Part I Getting Startedp. 1
Chapter 1 Introducing Mozilla and the Netscape Open Source Programp. 3
Introducing Mozillap. 4
So What Is Mozilla?p. 4
How Are Mozilla and Communicator Different?p. 5
Understanding the Netscape Open Source Programp. 7
What Is Open Source?p. 7
Where Is Open Source Headed?p. 9
How to Take Advantage of Netscape's Open Source Programp. 10
Licensing Issuesp. 10
Licensing Basicsp. 10
Netscape Public Licensep. 11
Mozilla Public Licensep. 14
License Versionsp. 15
What License Should You Use?p. 15
Exploring mozilla.orgp. 16
What Is 16
Who Are the Members?p. 16
Chapter 2 Getting Involvedp. 21
Joining the Open Source Teamp. 22
Before You Contributep. 22
Contributing Source Codep. 23
Contributing Documentationp. 24
Contributing in Other Waysp. 24
How to Contributep. 24
Understanding Modulesp. 25
Meet the Module Ownersp. 25
More on Module Ownersp. 27
Becoming a Module Ownerp. 27
Where Is Mozilla Headed?p. 28
Development Overviewp. 28
Following Current and Future Projectsp. 29
Status Reportsp. 30
Staying in Touch with Other Developersp. 31
What You Should Know Up Frontp. 31
Working with Mozilla Newsgroupsp. 33
Working with Mozilla Mailing Listsp. 33
More Discussion Opportunitiesp. 35
Part II Managing the Source Codep. 39
Chapter 3 Making Sense of the Mozilla Sourcep. 41
So Much Code, So Little Timep. 42
Understanding Module Files and Structurep. 42
Working with Modulesp. 42
Module and Source Naming Conventionsp. 43
Code Formatting Conventionsp. 46
Modularization: The Process of Creating Modulesp. 47
Virtual Interfaces and IIDsp. 48
The nsISupports Interfacep. 48
Working with QueryInterface()p. 49
Working with AddRef() and Release()p. 51
Factoriesp. 54
Creating and Registering DLLsp. 57
Chapter 4 Managing Source Files and Modulesp. 61
Understanding the CVS Architecturep. 62
Setting Up a Local Directory Treep. 63
Obtaining the Sourcep. 63
Creating the Treep. 64
Setting Up the Environment for CVSp. 64
CVS Environment Settingsp. 64
CVS Setup on Unixp. 65
CVS Setup on Windowsp. 66
CVS Setup on Macintoshp. 67
Creating Your CVS Sandboxp. 68
Checking Out Modulesp. 69
Creating Additional Sandboxesp. 70
Checking In Source Files and Modulesp. 71
Getting Permission and Write Accessp. 71
Ensuring That Your Code Is Portablep. 71
Following the Check In and Tree Rulesp. 75
Committing Changes and Adding to the Repositoryp. 76
Chapter 5 Developer Tools and Techniquesp. 79
Using Mozilla Cross Referencep. 80
Browsing the Treep. 80
Searching the Source Codep. 82
Controlling the Tree with Bonsaip. 86
Viewing Tree Statusp. 87
Getting Lists of Changesp. 87
Viewing Check in Logsp. 89
Tracking Revision Historyp. 90
Creating Scripts to Back Off Changesp. 92
Tracking Builds with Tinderboxp. 92
Tinderbox Basicsp. 93
Working with Tinderboxp. 93
Understanding Tree Statusp. 95
Using Bugzillap. 96
Reporting Bugs with Bugzillap. 97
Bug Tracking in Mozillap. 98
Part III Working with the Source Codep. 103
Chapter 6 User Interface Design Conceptsp. 105
Understanding Mozilla Color Palettesp. 106
Windows Color Palettep. 107
Macintosh Color Palettep. 109
Color Palette for Unix X Systemsp. 109
Enhanced Color Palettesp. 110
Designing Windows and Widgetsp. 111
Windows and Window Designp. 112
Widgets and Widget Designp. 114
Designing Menusp. 115
Mozilla's Menu Systemp. 115
Menu Access Features and Optionsp. 117
Designing Toolbarsp. 117
Toolbar Basicsp. 118
Toolbar Buttonsp. 118
Tool Tipsp. 123
Chapter 7 Programming the User Interfacep. 125
Understanding the XUL Architecturep. 126
XUL Basicsp. 126
The Architecturep. 127
Working with Application Servicesp. 128
Working with AppRunner and AppShellp. 128
Creating Window Instancesp. 129
Programming the Application Corep. 132
Working with nsAppCoresp. 132
Working with nsBroserAppCorep. 136
Creating an Application Corep. 138
Implementing the Objects and Interfacesp. 139
Creating the DOM Interface and Stub Functionsp. 142
Registering the Objects and Adding Them to a DLLp. 145
Chapter 8 Defining Windows, Menus, and Toolbars with XULp. 149
Initializing a Windowp. 150
Creating a Toolbar Windowp. 151
Defining the Namespace and Setting up the Windowp. 154
Setting up the Toolbox and Its Toolbarsp. 155
Adding Elements to the Toolbarp. 156
Adding Interactivity to the Toolbarp. 157
Creating the Content and Status Framesp. 159
Using Menu Bars, Broadcasters, and Observersp. 160
A Different Approach to Window Creationp. 163
Setting up a Menu Systemp. 165
Using Broadcasters and Observersp. 166
Chapter 9 Core Types and Variablesp. 171
Working with Core Typesp. 172
Working with Integer Typesp. 172
Using Native O/S Integer Typesp. 174
Using Floating-Point Integer Typesp. 174
Working with Objects and Pointersp. 175
Using Boolean Typesp. 176
Checking Status Codesp. 177
Defining, Declaring, and Calling External Functionsp. 177
Accessing System Information and the Environmentp. 179
Getting System Informationp. 179
Getting Environment Variablesp. 181
Chapter 10 Thread Handling and Synchronizationp. 183
Thread Handling Essentialsp. 184
Working with User and System Threadsp. 184
Using Local and Global Threadsp. 185
Using Joinable and Unjoinable Threadsp. 186
Setting Thread Prioritiesp. 187
Thread Creation and Managementp. 187
Creating a Threadp. 188
Joining a Threadp. 191
Getting the Current Threadp. 192
Getting and Setting Thread Priorityp. 194
Interrupting a Threadp. 195
Synchronizing Threadsp. 197
Working with Locksp. 198
Using Condition Variablesp. 200
Using Special Locks with PRMonitorp. 204
Chapter 11 Managing File I/O in Mozillap. 213
Understanding File I/O Typesp. 214
Directory Typesp. 214
File Descriptor Typesp. 214
File Information Typesp. 216
Working with Directoriesp. 217
Opening Directoriesp. 218
Reading Directoriesp. 218
Closing Directories and Freeing Resourcesp. 220
Creating and Removing Directoriesp. 221
Managing Filesp. 223
Checking File Informationp. 224
Checking to See if a File Is Accessiblep. 225
Opening and Creating Filesp. 227
Closing a Filep. 229
Deleting and Renaming Filesp. 229
Manipulating File Contentsp. 230
Determining the Number of Bytes Available for Readingp. 231
Setting the File Pointer Positionp. 232
Reading from a Filep. 235
Writing to a File and Synchronizing Buffersp. 235
Chapter 12 Memory Management and Error Handlingp. 239
Managing Memory in Mozilla Modulesp. 240
Allocating Memoryp. 240
Allocating Memory for an Array of Objectsp. 241
Freeing Memoryp. 243
Resizing Memory Allocationsp. 246
Error Handlingp. 247
Checking for Errorsp. 247
Setting Error Codes and Textp. 249
Part IV Developing and Building Mozillap. 253
Chapter 13 Understanding Mozilla's Build Systemp. 255
Working with Autoconfp. 256
Introducing Autoconfp. 256
Autoconf Template Filesp. 256
Where to Go for More Information on Autoconfp. 258
Working with GNU Makep. 258
Learning About makep. 259
Understanding Makefilesp. 259
GNU Make in Mozillap. 260
Where to Go for More Information on GNU Makep. 262
Working with CodeWarrior Projectsp. 262
Mac Build Directories and CodeWarrior Project Filesp. 262
The Mac Build Systemp. 263
Where to Go for More Information on CodeWarriorp. 264
Chapter 14 Developing Mozilla on Windows Systemsp. 265
Setting up the Developer Environmentp. 266
Obtaining and Installing GNU Toolsp. 266
Obtaining and Installing Netscape's Build Toolsp. 268
Obtaining and Installing Perl5 for Win32p. 271
Obtaining the Source Codep. 273
Setting up the Build Environmentp. 274
Running the Buildp. 276
Chapter 15 Developing Mozilla on Macintosh Systemsp. 279
Setting up the Developer Environmentp. 280
Working with Universal Headersp. 281
Working with GA Classes and ToolServerp. 281
Working with WASTE, CWASTE, and AEGizmosp. 282
Working with the Menu Sharing Toolkit and Internet Config SDKp. 282
Working with MacPerl5 and Related Filesp. 282
Working with the XPIDL Plug-inp. 283
Obtaining the Mac Source Codep. 284
Checking out the Mac Buildp. 284
Making Updates and Completing the Source Pullp. 285
Setting up the Mac Build Environmentp. 285
Working with the Build Scriptsp. 286
Examining NGLayoutBuildList.pmp. 286
Configuring Build Options in BuildNGLayoutDebug.plp. 287
Building Mozilla on the Macp. 288
Chapter 16 Developing Mozilla on Unix Systemsp. 291
Setting up the Unix Developer Environmentp. 292
Setting up the C/C++ Compilerp. 293
Setting up GNU m4 and Autoconfp. 295
Setting up GTK+, GLib, and libIDLp. 296
Installing the NSPR Libraryp. 297
Obtaining the Mozilla Source Codep. 301
Getting the Code with CVSp. 301
Getting the Code with FTP/HTTPp. 302
Building Mozilla on Unix Systemsp. 302
Options for a Manual Buildp. 302
Building Mozilla Manuallyp. 305
Running an Automated Buildp. 307
Appendix A CVS Commands and Syntaxp. 309
Appendix B Netscape Module Summary and Troubleshooting Guidep. 327
Appendix C Netscape Open Source Forums and Discussionsp. 359
Appendix D What's on the CD-ROM?p. 373
Indexp. 377
General Public Licensep. 387
Netscape and Mozilla Public Licenses Version 1.1p. 395
Netscape Public License Version 1.0p. 409
CD-ROM Installation Instructionsp. 430