How to install the SRD boundaries for Mozilla 1.0 with fixed Alert bug

Two ways to get SRD features for Mozilla 1.0
What to do with the tar ball?
Technical details

Two ways to get SRD features

If you have mozilla 1.0 source code, you can down load the tar file here, then follow the instructions. If you don't have source code, just want to see what the SRD boundaries looks like, you can download mozilla1.tar.gz file, untar it, then run ./mozilla.

What to do with the tar ball?

At first, you need Mozilla 1.0 source code. You can down load from Mozilla.org, build it following the instructions in the linux build page. The first time of compilation takes more than an hour on 800 MHZ machine.

Down load the tar ball into your mozilla source directory, using tar -zxvf change.tar.gz command untar the file, rebuild the whole mozilla using command gmake -f client.mk .

The tar file includes the files which we have changed. The changed files overwrite the original files, to install the SRD feature. You can untar the file outside the mozilla source code directory to view the code, before you copy them into your mozilla source code. The technical details part tells you what we have changed.

Notice:
1. In order to make the reference window work properly, you need enter dist/bin directory, then run ./mozilla.
2. We have not prepared an uninstall package yet. So if you do not like SRD feature, you probably need redownload the source code from Mozilla.org, and compile it.
3. We only changed some use interface for demo purpose, the navigator window, the page Info window, the viewSource window, the alert window.

Technical details

Changes in style sheet system
Changes in user interface directory
Changes in prompt service
Summary

If this is the first time you read about SRD boundaries, you should read the countermeasure page at first.

Changes in style sheet system

As we mentioned in the countermeasure page, we need distinguish the window which holds server side material and the window holds browser internal material, using the different color boundaries. Mozilla 1.0 has different style sheet system from Mozilla 0.9.2.1. It can not recognize externalwindow element like Mozilla-0.9.2.1. What we did in global.css is we let the window element could have an external attribute. We define the window has blue boundary if the external attribute is set, the window has orange boundary if the external attribute is removed. We did the same to the dialog element which is used as the window element in dialog windows.

Changes in user interface directory

Mozilla uses xul files to define the user interface. Most of the xul files which used in navigator are located in xpfe directory.

xpfe/browser/resources/content/navigator.xul is the file which defines the main navigator window. We put our JavaScript code into a separate file navigatorCB.js and link it into the navigator.xul file. navigatorCB.js has two functions, change and changeAttr. In the function change, we get the window element reference, set the external attribute to the window and call changeAttr function every 0.5 second; changAttr function reads the random value from the borderStyle module and sets the borderstyle attribute or removes it. Change function itself is called by the window onload method in xul file.

xpfe/browser/resources/content/pageInfo.xul and xpfe/browser/resources/content/viewSource.xul are the files which define the page info window and viewSource window. xpfe/components/search/resources/search-panel.xul and xpfe/components/search/resources/search.xul are the files which define the search window and the search panel window on the side bar of the navigator window. We did the same modification to them as to the navigator window. The only difference is we didn't set the external attribute to their window elements, because they are browser internal windows. The new JavaScript file names need to be added into xpfe/browser/jar.mn or xpfe/components/jar.mn files in order to be packed into the jar packages.

/xpfe/global/resources/content/commonDialog.xul defines the common dialog window, which includes the alert window, the confirm window and the prompt window. In order to distinguish the dialogs popped up by the browser and the dialogs invoked by the server, we defined a different xul file only used for the server dialogs, commonDialoE.xul. This file is the same as commonDialog.xul, the only difference is the JavaScript file which it links to. commonDialoE.js includes the code which is in navigatorCB.js, which set the external attribute for the dialog element; commonDialog.js does not.

Changes in prompt service

Alert windows, confirm windows and prompt windows use the prompt service. When an Alert window is invoked, Mozilla checks who is the caller. If the caller is the server, Mozilla write "JavaScript Application" into the window title then pass the call to the Prompt Service. The Prompt Service checks the window title, if the title has been written because of the caller is the server, Prompt Service use the external common dialog xul file, otherwise, use the internal one.

Summary

We added the borderStyle module and the reference window as in the Mozilla-0.9.2.1. The whole SRD structure doesn't change. Because Mozilla 1.0 made some changes in the user interface design, we made changes accordingly. The server invoked alert window has different color boundaries from the alert window invoked by the browser.

Some observations

Mozilla 1.0 uses dialog element instead of window element in commonDialog.xul. CommonDialog.xul only can be linked to one JavaScript file, otherwise the dialog text can not be displayed successfully.
eileen zishuang ye
Last modified: Wed Jul 17 13:17:03 EDT 2002