--- mozilla-firefox-1.0.4.orig/browser/app/profile/firefox.js
+++ mozilla-firefox-1.0.4/browser/app/profile/firefox.js
@@ -38,6 +38,9 @@
 // SYNTAX HINTS:  dashes are delimiters.  Use underscores instead.
 //  The first character after a period must be alphabetic.
 
+// Disable default browser checking.
+pref("browser.shell.checkDefaultBrowser", false);
+
 // pref("startup.homepage_override_url","chrome://browser-region/locale/region.properties");
 pref("general.startup.browser", true);
 
@@ -62,8 +65,8 @@
 );
 
 // App-specific update preferences
-pref("app.update.enabled", true);               // Whether or not app updates are enabled
-pref("app.update.autoUpdateEnabled", true);     // Whether or not background app updates 
+pref("app.update.enabled", false);               // Whether or not app updates are enabled
+pref("app.update.autoUpdateEnabled", false);     // Whether or not background app updates 
                                                 // are enabled
 pref("app.update.url", "chrome://mozapps/locale/update/update.properties");
 pref("app.update.updatesAvailable", false);
@@ -81,7 +84,7 @@
 //  .. etc ..
 //
 pref("extensions.update.enabled", true);
-pref("extensions.update.autoUpdateEnabled", true);
+pref("extensions.update.autoUpdateEnabled", false);
 pref("extensions.update.url", "chrome://mozapps/locale/extensions/extensions.properties");
 pref("extensions.update.autoUpdate", false);    // Automatically download and install 
                                                 // updates to themes and extensions. 
@@ -237,6 +240,9 @@
 pref("network.cookie.cookieBehavior",       0); // cookies enabled
 pref("network.cookie.enableForCurrentSessionOnly", false);
 
+// Use LANG environment variable to choose locale
+pref("intl.locale.matchOS", true);
+
 // l12n and i18n
 pref("intl.accept_languages", "chrome://global/locale/intl.properties");
 // collationOption is only set on linux for japanese. see bug 18338 and 62015
@@ -327,3 +333,17 @@
 
 // plugin finder service
 pref("pfs.datasource.url", "chrome://mozapps/locale/plugins/plugins.properties");
+
+// enable negotiate extension
+pref("network.negotiate-auth.trusted-uris", "https://");
+
+// don't raise windows by default
+pref("mozilla.widget.raise-on-setfocus", false);
+
+// disable insecure ciphers
+pref("security.enable_ssl2", false);
+
+pref("security.ssl2.rc2_40", false);
+pref("security.ssl2.rc4_40", false);
+pref("security.ssl3.rsa_rc4_40_md5", false);
+pref("security.ssl3.rsa_rc2_40_md5", false);
--- mozilla-firefox-1.0.4.orig/browser/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf.in
+++ mozilla-firefox-1.0.4/browser/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf.in
@@ -29,6 +29,15 @@
     <em:contributor>Mozilla Contributors</em:contributor>
 
     <em:internalName>classic/1.0</em:internalName>
+
+    <em:file>
+      <Description about="urn:mozilla:extension:file:classic.jar">
+        <em:skin>skin/classic/browser/</em:skin>
+	<em:skin>skin/classic/global/</em:skin>
+	<em:skin>skin/classic/communicator/</em:skin>
+	<em:skin>skin/classic/mozapps/</em:skin>
+      </Description>
+    </em:file>
   </Description>      
 
 </RDF>
--- mozilla-firefox-1.0.4.orig/browser/base/content/aboutDialog.css
+++ mozilla-firefox-1.0.4/browser/base/content/aboutDialog.css
@@ -26,11 +26,7 @@
    -moz-appearance: none;
    overflow: hidden;
 
-#ifdef XP_MACOSX
    height: 3.8em;
-#else
-   height: 2.4em;
-#endif
 
    border: none;
  }
--- mozilla-firefox-1.0.4.orig/browser/base/content/browser.js
+++ mozilla-firefox-1.0.4/browser/base/content/browser.js
@@ -511,7 +511,16 @@
   // Check for window.arguments[0]. If present, use that for uriToLoad.
   if ("arguments" in window && window.arguments.length >= 1 && window.arguments[0])
     uriToLoad = window.arguments[0];
-    
+
+  try {
+    if (makeURL(uriToLoad).schemeIs("chrome")) {
+      dump("*** Preventing external load of chrome: URI into browser window\n");
+      dump("    Use -chrome <uri> instead\n");
+      window.close();
+      return;
+    }
+  } catch(e) {}
+
   gIsLoadingBlank = uriToLoad == "about:blank";
 
   if (!gIsLoadingBlank)
@@ -1048,7 +1057,7 @@
     // XXXblake Proper fix is to just check whether focus is in the urlbar. However, focus with the autocomplete widget is all
     // hacky and broken and there's no way to do that right now. So this just patches it to ensure that alt+enter works when focus
     // is on a link.
-    if (!document.commandDispatcher.focusedElement || document.commandDispatcher.focusedElement.localName.toLowerCase() != "a") {
+    if (!(document.commandDispatcher.focusedElement instanceof HTMLAnchorElement)) {
       // Don't let winxp beep on ALT+ENTER, since the URL bar uses it.
       event.preventDefault();
       return;
@@ -3104,9 +3113,9 @@
         if (this.urlBar)
           this.urlBar.setAttribute("level", "low");
         try {
-          this.securityButton.setAttribute("label", 
+          this.securityButton.setAttribute("label",
             gBrowser.contentWindow.location.host);
-        } catch(exception) {}        
+        } catch(exception) {}
         break;
       case wpl.STATE_IS_BROKEN:
         this.securityButton.setAttribute("level", "broken");
@@ -3195,6 +3204,14 @@
   {
     var newWindow = null;
     var referrer = null;
+    var isExternal = (aContext == nsCI.nsIBrowserDOMWindow.OPEN_EXTERNAL);
+
+    if (isExternal && aURI && aURI.schemeIs("chrome"))
+      return null;
+
+    var loadflags = isExternal ?
+                       nsCI.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL :
+                       nsCI.nsIWebNavigation.LOAD_FLAGS_NONE;
     if (aWhere == nsCI.nsIBrowserDOMWindow.OPEN_DEFAULTWINDOW) {
       switch (aContext) {
         case nsCI.nsIBrowserDOMWindow.OPEN_EXTERNAL :
@@ -3225,8 +3242,7 @@
           }
           newWindow.QueryInterface(nsCI.nsIInterfaceRequestor)
                    .getInterface(nsCI.nsIWebNavigation)
-                   .loadURI(url, nsCI.nsIWebNavigation.LOAD_FLAGS_NONE,
-                            referrer, null, null);
+                   .loadURI(url, loadflags, referrer, null, null);
         } catch(e) {
         }
         break;
@@ -3241,13 +3257,12 @@
                                       .call(aOpener);
             newWindow.QueryInterface(nsCI.nsIInterfaceRequestor)
                      .getInterface(nsIWebNavigation)
-                     .loadURI(url, nsIWebNavigation.LOAD_FLAGS_NONE, referrer,
-                              null, null);
+                     .loadURI(url, loadflags, referrer, null, null);
           } else {
             newWindow = gBrowser.selectedBrowser.docShell
                                 .QueryInterface(nsCI.nsIInterfaceRequestor)
                                 .getInterface(nsCI.nsIDOMWindow);
-            loadURI(url, null);
+            getWebNavigation().loadURI(url, loadflags, null, null, null);
           }
         } catch(e) {
         }
@@ -3647,9 +3662,23 @@
 #endif
         this.showItem( "context-setWallpaper", haveSetWallpaper && this.onImage );
 
-        if( haveSetWallpaper && this.onImage )
-            // Disable the Set As Wallpaper menu item if we're still trying to load the image
-          this.setItemAttr( "context-setWallpaper", "disabled", (("complete" in this.target) && !this.target.complete) ? "true" : null );
+        if( haveSetWallpaper && this.onImage ) {
+            // Disable the Set As Wallpaper menu item if we're still trying to load the image or the load failed
+            const nsIImageLoadingContent = Components.interfaces.nsIImageLoadingContent;
+            var disableSetWallpaper = false;
+            if (("complete" in this.target) && !this.target.complete)
+                 disableSetWallpaper = true;
+            else if (this.target instanceof nsIImageLoadingContent) {
+                var request = this.target.QueryInterface(nsIImageLoadingContent)
+                                  .getRequest(nsIImageLoadingContent.CURRENT_REQUEST);
+                if (!request)
+                    disableSetWallpaper = true;
+            }
+            else if (makeURL(this.target.src).scheme == "javascript")
+                disableSetWallpaper = true;
+              
+            this.setItemAttr( "context-setWallpaper", "disabled", disableSetWallpaper);
+        }
 
         // View Image depends on whether an image was clicked on.
         this.showItem( "context-viewimage", this.onImage );
@@ -3762,7 +3791,7 @@
 
         // See if the user clicked on an image.
         if ( this.target.nodeType == Node.ELEMENT_NODE ) {
-             if ( this.target.localName.toUpperCase() == "IMG" ) {
+             if ( this.target instanceof HTMLImageElement ) {
                 this.onImage = true;
                 this.imageURL = this.target.src;
                 // Look for image map.
@@ -3777,9 +3806,7 @@
                         areas.length = 0;
                         for ( var i = 0; i < areas.length && !this.onLink; i++ ) {
                             var area = areas[i];
-                            if ( area.nodeType == Node.ELEMENT_NODE
-                                 &&
-                                 area.localName.toUpperCase() == "AREA" ) {
+                            if ( area instanceof HTMLAreaElement ) {
                                 // Get type (rect/circle/polygon/default).
                                 var type = area.getAttribute( "type" );
                                 var coords = this.parseCoords( area );
@@ -3804,7 +3831,7 @@
                         }
                     }
                 }
-             } else if ( this.target.localName.toUpperCase() == "OBJECT"
+             } else if ( this.target instanceof HTMLObjectElement
                          &&
                          // See if object tag is for an image.
                          this.objectIsImage( this.target ) ) {
@@ -3812,7 +3839,7 @@
                 this.onImage = true;
                 // URL must be constructed.
                 this.imageURL = this.objectImageURL( this.target );
-             } else if ( this.target.localName.toUpperCase() == "INPUT") {
+             } else if ( this.target instanceof HTMLInputElement) {
                type = this.target.getAttribute("type");
                if(type && type.toUpperCase() == "IMAGE") {
                  this.onImage = true;
@@ -3823,9 +3850,9 @@
                  this.onTextInput = this.isTargetATextBox(this.target);
                  this.onKeywordField = this.isTargetAKeywordField(this.target);
                }
-            } else if ( this.target.localName.toUpperCase() == "TEXTAREA" ) {
+            } else if ( this.target instanceof HTMLTextAreaElement ) {
                  this.onTextInput = true;
-            } else if ( this.target.localName.toUpperCase() == "HTML" ) {
+            } else if ( this.target instanceof HTMLHtmlElement ) {
                // pages with multiple <body>s are lame. we'll teach them a lesson.
                var bodyElt = this.target.ownerDocument.getElementsByTagName("body")[0];
                if ( bodyElt ) {
@@ -3892,13 +3919,11 @@
         var elem = this.target;
         while ( elem ) {
             if ( elem.nodeType == Node.ELEMENT_NODE ) {
-                var localname = elem.localName.toUpperCase();
-                
                 // Link?
                 if ( !this.onLink && 
-                    ( (localname === "A" && elem.href) ||
-                      localname === "AREA" ||
-                      localname === "LINK" ||
+                    ( (elem instanceof HTMLAnchorElement && elem.href) ||
+                      elem instanceof HTMLAreaElement ||
+                      elem instanceof HTMLLinkElement ||
                       elem.getAttributeNS( "http://www.w3.org/1999/xlink", "type") == "simple" ) ) {
                     // Clicked on a link.
                     this.onLink = true;
@@ -3920,14 +3945,12 @@
                 if ( !this.onMetaDataItem ) {
                     // We currently display metadata on anything which fits
                     // the below test.
-                    if ( ( localname === "BLOCKQUOTE" && 'cite' in elem && elem.cite)  ||
-                         ( localname === "Q" && 'cite' in elem && elem.cite)           ||
-                         ( localname === "TABLE" && 'summary' in elem && elem.summary) ||
-                         ( ( localname === "INS" || localname === "DEL" ) &&
-                           ( ( 'cite' in elem && elem.cite ) ||
-                             ( 'dateTime' in elem && elem.dateTime ) ) )               ||
-                         ( 'title' in elem && elem.title )                             ||
-                         ( 'lang' in elem && elem.lang ) ) {
+                    if ( ( elem instanceof HTMLQuoteElement && elem.cite)    ||
+                         ( elem instanceof HTMLTableElement && elem.summary) ||
+                         ( elem instanceof HTMLModElement &&
+                             ( elem.cite || elem.dateTime ) )                ||
+                         ( elem instanceof HTMLElement &&
+                             ( elem.title || elem.lang ) ) ) {
                         this.onMetaDataItem = true;
                     }
                 }
@@ -4057,10 +4080,12 @@
     },
     // Change current window to the URL of the image.
     viewImage : function (e) {
+        urlSecurityCheck( this.imageURL, document )
         openUILink( this.imageURL, e );
     },
     // Change current window to the URL of the background image.
     viewBGImage : function (e) {
+        urlSecurityCheck( this.bgImageURL, document )
         openUILink( this.bgImageURL, e );
     },
     setWallpaper: function() {
@@ -4336,28 +4361,10 @@
     },
     isTargetATextBox : function ( node )
     {
-      if (node.nodeType != Node.ELEMENT_NODE)
-        return false;
+      if (node instanceof HTMLInputElement)
+        return (node.type == "text" || node.type == "password")
 
-      if (node.localName.toUpperCase() == "INPUT") {
-        var attrib = "";
-        var type = node.getAttribute("type");
-
-        if (type)
-          attrib = type.toUpperCase();
-
-        return( (attrib != "IMAGE") &&
-                (attrib != "CHECKBOX") &&
-                (attrib != "RADIO") &&
-                (attrib != "SUBMIT") &&
-                (attrib != "RESET") &&
-                (attrib != "FILE") &&
-                (attrib != "HIDDEN") &&
-                (attrib != "RESET") &&
-                (attrib != "BUTTON") );
-      } else  {
-        return(node.localName.toUpperCase() == "TEXTAREA");
-      }
+      return (node instanceof HTMLTextAreaElement);
     },
     isTargetAKeywordField : function ( node )
     {
@@ -4451,26 +4458,20 @@
    var target = event.target;
    var linkNode;
 
-   var local_name = target.localName;
-
-   if (local_name) {
-     local_name = local_name.toLowerCase();
+   if (target instanceof HTMLAnchorElement ||
+       target instanceof HTMLAreaElement ||
+       target instanceof HTMLLinkElement) {
+     if (target.hasAttribute("href"))
+       linkNode = target;
    }
-
-   switch (local_name) {
-     case "a":
-     case "area":
-     case "link":
-       if (target.hasAttribute("href")) 
-         linkNode = target;
-       break;
-     default:
-       linkNode = findParentNode(event.originalTarget, "a");
-       // <a> cannot be nested.  So if we find an anchor without an
-       // href, there is no useful <a> around the target
-       if (linkNode && !linkNode.hasAttribute("href"))
-         linkNode = null;
-       break;
+   else {
+     linkNode = event.originalTarget;
+     while (linkNode && !(linkNode instanceof HTMLAnchorElement))
+       linkNode = linkNode.parentNode;
+     // <a> cannot be nested.  So if we find an anchor without an
+     // href, there is no useful <a> around the target
+     if (linkNode && !linkNode.hasAttribute("href"))
+       linkNode = null;
    }
    if (linkNode) {
      var wrapper = new XPCNativeWrapper(linkNode, "href", "getAttribute()", "ownerDocument");
@@ -4495,6 +4496,9 @@
          // javascript links should be executed in the current browser
          if (wrapper.href.substr(0, 11) === "javascript:")
            return true;
+         // data links should be executed in the current browser
+         if (wrapper.href.substr(0, 5) === "data:")
+           return true;
 
          if (!webPanelSecurityCheck(locWrapper.href, wrapper.href))
            return false;
@@ -4566,7 +4570,7 @@
      }
    }
    if (event.button == 1 &&
-       !findParentNode(event.originalTarget, "scrollbar") &&
+       !event.getPreventDefault() &&
        gPrefService.getBoolPref("middlemouse.contentLoadURL")) {
      middleMousePaste(event);
    }
@@ -4644,27 +4648,6 @@
   return ioService.newURI(baseURI.resolve(url), null, null).spec;
 }
 
-function findParentNode(node, parentNode)
-{
-  if (node && node.nodeType == Node.TEXT_NODE) {
-    node = node.parentNode;
-  }
-  while (node) {
-    var nodeName = node.localName;
-    if (!nodeName)
-      return null;
-    nodeName = nodeName.toLowerCase();
-    if (nodeName == "body" || nodeName == "html" ||
-        nodeName == "#document") {
-      return null;
-    }
-    if (nodeName == parentNode)
-      return node;
-    node = node.parentNode;
-  }
-  return null;
-}
-
 function saveFrameDocument()
 {
   var focusedWindow = document.commandDispatcher.focusedWindow;
@@ -5353,10 +5336,10 @@
       (node.form.enctype == "application/x-www-form-urlencoded" || node.form.enctype == "")) {
     for (var i = 0; i < node.form.elements.length; ++i) {
       var e = node.form.elements[i];
-      if (e.type.toLowerCase() == "text" || e.type.toLowerCase() == "hidden" || 
-          e.localName.toLowerCase() == "textarea") 
+      if (e.type.toLowerCase() == "text" || e.type.toLowerCase() == "hidden" ||
+          e instanceof HTMLTextAreaElement)
         postData += escape(e.name + "=" + (e == node ? "%s" : e.value)) + "&";
-      else if (e.localName.toLowerCase() == "select" && e.selectedIndex >= 0)
+      else if (e instanceof HTMLSelectElement && e.selectedIndex >= 0)
         postData += escape(e.name + "=" + e.options[e.selectedIndex].value) + "&";
       else if ((e.type.toLowerCase() == "checkbox" ||
 	  	e.type.toLowerCase() == "radio") && e.checked)
@@ -5370,10 +5353,10 @@
       if (e == node) // avoid duplication of the target field value, which was populated above.
         continue;
         
-      if (e.type.toLowerCase() == "text" || e.type.toLowerCase() == "hidden" || 
-          e.localName.toLowerCase() == "textarea")
+      if (e.type.toLowerCase() == "text" || e.type.toLowerCase() == "hidden" ||
+          e instanceof HTMLTextAreaElement)
         spec += "&" + escape(e.name) + "=" + escape(e.value);
-      else if (e.localName.toLowerCase() == "select" && e.selectedIndex >= 0)
+      else if (e instanceof HTMLSelectElement && e.selectedIndex >= 0)
         spec += "&" + escape(e.name) + "=" + escape(e.options[e.selectedIndex].value);
       else if ((e.type.toLowerCase() == "checkbox" ||
 	  	e.type.toLowerCase() == "radio") && e.checked)
@@ -5620,14 +5603,19 @@
 }
 
 missingPluginInstaller.prototype.installSinglePlugin = function(aEvent){
+  // Check if the event is trust-worthy.
+  if (!aEvent.isTrusted) {
+    return;
+  }
+
   var tabbrowser = getBrowser();
   var missingPluginsArray = new Object;
 
   var tagMimetype;
   var pluginsPage;
-  if (aEvent.target.localName.toLowerCase() == "applet") {
+  if (aEvent.target instanceof HTMLAppletElement) {
     tagMimetype = "application/x-java-vm";
-  } else if (aEvent.target.localName.toLowerCase() == "object") {
+  } else if (aEvent.target instanceof HTMLObjectElement) {
     tagMimetype = aEvent.target.type;
     pluginsPage = aEvent.target.getAttribute("codebase");
   } else {
@@ -5646,12 +5634,17 @@
 }
 
 missingPluginInstaller.prototype.newMissingPlugin = function(aEvent){
+  // Check if the event is trust-worthy.
+  if (!aEvent.isTrusted) {
+    return;
+  }
+
   // For broken non-object plugin tags, register a click handler so
   // that the user can click the plugin replacement to get the new
   // plugin. Object tags can, and often do, deal with that themselves,
   // so don't stomp on the page developers toes.
 
-  if (aEvent.target.localName.toLowerCase() != "object") {
+  if (!(aEvent.target instanceof HTMLObjectElement)) {
     aEvent.target.addEventListener("click",
                                    gMissingPluginInstaller.installSinglePlugin,
                                    false);
@@ -5681,9 +5674,9 @@
 
   var tagMimetype;
   var pluginsPage;
-  if (aEvent.target.localName.toLowerCase() == "applet") {
+  if (aEvent.target instanceof HTMLAppletElement) {
     tagMimetype = "application/x-java-vm";
-  } else if (aEvent.target.localName.toLowerCase() == "object") {
+  } else if (aEvent.target instanceof HTMLObjectElement) {
     tagMimetype = aEvent.target.type;
     pluginsPage = aEvent.target.getAttribute("codebase");
   } else {
--- mozilla-firefox-1.0.4.orig/browser/base/content/setWallpaper.xul
+++ mozilla-firefox-1.0.4/browser/base/content/setWallpaper.xul
@@ -54,6 +54,7 @@
     
     <stringbundle id="bundle_wallpaper" src="chrome://browser/locale/browser.properties"/>
     <script type="application/x-javascript" src="chrome://browser/content/utilityOverlay.js"/>
+    <script type="application/x-javascript" src="chrome://browser/content/contentAreaUtils.js"/>
 
     <script type="application/x-javascript">
       <![CDATA[
@@ -114,6 +115,17 @@
         function createImage()
         {
           var img = document.createElementNS(xulNS, "image");
+          const nsIImageLoadingContent = Components.interfaces.nsIImageLoadingContent;
+          if (window.arguments[0] instanceof nsIImageLoadingContent) {
+            var request = window.arguments[0].QueryInterface(nsIImageLoadingContent)
+                                .getRequest(nsIImageLoadingContent.CURRENT_REQUEST);
+            if (!request)
+              return false;
+          }
+          
+          if (makeURL(window.arguments[0].src).scheme == "javascript")
+            return false;
+          
           img.setAttribute("src", window.arguments[0].src);
           return img;
         }
--- mozilla-firefox-1.0.4.orig/browser/base/content/utilityOverlay.js
+++ mozilla-firefox-1.0.4/browser/base/content/utilityOverlay.js
@@ -323,8 +323,7 @@
     if ( node.nodeName == "#text" ) {
       // Add this text to our collection.
       text += " " + node.data;
-    } else if ( node.nodeType == Node.ELEMENT_NODE 
-                && node.localName.toUpperCase() == "IMG" ) {
+    } else if ( node instanceof HTMLImageElement) {
       // If it has an alt= attribute, use that.
       var altText = node.getAttribute( "alt" );
       if ( altText && altText != "" ) {
--- mozilla-firefox-1.0.4.orig/browser/components/prefwindow/content/pref-advanced.xul
+++ mozilla-firefox-1.0.4/browser/components/prefwindow/content/pref-advanced.xul
@@ -72,9 +72,9 @@
               open="true" persist="open" clearhidden="true" align="left">
       <label>&softwareupdateinfo.label;</label>
       <vbox class="indent" align="left">
-        <checkbox id="enableSmartUpdate"
+        <!-- checkbox id="enableSmartUpdate"
                   label="&enableSmartUpdate.label;" accesskey="&enableSmartUpdate.accesskey;"
-                  prefstring="app.update.autoUpdateEnabled"/>
+                  prefstring="app.update.autoUpdateEnabled"/ -->
         <checkbox id="enableExtensionUpdate"
                   label="&enableExtensionUpdate.label;" accesskey="&enableExtensionUpdate.accesskey;"
                   prefstring="extensions.update.autoUpdateEnabled"/>      
--- mozilla-firefox-1.0.4.orig/browser/installer/unix/packages-static
+++ mozilla-firefox-1.0.4/browser/installer/unix/packages-static
@@ -213,6 +213,7 @@
 
 ; [Layout Engine Resources]
 ; Style Sheets, Graphics and other Resources used by the layout engine. 
+bin/res/hiddenWindow.html
 bin/res/ua.css
 bin/res/html.css
 bin/res/quirk.css
@@ -253,7 +254,6 @@
 bin/res/langGroups.properties
 bin/res/language.properties
 bin/res/entityTables/*
-bin/res/builtin/platformHTMLBindings.xml
 
 ; [Personal Security Manager]
 ;
--- mozilla-firefox-1.0.4.orig/browser/installer/windows/config.it
+++ mozilla-firefox-1.0.4/browser/installer/windows/config.it
@@ -392,7 +392,7 @@
 Launch App=@COMPLETE_LAUNCH@
 Launch App Checked=TRUE
 Reset Homepage=@COMPLETE_RESET_HOMEPAGE@
-Reset Homepage Checked=TRUE
+Reset Homepage Checked=FALSE
 Registry Key=SOFTWARE\\$CompanyName$\\$ProductName$
 
 [Dialog Download]
--- mozilla-firefox-1.0.4.orig/browser/installer/windows/installer.cfg
+++ mozilla-firefox-1.0.4/browser/installer/windows/installer.cfg
@@ -13,4 +13,4 @@
 ComponentList             = xpcom,browser,talkback,@AB_CD@,adt,help
 LicenseFile               = browser/EULA
 7ZipSFXModule             = other-licenses/7zstub/firefox/7zSD.sfx
-GREVersion                = 1.7.8
+GREVersion                = 1.7.10
--- mozilla-firefox-1.0.4.orig/browser/installer/windows/packages-static
+++ mozilla-firefox-1.0.4/browser/installer/windows/packages-static
@@ -203,6 +203,7 @@
 
 ; [Layout Engine Resources]
 ; Style Sheets, Graphics and other Resources used by the layout engine. 
+bin\res\hiddenWindow.html
 bin\res\ua.css
 bin\res\html.css
 bin\res\quirk.css
@@ -243,7 +244,6 @@
 bin\res\langGroups.properties
 bin\res\language.properties
 bin\res\entityTables\*
-bin\res\builtin\platformHTMLBindings.xml
 
 ; [Personal Security Manager]
 ;
--- mozilla-firefox-1.0.4.orig/browser/locales/en-US/searchplugins/amazondotcom.src
+++ mozilla-firefox-1.0.4/browser/locales/en-US/searchplugins/amazondotcom.src
@@ -20,6 +20,6 @@
 <BROWSER
         update="http://www.mozilla.org/products/firefox/plugins/amazondotcom.src"
         updateIcon="http://www.mozilla.org/products/firefox/plugins/amazondotcom.png"
-        updateCheckDays="3"
+        updateCheckDays="0"
 	>
 
--- mozilla-firefox-1.0.4.orig/browser/locales/en-US/searchplugins/creativecommons.src
+++ mozilla-firefox-1.0.4/browser/locales/en-US/searchplugins/creativecommons.src
@@ -32,6 +32,6 @@
 <browser
 	update="http://mycroft.mozdev.org/plugins/creativecommons.src"
 	updateIcon="http://mycroft.mozdev.org/plugins/creativecommons.png"
-	updateCheckDays="3"
+	updateCheckDays="0"
 >
 
--- mozilla-firefox-1.0.4.orig/browser/locales/en-US/searchplugins/dictionary.src
+++ mozilla-firefox-1.0.4/browser/locales/en-US/searchplugins/dictionary.src
@@ -23,6 +23,6 @@
 <BROWSER
    update="http://www.mozilla.org/products/firefox/plugins/dictionary.src" 
    updateIcon="http://www.mozilla.org/products/firefox/plugins/dictionary.png" 
-   updateCheckDays="3"
+   updateCheckDays="0"
 >
 
--- mozilla-firefox-1.0.4.orig/browser/locales/en-US/searchplugins/eBay.src
+++ mozilla-firefox-1.0.4/browser/locales/en-US/searchplugins/eBay.src
@@ -32,5 +32,5 @@
 <BROWSER
    update="http://www.mozilla.org/products/firefox/plugins/ebay.src" 
    updateIcon="http://www.mozilla.org/products/firefox/plugins/eBay.gif" 
-   updateCheckDays="3"
+   updateCheckDays="0"
 >
--- mozilla-firefox-1.0.4.orig/browser/locales/en-US/searchplugins/google.src
+++ mozilla-firefox-1.0.4/browser/locales/en-US/searchplugins/google.src
@@ -6,7 +6,7 @@
    method="GET"
    action="http://www.google.com/search"
    update="http://www.google.com/mozilla/google.src"
-   updateCheckDays=1   
+   updateCheckDays=0   
    queryEncoding="utf-8"
    queryCharset="utf-8"
 >
--- mozilla-firefox-1.0.4.orig/browser/locales/en-US/searchplugins/yahoo.src
+++ mozilla-firefox-1.0.4/browser/locales/en-US/searchplugins/yahoo.src
@@ -36,7 +36,7 @@
     alsomatch="http://search.yahoo.com/bin/search"
     update="http://www.mozilla.org/products/firefox/plugins/yahoo.src"
     updateIcon="http://www.mozilla.org/products/firefox/plugins/yahoo.gif"
-    updateCheckDays="3"
+    updateCheckDays="0"
 >
 
 </search>
--- mozilla-firefox-1.0.4.orig/browser/themes/pinstripe/browser/browser.css
+++ mozilla-firefox-1.0.4/browser/themes/pinstripe/browser/browser.css
@@ -429,173 +429,173 @@
   list-style-image: url("chrome://browser/skin/Toolbar-small.png");
   padding: 1px 3px 1px 3px !important;
 }
-
-toolbar[iconsize="small"] #back-button {
-  -moz-image-region: rect(0px 24px 24px 0px);
-}
-
-/* back button */
-
-toolbar[iconsize="small"] #back-button[buttondown="true"] {
-  -moz-image-region: rect(24px 24px 48px 0px);
-}
-toolbar[iconsize="small"] #back-button[disabled="true"] {
-  -moz-image-region: rect(48px 24px 72px 0px) !important;
-}
-
-/* forward button */
-
-toolbar[iconsize="small"] #forward-button {
-  -moz-image-region: rect(0px 48px 24px 24px);
-  padding-right: 2px;
-}
-toolbar[iconsize="small"] #forward-button[buttondown="true"] {
-  -moz-image-region: rect(24px 48px 48px 24px);
-}
-toolbar[iconsize="small"] #forward-button[disabled="true"] {
-   -moz-image-region: rect(48px 48px 72px 24px) !important;
-}
-
-/* stop button */
-
-toolbar[iconsize="small"] #stop-button {
-  -moz-image-region: rect(0px 72px 24px 48px);
-}
-toolbar[iconsize="small"] #stop-button:active {
-  -moz-image-region: rect(24px 72px 48px 48px);
-}
-toolbar[iconsize="small"] #stop-button[disabled="true"] {
-  -moz-image-region: rect(48px 72px 72px 48px) !important;
-}
-
-/* reload button */
-
-toolbar[iconsize="small"] #reload-button {
-  -moz-image-region: rect(0px 96px 24px 72px);
-}
-toolbar[iconsize="small"] #reload-button:active {
-  -moz-image-region: rect(24px 96px 48px 72px);
-}
-toolbar[iconsize="small"] #reload-button[disabled="true"] {
-  -moz-image-region: rect(48px 96px 72px 72px);
-}
-
-/* home button */
-
-toolbar[iconsize="small"] #home-button {
-  -moz-image-region: rect(0px 120px 24px 96px);
-}
-toolbar[iconsize="small"] #home-button:active {
-  -moz-image-region: rect(24px 120px 48px 96px);
-}
-
-/* download manager button */
-
-toolbar[iconsize="small"] #downloads-button {
-  -moz-image-region: rect(0px 144px 24px 120px);
-}
-toolbar[iconsize="small"] #downloads-button:active {
-  -moz-image-region: rect(24px 144px 48px 120px);
-}
-toolbar[iconsize="small"] #downloads-button[disabled="true"] {
-  -moz-image-region: rect(48px 144px 72px 120px) !important;
-}
-
-/* history sidebar button */
-
-toolbar[iconsize="small"] #history-button {
-  -moz-image-region: rect(0px 168px 24px 144px);
-}
-toolbar[iconsize="small"] #history-button:active {
-  -moz-image-region: rect(24px 168px 48px 144px);
-}
-toolbar[iconsize="small"] #history-button[disabled="true"] {
-  -moz-image-region: rect(48px 168px 72px 144px) !important;
-}
-
-/* bookmark sidebar button */
-
-toolbar[iconsize="small"] #bookmarks-button {
-  -moz-image-region: rect(0px 192px 24px 168px);
-}
-toolbar[iconsize="small"] #bookmarks-button:active {
-  -moz-image-region: rect(24px 192px 48px 168px);
-}
-toolbar[iconsize="small"] #bookmarks-button[disabled="true"] {
-  -moz-image-region: rect(48px 192px 72px 168px) !important;
-}
-
-/* print button */
-
-toolbar[iconsize="small"] #print-button {
-  -moz-image-region: rect(0px 216px 24px 192px);
-}
-toolbar[iconsize="small"] #print-button:active {
-  -moz-image-region: rect(24px 216px 48px 192px);
-}
-toolbar[iconsize="small"] #print-button[disabled="true"] {
-  -moz-image-region: rect(48px 216px 72px 192px) !important;
-}
-
-/* new tab button */
-
-toolbar[iconsize="small"] #new-tab-button {
-  -moz-image-region: rect(0px 240px 24px 216px);
-}
-toolbar[iconsize="small"] #new-tab-button:active {
-  -moz-image-region: rect(24px 240px 48px 216px);
-}
-toolbar[iconsize="small"] #new-tab-button[disabled="true"] {
-  -moz-image-region: rect(48px 240px 72px 216px) !important;
-}
-
-/* new window button */
-
-toolbar[iconsize="small"] #new-window-button {
-  -moz-image-region: rect(0px 264px 24px 240px);
-}
-toolbar[iconsize="small"] #new-window-button:active {
-  -moz-image-region: rect(24px 264px 48px 240px);
-}
-toolbar[iconsize="small"] #new-window-button[disabled="true"] {
-  -moz-image-region: rect(48px 264px 72px 240px) !important;
-}
-
-/* cut button */
-
-toolbar[iconsize="small"] #cut-button {
-  -moz-image-region: rect(0px 288px 24px 264px);
-}
-toolbar[iconsize="small"] #cut-button:active {
-  -moz-image-region: rect(24px 288px 48px 264px);
-}
-toolbar[iconsize="small"] #cut-button[disabled="true"] {
-  -moz-image-region: rect(48px 288px 72px 264px) !important;
-}
-
-/* copy button */
-
-toolbar[iconsize="small"] #copy-button {
-  -moz-image-region: rect(0px 312px 24px 288px);
-}
-toolbar[iconsize="small"] #copy-button:active {
-  -moz-image-region: rect(24px 312px 48px 288px);
-}
-toolbar[iconsize="small"] #copy-button[disabled="true"] {
-  -moz-image-region: rect(48px 312px 72px 288px);
-}
-
-/* paste button */
-
-toolbar[iconsize="small"] #paste-button {
-  -moz-image-region: rect(0px 336px 24px 312px);
-}
-toolbar[iconsize="small"] #paste-button:active {
-  -moz-image-region: rect(24px 336px 48px 312px);
-}
-toolbar[iconsize="small"] #paste-button[disabled="true"] {
-  -moz-image-region: rect(48px 336px 72px 312px);
-}
+
+toolbar[iconsize="small"] #back-button {
+  -moz-image-region: rect(0px 24px 24px 0px);
+}
+
+/* back button */
+
+toolbar[iconsize="small"] #back-button[buttondown="true"] {
+  -moz-image-region: rect(24px 24px 48px 0px);
+}
+toolbar[iconsize="small"] #back-button[disabled="true"] {
+  -moz-image-region: rect(48px 24px 72px 0px) !important;
+}
+
+/* forward button */
+
+toolbar[iconsize="small"] #forward-button {
+  -moz-image-region: rect(0px 48px 24px 24px);
+  padding-right: 2px;
+}
+toolbar[iconsize="small"] #forward-button[buttondown="true"] {
+  -moz-image-region: rect(24px 48px 48px 24px);
+}
+toolbar[iconsize="small"] #forward-button[disabled="true"] {
+   -moz-image-region: rect(48px 48px 72px 24px) !important;
+}
+
+/* stop button */
+
+toolbar[iconsize="small"] #stop-button {
+  -moz-image-region: rect(0px 72px 24px 48px);
+}
+toolbar[iconsize="small"] #stop-button:active {
+  -moz-image-region: rect(24px 72px 48px 48px);
+}
+toolbar[iconsize="small"] #stop-button[disabled="true"] {
+  -moz-image-region: rect(48px 72px 72px 48px) !important;
+}
+
+/* reload button */
+
+toolbar[iconsize="small"] #reload-button {
+  -moz-image-region: rect(0px 96px 24px 72px);
+}
+toolbar[iconsize="small"] #reload-button:active {
+  -moz-image-region: rect(24px 96px 48px 72px);
+}
+toolbar[iconsize="small"] #reload-button[disabled="true"] {
+  -moz-image-region: rect(48px 96px 72px 72px);
+}
+
+/* home button */
+
+toolbar[iconsize="small"] #home-button {
+  -moz-image-region: rect(0px 120px 24px 96px);
+}
+toolbar[iconsize="small"] #home-button:active {
+  -moz-image-region: rect(24px 120px 48px 96px);
+}
+
+/* download manager button */
+
+toolbar[iconsize="small"] #downloads-button {
+  -moz-image-region: rect(0px 144px 24px 120px);
+}
+toolbar[iconsize="small"] #downloads-button:active {
+  -moz-image-region: rect(24px 144px 48px 120px);
+}
+toolbar[iconsize="small"] #downloads-button[disabled="true"] {
+  -moz-image-region: rect(48px 144px 72px 120px) !important;
+}
+
+/* history sidebar button */
+
+toolbar[iconsize="small"] #history-button {
+  -moz-image-region: rect(0px 168px 24px 144px);
+}
+toolbar[iconsize="small"] #history-button:active {
+  -moz-image-region: rect(24px 168px 48px 144px);
+}
+toolbar[iconsize="small"] #history-button[disabled="true"] {
+  -moz-image-region: rect(48px 168px 72px 144px) !important;
+}
+
+/* bookmark sidebar button */
+
+toolbar[iconsize="small"] #bookmarks-button {
+  -moz-image-region: rect(0px 192px 24px 168px);
+}
+toolbar[iconsize="small"] #bookmarks-button:active {
+  -moz-image-region: rect(24px 192px 48px 168px);
+}
+toolbar[iconsize="small"] #bookmarks-button[disabled="true"] {
+  -moz-image-region: rect(48px 192px 72px 168px) !important;
+}
+
+/* print button */
+
+toolbar[iconsize="small"] #print-button {
+  -moz-image-region: rect(0px 216px 24px 192px);
+}
+toolbar[iconsize="small"] #print-button:active {
+  -moz-image-region: rect(24px 216px 48px 192px);
+}
+toolbar[iconsize="small"] #print-button[disabled="true"] {
+  -moz-image-region: rect(48px 216px 72px 192px) !important;
+}
+
+/* new tab button */
+
+toolbar[iconsize="small"] #new-tab-button {
+  -moz-image-region: rect(0px 240px 24px 216px);
+}
+toolbar[iconsize="small"] #new-tab-button:active {
+  -moz-image-region: rect(24px 240px 48px 216px);
+}
+toolbar[iconsize="small"] #new-tab-button[disabled="true"] {
+  -moz-image-region: rect(48px 240px 72px 216px) !important;
+}
+
+/* new window button */
+
+toolbar[iconsize="small"] #new-window-button {
+  -moz-image-region: rect(0px 264px 24px 240px);
+}
+toolbar[iconsize="small"] #new-window-button:active {
+  -moz-image-region: rect(24px 264px 48px 240px);
+}
+toolbar[iconsize="small"] #new-window-button[disabled="true"] {
+  -moz-image-region: rect(48px 264px 72px 240px) !important;
+}
+
+/* cut button */
+
+toolbar[iconsize="small"] #cut-button {
+  -moz-image-region: rect(0px 288px 24px 264px);
+}
+toolbar[iconsize="small"] #cut-button:active {
+  -moz-image-region: rect(24px 288px 48px 264px);
+}
+toolbar[iconsize="small"] #cut-button[disabled="true"] {
+  -moz-image-region: rect(48px 288px 72px 264px) !important;
+}
+
+/* copy button */
+
+toolbar[iconsize="small"] #copy-button {
+  -moz-image-region: rect(0px 312px 24px 288px);
+}
+toolbar[iconsize="small"] #copy-button:active {
+  -moz-image-region: rect(24px 312px 48px 288px);
+}
+toolbar[iconsize="small"] #copy-button[disabled="true"] {
+  -moz-image-region: rect(48px 312px 72px 288px);
+}
+
+/* paste button */
+
+toolbar[iconsize="small"] #paste-button {
+  -moz-image-region: rect(0px 336px 24px 312px);
+}
+toolbar[iconsize="small"] #paste-button:active {
+  -moz-image-region: rect(24px 336px 48px 312px);
+}
+toolbar[iconsize="small"] #paste-button[disabled="true"] {
+  -moz-image-region: rect(48px 336px 72px 312px);
+}
 
 /* ::::: fullscreen window controls ::::: */
 
@@ -809,7 +809,7 @@
 
 
 #navigator-throbber[busy="true"] {
-  list-style-image: url("chrome://global/skin/icons/loading_16.gif");
+  list-style-image: url("chrome://global/skin/icons/loading_16.gif");
 }
 
 toolbar[iconsize="small"] #navigator-throbber,
@@ -847,11 +847,14 @@
 	display: none !important;
 }
 
-/* ::::: close button ::::: */

.tabs-closebutton {
+/* ::::: close button ::::: */
+
+.tabs-closebutton {
   padding-right: 4px;
   list-style-image: url("chrome://global/skin/icons/closetab.png") !important;
   list-style-image: none;
-  border: none;
}
+  border: none;
+}
 
 .tabs-closebutton:hover > .toolbarbutton-icon {
 	background-image: none !important;
--- mozilla-firefox-1.0.4.orig/browser/themes/pinstripe/browser/pageInfo.css
+++ mozilla-firefox-1.0.4/browser/themes/pinstripe/browser/pageInfo.css
@@ -34,18 +34,36 @@
  * the terms of any one of the NPL, the GPL or the LGPL.
  * ***** END LICENSE BLOCK ***** */
 
-@import "chrome://global/skin/";
   
tree {
	margin: .5em;
}
   
textbox,
textbox > .textbox-internal-box,
textbox > .textarea-internal-box {
-	background: transparent !important;
	border: none;
	padding: 0px;
	-moz-appearance: none;
-}
  
+@import "chrome://global/skin/";
+   
+tree {
+	margin: .5em;
+}
+   
+textbox,
+textbox > .textbox-internal-box,
+textbox > .textarea-internal-box {
+	background: transparent !important;
+	border: none;
+	padding: 0px;
+	-moz-appearance: none;
+}
+  
 textbox.header {
-	margin-left: 0;
}
+	margin-left: 0;
+}
 
-.iframe {
	margin: .5em;
+.iframe {
+	margin: .5em;
 	background: white;
 	overflow: auto;
-}
+}
+
+#thepreviewimage {
+	margin: 1em;
+}
 
-#thepreviewimage {
	margin: 1em;
+.fixedsize {
+	height: 8.5em;
 }
 
-.fixedsize {
	height: 8.5em;
}

\ No newline at end of file
--- mozilla-firefox-1.0.4.orig/client.mk
+++ mozilla-firefox-1.0.4/client.mk
@@ -54,19 +54,19 @@
 #
 # For branches, uncomment the MOZ_CO_TAG line with the proper tag,
 # and commit this file on that tag.
-MOZ_CO_TAG = FIREFOX_1_0_4_RELEASE
-NSPR_CO_TAG = FIREFOX_1_0_4_RELEASE
-PSM_CO_TAG = FIREFOX_1_0_4_RELEASE
-NSS_CO_TAG = FIREFOX_1_0_4_RELEASE
-LDAPCSDK_CO_TAG = FIREFOX_1_0_4_RELEASE
-ACCESSIBLE_CO_TAG = FIREFOX_1_0_4_RELEASE
-IMGLIB2_CO_TAG = FIREFOX_1_0_4_RELEASE
-IPC_CO_TAG = FIREFOX_1_0_4_RELEASE
-TOOLKIT_CO_TAG = FIREFOX_1_0_4_RELEASE
-BROWSER_CO_TAG = FIREFOX_1_0_4_RELEASE
-MAIL_CO_TAG = FIREFOX_1_0_4_RELEASE
-STANDALONE_COMPOSER_CO_TAG = FIREFOX_1_0_4_RELEASE
-LOCALES_CO_TAG = FIREFOX_1_0_4_RELEASE
+MOZ_CO_TAG = FIREFOX_1_0_6_RELEASE
+NSPR_CO_TAG = FIREFOX_1_0_6_RELEASE
+PSM_CO_TAG = FIREFOX_1_0_6_RELEASE
+NSS_CO_TAG = FIREFOX_1_0_6_RELEASE
+LDAPCSDK_CO_TAG = FIREFOX_1_0_6_RELEASE
+ACCESSIBLE_CO_TAG = FIREFOX_1_0_6_RELEASE
+IMGLIB2_CO_TAG = FIREFOX_1_0_6_RELEASE
+IPC_CO_TAG = FIREFOX_1_0_6_RELEASE
+TOOLKIT_CO_TAG = FIREFOX_1_0_6_RELEASE
+BROWSER_CO_TAG = FIREFOX_1_0_6_RELEASE
+MAIL_CO_TAG = FIREFOX_1_0_6_RELEASE
+STANDALONE_COMPOSER_CO_TAG = FIREFOX_1_0_6_RELEASE
+LOCALES_CO_TAG = FIREFOX_1_0_6_RELEASE
 BUILD_MODULES = all
 
 #######################################################################
--- mozilla-firefox-1.0.4.orig/build/unix/abs2rel.pl
+++ mozilla-firefox-1.0.4/build/unix/abs2rel.pl
@@ -1,41 +1,41 @@
-#!env perl
-
-# The contents of this file are subject to the Mozilla Public
-# License Version 1.1 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-
-# The Initial Developer of the Original Code is Netscape
-# Communications Corporation.  Portions created by Netscape are
-# Copyright (C) 2002 Netscape Communications Corporation. All
-# Rights Reserved.
-
-use File::Spec::Unix;
-use strict;
-
-print "Usage: $0 dest_path start_path\n" if ($#ARGV+1 != 2);
-my $finish = my_canonpath(shift);
-my $start = my_canonpath(shift);
-
-my $res = File::Spec::Unix->abs2rel($finish, $start);
-
-#print STDERR "abs2rel($finish,$start) = $res\n";
-print "$res\n";
-
-sub my_canonpath($) {
-    my ($file) = @_;
-    my (@inlist, @outlist, $dir);
-
-    # Do what File::Spec::Unix->no_upwards should do
-    my @inlist = split(/\//, File::Spec::Unix->canonpath($file));
-    foreach $dir (@inlist) {
-	if ($dir eq '..') {
-	    pop @outlist;
-	} else {
-	    push @outlist, $dir;
-	}
-    }
-    $file = join '/',@outlist;
-    return $file;
-}
-
+#!env perl
+
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation.  Portions created by Netscape are
+# Copyright (C) 2002 Netscape Communications Corporation. All
+# Rights Reserved.
+
+use File::Spec::Unix;
+use strict;
+
+print "Usage: $0 dest_path start_path\n" if ($#ARGV+1 != 2);
+my $finish = my_canonpath(shift);
+my $start = my_canonpath(shift);
+
+my $res = File::Spec::Unix->abs2rel($finish, $start);
+
+#print STDERR "abs2rel($finish,$start) = $res\n";
+print "$res\n";
+
+sub my_canonpath($) {
+    my ($file) = @_;
+    my (@inlist, @outlist, $dir);
+
+    # Do what File::Spec::Unix->no_upwards should do
+    my @inlist = split(/\//, File::Spec::Unix->canonpath($file));
+    foreach $dir (@inlist) {
+	if ($dir eq '..') {
+	    pop @outlist;
+	} else {
+	    push @outlist, $dir;
+	}
+    }
+    $file = join '/',@outlist;
+    return $file;
+}
+
--- mozilla-firefox-1.0.4.orig/build/unix/run-mozilla.sh
+++ mozilla-firefox-1.0.4/build/unix/run-mozilla.sh
@@ -249,16 +249,18 @@
 	fi
     if [ -x "$debugger" ] 
     then
-        echo "set args ${1+"$@"}" > /tmp/mozargs$$ 
+    	tmpfile=`mktemp -t` || { echo "Cannot create temporary file" >&2; exit 1; }
+	trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15
+        echo "set args ${1+"$@"}" > $tmpfile
 # If you are not using ddd, gdb and know of a way to convey the arguments 
 # over to the prog then add that here- Gagan Saksena 03/15/00
         case `basename $debugger` in
-            gdb) echo "$debugger $prog -x /tmp/mozargs$$"
-                $debugger "$prog" -x /tmp/mozargs$$
+            gdb) echo "$debugger $prog -x $tmpfile"
+                $debugger "$prog" -x $tmpfile
 		exitcode=$?
                 ;;
-            ddd) echo "$debugger --debugger \"gdb -x /tmp/mozargs$$\" $prog"
-                $debugger --debugger "gdb -x /tmp/mozargs$$" "$prog"
+            ddd) echo "$debugger --debugger \"gdb -x $tmpfile\" $prog"
+                $debugger --debugger "gdb -x $tmpfile" "$prog"
 		exitcode=$?
                 ;;
             *) echo "$debugger $prog ${1+"$@"}"
@@ -266,7 +268,6 @@
 		exitcode=$?
                 ;;
         esac
-        /bin/rm /tmp/mozargs$$
     else
         echo "Could not find a debugger on your system." 
     fi
--- mozilla-firefox-1.0.4.orig/nsprpub/admin/repackage.sh
+++ mozilla-firefox-1.0.4/nsprpub/admin/repackage.sh
@@ -161,15 +161,18 @@
     #
     headers=`ls $FROMTOP/$OBJDIR/include/*.h`
     for header in $headers; do
-        sed -e 's/$/
/g' $header > $NSPRDIR/include/`basename $header`
+        sed -e 's/$/
+/g' $header > $NSPRDIR/include/`basename $header`
     done
     headers=`ls $FROMTOP/$OBJDIR/include/obsolete/*.h`
     for header in $headers; do
-        sed -e 's/$/
/g' $header > $NSPRDIR/include/obsolete/`basename $header`
+        sed -e 's/$/
+/g' $header > $NSPRDIR/include/obsolete/`basename $header`
     done
     headers=`ls $FROMTOP/$OBJDIR/include/private/*.h`
     for header in $headers; do
-        sed -e 's/$/
/g' $header > $NSPRDIR/include/private/`basename $header`
+        sed -e 's/$/
+/g' $header > $NSPRDIR/include/private/`basename $header`
     done
 
     echo "copying $FROMTOP/$OBJDIR/lib"
--- mozilla-firefox-1.0.4.orig/security/nss/cmd/addbuiltin/addbuiltin.c
+++ mozilla-firefox-1.0.4/security/nss/cmd/addbuiltin/addbuiltin.c
@@ -194,7 +194,7 @@
      "# may use your version of this file under either the MPL or the\n"
      "# GPL.\n"
      "#\n"
-     "CVS_ID \"@(#) $RCSfile: addbuiltin.c,v $ $Revision: 1.6 $ $Date: 2003/01/07 22:22:10 $ $Name: FIREFOX_1_0_4_RELEASE $\"\n"
+     "CVS_ID \"@(#) $RCSfile: addbuiltin.c,v $ $Revision: 1.6 $ $Date: 2003/01/07 22:22:10 $ $Name: FIREFOX_1_0_6_RELEASE $\"\n"
      "\n"
      "#\n"
      "# certdata.txt\n"
--- mozilla-firefox-1.0.4.orig/security/nss/cmd/ssltap/ssltap-manual.html
+++ mozilla-firefox-1.0.4/security/nss/cmd/ssltap/ssltap-manual.html
@@ -1,4 +1,4 @@
-<HTML>
+<HTML>
 <!-- 
    - The contents of this file are subject to the Mozilla Public
    - License Version 1.1 (the "License"); you may not use this file
@@ -31,169 +31,169 @@
    - may use your version of this file under either the MPL or the
    - GPL.
   -->
-<HEAD>
-   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
-   <META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en] (WinNT; U) [Netscape]">
-   <META NAME="Author" CONTENT="Steve Parkinson">
-   <TITLE>SSLTap - manual</TITLE>
-</HEAD>
-<BODY>
-
-<H1>
-SSLTap Manual page</H1>
-
-<H3>
-Summary</H3>
-A command-line proxy which is SSL-aware. It snoops on TCP connections,
-and displays the data going by, including SSL records and handshaking&nbsp;
-if the connection is SSL.
-<H3>
-Synopsis</H3>
-<TT>ssltap [-vhfsxl] [-p port] hostname:port</TT>
-
-<P><TT>&nbsp;&nbsp; -v&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [prints version string]</TT>
-<BR><TT>&nbsp;&nbsp; -h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [outputs hex instead
-of ASCII]</TT>
-<BR><TT>&nbsp;&nbsp; -f&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [turn on Fancy HTML
-coloring]</TT>
-<BR><TT>&nbsp;&nbsp; -s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [turn on SSL decoding]</TT>
-<BR><TT>&nbsp;&nbsp; -x&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [turn on extra SSL
-hex dumps]</TT>
-<BR><TT>&nbsp;&nbsp; -p port [specify rendezvous port (default 1924)]</TT>
-<BR><TT>&nbsp;&nbsp; -l&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [loop - continue
-to wait for more connections]</TT>
-<H3>
-Description</H3>
-SSLTap opens a socket on a rendezvous port, and waits for an incoming connection
-(client side). Once this connection arrives, SSLTap makes another connection
-to hostname:port (server side). It passes any data sent by the client to
-the server, and vice versa. However, SSLTap will also display the data
-to the console. It can do this for plain HTTP connections, or any TCP protocol.
-However, SSLTap can also work with SSL streams, as detailed below.
-
-<P>Let's assume your development machine is called 'intercept'. The simplest
-usage of SSLTap is to run the command <TT>'ssltap www.netscape.com:80'</TT>
-on intercept. The program will wait for an incoming connection on port
-1924. Next you would want to go to your browser, and enter the URL http://intercept:1924.
-The page retrieved by the browser will actually be gotten from the server
-at www.netscape.com, but will go via SSLTap.
-
-<P>Data sent from the client to the server is surrounded by a '--> [ ]'
-symbol, and data sent from the server to the client, a '&lt;---[&nbsp;
-]' symbol.
-
-<P>You'll notice that the page retrieved with this example looks incomplete.
-This is because SSLTap by default closes down after the first connection
-is complete, so the browser is not able to load images. To make the SSLTap
-continue to accept connections, switch on looping mode with the -l option.
-
-<P>You can change the default rendezvous port to something else with the
--p option.
-
-<P>The remaining options change the way the output is produced.
-
-<P>The -f option prints 'fancy' output - in colored HTML. Data sent from
-the client to the server is in blue. The server's reply is in red. This
-is designed so you can load the output up into a browser. When used with
-looping mode, the different connections are separated with horizontal lines.
-
-<P>-x will turn on HEX printing. Instead of being output as ascii, the
-data is shown as Hex, like this:
-<UL><TT>&lt;-- [</TT>
-<BR><TT>&nbsp;&nbsp; 0: 56 d5 16 3e&nbsp; a1 6b b1 4a&nbsp; 8f 67 c4 d7&nbsp;
-21 2f 6f dd&nbsp; | V..>.k.J.g..!/o.</TT>
-<BR><TT>&nbsp; 10: bb 22 c4 75&nbsp; 8c f4 ce 28&nbsp; 16 a6 20 aa&nbsp;
-fb 9a 59 a1&nbsp; | .".u...(.. ...Y.</TT>
-<BR><TT>&nbsp; 20: 51 91 14 d2&nbsp; fc 9f a7 ea&nbsp; 4d 9c f7 3a&nbsp;
-9d 83 62 4a&nbsp; | Q.......M..:..bJ</TT>
-<BR><TT>]</TT>
-<BR>&nbsp;</UL>
-
-<H4>
-SSL Parse mode</H4>
-The following options deal with SSL connections.
-<UL>-s will turn on SSL parsing. (SSLTap doesn't automatically detect SSL
-sessions.)
-<BR>-x will turn on extra SSL hexdumps. Mostly, if SSL can decode the data,
-it doesn't display the hex.</UL>
-The following SSL3 Data structures are parsed: Handshake, ClientHello,
-ServerHello, CertificateChain, Certificate. In addition, SSL2 ClientHello,
-ServerHello, ClientMasterKey are also partly parsed. NO DECRYPTION IS PERFORMED
-ON THE DATA. SSLTAP CANNOT DECRYPT the data.
-
-<P>If a certificate chain is detected, DER-encoded certificates will be
-saved into files in the current directory called 'cert.0x' where x is the
-sequence number of the certificate.
-<BR>&nbsp;
-<H3>
-Operation Hints</H3>
-Often, you'll find that the server certificate does not get transferred,
-or other parts of the handshake do not happen. This is because the browser
-is taking advantage of session-id-reuse (using the handshake results from
-a previous session). If you restart the browser, it'll clear the session
-id cache.
-
-<P>If you run the ssltap on a different machine that the ssl server you're
-trying to connect to, the browser will complain that the host name you're
-trying to connect to is different to the certificate, but it will still
-let you connect, after showing you a dialog.
-<H3>
-Bugs</H3>
-Please contact <A HREF="mailto:ssltap-support@netscape.com">ssltap-support@netscape.com</A>
-for bug reports.
-<H3>
-History</H3>
-2.1 - First public release (March 1998)
-<BR>&nbsp;
-<H3>
-Other</H3>
-For reference, here is a table of some well-known port numbers:
-<BR>&nbsp;
-<TABLE BORDER=2 >
-<TR>
-<TD>HTTP</TD>
-
-<TD>80</TD>
-</TR>
-
-<TR>
-<TD>SMTP</TD>
-
-<TD>25</TD>
-</TR>
-
-<TR>
-<TD>HTTPS</TD>
-
-<TD>443</TD>
-</TR>
-
-<TR>
-<TD>FTP</TD>
-
-<TD>21</TD>
-</TR>
-
-<TR>
-<TD>IMAPS</TD>
-
-<TD>993</TD>
-</TR>
-
-<TR>
-<TD>NNTP</TD>
-
-<TD>119</TD>
-</TR>
-
-<TR>
-<TD>NNTPS</TD>
-
-<TD>563</TD>
-</TR>
-</TABLE>
-&nbsp;
-
-<P>&nbsp;
-</BODY>
-</HTML>
+<HEAD>
+   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+   <META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en] (WinNT; U) [Netscape]">
+   <META NAME="Author" CONTENT="Steve Parkinson">
+   <TITLE>SSLTap - manual</TITLE>
+</HEAD>
+<BODY>
+
+<H1>
+SSLTap Manual page</H1>
+
+<H3>
+Summary</H3>
+A command-line proxy which is SSL-aware. It snoops on TCP connections,
+and displays the data going by, including SSL records and handshaking&nbsp;
+if the connection is SSL.
+<H3>
+Synopsis</H3>
+<TT>ssltap [-vhfsxl] [-p port] hostname:port</TT>
+
+<P><TT>&nbsp;&nbsp; -v&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [prints version string]</TT>
+<BR><TT>&nbsp;&nbsp; -h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [outputs hex instead
+of ASCII]</TT>
+<BR><TT>&nbsp;&nbsp; -f&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [turn on Fancy HTML
+coloring]</TT>
+<BR><TT>&nbsp;&nbsp; -s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [turn on SSL decoding]</TT>
+<BR><TT>&nbsp;&nbsp; -x&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [turn on extra SSL
+hex dumps]</TT>
+<BR><TT>&nbsp;&nbsp; -p port [specify rendezvous port (default 1924)]</TT>
+<BR><TT>&nbsp;&nbsp; -l&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [loop - continue
+to wait for more connections]</TT>
+<H3>
+Description</H3>
+SSLTap opens a socket on a rendezvous port, and waits for an incoming connection
+(client side). Once this connection arrives, SSLTap makes another connection
+to hostname:port (server side). It passes any data sent by the client to
+the server, and vice versa. However, SSLTap will also display the data
+to the console. It can do this for plain HTTP connections, or any TCP protocol.
+However, SSLTap can also work with SSL streams, as detailed below.
+
+<P>Let's assume your development machine is called 'intercept'. The simplest
+usage of SSLTap is to run the command <TT>'ssltap www.netscape.com:80'</TT>
+on intercept. The program will wait for an incoming connection on port
+1924. Next you would want to go to your browser, and enter the URL http://intercept:1924.
+The page retrieved by the browser will actually be gotten from the server
+at www.netscape.com, but will go via SSLTap.
+
+<P>Data sent from the client to the server is surrounded by a '--> [ ]'
+symbol, and data sent from the server to the client, a '&lt;---[&nbsp;
+]' symbol.
+
+<P>You'll notice that the page retrieved with this example looks incomplete.
+This is because SSLTap by default closes down after the first connection
+is complete, so the browser is not able to load images. To make the SSLTap
+continue to accept connections, switch on looping mode with the -l option.
+
+<P>You can change the default rendezvous port to something else with the
+-p option.
+
+<P>The remaining options change the way the output is produced.
+
+<P>The -f option prints 'fancy' output - in colored HTML. Data sent from
+the client to the server is in blue. The server's reply is in red. This
+is designed so you can load the output up into a browser. When used with
+looping mode, the different connections are separated with horizontal lines.
+
+<P>-x will turn on HEX printing. Instead of being output as ascii, the
+data is shown as Hex, like this:
+<UL><TT>&lt;-- [</TT>
+<BR><TT>&nbsp;&nbsp; 0: 56 d5 16 3e&nbsp; a1 6b b1 4a&nbsp; 8f 67 c4 d7&nbsp;
+21 2f 6f dd&nbsp; | V..>.k.J.g..!/o.</TT>
+<BR><TT>&nbsp; 10: bb 22 c4 75&nbsp; 8c f4 ce 28&nbsp; 16 a6 20 aa&nbsp;
+fb 9a 59 a1&nbsp; | .".u...(.. ...Y.</TT>
+<BR><TT>&nbsp; 20: 51 91 14 d2&nbsp; fc 9f a7 ea&nbsp; 4d 9c f7 3a&nbsp;
+9d 83 62 4a&nbsp; | Q.......M..:..bJ</TT>
+<BR><TT>]</TT>
+<BR>&nbsp;</UL>
+
+<H4>
+SSL Parse mode</H4>
+The following options deal with SSL connections.
+<UL>-s will turn on SSL parsing. (SSLTap doesn't automatically detect SSL
+sessions.)
+<BR>-x will turn on extra SSL hexdumps. Mostly, if SSL can decode the data,
+it doesn't display the hex.</UL>
+The following SSL3 Data structures are parsed: Handshake, ClientHello,
+ServerHello, CertificateChain, Certificate. In addition, SSL2 ClientHello,
+ServerHello, ClientMasterKey are also partly parsed. NO DECRYPTION IS PERFORMED
+ON THE DATA. SSLTAP CANNOT DECRYPT the data.
+
+<P>If a certificate chain is detected, DER-encoded certificates will be
+saved into files in the current directory called 'cert.0x' where x is the
+sequence number of the certificate.
+<BR>&nbsp;
+<H3>
+Operation Hints</H3>
+Often, you'll find that the server certificate does not get transferred,
+or other parts of the handshake do not happen. This is because the browser
+is taking advantage of session-id-reuse (using the handshake results from
+a previous session). If you restart the browser, it'll clear the session
+id cache.
+
+<P>If you run the ssltap on a different machine that the ssl server you're
+trying to connect to, the browser will complain that the host name you're
+trying to connect to is different to the certificate, but it will still
+let you connect, after showing you a dialog.
+<H3>
+Bugs</H3>
+Please contact <A HREF="mailto:ssltap-support@netscape.com">ssltap-support@netscape.com</A>
+for bug reports.
+<H3>
+History</H3>
+2.1 - First public release (March 1998)
+<BR>&nbsp;
+<H3>
+Other</H3>
+For reference, here is a table of some well-known port numbers:
+<BR>&nbsp;
+<TABLE BORDER=2 >
+<TR>
+<TD>HTTP</TD>
+
+<TD>80</TD>
+</TR>
+
+<TR>
+<TD>SMTP</TD>
+
+<TD>25</TD>
+</TR>
+
+<TR>
+<TD>HTTPS</TD>
+
+<TD>443</TD>
+</TR>
+
+<TR>
+<TD>FTP</TD>
+
+<TD>21</TD>
+</TR>
+
+<TR>
+<TD>IMAPS</TD>
+
+<TD>993</TD>
+</TR>
+
+<TR>
+<TD>NNTP</TD>
+
+<TD>119</TD>
+</TR>
+
+<TR>
+<TD>NNTPS</TD>
+
+<TD>563</TD>
+</TR>
+</TABLE>
+&nbsp;
+
+<P>&nbsp;
+</BODY>
+</HTML>
--- mozilla-firefox-1.0.4.orig/security/nss/lib/asn1/Makefile
+++ mozilla-firefox-1.0.4/security/nss/lib/asn1/Makefile
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-MAKEFILE_CVS_ID = "@(#) $RCSfile: Makefile,v $ $Revision: 1.3 $ $Date: 2001/10/11 17:41:40 $ $Name: FIREFOX_1_0_4_RELEASE $"
+MAKEFILE_CVS_ID = "@(#) $RCSfile: Makefile,v $ $Revision: 1.3 $ $Date: 2001/10/11 17:41:40 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 include manifest.mn
 include $(CORE_DEPTH)/coreconf/config.mk
--- mozilla-firefox-1.0.4.orig/security/nss/lib/asn1/asn1.c
+++ mozilla-firefox-1.0.4/security/nss/lib/asn1/asn1.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: asn1.c,v $ $Revision: 1.2 $ $Date: 2001/11/08 00:14:34 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: asn1.c,v $ $Revision: 1.2 $ $Date: 2001/11/08 00:14:34 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/asn1/asn1.h
+++ mozilla-firefox-1.0.4/security/nss/lib/asn1/asn1.h
@@ -35,7 +35,7 @@
 #define ASN1_H
 
 #ifdef DEBUG
-static const char ASN1_CVS_ID[] = "@(#) $RCSfile: asn1.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:54:58 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char ASN1_CVS_ID[] = "@(#) $RCSfile: asn1.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:54:58 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/asn1/asn1m.h
+++ mozilla-firefox-1.0.4/security/nss/lib/asn1/asn1m.h
@@ -35,7 +35,7 @@
 #define ASN1M_H
 
 #ifdef DEBUG
-static const char ASN1M_CVS_ID[] = "@(#) $RCSfile: asn1m.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:55:23 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char ASN1M_CVS_ID[] = "@(#) $RCSfile: asn1m.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:55:23 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/asn1/asn1t.h
+++ mozilla-firefox-1.0.4/security/nss/lib/asn1/asn1t.h
@@ -35,7 +35,7 @@
 #define ASN1T_H
 
 #ifdef DEBUG
-static const char ASN1T_CVS_ID[] = "@(#) $RCSfile: asn1t.h,v $ $Revision: 1.2 $ $Date: 2001/01/07 08:12:46 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char ASN1T_CVS_ID[] = "@(#) $RCSfile: asn1t.h,v $ $Revision: 1.2 $ $Date: 2001/01/07 08:12:46 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/asn1/config.mk
+++ mozilla-firefox-1.0.4/security/nss/lib/asn1/config.mk
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-CONFIG_CVS_ID = "@(#) $RCSfile: config.mk,v $ $Revision: 1.2 $ $Date: 2001/10/11 17:41:40 $ $Name: FIREFOX_1_0_4_RELEASE $"
+CONFIG_CVS_ID = "@(#) $RCSfile: config.mk,v $ $Revision: 1.2 $ $Date: 2001/10/11 17:41:40 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 ifdef BUILD_IDG
 DEFINES += -DNSSDEBUG
--- mozilla-firefox-1.0.4.orig/security/nss/lib/asn1/manifest.mn
+++ mozilla-firefox-1.0.4/security/nss/lib/asn1/manifest.mn
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-MANIFEST_CVS_ID = "@(#) $RCSfile: manifest.mn,v $ $Revision: 1.3 $ $Date: 2002/09/06 16:37:40 $ $Name: FIREFOX_1_0_4_RELEASE $"
+MANIFEST_CVS_ID = "@(#) $RCSfile: manifest.mn,v $ $Revision: 1.3 $ $Date: 2002/09/06 16:37:40 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 CORE_DEPTH = ../../..
 
--- mozilla-firefox-1.0.4.orig/security/nss/lib/asn1/nssasn1t.h
+++ mozilla-firefox-1.0.4/security/nss/lib/asn1/nssasn1t.h
@@ -35,7 +35,7 @@
 #define NSSASN1T_H
 
 #ifdef DEBUG
-static const char NSSASN1T_CVS_ID[] = "@(#) $RCSfile: nssasn1t.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:57:16 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char NSSASN1T_CVS_ID[] = "@(#) $RCSfile: nssasn1t.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:57:16 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/base/Makefile
+++ mozilla-firefox-1.0.4/security/nss/lib/base/Makefile
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-MAKEFILE_CVS_ID = "@(#) $RCSfile: Makefile,v $ $Revision: 1.2 $ $Date: 2000/09/06 22:11:57 $ $Name: FIREFOX_1_0_4_RELEASE $"
+MAKEFILE_CVS_ID = "@(#) $RCSfile: Makefile,v $ $Revision: 1.2 $ $Date: 2000/09/06 22:11:57 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 include manifest.mn
 include $(CORE_DEPTH)/coreconf/config.mk
--- mozilla-firefox-1.0.4.orig/security/nss/lib/base/arena.c
+++ mozilla-firefox-1.0.4/security/nss/lib/base/arena.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: arena.c,v $ $Revision: 1.5 $ $Date: 2002/04/04 16:14:26 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: arena.c,v $ $Revision: 1.5 $ $Date: 2002/04/04 16:14:26 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/base/base.h
+++ mozilla-firefox-1.0.4/security/nss/lib/base/base.h
@@ -35,7 +35,7 @@
 #define BASE_H
 
 #ifdef DEBUG
-static const char BASE_CVS_ID[] = "@(#) $RCSfile: base.h,v $ $Revision: 1.15 $ $Date: 2002/04/04 16:14:26 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char BASE_CVS_ID[] = "@(#) $RCSfile: base.h,v $ $Revision: 1.15 $ $Date: 2002/04/04 16:14:26 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/base/baset.h
+++ mozilla-firefox-1.0.4/security/nss/lib/base/baset.h
@@ -35,7 +35,7 @@
 #define BASET_H
 
 #ifdef DEBUG
-static const char BASET_CVS_ID[] = "@(#) $RCSfile: baset.h,v $ $Revision: 1.6 $ $Date: 2001/10/15 16:50:01 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char BASET_CVS_ID[] = "@(#) $RCSfile: baset.h,v $ $Revision: 1.6 $ $Date: 2001/10/15 16:50:01 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/base/config.mk
+++ mozilla-firefox-1.0.4/security/nss/lib/base/config.mk
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-CONFIG_CVS_ID = "@(#) $RCSfile: config.mk,v $ $Revision: 1.3 $ $Date: 2001/02/02 01:49:22 $ $Name: FIREFOX_1_0_4_RELEASE $"
+CONFIG_CVS_ID = "@(#) $RCSfile: config.mk,v $ $Revision: 1.3 $ $Date: 2001/02/02 01:49:22 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 ifdef BUILD_IDG
 DEFINES += -DNSSDEBUG
--- mozilla-firefox-1.0.4.orig/security/nss/lib/base/error.c
+++ mozilla-firefox-1.0.4/security/nss/lib/base/error.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: error.c,v $ $Revision: 1.4 $ $Date: 2003/12/02 02:05:47 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: error.c,v $ $Revision: 1.4 $ $Date: 2003/12/02 02:05:47 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/base/errorval.c
+++ mozilla-firefox-1.0.4/security/nss/lib/base/errorval.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: errorval.c,v $ $Revision: 1.9 $ $Date: 2003/01/08 21:48:39 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: errorval.c,v $ $Revision: 1.9 $ $Date: 2003/01/08 21:48:39 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/base/hash.c
+++ mozilla-firefox-1.0.4/security/nss/lib/base/hash.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: hash.c,v $ $Revision: 1.7 $ $Date: 2002/09/07 01:22:27 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: hash.c,v $ $Revision: 1.7 $ $Date: 2002/09/07 01:22:27 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/base/hashops.c
+++ mozilla-firefox-1.0.4/security/nss/lib/base/hashops.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: hashops.c,v $ $Revision: 1.4 $ $Date: 2002/02/13 02:26:43 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: hashops.c,v $ $Revision: 1.4 $ $Date: 2002/02/13 02:26:43 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/base/item.c
+++ mozilla-firefox-1.0.4/security/nss/lib/base/item.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: item.c,v $ $Revision: 1.2 $ $Date: 2001/11/28 16:23:35 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: item.c,v $ $Revision: 1.2 $ $Date: 2001/11/28 16:23:35 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/base/libc.c
+++ mozilla-firefox-1.0.4/security/nss/lib/base/libc.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: libc.c,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:50:16 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: libc.c,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:50:16 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/base/list.c
+++ mozilla-firefox-1.0.4/security/nss/lib/base/list.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: list.c,v $ $Revision: 1.17 $ $Date: 2002/04/22 20:44:07 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: list.c,v $ $Revision: 1.17 $ $Date: 2002/04/22 20:44:07 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/base/manifest.mn
+++ mozilla-firefox-1.0.4/security/nss/lib/base/manifest.mn
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-MANIFEST_CVS_ID = "@(#) $RCSfile: manifest.mn,v $ $Revision: 1.6 $ $Date: 2002/09/06 16:37:42 $ $Name: FIREFOX_1_0_4_RELEASE $"
+MANIFEST_CVS_ID = "@(#) $RCSfile: manifest.mn,v $ $Revision: 1.6 $ $Date: 2002/09/06 16:37:42 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 CORE_DEPTH = ../../..
 
--- mozilla-firefox-1.0.4.orig/security/nss/lib/base/nssbase.h
+++ mozilla-firefox-1.0.4/security/nss/lib/base/nssbase.h
@@ -35,7 +35,7 @@
 #define NSSBASE_H
 
 #ifdef DEBUG
-static const char NSSBASE_CVS_ID[] = "@(#) $RCSfile: nssbase.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:50:22 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char NSSBASE_CVS_ID[] = "@(#) $RCSfile: nssbase.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:50:22 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/base/nssbaset.h
+++ mozilla-firefox-1.0.4/security/nss/lib/base/nssbaset.h
@@ -35,7 +35,7 @@
 #define NSSBASET_H
 
 #ifdef DEBUG
-static const char NSSBASET_CVS_ID[] = "@(#) $RCSfile: nssbaset.h,v $ $Revision: 1.4 $ $Date: 2001/11/08 00:14:37 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char NSSBASET_CVS_ID[] = "@(#) $RCSfile: nssbaset.h,v $ $Revision: 1.4 $ $Date: 2001/11/08 00:14:37 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/base/tracker.c
+++ mozilla-firefox-1.0.4/security/nss/lib/base/tracker.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: tracker.c,v $ $Revision: 1.4 $ $Date: 2001/12/06 21:25:32 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: tracker.c,v $ $Revision: 1.4 $ $Date: 2001/12/06 21:25:32 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/base/utf8.c
+++ mozilla-firefox-1.0.4/security/nss/lib/base/utf8.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: utf8.c,v $ $Revision: 1.5 $ $Date: 2001/11/08 00:14:37 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: utf8.c,v $ $Revision: 1.5 $ $Date: 2001/11/08 00:14:37 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/base/whatnspr.c
+++ mozilla-firefox-1.0.4/security/nss/lib/base/whatnspr.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: whatnspr.c,v $ $Revision: 1.2 $ $Date: 2002/01/31 19:18:55 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: whatnspr.c,v $ $Revision: 1.2 $ $Date: 2002/01/31 19:18:55 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef BASE_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/builtins/Makefile
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/builtins/Makefile
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-MAKEFILE_CVS_ID = "@(#) $RCSfile: Makefile,v $ $Revision: 1.12 $ $Date: 2003/04/20 04:23:24 $ $Name: FIREFOX_1_0_4_RELEASE $"
+MAKEFILE_CVS_ID = "@(#) $RCSfile: Makefile,v $ $Revision: 1.12 $ $Date: 2003/04/20 04:23:24 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 include manifest.mn
 include $(CORE_DEPTH)/coreconf/config.mk
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/builtins/anchor.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/builtins/anchor.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: anchor.c,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:43:46 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: anchor.c,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:43:46 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/builtins/bfind.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/builtins/bfind.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: bfind.c,v $ $Revision: 1.4 $ $Date: 2002/10/30 19:01:21 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: bfind.c,v $ $Revision: 1.4 $ $Date: 2002/10/30 19:01:21 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef BUILTINS_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/builtins/binst.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/builtins/binst.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: binst.c,v $ $Revision: 1.1 $ $Date: 2002/02/08 00:10:02 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: binst.c,v $ $Revision: 1.1 $ $Date: 2002/02/08 00:10:02 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #include "builtins.h"
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/builtins/bobject.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/builtins/bobject.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: bobject.c,v $ $Revision: 1.2 $ $Date: 2002/03/29 07:34:22 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: bobject.c,v $ $Revision: 1.2 $ $Date: 2002/03/29 07:34:22 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #include "builtins.h"
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/builtins/bsession.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/builtins/bsession.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: bsession.c,v $ $Revision: 1.1 $ $Date: 2002/02/08 00:10:03 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: bsession.c,v $ $Revision: 1.1 $ $Date: 2002/02/08 00:10:03 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #include "builtins.h"
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/builtins/bslot.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/builtins/bslot.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: bslot.c,v $ $Revision: 1.1 $ $Date: 2002/02/08 00:10:03 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: bslot.c,v $ $Revision: 1.1 $ $Date: 2002/02/08 00:10:03 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #include "builtins.h"
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/builtins/btoken.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/builtins/btoken.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: btoken.c,v $ $Revision: 1.1 $ $Date: 2002/02/08 00:10:05 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: btoken.c,v $ $Revision: 1.1 $ $Date: 2002/02/08 00:10:05 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #include "builtins.h"
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/builtins/builtins.h
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/builtins/builtins.h
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char BUILTINS_CVS_ID[] = "@(#) $RCSfile: builtins.h,v $ $Revision: 1.3 $ $Date: 2002/02/08 00:10:05 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char BUILTINS_CVS_ID[] = "@(#) $RCSfile: builtins.h,v $ $Revision: 1.3 $ $Date: 2002/02/08 00:10:05 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #include "nssckmdt.h"
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/builtins/certdata.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/builtins/certdata.c
@@ -32,7 +32,7 @@
  * GPL.
  */
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: certdata.c,v $ $Revision: 1.27.22.1.2.1 $ $Date: 2005/03/14 22:37:33 $ $Name: FIREFOX_1_0_4_RELEASE $""; @(#) $RCSfile: certdata.c,v $ $Revision: 1.27.22.1.2.1 $ $Date: 2005/03/14 22:37:33 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: certdata.c,v $ $Revision: 1.27.22.1.2.1 $ $Date: 2005/03/14 22:37:33 $ $Name: FIREFOX_1_0_6_RELEASE $""; @(#) $RCSfile: certdata.c,v $ $Revision: 1.27.22.1.2.1 $ $Date: 2005/03/14 22:37:33 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef BUILTINS_H
@@ -580,7 +580,7 @@
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"CVS ID", (PRUint32)7 },
   { (void *)"NSS", (PRUint32)4 },
-  { (void *)"@(#) $RCSfile: certdata.c,v $ $Revision: 1.27.22.1.2.1 $ $Date: 2005/03/14 22:37:33 $ $Name: FIREFOX_1_0_4_RELEASE $""; @(#) $RCSfile: certdata.c,v $ $Revision: 1.27.22.1.2.1 $ $Date: 2005/03/14 22:37:33 $ $Name: FIREFOX_1_0_4_RELEASE $", (PRUint32)212 }
+  { (void *)"@(#) $RCSfile: certdata.c,v $ $Revision: 1.27.22.1.2.1 $ $Date: 2005/03/14 22:37:33 $ $Name: FIREFOX_1_0_6_RELEASE $""; @(#) $RCSfile: certdata.c,v $ $Revision: 1.27.22.1.2.1 $ $Date: 2005/03/14 22:37:33 $ $Name: FIREFOX_1_0_6_RELEASE $", (PRUint32)212 }
 };
 #endif /* DEBUG */
 static const NSSItem nss_builtins_items_1 [] = {
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/builtins/certdata.perl
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/builtins/certdata.perl
@@ -31,7 +31,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-my $cvs_id = '@(#) $RCSfile: certdata.perl,v $ $Revision: 1.7 $ $Date: 2002/02/08 00:10:06 $ $Name: FIREFOX_1_0_4_RELEASE $';
+my $cvs_id = '@(#) $RCSfile: certdata.perl,v $ $Revision: 1.7 $ $Date: 2002/02/08 00:10:06 $ $Name: FIREFOX_1_0_6_RELEASE $';
 use strict;
 
 my %constants;
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/builtins/certdata.txt
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/builtins/certdata.txt
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-CVS_ID "@(#) $RCSfile: certdata.txt,v $ $Revision: 1.28.22.1.2.1 $ $Date: 2005/03/14 22:37:33 $ $Name: FIREFOX_1_0_4_RELEASE $"
+CVS_ID "@(#) $RCSfile: certdata.txt,v $ $Revision: 1.28.22.1.2.1 $ $Date: 2005/03/14 22:37:33 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 #
 # certdata.txt
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/builtins/config.mk
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/builtins/config.mk
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-CONFIG_CVS_ID = "@(#) $RCSfile: config.mk,v $ $Revision: 1.7.22.1 $ $Date: 2004/10/15 21:13:52 $ $Name: FIREFOX_1_0_4_RELEASE $"
+CONFIG_CVS_ID = "@(#) $RCSfile: config.mk,v $ $Revision: 1.7.22.1 $ $Date: 2004/10/15 21:13:52 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 #
 #  Override TARGETS variable so that only shared libraries
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/builtins/constants.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/builtins/constants.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: constants.c,v $ $Revision: 1.8 $ $Date: 2002/08/29 17:45:10 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: constants.c,v $ $Revision: 1.8 $ $Date: 2002/08/29 17:45:10 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/builtins/manifest.mn
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/builtins/manifest.mn
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-MANIFEST_CVS_ID = "@(#) $RCSfile: manifest.mn,v $ $Revision: 1.7.22.1 $ $Date: 2004/10/15 21:13:52 $ $Name: FIREFOX_1_0_4_RELEASE $"
+MANIFEST_CVS_ID = "@(#) $RCSfile: manifest.mn,v $ $Revision: 1.7.22.1 $ $Date: 2004/10/15 21:13:52 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 CORE_DEPTH = ../../../..
 
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/Makefile
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/Makefile
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-MAKEFILE_CVS_ID = "@(#) $RCSfile: Makefile,v $ $Revision: 1.5 $ $Date: 2002/05/20 16:01:21 $ $Name: FIREFOX_1_0_4_RELEASE $"
+MAKEFILE_CVS_ID = "@(#) $RCSfile: Makefile,v $ $Revision: 1.5 $ $Date: 2002/05/20 16:01:21 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 include manifest.mn
 include $(CORE_DEPTH)/coreconf/config.mk
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/ck.api
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/ck.api
@@ -34,7 +34,7 @@
 # This file is in part derived from a file "pkcs11f.h" made available
 # by RSA Security at ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-11/pkcs11f.h
 
-CVS_ID "@(#) $RCSfile: ck.api,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:43:09 $ $Name: FIREFOX_1_0_4_RELEASE $"
+CVS_ID "@(#) $RCSfile: ck.api,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:43:09 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 # Fields
 #  FUNCTION introduces a Cryptoki function
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/ck.h
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/ck.h
@@ -35,7 +35,7 @@
 #define CK_H
 
 #ifdef DEBUG
-static const char CK_CVS_ID[] = "@(#) $RCSfile: ck.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:43:09 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CK_CVS_ID[] = "@(#) $RCSfile: ck.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:43:09 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/ckapi.perl
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/ckapi.perl
@@ -31,7 +31,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-$cvs_id = '@(#) $RCSfile: ckapi.perl,v $ $Revision: 1.6 $ $Date: 2003/04/17 00:07:06 $ $Name: FIREFOX_1_0_4_RELEASE $';
+$cvs_id = '@(#) $RCSfile: ckapi.perl,v $ $Revision: 1.6 $ $Date: 2003/04/17 00:07:06 $ $Name: FIREFOX_1_0_6_RELEASE $';
 
 $copyright = '/* THIS IS A GENERATED FILE */
 /* 
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/ckfw.h
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/ckfw.h
@@ -35,7 +35,7 @@
 #define CKFW_H
 
 #ifdef DEBUG
-static const char CKFW_CVS_ID[] = "@(#) $RCSfile: ckfw.h,v $ $Revision: 1.3.282.1 $ $Date: 2004/10/15 21:13:51 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CKFW_CVS_ID[] = "@(#) $RCSfile: ckfw.h,v $ $Revision: 1.3.282.1 $ $Date: 2004/10/15 21:13:51 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/ckfwm.h
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/ckfwm.h
@@ -35,7 +35,7 @@
 #define CKFWM_H
 
 #ifdef DEBUG
-static const char CKFWM_CVS_ID[] = "@(#) $RCSfile: ckfwm.h,v $ $Revision: 1.2.130.1 $ $Date: 2004/10/15 21:13:51 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CKFWM_CVS_ID[] = "@(#) $RCSfile: ckfwm.h,v $ $Revision: 1.2.130.1 $ $Date: 2004/10/15 21:13:51 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/ckfwtm.h
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/ckfwtm.h
@@ -35,7 +35,7 @@
 #define CKFWTM_H
 
 #ifdef DEBUG
-static const char CKFWTM_CVS_ID[] = "@(#) $RCSfile: ckfwtm.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:43:13 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CKFWTM_CVS_ID[] = "@(#) $RCSfile: ckfwtm.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:43:13 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/ckmd.h
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/ckmd.h
@@ -35,7 +35,7 @@
 #define CKMD_H
 
 #ifdef DEBUG
-static const char CKMD_CVS_ID[] = "@(#) $RCSfile: ckmd.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:43:13 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CKMD_CVS_ID[] = "@(#) $RCSfile: ckmd.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:43:13 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/config.mk
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/config.mk
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-CONFIG_CVS_ID = "@(#) $RCSfile: config.mk,v $ $Revision: 1.3 $ $Date: 2001/02/02 01:49:29 $ $Name: FIREFOX_1_0_4_RELEASE $"
+CONFIG_CVS_ID = "@(#) $RCSfile: config.mk,v $ $Revision: 1.3 $ $Date: 2001/02/02 01:49:29 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 ifdef BUILD_IDG
 DEFINES += -DNSSDEBUG
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/find.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/find.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: find.c,v $ $Revision: 1.4 $ $Date: 2002/09/06 00:27:33 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: find.c,v $ $Revision: 1.4 $ $Date: 2002/09/06 00:27:33 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/hash.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/hash.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: hash.c,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:43:15 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: hash.c,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:43:15 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/instance.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/instance.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: instance.c,v $ $Revision: 1.7.76.1 $ $Date: 2004/10/15 21:13:51 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: instance.c,v $ $Revision: 1.7.76.1 $ $Date: 2004/10/15 21:13:51 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/manifest.mn
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/manifest.mn
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-MANIFEST_CVS_ID = "@(#) $RCSfile: manifest.mn,v $ $Revision: 1.5 $ $Date: 2002/09/06 16:37:52 $ $Name: FIREFOX_1_0_4_RELEASE $"
+MANIFEST_CVS_ID = "@(#) $RCSfile: manifest.mn,v $ $Revision: 1.5 $ $Date: 2002/09/06 16:37:52 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 CORE_DEPTH = ../../..
 
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/mechanism.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/mechanism.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: mechanism.c,v $ $Revision: 1.1 $ $Date: 2000/09/07 16:07:02 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: mechanism.c,v $ $Revision: 1.1 $ $Date: 2000/09/07 16:07:02 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/mutex.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/mutex.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: mutex.c,v $ $Revision: 1.2.132.1 $ $Date: 2004/10/15 21:13:51 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: mutex.c,v $ $Revision: 1.2.132.1 $ $Date: 2004/10/15 21:13:51 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/nssck.api
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/nssck.api
@@ -33,7 +33,7 @@
  */
 
 #ifdef DEBUG
-static const char NSSCKAPI_CVS_ID[] = "@(#) $RCSfile: nssck.api,v $ $Revision: 1.5 $ $Date: 2003/04/17 00:07:06 $ $Name: FIREFOX_1_0_4_RELEASE $ ; @(#) $RCSfile: nssck.api,v $ $Revision: 1.5 $ $Date: 2003/04/17 00:07:06 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char NSSCKAPI_CVS_ID[] = "@(#) $RCSfile: nssck.api,v $ $Revision: 1.5 $ $Date: 2003/04/17 00:07:06 $ $Name: FIREFOX_1_0_6_RELEASE $ ; @(#) $RCSfile: nssck.api,v $ $Revision: 1.5 $ $Date: 2003/04/17 00:07:06 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/nssckfw.h
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/nssckfw.h
@@ -35,7 +35,7 @@
 #define NSSCKFW_H
 
 #ifdef DEBUG
-static const char NSSCKFW_CVS_ID[] = "@(#) $RCSfile: nssckfw.h,v $ $Revision: 1.2 $ $Date: 2002/03/06 21:41:35 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char NSSCKFW_CVS_ID[] = "@(#) $RCSfile: nssckfw.h,v $ $Revision: 1.2 $ $Date: 2002/03/06 21:41:35 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/nssckfwc.h
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/nssckfwc.h
@@ -35,7 +35,7 @@
 #define NSSCKFWC_H
 
 #ifdef DEBUG
-static const char NSSCKFWC_CVS_ID[] = "@(#) $RCSfile: nssckfwc.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:43:29 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char NSSCKFWC_CVS_ID[] = "@(#) $RCSfile: nssckfwc.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:43:29 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/nssckfwt.h
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/nssckfwt.h
@@ -35,7 +35,7 @@
 #define NSSCKFWT_H
 
 #ifdef DEBUG
-static const char NSSCKFWT_CVS_ID[] = "@(#) $RCSfile: nssckfwt.h,v $ $Revision: 1.1.282.1 $ $Date: 2004/10/15 21:13:51 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char NSSCKFWT_CVS_ID[] = "@(#) $RCSfile: nssckfwt.h,v $ $Revision: 1.1.282.1 $ $Date: 2004/10/15 21:13:51 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/nssckmdt.h
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/nssckmdt.h
@@ -35,7 +35,7 @@
 #define NSSCKMDT_H
 
 #ifdef DEBUG
-static const char NSSCKMDT_CVS_ID[] = "@(#) $RCSfile: nssckmdt.h,v $ $Revision: 1.3 $ $Date: 2002/03/29 07:34:20 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char NSSCKMDT_CVS_ID[] = "@(#) $RCSfile: nssckmdt.h,v $ $Revision: 1.3 $ $Date: 2002/03/29 07:34:20 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/object.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/object.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: object.c,v $ $Revision: 1.9 $ $Date: 2002/03/29 18:53:15 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: object.c,v $ $Revision: 1.9 $ $Date: 2002/03/29 18:53:15 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/session.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/session.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: session.c,v $ $Revision: 1.6 $ $Date: 2001/09/20 22:09:46 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: session.c,v $ $Revision: 1.6 $ $Date: 2001/09/20 22:09:46 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/sessobj.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/sessobj.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: sessobj.c,v $ $Revision: 1.10 $ $Date: 2002/04/05 19:38:03 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: sessobj.c,v $ $Revision: 1.10 $ $Date: 2002/04/05 19:38:03 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/slot.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/slot.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: slot.c,v $ $Revision: 1.4 $ $Date: 2002/10/10 22:39:23 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: slot.c,v $ $Revision: 1.4 $ $Date: 2002/10/10 22:39:23 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/token.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/token.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: token.c,v $ $Revision: 1.8 $ $Date: 2002/10/10 22:39:23 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: token.c,v $ $Revision: 1.8 $ $Date: 2002/10/10 22:39:23 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/wrap.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/wrap.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: wrap.c,v $ $Revision: 1.9.76.1 $ $Date: 2004/10/15 21:13:51 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: wrap.c,v $ $Revision: 1.9.76.1 $ $Date: 2004/10/15 21:13:51 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/dbm/Makefile
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/dbm/Makefile
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-MAKEFILE_CVS_ID = "@(#) $RCSfile: Makefile,v $ $Revision: 1.1 $ $Date: 2000/05/15 20:39:53 $ $Name: FIREFOX_1_0_4_RELEASE $"
+MAKEFILE_CVS_ID = "@(#) $RCSfile: Makefile,v $ $Revision: 1.1 $ $Date: 2000/05/15 20:39:53 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 include manifest.mn
 include config.mk
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/dbm/anchor.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/dbm/anchor.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: anchor.c,v $ $Revision: 1.1 $ $Date: 2000/05/15 20:39:54 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: anchor.c,v $ $Revision: 1.1 $ $Date: 2000/05/15 20:39:54 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/dbm/ckdbm.h
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/dbm/ckdbm.h
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CKDBM_CVS_ID[] = "@(#) $RCSfile: ckdbm.h,v $ $Revision: 1.1 $ $Date: 2000/05/15 20:39:54 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CKDBM_CVS_ID[] = "@(#) $RCSfile: ckdbm.h,v $ $Revision: 1.1 $ $Date: 2000/05/15 20:39:54 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef CKDBM_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/dbm/config.mk
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/dbm/config.mk
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-CONFIG_CVS_ID = "@(#) $RCSfile: config.mk,v $ $Revision: 1.1 $ $Date: 2000/05/15 20:39:54 $ $Name: FIREFOX_1_0_4_RELEASE $"
+CONFIG_CVS_ID = "@(#) $RCSfile: config.mk,v $ $Revision: 1.1 $ $Date: 2000/05/15 20:39:54 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 ifdef BUILD_IDG
 DEFINES += -DNSSDEBUG
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/dbm/db.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/dbm/db.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: db.c,v $ $Revision: 1.4 $ $Date: 2000/05/17 18:28:13 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: db.c,v $ $Revision: 1.4 $ $Date: 2000/05/17 18:28:13 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #include "ckdbm.h"
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/dbm/find.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/dbm/find.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: find.c,v $ $Revision: 1.2 $ $Date: 2000/05/15 20:58:19 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: find.c,v $ $Revision: 1.2 $ $Date: 2000/05/15 20:58:19 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #include "ckdbm.h"
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/dbm/instance.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/dbm/instance.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: instance.c,v $ $Revision: 1.1 $ $Date: 2000/05/15 20:39:56 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: instance.c,v $ $Revision: 1.1 $ $Date: 2000/05/15 20:39:56 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #include "ckdbm.h"
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/dbm/manifest.mn
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/dbm/manifest.mn
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-MANIFEST_CVS_ID = "@(#) $RCSfile: manifest.mn,v $ $Revision: 1.2 $ $Date: 2002/09/06 16:37:56 $ $Name: FIREFOX_1_0_4_RELEASE $"
+MANIFEST_CVS_ID = "@(#) $RCSfile: manifest.mn,v $ $Revision: 1.2 $ $Date: 2002/09/06 16:37:56 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 CORE_DEPTH = ../../../..
 
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/dbm/object.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/dbm/object.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: object.c,v $ $Revision: 1.1 $ $Date: 2000/05/15 20:39:56 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: object.c,v $ $Revision: 1.1 $ $Date: 2000/05/15 20:39:56 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #include "ckdbm.h"
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/dbm/session.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/dbm/session.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: session.c,v $ $Revision: 1.1 $ $Date: 2000/05/15 20:39:57 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: session.c,v $ $Revision: 1.1 $ $Date: 2000/05/15 20:39:57 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #include "ckdbm.h"
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/dbm/slot.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/dbm/slot.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: slot.c,v $ $Revision: 1.1 $ $Date: 2000/05/15 20:39:57 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: slot.c,v $ $Revision: 1.1 $ $Date: 2000/05/15 20:39:57 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #include "ckdbm.h"
--- mozilla-firefox-1.0.4.orig/security/nss/lib/ckfw/dbm/token.c
+++ mozilla-firefox-1.0.4/security/nss/lib/ckfw/dbm/token.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: token.c,v $ $Revision: 1.2 $ $Date: 2000/05/17 18:28:13 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: token.c,v $ $Revision: 1.2 $ $Date: 2000/05/17 18:28:13 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #include "ckdbm.h"
--- mozilla-firefox-1.0.4.orig/security/nss/lib/dev/Makefile
+++ mozilla-firefox-1.0.4/security/nss/lib/dev/Makefile
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-MAKEFILE_CVS_ID = "@(#) $RCSfile: Makefile,v $ $Revision: 1.4 $ $Date: 2002/04/15 21:04:00 $ $Name: FIREFOX_1_0_4_RELEASE $"
+MAKEFILE_CVS_ID = "@(#) $RCSfile: Makefile,v $ $Revision: 1.4 $ $Date: 2002/04/15 21:04:00 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 include manifest.mn
 include $(CORE_DEPTH)/coreconf/config.mk
--- mozilla-firefox-1.0.4.orig/security/nss/lib/dev/ckhelper.c
+++ mozilla-firefox-1.0.4/security/nss/lib/dev/ckhelper.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: ckhelper.c,v $ $Revision: 1.29 $ $Date: 2003/07/01 00:32:20 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: ckhelper.c,v $ $Revision: 1.29 $ $Date: 2003/07/01 00:32:20 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef NSSCKEPV_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/dev/ckhelper.h
+++ mozilla-firefox-1.0.4/security/nss/lib/dev/ckhelper.h
@@ -41,7 +41,7 @@
 #define CKHELPER_H
 
 #ifdef DEBUG
-static const char CKHELPER_CVS_ID[] = "@(#) $RCSfile: ckhelper.h,v $ $Revision: 1.17 $ $Date: 2002/08/30 22:56:58 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CKHELPER_CVS_ID[] = "@(#) $RCSfile: ckhelper.h,v $ $Revision: 1.17 $ $Date: 2002/08/30 22:56:58 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef NSSCKT_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/dev/config.mk
+++ mozilla-firefox-1.0.4/security/nss/lib/dev/config.mk
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-CONFIG_CVS_ID = "@(#) $RCSfile: config.mk,v $ $Revision: 1.2 $ $Date: 2001/10/11 17:41:41 $ $Name: FIREFOX_1_0_4_RELEASE $"
+CONFIG_CVS_ID = "@(#) $RCSfile: config.mk,v $ $Revision: 1.2 $ $Date: 2001/10/11 17:41:41 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 ifdef BUILD_IDG
 DEFINES += -DNSSDEBUG
--- mozilla-firefox-1.0.4.orig/security/nss/lib/dev/dev.h
+++ mozilla-firefox-1.0.4/security/nss/lib/dev/dev.h
@@ -41,7 +41,7 @@
  */
 
 #ifdef DEBUG
-static const char DEV_CVS_ID[] = "@(#) $RCSfile: dev.h,v $ $Revision: 1.33 $ $Date: 2003/04/19 00:03:13 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char DEV_CVS_ID[] = "@(#) $RCSfile: dev.h,v $ $Revision: 1.33 $ $Date: 2003/04/19 00:03:13 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef NSSCKT_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/dev/devm.h
+++ mozilla-firefox-1.0.4/security/nss/lib/dev/devm.h
@@ -35,7 +35,7 @@
 #define DEVM_H
 
 #ifdef DEBUG
-static const char DEVM_CVS_ID[] = "@(#) $RCSfile: devm.h,v $ $Revision: 1.9 $ $Date: 2002/05/20 23:21:34 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char DEVM_CVS_ID[] = "@(#) $RCSfile: devm.h,v $ $Revision: 1.9 $ $Date: 2002/05/20 23:21:34 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef BASE_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/dev/devmod.c
+++ mozilla-firefox-1.0.4/security/nss/lib/dev/devmod.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: devmod.c,v $ $Revision: 1.5 $ $Date: 2003/08/01 02:02:43 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: devmod.c,v $ $Revision: 1.5 $ $Date: 2003/08/01 02:02:43 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef NSSCKEPV_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/dev/devslot.c
+++ mozilla-firefox-1.0.4/security/nss/lib/dev/devslot.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: devslot.c,v $ $Revision: 1.18 $ $Date: 2003/08/01 02:02:43 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: devslot.c,v $ $Revision: 1.18 $ $Date: 2003/08/01 02:02:43 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef NSSCKEPV_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/dev/devt.h
+++ mozilla-firefox-1.0.4/security/nss/lib/dev/devt.h
@@ -35,7 +35,7 @@
 #define DEVT_H
 
 #ifdef DEBUG
-static const char DEVT_CVS_ID[] = "@(#) $RCSfile: devt.h,v $ $Revision: 1.19 $ $Date: 2003/05/13 22:59:20 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char DEVT_CVS_ID[] = "@(#) $RCSfile: devt.h,v $ $Revision: 1.19 $ $Date: 2003/05/13 22:59:20 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/dev/devtm.h
+++ mozilla-firefox-1.0.4/security/nss/lib/dev/devtm.h
@@ -35,7 +35,7 @@
 #define DEVTM_H
 
 #ifdef DEBUG
-static const char DEVTM_CVS_ID[] = "@(#) $RCSfile: devtm.h,v $ $Revision: 1.2 $ $Date: 2002/04/18 17:29:54 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char DEVTM_CVS_ID[] = "@(#) $RCSfile: devtm.h,v $ $Revision: 1.2 $ $Date: 2002/04/18 17:29:54 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/dev/devtoken.c
+++ mozilla-firefox-1.0.4/security/nss/lib/dev/devtoken.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: devtoken.c,v $ $Revision: 1.36 $ $Date: 2003/09/23 20:34:15 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: devtoken.c,v $ $Revision: 1.36 $ $Date: 2003/09/23 20:34:15 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef NSSCKEPV_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/dev/devutil.c
+++ mozilla-firefox-1.0.4/security/nss/lib/dev/devutil.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: devutil.c,v $ $Revision: 1.23.22.1 $ $Date: 2004/10/15 21:13:53 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: devutil.c,v $ $Revision: 1.23.22.1 $ $Date: 2004/10/15 21:13:53 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef DEVM_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/dev/manifest.mn
+++ mozilla-firefox-1.0.4/security/nss/lib/dev/manifest.mn
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-MANIFEST_CVS_ID = "@(#) $RCSfile: manifest.mn,v $ $Revision: 1.9 $ $Date: 2002/09/06 16:38:04 $ $Name: FIREFOX_1_0_4_RELEASE $"
+MANIFEST_CVS_ID = "@(#) $RCSfile: manifest.mn,v $ $Revision: 1.9 $ $Date: 2002/09/06 16:38:04 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 CORE_DEPTH = ../../..
 
--- mozilla-firefox-1.0.4.orig/security/nss/lib/dev/nssdev.h
+++ mozilla-firefox-1.0.4/security/nss/lib/dev/nssdev.h
@@ -35,7 +35,7 @@
 #define NSSDEV_H
 
 #ifdef DEBUG
-static const char NSSDEV_CVS_ID[] = "@(#) $RCSfile: nssdev.h,v $ $Revision: 1.1 $ $Date: 2002/04/04 20:00:23 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char NSSDEV_CVS_ID[] = "@(#) $RCSfile: nssdev.h,v $ $Revision: 1.1 $ $Date: 2002/04/04 20:00:23 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 /*
  * nssdev.h
--- mozilla-firefox-1.0.4.orig/security/nss/lib/dev/nssdevt.h
+++ mozilla-firefox-1.0.4/security/nss/lib/dev/nssdevt.h
@@ -35,7 +35,7 @@
 #define NSSDEVT_H
 
 #ifdef DEBUG
-static const char NSSDEVT_CVS_ID[] = "@(#) $RCSfile: nssdevt.h,v $ $Revision: 1.3 $ $Date: 2001/11/28 16:23:39 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char NSSDEVT_CVS_ID[] = "@(#) $RCSfile: nssdevt.h,v $ $Revision: 1.3 $ $Date: 2001/11/28 16:23:39 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/freebl/unix_rand.c
+++ mozilla-firefox-1.0.4/security/nss/lib/freebl/unix_rand.c
@@ -875,12 +875,14 @@
 	safe_pclose(fp);
     }
 #endif
+#ifndef LINUX 
     fp = safe_popen(netstat_ni_cmd);
     if (fp != NULL) {
 	while ((bytes = fread(buf, 1, sizeof(buf), fp)) > 0)
 	    RNG_RandomUpdate(buf, bytes);
 	safe_pclose(fp);
     }
+#endif
 
 }
 #else
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pk11wrap/dev3hack.c
+++ mozilla-firefox-1.0.4/security/nss/lib/pk11wrap/dev3hack.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: dev3hack.c,v $ $Revision: 1.19 $ $Date: 2003/05/10 14:21:40 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: dev3hack.c,v $ $Revision: 1.19 $ $Date: 2003/05/10 14:21:40 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef NSS_3_4_CODE
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pk11wrap/dev3hack.h
+++ mozilla-firefox-1.0.4/security/nss/lib/pk11wrap/dev3hack.h
@@ -35,7 +35,7 @@
 #define DEVNSS3HACK_H
 
 #ifdef DEBUG
-static const char DEVNSS3HACK_CVS_ID[] = "@(#) $RCSfile: dev3hack.h,v $ $Revision: 1.7 $ $Date: 2002/04/18 17:29:59 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char DEVNSS3HACK_CVS_ID[] = "@(#) $RCSfile: dev3hack.h,v $ $Revision: 1.7 $ $Date: 2002/04/18 17:29:59 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #include "cert.h"
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki/Makefile
+++ mozilla-firefox-1.0.4/security/nss/lib/pki/Makefile
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-MAKEFILE_CVS_ID = "@(#) $RCSfile: Makefile,v $ $Revision: 1.4 $ $Date: 2002/04/05 19:08:29 $ $Name: FIREFOX_1_0_4_RELEASE $"
+MAKEFILE_CVS_ID = "@(#) $RCSfile: Makefile,v $ $Revision: 1.4 $ $Date: 2002/04/05 19:08:29 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 include manifest.mn
 include $(CORE_DEPTH)/coreconf/config.mk
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki/asymmkey.c
+++ mozilla-firefox-1.0.4/security/nss/lib/pki/asymmkey.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: asymmkey.c,v $ $Revision: 1.4 $ $Date: 2002/09/23 21:32:31 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: asymmkey.c,v $ $Revision: 1.4 $ $Date: 2002/09/23 21:32:31 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef NSSPKI_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki/certdecode.c
+++ mozilla-firefox-1.0.4/security/nss/lib/pki/certdecode.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: certdecode.c,v $ $Revision: 1.14 $ $Date: 2003/11/11 21:46:53 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: certdecode.c,v $ $Revision: 1.14 $ $Date: 2003/11/11 21:46:53 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef PKIT_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki/certificate.c
+++ mozilla-firefox-1.0.4/security/nss/lib/pki/certificate.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: certificate.c,v $ $Revision: 1.49 $ $Date: 2003/11/15 00:09:51 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: certificate.c,v $ $Revision: 1.49 $ $Date: 2003/11/15 00:09:51 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef NSSPKI_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki/config.mk
+++ mozilla-firefox-1.0.4/security/nss/lib/pki/config.mk
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-CONFIG_CVS_ID = "@(#) $RCSfile: config.mk,v $ $Revision: 1.4 $ $Date: 2002/04/05 19:08:29 $ $Name: FIREFOX_1_0_4_RELEASE $"
+CONFIG_CVS_ID = "@(#) $RCSfile: config.mk,v $ $Revision: 1.4 $ $Date: 2002/04/05 19:08:29 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 ifdef BUILD_IDG
 DEFINES += -DNSSDEBUG
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki/cryptocontext.c
+++ mozilla-firefox-1.0.4/security/nss/lib/pki/cryptocontext.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: cryptocontext.c,v $ $Revision: 1.12 $ $Date: 2003/01/08 21:58:29 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: cryptocontext.c,v $ $Revision: 1.12 $ $Date: 2003/01/08 21:58:29 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef DEV_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki/manifest.mn
+++ mozilla-firefox-1.0.4/security/nss/lib/pki/manifest.mn
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-MANIFEST_CVS_ID = "@(#) $RCSfile: manifest.mn,v $ $Revision: 1.12 $ $Date: 2002/09/06 16:38:36 $ $Name: FIREFOX_1_0_4_RELEASE $"
+MANIFEST_CVS_ID = "@(#) $RCSfile: manifest.mn,v $ $Revision: 1.12 $ $Date: 2002/09/06 16:38:36 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 CORE_DEPTH = ../../..
 
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki/nsspki.h
+++ mozilla-firefox-1.0.4/security/nss/lib/pki/nsspki.h
@@ -35,7 +35,7 @@
 #define NSSPKI_H
 
 #ifdef DEBUG
-static const char NSSPKI_CVS_ID[] = "@(#) $RCSfile: nsspki.h,v $ $Revision: 1.7 $ $Date: 2001/12/14 17:32:19 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char NSSPKI_CVS_ID[] = "@(#) $RCSfile: nsspki.h,v $ $Revision: 1.7 $ $Date: 2001/12/14 17:32:19 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki/nsspkit.h
+++ mozilla-firefox-1.0.4/security/nss/lib/pki/nsspkit.h
@@ -35,7 +35,7 @@
 #define NSSPKIT_H
 
 #ifdef DEBUG
-static const char NSSPKIT_CVS_ID[] = "@(#) $RCSfile: nsspkit.h,v $ $Revision: 1.4 $ $Date: 2001/09/19 19:08:32 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char NSSPKIT_CVS_ID[] = "@(#) $RCSfile: nsspkit.h,v $ $Revision: 1.4 $ $Date: 2001/09/19 19:08:32 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki/pki.h
+++ mozilla-firefox-1.0.4/security/nss/lib/pki/pki.h
@@ -35,7 +35,7 @@
 #define PKI_H
 
 #ifdef DEBUG
-static const char PKI_CVS_ID[] = "@(#) $RCSfile: pki.h,v $ $Revision: 1.11 $ $Date: 2002/04/15 15:22:09 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char PKI_CVS_ID[] = "@(#) $RCSfile: pki.h,v $ $Revision: 1.11 $ $Date: 2002/04/15 15:22:09 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef NSSDEVT_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki/pki3hack.c
+++ mozilla-firefox-1.0.4/security/nss/lib/pki/pki3hack.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: pki3hack.c,v $ $Revision: 1.79.20.1 $ $Date: 2004/10/15 21:13:55 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: pki3hack.c,v $ $Revision: 1.79.20.1 $ $Date: 2004/10/15 21:13:55 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki/pki3hack.h
+++ mozilla-firefox-1.0.4/security/nss/lib/pki/pki3hack.h
@@ -35,7 +35,7 @@
 #define PKINSS3HACK_H
 
 #ifdef DEBUG
-static const char PKINSS3HACK_CVS_ID[] = "@(#) $RCSfile: pki3hack.h,v $ $Revision: 1.15.22.1 $ $Date: 2004/10/15 21:13:55 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char PKINSS3HACK_CVS_ID[] = "@(#) $RCSfile: pki3hack.h,v $ $Revision: 1.15.22.1 $ $Date: 2004/10/15 21:13:55 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef NSSDEVT_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki/pkibase.c
+++ mozilla-firefox-1.0.4/security/nss/lib/pki/pkibase.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: pkibase.c,v $ $Revision: 1.22 $ $Date: 2003/12/16 04:24:57 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: pkibase.c,v $ $Revision: 1.22 $ $Date: 2003/12/16 04:24:57 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef DEV_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki/pkim.h
+++ mozilla-firefox-1.0.4/security/nss/lib/pki/pkim.h
@@ -35,7 +35,7 @@
 #define PKIM_H
 
 #ifdef DEBUG
-static const char PKIM_CVS_ID[] = "@(#) $RCSfile: pkim.h,v $ $Revision: 1.23 $ $Date: 2002/11/06 18:53:54 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char PKIM_CVS_ID[] = "@(#) $RCSfile: pkim.h,v $ $Revision: 1.23 $ $Date: 2002/11/06 18:53:54 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef BASE_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki/pkistore.c
+++ mozilla-firefox-1.0.4/security/nss/lib/pki/pkistore.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: pkistore.c,v $ $Revision: 1.22 $ $Date: 2003/01/08 21:48:45 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: pkistore.c,v $ $Revision: 1.22 $ $Date: 2003/01/08 21:48:45 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef PKIM_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki/pkistore.h
+++ mozilla-firefox-1.0.4/security/nss/lib/pki/pkistore.h
@@ -35,7 +35,7 @@
 #define PKISTORE_H
 
 #ifdef DEBUG
-static const char PKISTORE_CVS_ID[] = "@(#) $RCSfile: pkistore.h,v $ $Revision: 1.5 $ $Date: 2003/01/08 21:48:45 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char PKISTORE_CVS_ID[] = "@(#) $RCSfile: pkistore.h,v $ $Revision: 1.5 $ $Date: 2003/01/08 21:48:45 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef NSSPKIT_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki/pkit.h
+++ mozilla-firefox-1.0.4/security/nss/lib/pki/pkit.h
@@ -35,7 +35,7 @@
 #define PKIT_H
 
 #ifdef DEBUG
-static const char PKIT_CVS_ID[] = "@(#) $RCSfile: pkit.h,v $ $Revision: 1.13.104.1 $ $Date: 2004/10/15 21:13:55 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char PKIT_CVS_ID[] = "@(#) $RCSfile: pkit.h,v $ $Revision: 1.13.104.1 $ $Date: 2004/10/15 21:13:55 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki/pkitm.h
+++ mozilla-firefox-1.0.4/security/nss/lib/pki/pkitm.h
@@ -35,7 +35,7 @@
 #define PKITM_H
 
 #ifdef DEBUG
-static const char PKITM_CVS_ID[] = "@(#) $RCSfile: pkitm.h,v $ $Revision: 1.10 $ $Date: 2002/10/01 14:32:15 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char PKITM_CVS_ID[] = "@(#) $RCSfile: pkitm.h,v $ $Revision: 1.10 $ $Date: 2002/10/01 14:32:15 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki/symmkey.c
+++ mozilla-firefox-1.0.4/security/nss/lib/pki/symmkey.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: symmkey.c,v $ $Revision: 1.4 $ $Date: 2002/09/23 21:32:34 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: symmkey.c,v $ $Revision: 1.4 $ $Date: 2002/09/23 21:32:34 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef NSSPKI_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki/tdcache.c
+++ mozilla-firefox-1.0.4/security/nss/lib/pki/tdcache.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: tdcache.c,v $ $Revision: 1.38 $ $Date: 2003/12/19 22:33:12 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: tdcache.c,v $ $Revision: 1.38 $ $Date: 2003/12/19 22:33:12 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef PKIM_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki/trustdomain.c
+++ mozilla-firefox-1.0.4/security/nss/lib/pki/trustdomain.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: trustdomain.c,v $ $Revision: 1.48.44.1 $ $Date: 2004/10/15 21:13:55 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: trustdomain.c,v $ $Revision: 1.48.44.1 $ $Date: 2004/10/15 21:13:55 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef DEV_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki1/Makefile
+++ mozilla-firefox-1.0.4/security/nss/lib/pki1/Makefile
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-MAKEFILE_CVS_ID = "@(#) $RCSfile: Makefile,v $ $Revision: 1.5 $ $Date: 2002/01/04 05:22:06 $ $Name: FIREFOX_1_0_4_RELEASE $"
+MAKEFILE_CVS_ID = "@(#) $RCSfile: Makefile,v $ $Revision: 1.5 $ $Date: 2002/01/04 05:22:06 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 include manifest.mn
 include $(CORE_DEPTH)/coreconf/config.mk
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki1/atav.c
+++ mozilla-firefox-1.0.4/security/nss/lib/pki1/atav.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: atav.c,v $ $Revision: 1.6 $ $Date: 2002/02/19 02:06:25 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: atav.c,v $ $Revision: 1.6 $ $Date: 2002/02/19 02:06:25 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki1/config.mk
+++ mozilla-firefox-1.0.4/security/nss/lib/pki1/config.mk
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-CONFIG_CVS_ID = "@(#) $RCSfile: config.mk,v $ $Revision: 1.3 $ $Date: 2002/12/05 22:15:36 $ $Name: FIREFOX_1_0_4_RELEASE $"
+CONFIG_CVS_ID = "@(#) $RCSfile: config.mk,v $ $Revision: 1.3 $ $Date: 2002/12/05 22:15:36 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 ifdef BUILD_IDG
 DEFINES += -DNSSDEBUG
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki1/genname.c
+++ mozilla-firefox-1.0.4/security/nss/lib/pki1/genname.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: genname.c,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:16:18 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: genname.c,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:16:18 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki1/gnseq.c
+++ mozilla-firefox-1.0.4/security/nss/lib/pki1/gnseq.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: gnseq.c,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:16:18 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: gnseq.c,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:16:18 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki1/manifest.mn
+++ mozilla-firefox-1.0.4/security/nss/lib/pki1/manifest.mn
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-MANIFEST_CVS_ID = "@(#) $RCSfile: manifest.mn,v $ $Revision: 1.7 $ $Date: 2002/12/05 22:15:36 $ $Name: FIREFOX_1_0_4_RELEASE $"
+MANIFEST_CVS_ID = "@(#) $RCSfile: manifest.mn,v $ $Revision: 1.7 $ $Date: 2002/12/05 22:15:36 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 CORE_DEPTH = ../../..
 
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki1/name.c
+++ mozilla-firefox-1.0.4/security/nss/lib/pki1/name.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: name.c,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:16:19 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: name.c,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:16:19 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki1/nsspki1.h
+++ mozilla-firefox-1.0.4/security/nss/lib/pki1/nsspki1.h
@@ -35,7 +35,7 @@
 #define NSSPKI1_H
 
 #ifdef DEBUG
-static const char NSSPKI1_CVS_ID[] = "@(#) $RCSfile: nsspki1.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:16:20 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char NSSPKI1_CVS_ID[] = "@(#) $RCSfile: nsspki1.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:16:20 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki1/nsspki1t.h
+++ mozilla-firefox-1.0.4/security/nss/lib/pki1/nsspki1t.h
@@ -35,7 +35,7 @@
 #define NSSPKI1T_H
 
 #ifdef DEBUG
-static const char NSSPKI1T_CVS_ID[] = "@(#) $RCSfile: nsspki1t.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:16:21 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char NSSPKI1T_CVS_ID[] = "@(#) $RCSfile: nsspki1t.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:16:21 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki1/oid.c
+++ mozilla-firefox-1.0.4/security/nss/lib/pki1/oid.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: oid.c,v $ $Revision: 1.4 $ $Date: 2001/12/07 01:36:10 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: oid.c,v $ $Revision: 1.4 $ $Date: 2001/12/07 01:36:10 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki1/oiddata.c
+++ mozilla-firefox-1.0.4/security/nss/lib/pki1/oiddata.c
@@ -32,7 +32,7 @@
  * GPL.
  */
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: oiddata.c,v $ $Revision: 1.1 $ $Date: 2002/01/04 05:22:07 $ $Name: FIREFOX_1_0_4_RELEASE $ ; @(#) $RCSfile: oiddata.c,v $ $Revision: 1.1 $ $Date: 2002/01/04 05:22:07 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: oiddata.c,v $ $Revision: 1.1 $ $Date: 2002/01/04 05:22:07 $ $Name: FIREFOX_1_0_6_RELEASE $ ; @(#) $RCSfile: oiddata.c,v $ $Revision: 1.1 $ $Date: 2002/01/04 05:22:07 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef PKI1T_H
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki1/oiddata.h
+++ mozilla-firefox-1.0.4/security/nss/lib/pki1/oiddata.h
@@ -36,16 +36,13 @@
 #define OIDDATA_H
 
 #ifdef DEBUG
-static const char OIDDATA_CVS_ID[] = "@(#) $RCSfile: oiddata.h,v $ $Revision: 1.1 $ $Date: 2002/01/04 05:22:07 $ $Name: FIREFOX_1_0_4_RELEASE $ ; @(#) $RCSfile: oiddata.h,v $ $Revision: 1.1 $ $Date: 2002/01/04 05:22:07 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char OIDDATA_CVS_ID[] = "@(#) $RCSfile: oiddata.h,v $ $Revision: 1.1 $ $Date: 2002/01/04 05:22:07 $ $Name: FIREFOX_1_0_6_RELEASE $ ; @(#) $RCSfile: oiddata.h,v $ $Revision: 1.1 $ $Date: 2002/01/04 05:22:07 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #ifndef NSSPKI1T_H
 #include "nsspki1t.h"
 #endif /* NSSPKI1T_H */
 
-extern const NSSOID nss_builtin_oids[];
-extern const PRUint32 nss_builtin_oid_count;
-
 /*extern const nssAttributeTypeAliasTable nss_attribute_type_aliases[];*/
 /*extern const PRUint32 nss_attribute_type_alias_count;*/
 
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki1/oidgen.perl
+++ mozilla-firefox-1.0.4/security/nss/lib/pki1/oidgen.perl
@@ -31,7 +31,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-$cvs_id = '@(#) $RCSfile: oidgen.perl,v $ $Revision: 1.2 $ $Date: 2001/11/08 00:15:25 $ $Name: FIREFOX_1_0_4_RELEASE $';
+$cvs_id = '@(#) $RCSfile: oidgen.perl,v $ $Revision: 1.2 $ $Date: 2001/11/08 00:15:25 $ $Name: FIREFOX_1_0_6_RELEASE $';
 $cfile = shift;
 $hfile = shift;
 $count = -1;
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki1/oids.txt
+++ mozilla-firefox-1.0.4/security/nss/lib/pki1/oids.txt
@@ -30,7 +30,7 @@
 # may use your version of this file under either the MPL or the
 # GPL.
 #
-CVS_ID "@(#) $RCSfile: oids.txt,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:16:23 $ $Name: FIREFOX_1_0_4_RELEASE $"
+CVS_ID "@(#) $RCSfile: oids.txt,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:16:23 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 # Fields
 #  OID  -- the OID data itself, in dotted-number format
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki1/pki1.h
+++ mozilla-firefox-1.0.4/security/nss/lib/pki1/pki1.h
@@ -35,7 +35,7 @@
 #define PKI1_H
 
 #ifdef DEBUG
-static const char PKI1_CVS_ID[] = "@(#) $RCSfile: pki1.h,v $ $Revision: 1.2 $ $Date: 2001/07/19 20:40:42 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char PKI1_CVS_ID[] = "@(#) $RCSfile: pki1.h,v $ $Revision: 1.2 $ $Date: 2001/07/19 20:40:42 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
@@ -58,6 +58,8 @@
 /* fgmr 19990505 moved these here from oiddata.h */
 extern const nssAttributeTypeAliasTable nss_attribute_type_aliases[];
 extern const PRUint32 nss_attribute_type_alias_count;
+extern const NSSOID nss_builtin_oids[];
+extern const PRUint32 nss_builtin_oid_count;
 
 /*
  * NSSOID
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki1/pki1t.h
+++ mozilla-firefox-1.0.4/security/nss/lib/pki1/pki1t.h
@@ -35,7 +35,7 @@
 #define PKI1T_H
 
 #ifdef DEBUG
-static const char PKI1T_CVS_ID[] = "@(#) $RCSfile: pki1t.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:16:25 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char PKI1T_CVS_ID[] = "@(#) $RCSfile: pki1t.h,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:16:25 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki1/rdn.c
+++ mozilla-firefox-1.0.4/security/nss/lib/pki1/rdn.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: rdn.c,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:16:25 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: rdn.c,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:16:25 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/pki1/rdnseq.c
+++ mozilla-firefox-1.0.4/security/nss/lib/pki1/rdnseq.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: rdnseq.c,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:16:26 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: rdnseq.c,v $ $Revision: 1.1 $ $Date: 2000/03/31 19:16:26 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/softoken/pkcs11n.h
+++ mozilla-firefox-1.0.4/security/nss/lib/softoken/pkcs11n.h
@@ -36,7 +36,7 @@
 #define _PKCS11N_H_
 
 #ifdef DEBUG
-static const char CKT_CVS_ID[] = "@(#) $RCSfile: pkcs11n.h,v $ $Revision: 1.8 $ $Date: 2003/01/22 03:13:04 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CKT_CVS_ID[] = "@(#) $RCSfile: pkcs11n.h,v $ $Revision: 1.8 $ $Date: 2003/01/22 03:13:04 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/security/nss/lib/util/utf8.c
+++ mozilla-firefox-1.0.4/security/nss/lib/util/utf8.c
@@ -33,7 +33,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: utf8.c,v $ $Revision: 1.7 $ $Date: 2004/01/20 19:57:17 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: utf8.c,v $ $Revision: 1.7 $ $Date: 2004/01/20 19:57:17 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 #include "seccomon.h"
--- mozilla-firefox-1.0.4.orig/security/nss/tests/pkcs11/netscape/trivial/Makefile.in
+++ mozilla-firefox-1.0.4/security/nss/tests/pkcs11/netscape/trivial/Makefile.in
@@ -30,7 +30,7 @@
 # GPL.
 #
 
-MAKEFILE_IN_CVS_ID = "@(#) $RCSfile: Makefile.in,v $ $Revision: 1.1 $ $Date: 2000/05/08 23:19:43 $ $Name: FIREFOX_1_0_4_RELEASE $"
+MAKEFILE_IN_CVS_ID = "@(#) $RCSfile: Makefile.in,v $ $Revision: 1.1 $ $Date: 2000/05/08 23:19:43 $ $Name: FIREFOX_1_0_6_RELEASE $"
 
 SHELL = /bin/sh
 .SUFFIXES:
--- mozilla-firefox-1.0.4.orig/security/nss/tests/pkcs11/netscape/trivial/configure.in
+++ mozilla-firefox-1.0.4/security/nss/tests/pkcs11/netscape/trivial/configure.in
@@ -30,7 +30,7 @@
 dnl GPL.
 dnl
 
-dnl My revision info: "@(#) $RCSfile: configure.in,v $ $Revision: 1.1 $ $Date: 2000/05/08 23:19:45 $ $Name: FIREFOX_1_0_4_RELEASE $"
+dnl My revision info: "@(#) $RCSfile: configure.in,v $ $Revision: 1.1 $ $Date: 2000/05/08 23:19:45 $ $Name: FIREFOX_1_0_6_RELEASE $"
 dnl Don't use AC_REVISION; it's broken
 
 AC_INIT(trivial.c)
--- mozilla-firefox-1.0.4.orig/security/nss/tests/pkcs11/netscape/trivial/trivial.c
+++ mozilla-firefox-1.0.4/security/nss/tests/pkcs11/netscape/trivial/trivial.c
@@ -32,7 +32,7 @@
  */
 
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: trivial.c,v $ $Revision: 1.2 $ $Date: 2000/07/20 21:48:26 $ $Name: FIREFOX_1_0_4_RELEASE $";
+static const char CVS_ID[] = "@(#) $RCSfile: trivial.c,v $ $Revision: 1.2 $ $Date: 2000/07/20 21:48:26 $ $Name: FIREFOX_1_0_6_RELEASE $";
 #endif /* DEBUG */
 
 /*
--- mozilla-firefox-1.0.4.orig/directory/c-sdk/ldap/docs/draft-ietf-ldapext-ldap-c-api-05.txt
+++ mozilla-firefox-1.0.4/directory/c-sdk/ldap/docs/draft-ietf-ldapext-ldap-c-api-05.txt
@@ -1,4647 +1,4647 @@
-
-
-Network Working Group                                   M. Smith, Editor
-INTERNET-DRAFT                             Netscape Communications Corp.
-Intended Category: Standards Track                              T. Howes
-Obsoletes: RFC 1823                                      Loudcloud, Inc.
-Expires: May 2001                                              A. Herron
-                                                         Microsoft Corp.
-                                                                 M. Wahl
-                                                  Sun Microsystems, Inc.
-                                                              A. Anantha
-                                                         Microsoft Corp.
-
-
-                                                        17 November 2000
-
-                The C LDAP Application Program Interface
-                 <draft-ietf-ldapext-ldap-c-api-05.txt>
-
-
-1.  Status of this Memo
-
-This document is an Internet-Draft and is in full conformance with all
-provisions of Section 10 of RFC2026.  Internet-Drafts are working docu-
-ments of the Internet Engineering Task Force (IETF), its areas, and its
-working groups.  Note that other groups may also distribute working
-documents as Internet-Drafts.
-
-Internet-Drafts are draft documents valid for a maximum of six months
-and may be updated, replaced, or obsoleted by other documents at any
-time.  It is inappropriate to use Internet-Drafts as reference material
-or to cite them other than as "work in progress."
-
-The list of current Internet-Drafts can be accessed at
-http://www.ietf.org/ietf/1id-abstracts.txt.
-
-The list of Internet-Draft Shadow Directories can be accessed at
-http://www.ietf.org/shadow.html.
-
-This draft document will be submitted to the RFC Editor as a Standards
-Track document. Distribution of this memo is unlimited.  Technical dis-
-cussion of this document will take place on the IETF LDAP Extension
-Working Group mailing list <ietf-ldapext@netscape.com>.  Please send
-editorial comments directly to the authors.
-
-Copyright (C) The Internet Society (1997-1999). All Rights Reserved.
-
-Please see the Copyright section near the end of this document for more
-information.
-
-
-
-
-Expires: May 2001                                               [Page 1]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-2.  Introduction
-
-This document defines a C language application program interface (API)
-to the Lightweight Directory Access Protocol (LDAP). This document
-replaces the previous definition of this API, defined in RFC 1823,
-updating it to include support for features found in version 3 of the
-LDAP protocol.  New extended operation functions were added to support
-LDAPv3 features such as controls.  In addition, other LDAP API changes
-were made to support information hiding and thread safety.
-
-The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
-"SHOULD", "SHOULD NOT", "RECOMMENDED",  "MAY", and "OPTIONAL" in this
-document are to be interpreted as described in RFC 2119[1].
-
-The C LDAP API is designed to be powerful, yet simple to use. It defines
-compatible synchronous and asynchronous interfaces to LDAP to suit a
-wide variety of applications. This document gives a brief overview of
-the LDAP model, then an overview of how the API is used by an applica-
-tion program to obtain LDAP information.  The API calls are described in
-detail, followed by appendices that provide example code demonstrating
-use of the API, the namespace consumed by the API, a summary of require-
-ments for API extensions, known incompatibilities with RFC 1823, and a
-list of changes made since the last revision of this document.
-
-
-3.  Table of Contents
-
-1.     Status of this Memo............................................1
-2.     Introduction...................................................2
-3.     Table of Contents..............................................2
-4.     Overview of the LDAP Model.....................................4
-5.     Overview of LDAP API Use and General Requirements..............4
-6.     Header Requirements............................................6
-7.     Common Data Structures and Types...............................7
-8.     Memory Handling Overview.......................................9
-9.     Retrieving Information About the API Implementation............9
-9.1.      Retrieving Information at Compile Time......................10
-9.2.      Retrieving Information During Execution.....................11
-10.    Result Codes...................................................14
-11.    Performing LDAP Operations.....................................16
-11.1.     Initializing an LDAP Session................................16
-11.2.     LDAP Session Handle Options.................................17
-11.3.     Working With Controls.......................................23
-11.3.1.      A Client Control That Governs Referral Processing........24
-11.4.     Authenticating to the directory.............................25
-11.5.     Closing the session.........................................27
-11.6.     Searching...................................................28
-11.7.     Reading an Entry............................................32
-
-
-
-Expires: May 2001                                               [Page 2]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-
-11.8.     Listing the Children of an Entry............................32
-11.9.     Comparing a Value Against an Entry..........................33
-11.10.    Modifying an entry..........................................35
-11.11.    Modifying the Name of an Entry..............................37
-11.12.    Adding an entry.............................................39
-11.13.    Deleting an entry...........................................41
-11.14.    Extended Operations.........................................43
-12.    Abandoning An Operation........................................44
-13.    Obtaining Results and Peeking Inside LDAP Messages.............45
-14.    Handling Errors and Parsing Results............................47
-15.    Stepping Through a List of Results.............................51
-16.    Parsing Search Results.........................................51
-16.1.     Stepping Through a List of Entries or References............52
-16.2.     Stepping Through the Attributes of an Entry.................53
-16.3.     Retrieving the Values of an Attribute.......................54
-16.4.     Retrieving the name of an entry.............................55
-16.5.     Retrieving controls from an entry...........................56
-16.6.     Parsing References..........................................57
-17.    Encoded ASN.1 Value Manipulation...............................58
-17.1.     BER Data Structures and Types...............................58
-17.2.     Memory Disposal and Utility Functions.......................60
-17.3.     Encoding....................................................60
-17.4.     Encoding Example............................................63
-17.5.     Decoding....................................................64
-17.6.     Decoding Example............................................67
-18.    Security Considerations........................................70
-19.    Acknowledgements...............................................70
-20.    Copyright......................................................70
-21.    Bibliography...................................................71
-22.    Authors' Addresses.............................................72
-23.    Appendix A - Sample C LDAP API Code............................73
-24.    Appendix B - Namespace Consumed By This Specification..........74
-25.    Appendix C - Summary of Requirements for API Extensions........75
-25.1.     Compatibility...............................................75
-25.2.     Style.......................................................75
-25.3.     Dependence on Externally Defined Types......................75
-25.4.     Compile Time Information....................................76
-25.5.     Runtime Information.........................................76
-25.6.     Values Used for Session Handle Options......................76
-26.    Appendix D - Known Incompatibilities with RFC 1823.............76
-26.1.     Opaque LDAP Structure.......................................76
-26.2.     Additional Result Codes.....................................77
-26.3.     Freeing of String Data with ldap_memfree()..................77
-26.4.     Changes to ldap_result()....................................77
-26.5.     Changes to ldap_first_attribute() and ldap_next_attribute...77
-26.6.     Changes to ldap_modrdn() and ldap_modrdn_s() Functions......78
-26.7.     Changes to the berval structure.............................78
-26.8.     API Specification Clarified.................................78
-
-
-Expires: May 2001                                               [Page 3]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-26.9.     Deprecated Functions........................................78
-27.    Appendix E - Data Types and Legacy Implementations.............79
-28.    Appendix F - Changes Made Since Last Document Revision.........80
-28.1.     API Changes.................................................80
-28.2.     Editorial Changes and Clarifications........................81
-
-
-4.  Overview of the LDAP Model
-
-LDAP is the lightweight directory access protocol, described in [2] and
-[3]. It can provide a lightweight frontend to the X.500 directory [4],
-or a stand-alone service. In either mode, LDAP is based on a client-
-server model in which a client makes a TCP connection to an LDAP server,
-over which it sends requests and receives responses.
-
-The LDAP information model is based on the entry, which contains infor-
-mation about some object (e.g., a person).  Entries are composed of
-attributes, which have a type and one or more values. Each attribute has
-a syntax that determines what kinds of values are allowed in the attri-
-bute (e.g., ASCII characters, a jpeg photograph, etc.) and how those
-values behave during directory operations (e.g., is case significant
-during comparisons).
-
-Entries may be organized in a tree structure, usually based on politi-
-cal, geographical, and organizational boundaries. Each entry is uniquely
-named relative to its sibling entries by its relative distinguished name
-(RDN) consisting of one or more distinguished attribute values from the
-entry.  At most one value from each attribute may be used in the RDN.
-For example, the entry for the person Babs Jensen might be named with
-the "Barbara Jensen" value from the commonName attribute.
-
-A globally unique name for an entry, called a distinguished name or DN,
-is constructed by concatenating the sequence of RDNs from the entry up
-to the root of the tree. For example, if Babs worked for the University
-of Michigan, the DN of her U-M entry might be "cn=Barbara Jensen,
-o=University of Michigan, c=US". The DN format used by LDAP is defined
-in [5].
-
-Operations are provided to authenticate, search for and retrieve infor-
-mation, modify information, and add and delete entries from the tree.
-The next sections give an overview of how the API is used and detailed
-descriptions of the LDAP API calls that implement all of these func-
-tions.
-
-
-5.  Overview of LDAP API Use and General Requirements
-
-An application generally uses the C LDAP API in four simple steps.
-
-
-
-Expires: May 2001                                               [Page 4]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-   1.   Initialize an LDAP session with a primary LDAP server. The
-        ldap_init() function returns a handle to the session, allowing
-        multiple connections to be open at once.
-
-   2.   Authenticate to the LDAP server. The ldap_sasl_bind() function
-        and friends support a variety of authentication methods.
-
-   3.   Perform some LDAP operations and obtain some results.
-        ldap_search() and friends return results which can be parsed by
-        ldap_parse_result(), ldap_first_entry(), ldap_next_entry(), etc.
-
-   4.   Close the session. The ldap_unbind() function closes the connec-
-        tion.
-
-Operations can be performed either synchronously or asynchronously.  The
-names of the synchronous functions end in _s. For example, a synchronous
-search can be completed by calling ldap_search_s(). An asynchronous
-search can be initiated by calling ldap_search(). All synchronous rou-
-tines return an indication of the outcome of the operation (e.g, the
-constant LDAP_SUCCESS or some other result code).  The asynchronous rou-
-tines make available to the caller the message id of the operation ini-
-tiated. This id can be used in subsequent calls to ldap_result() to
-obtain the result(s) of the operation. An asynchronous operation can be
-abandoned by calling ldap_abandon() or ldap_abandon_ext().  Note that
-there is no requirement that an LDAP API implementation not block when
-handling asynchronous API functions; the term "asynchronous" as used in
-this document refers to the fact that the sending of LDAP requests can
-be separated from the receiving of LDAP responses.
-
-Results and errors are returned in an opaque structure called LDAPMes-
-sage.  Routines are provided to parse this structure, step through
-entries and attributes returned, etc. Routines are also provided to
-interpret errors. Later sections of this document describe these rou-
-tines in more detail.
-
-LDAP version 3 servers can return referrals and references to other
-servers.  By default, implementations of this API will attempt to follow
-referrals automatically for the application.  This behavior can be dis-
-abled globally (using the ldap_set_option() call) or on a per-request
-basis through the use of a client control.
-
-All DN and string attribute values passed into or produced by this C
-LDAP API are represented using the character set of the underlying LDAP
-protocol version in use.  When this API is used with LDAPv3, DN and
-string values are represented as UTF-8[6] characters.  When this API is
-used with LDAPv2, the US-ASCII[7] or T.61[7] character set are used.
-Future documents MAY specify additional APIs supporting other character
-sets.
-
-
-
-Expires: May 2001                                               [Page 5]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-For compatibility with existing applications, implementations of this
-API will by default use version 2 of the LDAP protocol.  Applications
-that intend to take advantage of LDAP version 3 features will need to
-use the ldap_set_option() call with a LDAP_OPT_PROTOCOL_VERSION to
-switch to version 3.
-
-Unless otherwise indicated, conformant implementations of this specifi-
-cation MUST implement all of the C LDAP API functions as described in
-this document, and they MUST use the function prototypes, macro defini-
-tions, and types defined in this document.
-
-Note that this API is designed for use in environments where the 'int'
-type is at least 32 bits in size.
-
-
-6.  Header Requirements
-
-To promote portability of applications, the following requirements are
-imposed on the headers used by applications to access the services of
-this API:
-
-Name and Inclusion
-        Applications only need to include a single header named ldap.h
-        to access all of the API services described in this document.
-        Therefore, the following C source program MUST compile and exe-
-        cute without errors:
-
-           #include <ldap.h>
-
-           int
-           main()
-           {
-               return 0;
-           }
-
-        The ldap.h header MAY include other implementation-specific
-        headers.
-
-Implementations SHOULD also provide a header named lber.h to facilitate
-development of applications desiring compatibility with older LDAP
-implementations.  The lber.h header MAY be empty.  Old applications that
-include lber.h in order to use BER facilities will need to include
-ldap.h.
-
-
-Idempotence
-        All headers SHOULD be idempotent; that is, if they are included
-        more than once the effect is as if they had only been included
-
-
-
-Expires: May 2001                                               [Page 6]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-        once.
-
-Must Be Included Before API Is Used
-        An application MUST include the ldap.h header before referencing
-        any of the function or type definitions described in this API
-        specification.
-
-Mutual Independence
-        Headers SHOULD be mutually independent with minimal dependence
-        on system or any other headers.
-
-Use of the 'const' Keyword
-        This API specification is defined in terms of ISO C[8].  It
-        makes use of function prototypes and the 'const' keyword.  The
-        use of 'const' in this specification is limited to simple, non-
-        array function parameters to avoid forcing applications to
-        declare parameters and variables that accept return values from
-        LDAP API functions as 'const.'  Implementations specifically
-        designed to be used with non-ISO C translators SHOULD provide
-        function declarations without prototypes or function prototypes
-        without specification of 'const' arguments.
-
-Definition of 'struct timeval'
-        This API specification uses the 'struct timeval' type.  Imple-
-        mentations of this API MUST ensure that the struct timeval type
-        is by default defined as a consequence of including the ldap.h
-        header.  Because struct timeval is usually defined in one or
-        more system headers, it is possible for header conflicts to
-        occur if ldap.h also defines it or arranges for it to be defined
-        by including another header.  Therefore, applications MAY want
-        to arrange for struct timeval to be defined before they include
-        ldap.h.  To support this, the ldap.h header MUST NOT itself
-        define struct timeval if the preprocessor symbol
-        LDAP_TYPE_TIMEVAL_DEFINED is defined before ldap.h is included.
-
-
-7.  Common Data Structures and Types
-
-Data structures and types that are common to several LDAP API functions
-are defined here:
-
-       typedef struct ldap LDAP;
-
-       typedef struct ldapmsg LDAPMessage;
-
-       typedef struct berelement BerElement;
-
-       typedef <impl_len_t> ber_len_t;
-
-
-
-Expires: May 2001                                               [Page 7]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-       typedef struct berval {
-           ber_len_t       bv_len;
-           char            *bv_val;
-       } BerValue;
-
-       struct timeval {
-           <impl_sec_t>    tv_sec;
-           <impl_usec_t>   tv_usec;
-       };
-
-The LDAP structure is an opaque data type that represents an LDAP ses-
-sion Typically this corresponds to a connection to a single server, but
-it MAY encompass several server connections in the face of LDAPv3 refer-
-rals.
-
-The LDAPMessage structure is an opaque data type that is used to return
-entry, reference, result, and error information.  An LDAPMessage struc-
-ture can represent the beginning of a list, or chain of messages that
-consists of a series of entries, references, and result messages as
-returned by LDAP operations such as search.  LDAP API functions such as
-ldap_parse_result() that operate on message chains that can contain more
-than one result message always operate on the first result message in
-the chain.  See the "Obtaining Results and Peeking Inside LDAP Messages"
-section of this document for more information.
-
-The BerElement structure is an opaque data type that is used to hold
-data and state information about encoded data.  It is described in more
-detail in the section "Encoded ASN.1 Value Manipulation" later in this
-document.
-
-The `ber_len_t' type is an unsigned integral data type that is large
-enough to contain the length of the largest piece of data supported by
-the API implementation.  The `<impl_len_t>' in the `ber_len_t' typedef
-MUST be replaced with an appropriate type.  The width (number of signi-
-ficant bits) of `ber_len_t' MUST be at least 32 and no larger than that
-of `unsigned long'.  See the appendix "Data Types and Legacy Implementa-
-tions" for additional considerations.
-
-The BerValue structure is used to represent arbitrary binary data and
-its fields have the following meanings:
-
-bv_len   Length of data in bytes.
-
-bv_val   A pointer to the data itself.
-
-
-The timeval structure is used to represent an interval of time and its
-fields have the following meanings:
-
-
-
-Expires: May 2001                                               [Page 8]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-tv_sec   Seconds component of time interval.
-
-tv_usec  Microseconds component of time interval.
-
-Note that because the struct timeval definition typically is derived
-from a system header, the types used for the tv_sec and tv_usec com-
-ponents are implementation-specific integral types.  Therefore,
-`<impl_sec_t>' and `<impl_usec_t>' in the struct timeval definition MUST
-be replaced with appropriate types.  See the earlier section "Header
-Requirements" for more information on struct timeval.
-
-
-8.  Memory Handling Overview
-
-All memory that is allocated by a function in this C LDAP API and
-returned to the caller SHOULD be disposed of by calling the appropriate
-"free" function provided by this API.  The correct "free" function to
-call is documented in each section of this document where a function
-that allocates memory is described.
-
-Memory that is allocated through means outside of the C LDAP API MUST
-NOT be disposed of using a function provided by this API.
-
-If a pointer value passed to one of the C LDAP API "free" functions is
-NULL, graceful failure (i.e, ignoring of the NULL pointer) MUST occur.
-
-The complete list of "free" functions that are used to dispose of allo-
-cated memory is:
-
-   ber_bvecfree()
-   ber_bvfree()
-   ber_free()
-   ldap_control_free()
-   ldap_controls_free()
-   ldap_memfree()
-   ldap_msgfree()
-   ldap_value_free()
-   ldap_value_free_len()
-
-
-9.  Retrieving Information About the API Implementation
-
-Applications developed to this specification need to be able to deter-
-mine information about the particular API implementation they are using
-both at compile time and during execution.
-
-
-
-
-
-
-Expires: May 2001                                               [Page 9]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-9.1.  Retrieving Information at Compile Time
-
-All conformant implementations MUST include the following five defini-
-tions in a header so compile time tests can be done by LDAP software
-developers:
-
-   #define LDAP_API_VERSION     level
-   #define LDAP_VERSION_MIN     min-version
-   #define LDAP_VERSION_MAX     max-version
-   #define LDAP_VENDOR_NAME     "vend-name"
-   #define LDAP_VENDOR_VERSION  vend-version
-
-where:
-
-     "level" is replaced with the RFC number given to this C LDAP API
-     specification when it is published as a standards track RFC.
-
-     min-version is replaced with the lowest LDAP protocol version sup-
-     ported by the implementation.
-
-     max-version is replaced with the highest LDAP protocol version sup-
-     ported by the implementation.  This SHOULD be 3.
-
-     "vend-name" is replaced with a text string that identifies the
-     party that supplies the API implementation.
-
-     "vend-version" is a supplier-specific version number multiplied
-     times 100.
-
-Note that the LDAP_VENDOR_NAME macro SHOULD be defined as "" if no ven-
-dor name is available and the LDAP_VENDOR_VERSION macro SHOULD be
-defined as 0 if no vendor-specific version information is available.
-
-For example, if this specification is published as RFC 88888, Netscape
-Communication's version 4.0 implementation that supports LDAPv2 and v3
-might include macro definitions like these:
-
-   #define LDAP_API_VERSION     88888      /* RFC 88888 compliant */
-   #define LDAP_VERSION_MIN     2
-   #define LDAP_VERSION_MAX     3
-   #define LDAP_VENDOR_NAME     "Netscape Communications Corp."
-   #define LDAP_VENDOR_VERSION  400        /* version 4.0 */
-
-and application code can test the C LDAP API version level using a
-construct such as this one:
-
-   #if (LDAP_API_VERSION >= 88888)
-           /* use features supported in RFC 88888 or later */
-
-
-
-Expires: May 2001                                              [Page 10]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-   #endif
-
-Until such time as this document is published as an RFC, implementations
-SHOULD use the value 2000 plus the revision number of this draft for
-LDAP_API_VERSION.  For example, the correct value for LDAP_API_VERSION
-for revision 05 of this draft is 2005.
-
-Documents that extend this specification SHOULD define a macro of the
-form:
-
-   #define LDAP_API_FEATURE_x level
-
-where "x" is replaced with a name (textual identifier) for the feature
-and "level" is replaced with the number of the RFC that specifies the
-API extension.  The name SHOULD NOT begin with the string "X_".
-
-For example, if C LDAP API extensions for Transport Layer Security [9]
-were published in RFC 99999, that RFC might require conformant implemen-
-tations to define a macro like this:
-
-   #define LDAP_API_FEATURE_TLS 99999
-
-
-Private or experimental API extensions SHOULD be indicated by defining a
-macro of this same form where "x" (the extension's name) begins with the
-string "X_" and "level" is replaced with a integer number that is
-specific to the extension.
-
-It is RECOMMENDED that private or experimental API extensions use only
-the following prefixes for macros, types, and function names:
-       LDAP_X_
-       LBER_X_
-       ldap_x_
-       ber_x_
-and that these prefixes not be used by standard extensions.
-
-
-9.2.  Retrieving Information During Execution
-
-The ldap_get_option() call (described in greater detail later in this
-document) can be used during execution in conjunction with an option
-parameter value of LDAP_OPT_API_INFO (0x00) to retrieve some basic
-information about the API and about the specific implementation being
-used.  The ld parameter to ldap_get_option() can be either NULL or a
-valid LDAP session handle which was obtained by calling ldap_init().
-The optdata parameter to ldap_get_option() SHOULD be the address of an
-LDAPAPIInfo structure which is defined as follows:
-
-
-
-
-Expires: May 2001                                              [Page 11]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-   typedef struct ldapapiinfo {
-       int  ldapai_info_version;     /* version of this struct (1) */
-       int  ldapai_api_version;      /* revision of API supported */
-       int  ldapai_protocol_version; /* highest LDAP version supported */
-       char **ldapai_extensions;     /* names of API extensions */
-       char *ldapai_vendor_name;     /* name of supplier */
-       int  ldapai_vendor_version;   /* supplier-specific version times 100 */
-   } LDAPAPIInfo;
-
-In addition, API implementations MUST include the following macro defin-
-ition:
-
-   #define LDAP_API_INFO_VERSION    1
-
-Note that the ldapai_info_version field of the LDAPAPIInfo structure
-SHOULD be set to the value LDAP_API_INFO_VERSION (1) before calling
-ldap_get_option() so that it can be checked for consistency.  All other
-fields are set by the ldap_get_option() function.
-
-The members of the LDAPAPIInfo structure are:
-
-ldapai_info_version
-          A number that identifies the version of the LDAPAPIInfo struc-
-          ture.  This SHOULD be set to the value LDAP_API_INFO_VERSION
-          (1) before calling ldap_get_option().  If the value received
-          is not recognized by the API implementation, the
-          ldap_get_option() function sets ldapai_info_version to a valid
-          value that would be recognized, sets the ldapai_api_version to
-          the correct value, and returns an error without filling in any
-          of the other fields in the LDAPAPIInfo structure.
-
-ldapai_api_version
-          A number that matches that assigned to the C LDAP API RFC sup-
-          ported by the API implementation.  This SHOULD match the value
-          of the LDAP_API_VERSION macro defined earlier.
-
-ldapai_protocol_version
-          The highest LDAP protocol version supported by the implementa-
-          tion.  For example, if LDAPv3 is the highest version supported
-          then this field will be set to 3.
-
-ldapai_vendor_name
-          A zero-terminated string that contains the name of the party
-          that produced the LDAP API implementation.  This field may be
-          set to NULL if no name is available.  If non-NULL, the caller
-          is responsible for disposing of the memory occupied by passing
-          this pointer to ldap_memfree() which is described later in
-          this document.  This value SHOULD match the value of the
-
-
-
-Expires: May 2001                                              [Page 12]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-          LDAP_VENDOR_NAME macro described earlier in this document.
-
-ldapai_vendor_version
-          An implementation-specific version number multiplied by 100.
-          For example, if the implementation version is 4.0 then this
-          field will be set to 400.  If no version information is avail-
-          able, this field will be set to 0.  This value SHOULD match
-          the value of the LDAP_VENDOR_VERSION macro described earlier
-          in this document.
-
-ldapai_extensions
-          A NULL-terminated array of character strings that lists the
-          names of the API extensions supported by the LDAP API imple-
-          mentation.  These names will typically match the textual iden-
-          tifiers that appear in the "x" portion of the
-          LDAP_API_FEATURE_x macros described above, although the pre-
-          cise value MUST be defined by documents that specify C LDAP
-          API extensions.  If no API extensions are supported, this
-          field will be set to NULL.  The caller is responsible for
-          disposing of the memory occupied by this array by passing it
-          to ldap_value_free() which is described later in this docu-
-          ment.  To retrieve more information about a particular exten-
-          sion, the ldap_get_option() call can be used with an option
-          parameter value of LDAP_OPT_API_FEATURE_INFO (0x15).  The opt-
-          data parameter to the ldap_get_option() SHOULD be the address
-          of an LDAPAPIFeatureInfo structure which is defined as fol-
-          lows:
-
-             typedef struct ldap_apifeature_info {
-                 int   ldapaif_info_version; /* version of this struct (1) */
-                 char  *ldapaif_name;        /* name of supported feature */
-                 int   ldapaif_version;      /* revision of supported feature */
-             } LDAPAPIFeatureInfo;
-
-          In addition, API implementations MUST include the following
-          macro definition:
-
-             #define LDAP_FEATURE_INFO_VERSION    1
-
-          Note that the ldapaif_info_version field of the LDAPAPI-
-          FeatureInfo structure SHOULD be set to the value
-          LDAP_FEATURE_INFO_VERSION (1) and the ldapaif_name field
-          SHOULD be set to the extension name string as described below
-          before ldap_get_option() is called.  The call will fill in the
-          ldapaif_version field of the LDAPAPIFeatureInfo structure.
-
-   The members of the LDAPAPIFeatureInfo structure are:
-
-
-
-
-Expires: May 2001                                              [Page 13]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-   ldapaif_info_version
-             A number that identifies the version of the LDAPAPI-
-             FeatureInfo structure.  This SHOULD be set to the value
-             LDAP_FEATURE_INFO_VERSION (1) before calling
-             ldap_get_option().  If the value received is not recognized
-             by the API implementation, the ldap_get_option() function
-             sets ldapaif_info_version to a valid value that would be
-             recognized and returns an error without filling in the
-             ldapaif_version field in the LDAPAPIFeatureInfo structure.
-
-   ldapaif_name
-             The name of an extension, as returned in the
-             ldapai_extensions array of the LDAPAPIInfo structure and as
-             specified in the document that describes the extension.
-
-   ldapaif_version
-             This field will be set as a result of calling
-             ldap_get_option().  It is a number that matches that
-             assigned to the C LDAP API extension RFC supported for this
-             extension.  For private or experimental API extensions, the
-             value is extension-specific.  In either case, the value of
-             ldapaxi_ext_version SHOULD be identical to the value of the
-             LDAP_API_FEATURE_x macro defined for the extension
-             (described above).
-
-
-10.  Result Codes
-
-Many of the LDAP API routines return result codes, some of which indi-
-cate local API errors and some of which are LDAP resultCodes that are
-returned by servers.  All of the result codes are non-negative integers.
-Supported result codes are as follows (hexadecimal values are given in
-parentheses after the constant):
-
-           LDAP_SUCCESS (0x00)
-           LDAP_OPERATIONS_ERROR (0x01)
-           LDAP_PROTOCOL_ERROR (0x02)
-           LDAP_TIMELIMIT_EXCEEDED (0x03)
-           LDAP_SIZELIMIT_EXCEEDED (0x04)
-           LDAP_COMPARE_FALSE (0x05)
-           LDAP_COMPARE_TRUE (0x06)
-           LDAP_STRONG_AUTH_NOT_SUPPORTED (0x07)
-           LDAP_STRONG_AUTH_REQUIRED (0x08)
-           LDAP_REFERRAL (0x0a)                            -- new in LDAPv3
-           LDAP_ADMINLIMIT_EXCEEDED (0x0b)                 -- new in LDAPv3
-           LDAP_UNAVAILABLE_CRITICAL_EXTENSION (0x0c)      -- new in LDAPv3
-           LDAP_CONFIDENTIALITY_REQUIRED (0x0d)            -- new in LDAPv3
-           LDAP_SASL_BIND_IN_PROGRESS (0x0e)               -- new in LDAPv3
-
-
-
-Expires: May 2001                                              [Page 14]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-           LDAP_NO_SUCH_ATTRIBUTE (0x10)
-           LDAP_UNDEFINED_TYPE (0x11)
-           LDAP_INAPPROPRIATE_MATCHING (0x12)
-           LDAP_CONSTRAINT_VIOLATION (0x13)
-           LDAP_TYPE_OR_VALUE_EXISTS (0x14)
-           LDAP_INVALID_SYNTAX (0x15)
-           LDAP_NO_SUCH_OBJECT (0x20)
-           LDAP_ALIAS_PROBLEM (0x21)
-           LDAP_INVALID_DN_SYNTAX (0x22)
-           LDAP_IS_LEAF (0x23)                             -- not used in LDAPv3
-           LDAP_ALIAS_DEREF_PROBLEM (0x24)
-           LDAP_INAPPROPRIATE_AUTH (0x30)
-           LDAP_INVALID_CREDENTIALS (0x31)
-           LDAP_INSUFFICIENT_ACCESS (0x32)
-           LDAP_BUSY (0x33)
-           LDAP_UNAVAILABLE (0x34)
-           LDAP_UNWILLING_TO_PERFORM (0x35)
-           LDAP_LOOP_DETECT (0x36)
-           LDAP_NAMING_VIOLATION (0x40)
-           LDAP_OBJECT_CLASS_VIOLATION (0x41)
-           LDAP_NOT_ALLOWED_ON_NONLEAF (0x42)
-           LDAP_NOT_ALLOWED_ON_RDN (0x43)
-           LDAP_ALREADY_EXISTS (0x44)
-           LDAP_NO_OBJECT_CLASS_MODS (0x45)
-           LDAP_RESULTS_TOO_LARGE (0x46)                   -- reserved for CLDAP
-           LDAP_AFFECTS_MULTIPLE_DSAS (0x47)               -- new in LDAPv3
-           LDAP_OTHER (0x50)
-           LDAP_SERVER_DOWN (0x51)
-           LDAP_LOCAL_ERROR (0x52)
-           LDAP_ENCODING_ERROR (0x53)
-           LDAP_DECODING_ERROR (0x54)
-           LDAP_TIMEOUT (0x55)
-           LDAP_AUTH_UNKNOWN (0x56)
-           LDAP_FILTER_ERROR (0x57)
-           LDAP_USER_CANCELLED (0x58)
-           LDAP_PARAM_ERROR (0x59)
-           LDAP_NO_MEMORY (0x5a)
-           LDAP_CONNECT_ERROR (0x5b)
-           LDAP_NOT_SUPPORTED (0x5c)
-           LDAP_CONTROL_NOT_FOUND (0x5d)
-           LDAP_NO_RESULTS_RETURNED (0x5e)
-           LDAP_MORE_RESULTS_TO_RETURN (0x5f)
-           LDAP_CLIENT_LOOP (0x60)
-           LDAP_REFERRAL_LIMIT_EXCEEDED (0x61)
-
-
-
-
-
-
-
-Expires: May 2001                                              [Page 15]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-11.  Performing LDAP Operations
-
-This section describes each LDAP operation API call in detail. Most
-functions take a "session handle," a pointer to an LDAP structure con-
-taining per-connection information.  Many routines return results in an
-LDAPMessage structure. These structures and others are described as
-needed below.
-
-
-11.1.  Initializing an LDAP Session
-
-ldap_init() initializes a session with an LDAP server. The server is not
-actually contacted until an operation is performed that requires it,
-allowing various options to be set after initialization.
-
-           LDAP *ldap_init(
-                   const char      *hostname,
-                   int             portno
-           );
-
-Use of the following routine is deprecated:
-
-           LDAP *ldap_open(
-                   const char      *hostname,
-                   int             portno
-           );
-
-Unlike ldap_init(), ldap_open() attempts to make a server connection
-before returning to the caller.  A more complete description can be
-found in RFC 1823.
-
-Parameters are:
-
-hostname Contains a space-separated list of hostnames or dotted strings
-         representing the IP address of hosts running an LDAP server to
-         connect to. Each hostname in the list MAY include a port number
-         which is separated from the host itself with a colon (:) char-
-         acter.  The hosts will be tried in the order listed, stopping
-         with the first one to which a successful connection is made.
-
-   Note: A suitable representation for including a literal IPv6[10]
-   address in the hostname parameter is desired, but has not yet been
-   determined or implemented in practice.
-
-portno   Contains the TCP port number to connect to. The default LDAP
-         port of 389 can be obtained by supplying the value zero (0) or
-         the macro LDAP_PORT (389).  If a host includes a port number
-         then this parameter is ignored.
-
-
-
-Expires: May 2001                                              [Page 16]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-ldap_init() and ldap_open() both return a "session handle," a pointer to
-an opaque structure that MUST be passed to subsequent calls pertaining
-to the session. These routines return NULL if the session cannot be ini-
-tialized in which case the operating system error reporting mechanism
-can be checked to see why the call failed.
-
-Note that if you connect to an LDAPv2 server, one of the LDAP bind calls
-described below SHOULD be completed before other operations can be per-
-formed on the session.  LDAPv3 does not require that a bind operation be
-completed before other operations can be performed.
-
-The calling program can set various attributes of the session by calling
-the routines described in the next section.
-
-
-11.2.  LDAP Session Handle Options
-
-The LDAP session handle returned by ldap_init() is a pointer to an
-opaque data type representing an LDAP session. In RFC 1823 this data
-type was a structure exposed to the caller, and various fields in the
-structure could be set to control aspects of the session, such as size
-and time limits on searches.
-
-In the interest of insulating callers from inevitable changes to this
-structure, these aspects of the session are now accessed through a pair
-of accessor functions, described below.
-
-ldap_get_option() is used to access the current value of various
-session-wide parameters. ldap_set_option() is used to set the value of
-these parameters.  Note that some options are READ-ONLY and cannot be
-set; it is an error to call ldap_set_option() and attempt to set a
-READ-ONLY option.
-
-Note that if automatic referral following is enabled (the default), any
-connections created during the course of following referrals will
-inherit the options associated with the session that sent the original
-request that caused the referrals to be returned.
-
-           int ldap_get_option(
-                   LDAP            *ld,
-                   int             option,
-                   void            *outvalue
-           );
-
-           int ldap_set_option(
-                   LDAP            *ld,
-                   int             option,
-                   const void      *invalue
-
-
-
-Expires: May 2001                                              [Page 17]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-           );
-
-           #define LDAP_OPT_ON     (<impl_void_star_value>)
-           #define LDAP_OPT_OFF    ((void *)0)
-
-   LDAP_OPT_ON MUST be defined as a non-null pointer to void;  that is,
-   <impl_void_star_value> MUST be replaced with a non-null pointer to
-   void, e.g., one could use:
-           #define LDAP_OPT_ON     ((void *)1)
-   if that value is safe to use on the architecture where the API is
-   implemented.
-
-Parameters are:
-
-ld     The session handle.  If this is NULL, a set of global defaults is
-       accessed.  New LDAP session handles created with ldap_init() or
-       ldap_open() inherit their characteristics from these global
-       defaults.
-
-option The name of the option being accessed or set. This parameter
-       SHOULD be one of the following constants, which have the indi-
-       cated meanings.  After the constant the actual hexadecimal value
-       of the constant is listed in parentheses.
-
-
-   LDAP_OPT_API_INFO (0x00)
-      Type for invalue parameter: not applicable (option is READ-ONLY)
-
-      Type for outvalue parameter: LDAPAPIInfo *
-
-      Description:
-           Used to retrieve some basic information about the LDAP API
-           implementation at execution time.  See the section "Retriev-
-           ing Information About the API Implementation" above for more
-           information.  This option is READ-ONLY and cannot be set.
-
-   LDAP_OPT_DEREF (0x02)
-      Type for invalue parameter: int *
-
-      Type for outvalue parameter: int *
-
-      Description:
-           Determines how aliases are handled during search. It SHOULD
-           have one of the following values: LDAP_DEREF_NEVER (0x00),
-           LDAP_DEREF_SEARCHING (0x01), LDAP_DEREF_FINDING (0x02), or
-           LDAP_DEREF_ALWAYS (0x03).  The LDAP_DEREF_SEARCHING value
-           means aliases are dereferenced during the search but not when
-           locating the base object of the search. The
-
-
-
-Expires: May 2001                                              [Page 18]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-           LDAP_DEREF_FINDING value means aliases are dereferenced when
-           locating the base object but not during the search.  The
-           default value for this option is LDAP_DEREF_NEVER.
-
-   LDAP_OPT_SIZELIMIT (0x03)
-      Type for invalue parameter: int *
-
-      Type for outvalue parameter: int *
-
-      Description:
-           A limit on the number of entries to return from a search. A
-           value of LDAP_NO_LIMIT (0) means no limit.  The default value
-           for this option is LDAP_NO_LIMIT.
-
-   LDAP_OPT_TIMELIMIT (0x04)
-      Type for invalue parameter: int *
-
-      Type for outvalue parameter: int *
-
-      Description:
-           A limit on the number of seconds to spend on a search. A
-           value of LDAP_NO_LIMIT (0) means no limit.  The default value
-           for this option is LDAP_NO_LIMIT.  This value is passed to
-           the server in the search request only; it does not affect how
-           long the C LDAP API implementation itself will wait locally
-           for search results.  Note that the timeout parameter passed
-           to the ldap_search_ext_s() or ldap_result() functions can be
-           used to specify a limit on how long the API implementation
-           will wait for results.
-
-   LDAP_OPT_REFERRALS (0x08)
-      Type for invalue parameter: void * (LDAP_OPT_ON or LDAP_OPT_OFF)
-
-      Type for outvalue parameter: int *
-
-      Description:
-           Determines whether the LDAP library automatically follows
-           referrals returned by LDAP servers or not. It MAY be set to
-           one of the constants LDAP_OPT_ON or LDAP_OPT_OFF; any non-
-           NULL pointer value passed to ldap_set_option() enables this
-           option.  When reading the current setting using
-           ldap_get_option(), a zero value means OFF and any non-zero
-           value means ON.  By default, this option is ON.
-
-   LDAP_OPT_RESTART (0x09)
-      Type for invalue parameter: void * (LDAP_OPT_ON or LDAP_OPT_OFF)
-
-      Type for outvalue parameter: int *
-
-
-
-Expires: May 2001                                              [Page 19]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-      Description:
-           Determines whether LDAP I/O operations are automatically res-
-           tarted if they abort prematurely. It MAY be set to one of the
-           constants LDAP_OPT_ON or LDAP_OPT_OFF; any non-NULL pointer
-           value passed to ldap_set_option() enables this option.  When
-           reading the current setting using ldap_get_option(), a zero
-           value means OFF and any non-zero value means ON. This option
-           is useful if an LDAP I/O operation can be interrupted prema-
-           turely, for example by a timer going off, or other interrupt.
-           By default, this option is OFF.
-
-   LDAP_OPT_PROTOCOL_VERSION (0x11)
-      Type for invalue parameter: int *
-
-      Type for outvalue parameter: int *
-
-      Description:
-           This option indicates the version of the LDAP protocol used
-           when communicating with the primary LDAP server. It SHOULD be
-           one of the constants LDAP_VERSION2 (2) or LDAP_VERSION3 (3).
-           If no version is set the default is LDAP_VERSION2 (2).
-
-   LDAP_OPT_SERVER_CONTROLS (0x12)
-      Type for invalue parameter: LDAPControl **
-
-      Type for outvalue parameter: LDAPControl ***
-
-      Description:
-           A default list of LDAP server controls to be sent with each
-           request.  See the Working With Controls section below.
-
-   LDAP_OPT_CLIENT_CONTROLS (0x13)
-      Type for invalue parameter: LDAPControl **
-
-      Type for outvalue parameter: LDAPControl ***
-
-      Description:
-           A default list of client controls that affect the LDAP ses-
-           sion.  See the Working With Controls section below.
-
-   LDAP_OPT_API_FEATURE_INFO (0x15)
-      Type for invalue parameter: not applicable (option is READ-ONLY)
-
-      Type for outvalue parameter: LDAPAPIFeatureInfo *
-
-      Description:
-           Used to retrieve version information about LDAP API extended
-           features at execution time.  See the section "Retrieving
-
-
-
-Expires: May 2001                                              [Page 20]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-           Information About the API Implementation" above for more
-           information.  This option is READ-ONLY and cannot be set.
-
-   LDAP_OPT_HOST_NAME (0x30)
-      Type for invalue parameter: char *
-
-      Type for outvalue parameter: char **
-
-      Description:
-           The host name (or list of hosts) for the primary LDAP server.
-           See the definition of the hostname parameter to ldap_init()
-           for the allowed syntax.  Note that if the portno parameter
-           passed to ldap_init() is a value other than 0 or 389
-           (LDAP_PORT), this value SHOULD include a string like
-           ":portno" after each hostname or IP address that did not have
-           one in the original hostname parameter that was passed to
-           ldap_init().  For example, if this hostname value was passed
-           to ldap_init():
-
-               "ldap.example.com:389 ldap2.example.com"
-
-           and the portno parameter passed to ldap_init() was 6389, then
-           the value returned for the LDAP_OPT_HOST_NAME option SHOULD
-           be:
-
-               "ldap.example.com:389 ldap2.example.com:6389"
-
-
-   LDAP_OPT_RESULT_CODE (0x31)
-      Type for invalue parameter: int *
-
-      Type for outvalue parameter: int *
-
-      Description:
-           The most recent local (API generated) or server returned LDAP
-           result code that occurred for this session.
-
-   LDAP_OPT_ERROR_STRING (0x32)
-      Type for invalue parameter: char *
-
-      Type for outvalue parameter: char **
-
-      Description:
-           The message returned with the most recent LDAP error that
-           occurred for this session.
-
-   LDAP_OPT_MATCHED_DN (0x33)
-      Type for invalue parameter: char *
-
-
-
-Expires: May 2001                                              [Page 21]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-      Type for outvalue parameter: char **
-
-      Description:
-           The matched DN value returned with the most recent LDAP error
-           that occurred for this session.
-
-
-outvalue The address of a place to put the value of the option. The
-         actual type of this parameter depends on the setting of the
-         option parameter.  For outvalues of type char ** and LDAPCon-
-         trol **, a copy of the data that is associated with the LDAP
-         session ld is returned; callers should dispose of the memory by
-         calling ldap_memfree() or ldap_controls_free(), depending on
-         the type of data returned.
-
-invalue  A pointer to the value the option is to be given. The actual
-         type of this parameter depends on the setting of the option
-         parameter. The data associated with invalue is copied by the
-         API implementation to allow callers of the API to dispose of or
-         otherwise change their copy of the data after a successful call
-         to ldap_set_option().  If a value passed for invalue is invalid
-         or cannot be accepted by the implementation, ldap_set_option()
-         should return -1 to indicate an error.
-
-Both ldap_get_option() and ldap_set_option() return 0 if successful and
--1 if an error occurs.  If -1 is returned by either function, a specific
-result code MAY be retrieved by calling ldap_get_option() with an option
-value of LDAP_OPT_RESULT_CODE.  Note that there is no way to retrieve a
-more specific result code if a call to ldap_get_option() with an option
-value of LDAP_OPT_RESULT_CODE fails.
-
-When a call to ldap_get_option() succeeds, the API implementation MUST
-NOT change the state of the LDAP session handle or the state of the
-underlying implementation in a way that affects the behavior of future
-LDAP API calls.  When a call to ldap_get_option() fails, the only ses-
-sion handle change permitted is setting the LDAP result code (as
-returned by the LDAP_OPT_RESULT_CODE option).
-
-When a call to ldap_set_option() fails, it MUST NOT change the state of
-the LDAP session handle or the state of the underlying implementation in
-a way that affects the behavior of future LDAP API calls.
-
-Standards track documents that extend this specification and specify new
-options SHOULD use values for option macros that are between 0x1000 and
-0x3FFF inclusive.  Private and experimental extensions SHOULD use values
-for the option macros that are between 0x4000 and 0x7FFF inclusive.  All
-values below 0x1000 and above 0x7FFF that are not defined in this docu-
-ment are reserved and SHOULD NOT be used.  The following macro MUST be
-
-
-
-Expires: May 2001                                              [Page 22]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-defined by C LDAP API implementations to aid extension implementors:
-   #define LDAP_OPT_PRIVATE_EXTENSION_BASE 0x4000  /* to 0x7FFF inclusive */
-
-
-
-11.3.  Working With Controls
-
-LDAPv3 operations can be extended through the use of controls.  Controls
-can be sent to a server or returned to the client with any LDAP message.
-These controls are referred to as server controls.
-
-The LDAP API also supports a client-side extension mechanism through the
-use of client controls. These controls affect the behavior of the LDAP
-API only and are never sent to a server.  A common data structure is
-used to represent both types of controls:
-
-           typedef struct ldapcontrol {
-                   char            *ldctl_oid;
-                   struct berval   ldctl_value;
-                   char            ldctl_iscritical;
-           } LDAPControl;
-
-The fields in the ldapcontrol structure have the following meanings:
-
-ldctl_oid        The control type, represented as a string.
-
-ldctl_value      The data associated with the control (if any).  To
-                 specify a zero-length value, set ldctl_value.bv_len to
-                 zero and ldctl_value.bv_val to a zero-length string.
-                 To indicate that no data is associated with the con-
-                 trol, set ldctl_value.bv_val to NULL.
-
-ldctl_iscritical Indicates whether the control is critical of not. If
-                 this field is non-zero, the operation will only be car-
-                 ried out if the control is recognized by the server
-                 and/or client.  Note that the LDAP unbind and abandon
-                 operations have no server response, so clients SHOULD
-                 NOT mark server controls critical when used with these
-                 two operations.
-
-Some LDAP API calls allocate an ldapcontrol structure or a NULL-
-terminated array of ldapcontrol structures.  The following routines can
-be used to dispose of a single control or an array of controls:
-
-           void ldap_control_free( LDAPControl *ctrl );
-           void ldap_controls_free( LDAPControl **ctrls );
-If the ctrl or ctrls parameter is NULL, these calls do nothing.
-
-
-
-
-Expires: May 2001                                              [Page 23]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-A set of controls that affect the entire session can be set using the
-ldap_set_option() function (see above).  A list of controls can also be
-passed directly to some LDAP API calls such as ldap_search_ext(), in
-which case any controls set for the session through the use of
-ldap_set_option() are ignored. Control lists are represented as a NULL-
-terminated array of pointers to ldapcontrol structures.
-
-Server controls are defined by LDAPv3 protocol extension documents; for
-example, a control has been proposed to support server-side sorting of
-search results [11].
-
-One client control is defined in this document (described in the follow-
-ing section).  Other client controls MAY be defined in future revisions
-of this document or in documents that extend this API.
-
-
-11.3.1.  A Client Control That Governs Referral Processing
-
-As described previously in the section "LDAP Session Handle Options,"
-applications can enable and disable automatic chasing of referrals on a
-session-wide basic by using the ldap_set_option() function with the
-LDAP_OPT_REFERRALS option.  It is also useful to govern automatic refer-
-ral chasing on per-request basis.  A client control with an OID of
-1.2.840.113556.1.4.616 exists to provide this functionality.
-
-   /* OID for referrals client control */
-   #define LDAP_CONTROL_REFERRALS              "1.2.840.113556.1.4.616"
-
-   /* Flags for referrals client control value */
-   #define LDAP_CHASE_SUBORDINATE_REFERRALS    0x00000020U
-   #define LDAP_CHASE_EXTERNAL_REFERRALS       0x00000040U
-
-To create a referrals client control, the ldctl_oid field of an LDAPCon-
-trol structure MUST be set to LDAP_CONTROL_REFERRALS
-("1.2.840.113556.1.4.616") and the ldctl_value field MUST be set to a
-value that contains a set of flags.  The ldctl_value.bv_len field MUST
-be set to sizeof(ber_uint_t), and the ldctl_value.bv_val field MUST
-point to a ber_uint_t which contains the flags value." The ber_uint_t
-type is define in the section "BER Data Structures and Types" below.
-
-The flags value can be set to zero to disable automatic chasing of
-referrals and LDAPv3 references altogether.  Alternatively, the flags
-value can be set to the value LDAP_CHASE_SUBORDINATE_REFERRALS
-(0x00000020U) to indicate that only LDAPv3 search continuation refer-
-ences are to be automatically chased by the API implementation, to the
-value LDAP_CHASE_EXTERNAL_REFERRALS (0x00000040U) to indicate that only
-LDAPv3 referrals are to be automatically chased, or the logical OR of
-the two flag values (0x00000060U) to indicate that both referrals and
-
-
-
-Expires: May 2001                                              [Page 24]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-references are to be automatically chased.
-
-
-11.4.  Authenticating to the directory
-
-The following functions are used to authenticate an LDAP client to an
-LDAP directory server.
-
-The ldap_sasl_bind() and ldap_sasl_bind_s() functions can be used to do
-general and extensible authentication over LDAP through the use of the
-Simple Authentication Security Layer [12].  The routines both take the
-dn to bind as, the method to use, as a dotted-string representation of
-an OID identifying the method, and a struct berval holding the creden-
-tials. The special constant value LDAP_SASL_SIMPLE (NULL) can be passed
-to request simple authentication, or the simplified routines
-ldap_simple_bind() or ldap_simple_bind_s() can be used.
-
-           int ldap_sasl_bind(
-                   LDAP                    *ld,
-                   const char              *dn,
-                   const char              *mechanism,
-                   const struct berval     *cred,
-                   LDAPControl             **serverctrls,
-                   LDAPControl             **clientctrls,
-                   int                     *msgidp
-           );
-
-           int ldap_sasl_bind_s(
-                   LDAP                    *ld,
-                   const char              *dn,
-                   const char              *mechanism,
-                   const struct berval     *cred,
-                   LDAPControl             **serverctrls,
-                   LDAPControl             **clientctrls,
-                   struct berval           **servercredp
-           );
-
-           int ldap_simple_bind(
-                   LDAP                    *ld,
-                   const char              *dn,
-                   const char              *passwd
-           );
-
-           int ldap_simple_bind_s(
-                   LDAP                    *ld,
-                   const char              *dn,
-                   const char              *passwd
-           );
-
-
-
-Expires: May 2001                                              [Page 25]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-   The use of the following routines is deprecated and more complete
-   descriptions can be found in RFC 1823:
-
-           int ldap_bind( LDAP *ld, const char *dn, const char *cred,
-                   int method );
-
-           int ldap_bind_s( LDAP *ld, const char *dn, const char *cred,
-                   int method );
-
-           int ldap_kerberos_bind( LDAP *ld, const char *dn );
-
-           int ldap_kerberos_bind_s( LDAP *ld, const char *dn );
-
-Parameters are:
-
-ld           The session handle.
-
-dn           The name of the entry to bind as.  If NULL, a zero length
-             DN is sent to the server.
-
-mechanism    Either LDAP_SASL_SIMPLE (NULL) to get simple authentica-
-             tion, or a text string identifying the SASL method.
-
-cred         The credentials with which to authenticate. Arbitrary
-             credentials can be passed using this parameter. The format
-             and content of the credentials depends on the setting of
-             the mechanism parameter.  If the cred parameter is NULL and
-             the mechanism is LDAP_SASL_SIMPLE, a zero-length octet
-             string is sent to the server in the simple credentials
-             field of the bind request.  If the cred parameter is NULL
-             and the mechanism is anything else, no credentials are sent
-             to the server in the bind request.
-
-passwd       For ldap_simple_bind(), the password that is sent to the
-             server in the simple credentials field of the bind request.
-             If NULL, a zero length password is sent to the server.
-
-serverctrls  List of LDAP server controls, or NULL if no server controls
-             are used.
-
-clientctrls  List of client controls, or NULL if no client controls are
-             used.
-
-msgidp       This result parameter will be set to the message id of the
-             request if the ldap_sasl_bind() call succeeds.  The value
-             is undefined if a value other than LDAP_SUCCESS is
-             returned.
-
-
-
-
-Expires: May 2001                                              [Page 26]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-servercredp  This result parameter will be filled in with the creden-
-             tials passed back by the server for mutual authentication,
-             if given. An allocated berval structure is returned that
-             SHOULD be disposed of by calling ber_bvfree().  NULL SHOULD
-             be passed to ignore this field.  If an API error occurs or
-             the server did not return any credentials, *servercredp is
-             set to NULL.
-
-Additional parameters for the deprecated routines are not described.
-Interested readers are referred to RFC 1823.
-
-The ldap_sasl_bind() function initiates an asynchronous bind operation
-and returns the constant LDAP_SUCCESS if the request was successfully
-sent, or another LDAP result code if not.  See the section below on
-error handling for more information about possible errors and how to
-interpret them.  If successful, ldap_sasl_bind() places the message id
-of the request in *msgidp. A subsequent call to ldap_result(), described
-below, can be used to obtain the result of the bind.
-
-The ldap_simple_bind() function initiates a simple asynchronous bind
-operation and returns the message id of the operation initiated.  A sub-
-sequent call to ldap_result(), described below, can be used to obtain
-the result of the bind. In case of error, ldap_simple_bind() will return
--1, setting the session error parameters in the LDAP structure appropri-
-ately.
-
-The synchronous ldap_sasl_bind_s() and ldap_simple_bind_s() functions
-both return the result of the operation, either the constant
-LDAP_SUCCESS if the operation was successful, or another LDAP result
-code if it was not. See the section below on error handling for more
-information about possible errors and how to interpret them.
-
-Note that if an LDAPv2 server is contacted, no other operations over the
-connection can be attempted before a bind call has successfully com-
-pleted.
-
-Subsequent bind calls can be used to re-authenticate over the same con-
-nection, and multistep SASL sequences can be accomplished through a
-sequence of calls to ldap_sasl_bind() or ldap_sasl_bind_s().
-
-
-11.5.  Closing the session
-
-The following functions are used to unbind from the directory, close
-open connections, and dispose of the session handle.
-
-           int ldap_unbind_ext( LDAP *ld, LDAPControl **serverctrls,
-                   LDAPControl **clientctrls );
-
-
-
-Expires: May 2001                                              [Page 27]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-           int ldap_unbind( LDAP *ld );
-
-           int ldap_unbind_s( LDAP *ld );
-
-Parameters are:
-
-ld           The session handle.
-
-serverctrls  List of LDAP server controls, or NULL if no server controls
-             are to be used.
-
-clientctrls  List of client controls, or NULL if no client controls are
-             to be used.
-
-The ldap_unbind_ext(), ldap_unbind() and ldap_unbind_s() all work syn-
-chronously in the sense that they send an unbind request to the server,
-close all open connections associated with the LDAP session handle, and
-dispose of all resources associated with the session handle before
-returning.  Note, however, that there is no server response to an LDAP
-unbind operation.  All three of the unbind functions return LDAP_SUCCESS
-(or another LDAP result code if the request cannot be sent to the LDAP
-server).  After a call to one of the unbind functions, the session han-
-dle ld is invalid and it is illegal to make any further LDAP API calls
-using ld.
-
-The ldap_unbind() and ldap_unbind_s() functions behave identically.  The
-ldap_unbind_ext() function allows server and client controls to be
-included explicitly, but note that since there is no server response to
-an unbind request there is no way to receive a response to a server con-
-trol sent with an unbind request.
-
-
-
-11.6.  Searching
-
-The following functions are used to search the LDAP directory, returning
-a requested set of attributes for each entry matched.  There are five
-variations.
-
-           int ldap_search_ext(
-                   LDAP            *ld,
-                   const char      *base,
-                   int             scope,
-                   const char      *filter,
-                   char            **attrs,
-                   int             attrsonly,
-                   LDAPControl     **serverctrls,
-                   LDAPControl     **clientctrls,
-
-
-
-Expires: May 2001                                              [Page 28]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-                   struct timeval  *timeout,
-                   int             sizelimit,
-                   int             *msgidp
-           );
-
-           int ldap_search_ext_s(
-                   LDAP            *ld,
-                   const char      *base,
-                   int             scope,
-                   const char      *filter,
-                   char            **attrs,
-                   int             attrsonly,
-                   LDAPControl     **serverctrls,
-                   LDAPControl     **clientctrls,
-                   struct timeval  *timeout,
-                   int             sizelimit,
-                   LDAPMessage     **res
-           );
-
-           int ldap_search(
-                   LDAP            *ld,
-                   const char      *base,
-                   int             scope,
-                   const char      *filter,
-                   char            **attrs,
-                   int             attrsonly
-           );
-
-           int ldap_search_s(
-                   LDAP            *ld,
-                   const char      *base,
-                   int             scope,
-                   const char      *filter,
-                   char            **attrs,
-                   int             attrsonly,
-                   LDAPMessage     **res
-           );
-
-           int ldap_search_st(
-                   LDAP            *ld,
-                   const char      *base,
-                   int             scope,
-                   const char      *filter,
-                   char            **attrs,
-                   int             attrsonly,
-                   struct timeval  *timeout,
-                   LDAPMessage     **res
-           );
-
-
-
-Expires: May 2001                                              [Page 29]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-Parameters are:
-
-ld           The session handle.
-
-base         The dn of the entry at which to start the search.  If NULL,
-             a zero length DN is sent to the server.
-
-scope        One of LDAP_SCOPE_BASE (0x00), LDAP_SCOPE_ONELEVEL (0x01),
-             or LDAP_SCOPE_SUBTREE (0x02), indicating the scope of the
-             search.
-
-filter       A character string as described in [13], representing the
-             search filter.  The value NULL can be passed to indicate
-             that the filter "(objectclass=*)" which matches all entries
-             is to be used.  Note that if the caller of the API is using
-             LDAPv2, only a subset of the filter functionality described
-             in [13] can be successfully used.
-
-attrs        A NULL-terminated array of strings indicating which attri-
-             butes to return for each matching entry. Passing NULL for
-             this parameter causes all available user attributes to be
-             retrieved.  The special constant string LDAP_NO_ATTRS
-             ("1.1") MAY be used as the only string in the array to
-             indicate that no attribute types are to be returned by the
-             server.  The special constant string LDAP_ALL_USER_ATTRS
-             ("*") can be used in the attrs array along with the names
-             of some operational attributes to indicate that all user
-             attributes plus the listed operational attributes are to be
-             returned.
-
-attrsonly    A boolean value that MUST be zero if both attribute types
-             and values are to be returned, and non-zero if only types
-             are wanted.
-
-timeout      For the ldap_search_st() function, this specifies the local
-             search timeout value (if it is NULL, the timeout is infin-
-             ite).  If a zero timeout (where tv_sec and tv_usec are both
-             zero) is passed, API implementations SHOULD return
-             LDAP_PARAM_ERROR.
-
-             For the ldap_search_ext() and ldap_search_ext_s() func-
-             tions, the timeout parameter specifies both the local
-             search timeout value and the operation time limit that is
-             sent to the server within the search request.  Passing a
-             NULL value for timeout causes the default timeout stored in
-             the LDAP session handle (set by using ldap_set_option()
-             with the LDAP_OPT_TIMELIMIT parameter) to be sent to the
-             server with the request but an infinite local search
-
-
-
-Expires: May 2001                                              [Page 30]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-             timeout to be used.  If a zero timeout (where tv_sec and
-             tv_usec are both zero) is passed in, API implementations
-             SHOULD return LDAP_PARAM_ERROR.  If a zero value for tv_sec
-             is used but tv_usec is non-zero, an operation time limit of
-             1 SHOULD be passed to the LDAP server as the operation time
-             limit.  For other values of tv_sec, the tv_sec value itself
-             SHOULD be passed to the LDAP server.
-
-sizelimit    For the ldap_search_ext() and ldap_search_ext_s() calls,
-             this is a limit on the number of entries to return from the
-             search.  A value of LDAP_NO_LIMIT (0) means no limit.  A
-             value of LDAP_DEFAULT_SIZELIMIT (-1) means use the default
-             timeout from the LDAP session handle (which is set by cal-
-             ling ldap_set_option() with the LDAP_OPT_SIZELIMIT parame-
-             ter).
-
-res          For the synchronous calls, this is a result parameter which
-             will contain the results of the search upon completion of
-             the call.  If an API error occurs or no results are
-             returned, *res is set to NULL.
-
-serverctrls  List of LDAP server controls, or NULL if no server controls
-             are to be used.
-
-clientctrls  List of client controls, or NULL if no client controls are
-             to be used.
-
-msgidp       This result parameter will be set to the message id of the
-             request if the ldap_search_ext() call succeeds. The value
-             is undefined if a value other than LDAP_SUCCESS is
-             returned.
-
-There are three options in the session handle ld which potentially
-affect how the search is performed. They are:
-
-        LDAP_OPT_SIZELIMIT
-        LDAP_OPT_TIMELIMIT
-        LDAP_OPT_DEREF
-
-These options are fully described in the earlier section "LDAP Session
-Handle Options."
-
-The ldap_search_ext() function initiates an asynchronous search opera-
-tion and returns the constant LDAP_SUCCESS if the request was success-
-fully sent, or another LDAP result code if not.  See the section below
-on error handling for more information about possible errors and how to
-interpret them.  If successful, ldap_search_ext() places the message id
-of the request in *msgidp. A subsequent call to ldap_result(), described
-
-
-
-Expires: May 2001                                              [Page 31]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-below, can be used to obtain the results from the search.  These results
-can be parsed using the result parsing routines described in detail
-later.
-
-Similar to ldap_search_ext(), the ldap_search() function initiates an
-asynchronous search operation and returns the message id of the opera-
-tion initiated.  As for ldap_search_ext(), a subsequent call to
-ldap_result(), described below, can be used to obtain the result of the
-bind. In case of error, ldap_search() will return -1, setting the ses-
-sion error parameters in the LDAP structure appropriately.
-
-The synchronous ldap_search_ext_s(), ldap_search_s(), and
-ldap_search_st() functions all return the result of the operation,
-either the constant LDAP_SUCCESS if the operation was successful, or
-another LDAP result code if it was not. See the section below on error
-handling for more information about possible errors and how to interpret
-them.  Entries returned from the search (if any) are contained in the
-res parameter. This parameter is opaque to the caller.  Entries, attri-
-butes, values, etc., can be extracted by calling the parsing routines
-described below. The results contained in res SHOULD be freed when no
-longer in use by calling ldap_msgfree(), described later.
-
-The ldap_search_ext() and ldap_search_ext_s() functions support LDAPv3
-server controls, client controls, and allow varying size and time limits
-to be easily specified for each search operation.  The ldap_search_st()
-function is identical to ldap_search_s() except that it takes an addi-
-tional parameter specifying a local timeout for the search.  The local
-search timeout is used to limit the amount of time the API implementa-
-tion will wait for a search to complete.  After the local search timeout
-expires, the API implementation will send an abandon operation to abort
-the search operation.
-
-11.7.  Reading an Entry
-
-LDAP does not support a read operation directly. Instead, this operation
-is emulated by a search with base set to the DN of the entry to read,
-scope set to LDAP_SCOPE_BASE, and filter set to "(objectclass=*)" or
-NULL. attrs contains the list of attributes to return.
-
-
-11.8.  Listing the Children of an Entry
-
-LDAP does not support a list operation directly. Instead, this operation
-is emulated by a search with base set to the DN of the entry to list,
-scope set to LDAP_SCOPE_ONELEVEL, and filter set to "(objectclass=*)" or
-NULL. attrs contains the list of attributes to return for each child
-entry.
-
-
-
-
-Expires: May 2001                                              [Page 32]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-11.9.  Comparing a Value Against an Entry
-
-The following routines are used to compare a given attribute value
-assertion against an LDAP entry.  There are four variations:
-
-           int ldap_compare_ext(
-                   LDAP                    *ld,
-                   const char              *dn,
-                   const char              *attr,
-                   const struct berval     *bvalue,
-                   LDAPControl             **serverctrls,
-                   LDAPControl             **clientctrls,
-                   int                     *msgidp
-           );
-
-           int ldap_compare_ext_s(
-                   LDAP                    *ld,
-                   const char              *dn,
-                   const char              *attr,
-                   const struct berval     *bvalue,
-                   LDAPControl             **serverctrls,
-                   LDAPControl             **clientctrls
-           );
-
-           int ldap_compare(
-                   LDAP                    *ld,
-                   const char              *dn,
-                   const char              *attr,
-                   const char              *value
-           );
-
-           int ldap_compare_s(
-                   LDAP                    *ld,
-                   const char              *dn,
-                   const char              *attr,
-                   const char              *value
-           );
-
-Parameters are:
-
-ld           The session handle.
-
-dn           The name of the entry to compare against.  If NULL, a zero
-             length DN is sent to the server.
-
-attr         The attribute to compare against.
-
-bvalue       The attribute value to compare against those found in the
-
-
-
-Expires: May 2001                                              [Page 33]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-             given entry. This parameter is used in the extended rou-
-             tines and is a pointer to a struct berval so it is possible
-             to compare binary values.
-
-value        A string attribute value to compare against, used by the
-             ldap_compare() and ldap_compare_s() functions.  Use
-             ldap_compare_ext() or ldap_compare_ext_s() if you need to
-             compare binary values.
-
-serverctrls  List of LDAP server controls, or NULL if no server controls
-             are to be used.
-
-clientctrls  List of client controls, or NULL if no client controls are
-             to be used.
-
-msgidp       This result parameter will be set to the message id of the
-             request if the ldap_compare_ext() call succeeds. The value
-             is undefined if a value other than LDAP_SUCCESS is
-             returned.
-
-The ldap_compare_ext() function initiates an asynchronous compare opera-
-tion and returns the constant LDAP_SUCCESS if the request was success-
-fully sent, or another LDAP result code if not.  See the section below
-on error handling for more information about possible errors and how to
-interpret them.  If successful, ldap_compare_ext() places the message id
-of the request in *msgidp. A subsequent call to ldap_result(), described
-below, can be used to obtain the result of the compare.
-
-Similar to ldap_compare_ext(), the ldap_compare() function initiates an
-asynchronous compare operation and returns the message id of the opera-
-tion initiated.  As for ldap_compare_ext(), a subsequent call to
-ldap_result(), described below, can be used to obtain the result of the
-bind. In case of error, ldap_compare() will return -1, setting the ses-
-sion error parameters in the LDAP structure appropriately.
-
-The synchronous ldap_compare_ext_s() and ldap_compare_s() functions both
-return the result of the operation: one of the constants
-LDAP_COMPARE_TRUE or LDAP_COMPARE_FALSE if the operation was successful,
-or another LDAP result code if it was not.  See the section below on
-error handling for more information about possible errors and how to
-interpret them.
-
-The ldap_compare_ext() and ldap_compare_ext_s() functions support LDAPv3
-server controls and client controls.
-
-
-
-
-
-
-
-Expires: May 2001                                              [Page 34]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-11.10.  Modifying an entry
-
-The following routines are used to modify an existing LDAP entry.  There
-are four variations:
-
-           typedef union mod_vals_u {
-                   char            **modv_strvals;
-                   struct berval   **modv_bvals;
-           } mod_vals_u_t;
-
-           typedef struct ldapmod {
-                   int             mod_op;
-                   char            *mod_type;
-                   mod_vals_u_t    mod_vals;
-           } LDAPMod;
-           #define mod_values      mod_vals.modv_strvals
-           #define mod_bvalues     mod_vals.modv_bvals
-
-           int ldap_modify_ext(
-                   LDAP            *ld,
-                   const char      *dn,
-                   LDAPMod         **mods,
-                   LDAPControl     **serverctrls,
-                   LDAPControl     **clientctrls,
-                   int             *msgidp
-           );
-
-           int ldap_modify_ext_s(
-                   LDAP            *ld,
-                   const char      *dn,
-                   LDAPMod         **mods,
-                   LDAPControl     **serverctrls,
-                   LDAPControl     **clientctrls
-           );
-
-           int ldap_modify(
-                   LDAP            *ld,
-                   const char      *dn,
-                   LDAPMod         **mods
-           );
-
-           int ldap_modify_s(
-                   LDAP            *ld,
-                   const char      *dn,
-                   LDAPMod         **mods
-           );
-
-Parameters are:
-
-
-
-Expires: May 2001                                              [Page 35]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-ld           The session handle.
-
-dn           The name of the entry to modify.  If NULL, a zero length DN
-             is sent to the server.
-
-mods         A NULL-terminated array of modifications to make to the
-             entry.
-
-serverctrls  List of LDAP server controls, or NULL if no server controls
-             are to be used.
-
-clientctrls  List of client controls, or NULL if no client controls are
-             to be used.
-
-msgidp       This result parameter will be set to the message id of the
-             request if the ldap_modify_ext() call succeeds. The value
-             is undefined if a value other than LDAP_SUCCESS is
-             returned.
-
-The fields in the LDAPMod structure have the following meanings:
-
-mod_op       The modification operation to perform. It MUST be one of
-             LDAP_MOD_ADD (0x00), LDAP_MOD_DELETE (0x01), or
-             LDAP_MOD_REPLACE (0x02).  This field also indicates the
-             type of values included in the mod_vals union. It is logi-
-             cally ORed with LDAP_MOD_BVALUES (0x80) to select the
-             mod_bvalues form. Otherwise, the mod_values form is used.
-
-mod_type     The type of the attribute to modify.
-
-mod_vals     The values (if any) to add, delete, or replace. Only one of
-             the mod_values or mod_bvalues variants can be used,
-             selected by ORing the mod_op field with the constant
-             LDAP_MOD_BVALUES. mod_values is a NULL-terminated array of
-             zero-terminated strings and mod_bvalues is a NULL-
-             terminated array of berval structures that can be used to
-             pass binary values such as images.
-
-For LDAP_MOD_ADD modifications, the given values are added to  the
-entry, creating the attribute if necessary.
-
-For LDAP_MOD_DELETE modifications, the given values are deleted from the
-entry, removing the attribute if no values remain. If the entire attri-
-bute is to be deleted, the mod_vals field can be set to NULL.
-
-For LDAP_MOD_REPLACE modifications, the attribute will have the listed
-values after the modification, having been created if necessary, or
-removed if the mod_vals field is NULL. All modifications are performed
-
-
-
-Expires: May 2001                                              [Page 36]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-in the order in which they are listed.
-
-The ldap_modify_ext() function initiates an asynchronous modify opera-
-tion and returns the constant LDAP_SUCCESS if the request was success-
-fully sent, or another LDAP result code if not.  See the section below
-on error handling for more information about possible errors and how to
-interpret them.  If successful, ldap_modify_ext() places the message id
-of the request in *msgidp. A subsequent call to ldap_result(), described
-below, can be used to obtain the result of the modify.
-
-Similar to ldap_modify_ext(), the ldap_modify() function initiates an
-asynchronous modify operation and returns the message id of the opera-
-tion initiated.  As for ldap_modify_ext(), a subsequent call to
-ldap_result(), described below, can be used to obtain the result of the
-modify. In case of error, ldap_modify() will return -1, setting the ses-
-sion error parameters in the LDAP structure appropriately.
-
-The synchronous ldap_modify_ext_s() and ldap_modify_s() functions both
-return the result of the operation, either the constant LDAP_SUCCESS if
-the operation was successful, or another LDAP result code if it was not.
-See the section below on error handling for more information about pos-
-sible errors and how to interpret them.
-
-The ldap_modify_ext() and ldap_modify_ext_s() functions support LDAPv3
-server controls and client controls.
-
-
-11.11.  Modifying the Name of an Entry
-
-In LDAPv2, the ldap_modrdn(), ldap_modrdn_s(), ldap_modrdn2(), and
-ldap_modrdn2_s() routines were used to change the name of an LDAP entry.
-They could only be used to change the least significant component of a
-name (the RDN or relative distinguished name). LDAPv3 provides the
-Modify DN protocol operation that allows more general name change
-access. The ldap_rename() and ldap_rename_s() routines are used to
-change the name of an entry, and the use of the ldap_modrdn(),
-ldap_modrdn_s(), ldap_modrdn2(), and ldap_modrdn2_s() routines is depre-
-cated.
-
-           int ldap_rename(
-                   LDAP            *ld,
-                   const char      *dn,
-                   const char      *newrdn,
-                   const char      *newparent,
-                   int             deleteoldrdn,
-                   LDAPControl     **serverctrls,
-                   LDAPControl     **clientctrls,
-                   int             *msgidp
-
-
-
-Expires: May 2001                                              [Page 37]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-           );
-           int ldap_rename_s(
-                   LDAP            *ld,
-                   const char      *dn,
-                   const char      *newrdn,
-                   const char      *newparent,
-                   int             deleteoldrdn,
-                   LDAPControl     **serverctrls,
-                   LDAPControl     **clientctrls
-           );
-
-   The use of the following routines is deprecated and more complete
-   descriptions can be found in RFC 1823:
-
-           int ldap_modrdn(
-                   LDAP            *ld,
-                   const char      *dn,
-                   const char      *newrdn
-           );
-           int ldap_modrdn_s(
-                   LDAP            *ld,
-                   const char      *dn,
-                   const char      *newrdn
-           );
-           int ldap_modrdn2(
-                   LDAP            *ld,
-                   const char      *dn,
-                   const char      *newrdn,
-                   int             deleteoldrdn
-           );
-           int ldap_modrdn2_s(
-                   LDAP            *ld,
-                   const char      *dn,
-                   const char      *newrdn,
-                   int             deleteoldrdn
-           );
-
-Parameters are:
-
-ld           The session handle.
-
-dn           The name of the entry whose DN is to be changed.  If NULL,
-             a zero length DN is sent to the server.
-
-newrdn       The new RDN to give the entry.
-
-newparent    The new parent, or superior entry.  If this parameter is
-             NULL, only the RDN of the entry is changed.  The root DN
-
-
-
-Expires: May 2001                                              [Page 38]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-             SHOULD be specified by passing a zero length string, "".
-             The newparent parameter SHOULD always be NULL when using
-             version 2 of the LDAP protocol; otherwise the server's
-             behavior is undefined.
-
-deleteoldrdn This parameter only has meaning on the rename routines if
-             newrdn is different than the old RDN. It is a boolean
-             value, if non-zero indicating that the old RDN value(s) is
-             to be removed, if zero indicating that the old RDN value(s)
-             is to be retained as non-distinguished values of the entry.
-
-serverctrls  List of LDAP server controls, or NULL if no server controls
-             are to be used.
-
-clientctrls  List of client controls, or NULL if no client controls are
-             to be used.
-
-msgidp       This result parameter will be set to the message id of the
-             request if the ldap_rename() call succeeds. The value is
-             undefined if a value other than LDAP_SUCCESS is returned.
-
-The ldap_rename() function initiates an asynchronous modify DN operation
-and returns the constant LDAP_SUCCESS if the request was successfully
-sent, or another LDAP result code if not.  See the section below on
-error handling for more information about possible errors and how to
-interpret them.  If successful, ldap_rename() places the DN message id
-of the request in *msgidp. A subsequent call to ldap_result(), described
-below, can be used to obtain the result of the rename.
-
-The synchronous ldap_rename_s() returns the result of the operation,
-either the constant LDAP_SUCCESS if the operation was successful, or
-another LDAP result code if it was not.  See the section below on error
-handling for more information about possible errors and how to interpret
-them.
-
-The ldap_rename() and ldap_rename_s() functions both support LDAPv3
-server controls and client controls.
-
-
-11.12.  Adding an entry
-
-The following functions are used to add entries to the LDAP directory.
-There are four variations:
-
-           int ldap_add_ext(
-                   LDAP            *ld,
-                   const char      *dn,
-                   LDAPMod         **attrs,
-
-
-
-Expires: May 2001                                              [Page 39]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-                   LDAPControl     **serverctrls,
-                   LDAPControl     **clientctrls,
-                   int             *msgidp
-           );
-
-           int ldap_add_ext_s(
-                   LDAP            *ld,
-                   const char      *dn,
-                   LDAPMod         **attrs,
-                   LDAPControl     **serverctrls,
-                   LDAPControl     **clientctrls
-           );
-
-           int ldap_add(
-                   LDAP            *ld,
-                   const char      *dn,
-                   LDAPMod         **attrs
-           );
-
-           int ldap_add_s(
-                   LDAP            *ld,
-                   const char      *dn,
-                   LDAPMod         **attrs
-           );
-
-Parameters are:
-
-ld           The session handle.
-
-dn           The name of the entry to add.  If NULL, a zero length DN is
-             sent to the server.
-
-attrs        The entry's attributes, specified using the LDAPMod struc-
-             ture defined for ldap_modify(). The mod_type and mod_vals
-             fields MUST be filled in.  The mod_op field is ignored
-             unless ORed with the constant LDAP_MOD_BVALUES, used to
-             select the mod_bvalues case of the mod_vals union.
-
-serverctrls  List of LDAP server controls, or NULL if no server controls
-             are to be used.
-
-clientctrls  List of client controls, or NULL if no client controls are
-             to be used.
-
-msgidp       This result parameter will be set to the message id of the
-             request if the ldap_add_ext() call succeeds. The value is
-             undefined if a value other than LDAP_SUCCESS is returned.
-
-
-
-
-Expires: May 2001                                              [Page 40]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-Note that the parent of the entry being added must already exist or the
-parent must be empty (i.e., equal to the root DN) for an add to succeed.
-
-The ldap_add_ext() function initiates an asynchronous add operation and
-returns the constant LDAP_SUCCESS if the request was successfully sent,
-or another LDAP result code if not.  See the section below on error han-
-dling for more information about possible errors and how to interpret
-them.  If successful, ldap_add_ext() places the message id of the
-request in *msgidp. A subsequent call to ldap_result(), described below,
-can be used to obtain the result of the add.
-
-Similar to ldap_add_ext(), the ldap_add() function initiates an asyn-
-chronous add operation and returns the message id of the operation ini-
-tiated.  As for ldap_add_ext(), a subsequent call to ldap_result(),
-described below, can be used to obtain the result of the add. In case of
-error, ldap_add() will return -1, setting the session error parameters
-in the LDAP structure appropriately.
-
-The synchronous ldap_add_ext_s() and ldap_add_s() functions both return
-the result of the operation, either the constant LDAP_SUCCESS if the
-operation was successful, or another LDAP result code if it was not.
-See the section below on error handling for more information about pos-
-sible errors and how to interpret them.
-
-The ldap_add_ext() and ldap_add_ext_s() functions support LDAPv3 server
-controls and client controls.
-
-
-
-11.13.  Deleting an entry
-
-The following functions are used to delete a leaf entry from the LDAP
-directory.  There are four variations:
-
-           int ldap_delete_ext(
-                   LDAP            *ld,
-                   const char      *dn,
-                   LDAPControl     **serverctrls,
-                   LDAPControl     **clientctrls,
-                   int             *msgidp
-           );
-
-           int ldap_delete_ext_s(
-                   LDAP            *ld,
-                   const char      *dn,
-                   LDAPControl     **serverctrls,
-                   LDAPControl     **clientctrls
-           );
-
-
-
-Expires: May 2001                                              [Page 41]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-
-           int ldap_delete(
-                   LDAP            *ld,
-                   const char      *dn
-           );
-
-           int ldap_delete_s(
-                   LDAP            *ld,
-                   const char      *dn
-           );
-
-Parameters are:
-
-ld           The session handle.
-
-dn           The name of the entry to delete.  If NULL, a zero length DN
-             is sent to the server.
-
-serverctrls  List of LDAP server controls, or NULL if no server controls
-             are to be used.
-
-clientctrls  List of client controls, or NULL if no client controls are
-             to be used.
-
-msgidp       This result parameter will be set to the message id of the
-             request if the ldap_delete_ext() call succeeds. The value
-             is undefined if a value other than LDAP_SUCCESS is
-             returned.
-
-Note that the entry to delete must be a leaf entry (i.e., it must have
-no children). Deletion of entire subtrees in a single operation is not
-supported by LDAP.
-
-The ldap_delete_ext() function initiates an asynchronous delete opera-
-tion and returns the constant LDAP_SUCCESS if the request was success-
-fully sent, or another LDAP result code if not.  See the section below
-on error handling for more information about possible errors and how to
-interpret them.  If successful, ldap_delete_ext() places the message id
-of the request in *msgidp. A subsequent call to ldap_result(), described
-below, can be used to obtain the result of the delete.
-
-Similar to ldap_delete_ext(), the ldap_delete() function initiates an
-asynchronous delete operation and returns the message id of the opera-
-tion initiated.  As for ldap_delete_ext(), a subsequent call to
-ldap_result(), described below, can be used to obtain the result of the
-delete. In case of error, ldap_delete() will return -1, setting the ses-
-sion error parameters in the LDAP structure appropriately.
-
-
-
-
-Expires: May 2001                                              [Page 42]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-The synchronous ldap_delete_ext_s() and ldap_delete_s() functions both
-return the result of the operation, either the constant LDAP_SUCCESS if
-the operation was successful, or another LDAP result code if it was not.
-See the section below on error handling for more information about pos-
-sible errors and how to interpret them.
-
-The ldap_delete_ext() and ldap_delete_ext_s() functions support LDAPv3
-server controls and client controls.
-
-
-11.14.  Extended Operations
-
-The ldap_extended_operation() and ldap_extended_operation_s() routines
-allow extended LDAP operations to be passed to the server, providing a
-general protocol extensibility mechanism.
-
-           int ldap_extended_operation(
-                   LDAP                    *ld,
-                   const char              *requestoid,
-                   const struct berval     *requestdata,
-                   LDAPControl             **serverctrls,
-                   LDAPControl             **clientctrls,
-                   int                     *msgidp
-           );
-
-           int ldap_extended_operation_s(
-                   LDAP                    *ld,
-                   const char              *requestoid,
-                   const struct berval     *requestdata,
-                   LDAPControl             **serverctrls,
-                   LDAPControl             **clientctrls,
-                   char                    **retoidp,
-                   struct berval           **retdatap
-           );
-
-Parameters are:
-
-ld           The session handle.
-
-requestoid   The dotted-OID text string naming the request.
-
-requestdata  The arbitrary data needed by the operation (if NULL, no
-             data is sent to the server).
-
-serverctrls  List of LDAP server controls, or NULL if no server controls
-             are to be used.
-
-clientctrls  List of client controls, or NULL if no client controls are
-
-
-
-Expires: May 2001                                              [Page 43]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-             to be used.
-
-msgidp       This result parameter will be set to the message id of the
-             request if the ldap_extended_operation() call succeeds. The
-             value is undefined if a value other than LDAP_SUCCESS is
-             returned.
-
-retoidp      Pointer to a character string that will be set to an allo-
-             cated, dotted-OID text string returned by the server.  This
-             string SHOULD be disposed of using the ldap_memfree() func-
-             tion.  If an API error occurs or no OID is returned by the
-             server, *retoidp is set to NULL.
-
-retdatap     Pointer to a berval structure pointer that will be set an
-             allocated copy of the data returned by the server.  This
-             struct berval SHOULD be disposed of using ber_bvfree().  If
-             an API error occurs or no data is returned by the server,
-             *retdatap is set to NULL.
-
-The ldap_extended_operation() function initiates an asynchronous
-extended operation and returns the constant LDAP_SUCCESS if the request
-was successfully sent, or another LDAP result code if not.  See the sec-
-tion below on error handling for more information about possible errors
-and how to interpret them.  If successful, ldap_extended_operation()
-places the message id of the request in *msgidp. A subsequent call to
-ldap_result(), described below, can be used to obtain the result of the
-extended operation which can be passed to ldap_parse_extended_result()
-to obtain the OID and data contained in the response.
-
-The synchronous ldap_extended_operation_s() function returns the result
-of the operation, either the constant LDAP_SUCCESS if the operation was
-successful, or another LDAP result code if it was not.  See the section
-below on error handling for more information about possible errors and
-how to interpret them.  The retoid and retdata parameters are filled in
-with the OID and data from the response.
-
-The ldap_extended_operation() and ldap_extended_operation_s() functions
-both support LDAPv3 server controls and client controls.
-
-
-12.  Abandoning An Operation
-
-The following calls are used to abandon an operation in progress:
-
-           int ldap_abandon_ext(
-                   LDAP            *ld,
-                   int             msgid,
-                   LDAPControl     **serverctrls,
-
-
-
-Expires: May 2001                                              [Page 44]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-                   LDAPControl     **clientctrls
-           );
-
-           int ldap_abandon(
-                   LDAP            *ld,
-                   int             msgid
-           );
-
-
-ld           The session handle.
-
-msgid        The message id of the request to be abandoned.
-
-serverctrls  List of LDAP server controls, or NULL if no server controls
-             are to be used.
-
-clientctrls  List of client controls, or NULL if no client controls are
-             to be used.
-
-ldap_abandon_ext() abandons the operation with message id msgid and
-returns the constant LDAP_SUCCESS if the abandon was successful or
-another LDAP result code if not.  See the section below on error han-
-dling for more information about possible errors and how to interpret
-them.
-
-ldap_abandon() is identical to ldap_abandon_ext() except that it does
-not accept client or server controls and it returns zero if the abandon
-was successful, -1 otherwise.
-
-After a successful call to ldap_abandon() or ldap_abandon_ext(), results
-with the given message id are never returned from a subsequent call to
-ldap_result().  There is no server response to LDAP abandon operations.
-
-
-13.  Obtaining Results and Peeking Inside LDAP Messages
-
-ldap_result() is used to obtain the result of a previous asynchronously
-initiated operation. Note that depending on how it is called,
-ldap_result() can actually return a list or "chain" of result messages.
-The ldap_result() function only returns messages for a single request,
-so for all LDAP operations other than search only one result message is
-expected; that is, the only time the "result chain" can contain more
-than one message is if results from a search operation are returned.
-Once a chain of messages has been returned to the caller, it is no
-longer tied in any caller-visible way to the LDAP request that produced
-it.  However, it MAY be tied to the session handle.  Therefore, a chain
-of messages returned by calling ldap_result() or by calling a synchro-
-nous search routine will never be affected by subsequent LDAP API calls
-
-
-
-Expires: May 2001                                              [Page 45]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-except for ldap_msgfree() (which is used to dispose of a chain of mes-
-sages) and the unbind calls (which dispose of a session handle):
-ldap_unbind(), ldap_unbind_s(), or ldap_unbind_ext(), or functions
-defined by extensions of this API.
-
-ldap_msgfree() frees the result messages (possibly an entire chain of
-messages) obtained from a previous call to ldap_result() or from a call
-to a synchronous search routine.
-
-ldap_msgtype() returns the type of an LDAP message.
-
-ldap_msgid() returns the message ID of an LDAP message.
-
-           int ldap_result(
-                   LDAP            *ld,
-                   int             msgid,
-                   int             all,
-                   struct timeval  *timeout,
-                   LDAPMessage     **res
-           );
-
-           int ldap_msgfree( LDAPMessage *res );
-
-           int ldap_msgtype( LDAPMessage *res );
-
-           int ldap_msgid( LDAPMessage *res );
-
-Parameters are:
-
-ld       The session handle.
-
-msgid    The message id of the operation whose results are to be
-         returned, the constant LDAP_RES_UNSOLICITED (0) if an unsoli-
-         cited result is desired, or or the constant LDAP_RES_ANY (-1)
-         if any result is desired.
-
-all      Specifies how many messages will be retrieved in a single call
-         to ldap_result().  This parameter only has meaning for search
-         results.  Pass the constant LDAP_MSG_ONE (0x00) to retrieve one
-         message at a time.  Pass LDAP_MSG_ALL (0x01) to request that
-         all results of a search be received before returning all
-         results in a single chain.  Pass LDAP_MSG_RECEIVED (0x02) to
-         indicate that all messages retrieved so far are to be returned
-         in the result chain.
-
-timeout  A timeout specifying how long to wait for results to be
-         returned.  A NULL value causes ldap_result() to block until
-         results are available.  A timeout value of zero seconds
-
-
-
-Expires: May 2001                                              [Page 46]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-         specifies a polling behavior.
-
-res      For ldap_result(), a result parameter that will contain the
-         result(s) of the operation. If an API error occurs or no
-         results are returned, *res is set to NULL.  For ldap_msgfree(),
-         the result chain to be freed, obtained from a previous call to
-         ldap_result(), ldap_search_s(), or ldap_search_st().  If res is
-         NULL, nothing is done and ldap_msgfree() returns zero.
-
-Upon successful completion, ldap_result() returns the type of the first
-result returned in the res parameter. This will be one of the following
-constants.
-
-             LDAP_RES_BIND (0x61)
-             LDAP_RES_SEARCH_ENTRY (0x64)
-             LDAP_RES_SEARCH_REFERENCE (0x73)      -- new in LDAPv3
-             LDAP_RES_SEARCH_RESULT (0x65)
-             LDAP_RES_MODIFY (0x67)
-             LDAP_RES_ADD (0x69)
-             LDAP_RES_DELETE (0x6B)
-             LDAP_RES_MODDN (0x6D)
-             LDAP_RES_COMPARE (0x6F)
-             LDAP_RES_EXTENDED (0x78)              -- new in LDAPv3
-
-ldap_result() returns 0 if the timeout expired and -1 if an error
-occurs, in which case the error parameters of the LDAP session handle
-will be set accordingly.
-
-ldap_msgfree() frees each message in the result chain pointed to by res
-and returns the type of the last message in the chain.  If res is NULL,
-nothing is done and the value zero is returned.
-
-ldap_msgtype() returns the type of the LDAP message it is passed as a
-parameter. The type will be one of the types listed above, or -1 on
-error.
-
-ldap_msgid() returns the message ID associated with the LDAP message
-passed as a parameter, or -1 on error.
-
-
-14.  Handling Errors and Parsing Results
-
-The following calls are used to extract information from results and
-handle errors returned by other LDAP API routines.  Note that
-ldap_parse_sasl_bind_result() and ldap_parse_extended_result() must typ-
-ically be used in addition to ldap_parse_result() to retrieve all the
-result information from SASL Bind and Extended Operations respectively.
-
-
-
-
-Expires: May 2001                                              [Page 47]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-           int ldap_parse_result(
-                   LDAP            *ld,
-                   LDAPMessage     *res,
-                   int             *errcodep,
-                   char            **matcheddnp,
-                   char            **errmsgp,
-                   char            ***referralsp,
-                   LDAPControl     ***serverctrlsp,
-                   int             freeit
-           );
-
-           int ldap_parse_sasl_bind_result(
-                   LDAP            *ld,
-                   LDAPMessage     *res,
-                   struct berval   **servercredp,
-                   int             freeit
-           );
-
-           int ldap_parse_extended_result(
-                   LDAP            *ld,
-                   LDAPMessage     *res,
-                   char            **retoidp,
-                   struct berval   **retdatap,
-                   int             freeit
-           );
-
-           #define LDAP_NOTICE_OF_DISCONNECTION    "1.3.6.1.4.1.1466.20036"
-
-           char *ldap_err2string( int err );
-
-   The use of the following routines is deprecated and more complete
-   descriptions can be found in RFC 1823:
-
-           int ldap_result2error(
-                   LDAP            *ld,
-                   LDAPMessage     *res,
-                   int             freeit
-           );
-
-           void ldap_perror( LDAP *ld, const char *msg );
-
-Parameters are:
-
-ld           The session handle.
-
-res          The result of an LDAP operation as returned by
-             ldap_result() or one of the synchronous API operation
-             calls.
-
-
-
-Expires: May 2001                                              [Page 48]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-errcodep     This result parameter will be filled in with the LDAP
-             resultCode field from the LDAPMessage message.  This is the
-             indication from the server of the outcome of the operation.
-             NULL SHOULD be passed to ignore this field.
-
-matcheddnp   If the server returned a matchedDN string to indicate how
-             much of a name passed in a request was recognized, this
-             result parameter will be filled in with that matchedDN
-             string.  Otherwise, this field will be set to NULL.  NULL
-             SHOULD be passed to ignore this field.  The matched DN
-             string SHOULD be freed by calling ldap_memfree() which is
-             described later in this document.  Note that the server may
-             return a zero length matchedDN (in which case *matchednp is
-             set to an allocated copy of "") which is different than not
-             returning a value at all (in which case *matcheddnp is set
-             to NULL).
-
-errmsgp      This result parameter will be filled in with the contents
-             of the error message field from the LDAPMessage message.
-             The error message string SHOULD be freed by calling
-             ldap_memfree() which is described later in this document.
-             NULL SHOULD be passed to ignore this field.
-
-referralsp   This result parameter will be filled in with the contents
-             of the referrals field from the LDAPMessage message, indi-
-             cating zero or more alternate LDAP servers where the
-             request is to be retried.  The referrals array SHOULD be
-             freed by calling ldap_value_free() which is described later
-             in this document.  NULL SHOULD be passed to ignore this
-             field.  If no referrals were returned, *referralsp is set
-             to NULL.
-
-serverctrlsp This result parameter will be filled in with an allocated
-             array of controls copied out of the LDAPMessage message.
-             If serverctrlsp is NULL, no controls are returned.  The
-             control array SHOULD be freed by calling
-             ldap_controls_free() which was described earlier.  If no
-             controls were returned, *serverctrlsp is set to NULL.
-
-freeit       A boolean that determines whether the res parameter is
-             disposed of or not.  Pass any non-zero value to have these
-             routines free res after extracting the requested informa-
-             tion.  This is provided as a convenience; you can also use
-             ldap_msgfree() to free the result later.  If freeit is
-             non-zero, the entire chain of messages represented by res
-             is disposed of.
-
-servercredp  For SASL bind results, this result parameter will be filled
-
-
-
-Expires: May 2001                                              [Page 49]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-             in with the credentials passed back by the server for
-             mutual authentication, if given. An allocated berval struc-
-             ture is returned that SHOULD be disposed of by calling
-             ber_bvfree().  NULL SHOULD be passed to ignore this field.
-
-retoidp      For extended results, this result parameter will be filled
-             in with the dotted-OID text representation of the name of
-             the extended operation response.  This string SHOULD be
-             disposed of by calling ldap_memfree().  NULL SHOULD be
-             passed to ignore this field.  If no OID was returned,
-             *retoidp is set to NULL.  The LDAP_NOTICE_OF_DISCONNECTION
-             macro is defined as a convenience for clients that wish to
-             check an OID to see if it matches the one used for the
-             unsolicited Notice of Disconnection (defined in RFC 2251[2]
-             section 4.4.1).
-
-retdatap     For extended results, this result parameter will be filled
-             in with a pointer to a struct berval containing the data in
-             the extended operation response.  It SHOULD be disposed of
-             by calling ber_bvfree(). NULL SHOULD be passed to ignore
-             this field.  If no data is returned, *retdatap is set to
-             NULL.
-
-err          For ldap_err2string(), an LDAP result code, as returned by
-             ldap_parse_result() or another LDAP API call.
-
-Additional parameters for the deprecated routines are not described.
-Interested readers are referred to RFC 1823.
-
-The ldap_parse_result(), ldap_parse_sasl_bind_result(), and
-ldap_parse_extended_result() functions all skip over messages of type
-LDAP_RES_SEARCH_ENTRY and LDAP_RES_SEARCH_REFERENCE when looking for a
-result message to parse.  They return the constant LDAP_SUCCESS if the
-result was successfully parsed and another LDAP API result code if not.
-If a value other than LDAP_SUCCESS is returned, the values of all the
-result parameters are undefined.  Note that the LDAP result code that
-indicates the outcome of the operation performed by the server is placed
-in the errcodep ldap_parse_result() parameter.  If a chain of messages
-that contains more than one result message is passed to these routines
-they always operate on the first result in the chain.
-
-ldap_err2string() is used to convert a numeric LDAP result code, as
-returned by ldap_parse_result(), ldap_parse_sasl_bind_result(),
-ldap_parse_extended_result() or one of the synchronous API operation
-calls, into an informative zero-terminated character string message
-describing the error.  It returns a pointer to static data and it MUST
-NOT return NULL; the value returned is always a valid null-terminated
-"C" string.
-
-
-
-Expires: May 2001                                              [Page 50]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-15.  Stepping Through a List of Results
-
-The ldap_first_message() and ldap_next_message() routines are used to
-step through the list of messages in a result chain returned by
-ldap_result().  For search operations, the result chain can actually
-include referral messages, entry messages, and result messages.
-ldap_count_messages() is used to count the number of messages returned.
-The ldap_msgtype() function, described above, can be used to distinguish
-between the different message types.
-
-           LDAPMessage *ldap_first_message( LDAP *ld, LDAPMessage *res );
-
-           LDAPMessage *ldap_next_message( LDAP *ld, LDAPMessage *msg );
-
-           int ldap_count_messages( LDAP *ld, LDAPMessage *res );
-
-Parameters are:
-
-ld     The session handle.
-
-res    The result chain, as obtained by a call to one of the synchronous
-       search routines or ldap_result().
-
-msg    The message returned by a previous call to ldap_first_message()
-       or ldap_next_message().
-
-ldap_first_message() and ldap_next_message() will return NULL when no
-more messages exist in the result set to be returned.  NULL is also
-returned if an error occurs while stepping through the entries, in which
-case the error parameters in the session handle ld will be set to indi-
-cate the error.
-
-If successful, ldap_count_messages() returns the number of messages con-
-tained in a chain of results; if an error occurs such as the res parame-
-ter being invalid, -1 is returned.  The ldap_count_messages() call can
-also be used to count the number of messages that remain in a chain if
-called with a message, entry, or reference returned by
-ldap_first_message(), ldap_next_message(), ldap_first_entry(),
-ldap_next_entry(), ldap_first_reference(), ldap_next_reference().
-
-
-16.  Parsing Search Results
-
-The following calls are used to parse the entries and references
-returned by ldap_search() and friends. These results are returned in an
-opaque structure that MAY be accessed by calling the routines described
-below. Routines are provided to step through the entries and references
-returned, step through the attributes of an entry, retrieve the name of
-
-
-
-Expires: May 2001                                              [Page 51]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-an entry, and retrieve the values associated with a given attribute in
-an entry.
-
-
-16.1.  Stepping Through a List of Entries or References
-
-The ldap_first_entry() and ldap_next_entry() routines are used to step
-through and retrieve the list of entries from a search result chain.
-The ldap_first_reference() and ldap_next_reference() routines are used
-to step through and retrieve the list of continuation references from a
-search result chain.  ldap_count_entries() is used to count the number
-of entries returned. ldap_count_references() is used to count the number
-of references returned.
-
-           LDAPMessage *ldap_first_entry( LDAP *ld, LDAPMessage *res );
-
-           LDAPMessage *ldap_next_entry( LDAP *ld, LDAPMessage *entry );
-
-           LDAPMessage *ldap_first_reference( LDAP *ld, LDAPMessage *res );
-
-           LDAPMessage *ldap_next_reference( LDAP *ld, LDAPMessage *ref );
-
-           int ldap_count_entries( LDAP *ld, LDAPMessage *res );
-
-           int ldap_count_references( LDAP *ld, LDAPMessage *res );
-
-Parameters are:
-
-ld     The session handle.
-
-res    The search result, as obtained by a call to one of the synchro-
-       nous search routines or ldap_result().
-
-entry  The entry returned by a previous call to ldap_first_entry() or
-       ldap_next_entry().
-
-ref    The reference returned by a previous call to
-       ldap_first_reference() or ldap_next_reference().
-
-ldap_first_entry(), ldap_next_entry(), ldap_first_reference() and
-ldap_next_reference() all return NULL when no more entries or references
-exist in the result set to be returned.  NULL is also returned if an
-error occurs while stepping through the entries or references, in which
-case the error parameters in the session handle ld will be set to indi-
-cate the error.
-
-ldap_count_entries() returns the number of entries contained in a chain
-of entries; if an error occurs such as the res parameter being invalid,
-
-
-
-Expires: May 2001                                              [Page 52]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
--1 is returned.  The ldap_count_entries() call can also be used to count
-the number of entries that remain in a chain if called with a message,
-entry or reference returned by ldap_first_message(),
-ldap_next_message(), ldap_first_entry(), ldap_next_entry(),
-ldap_first_reference(), ldap_next_reference().
-
-ldap_count_references() returns the number of references contained in a
-chain of search results; if an error occurs such as the res parameter
-being invalid, -1 is returned.  The ldap_count_references() call can
-also be used to count the number of references that remain in a chain.
-
-
-16.2.  Stepping Through the Attributes of an Entry
-
-The ldap_first_attribute() and ldap_next_attribute() calls are used to
-step through the list of attribute types returned with an entry.
-
-           char *ldap_first_attribute(
-                   LDAP            *ld,
-                   LDAPMessage     *entry,
-                   BerElement      **ptr
-           );
-
-           char *ldap_next_attribute(
-                   LDAP            *ld,
-                   LDAPMessage     *entry,
-                   BerElement      *ptr
-           );
-
-           void ldap_memfree( char *mem );
-
-Parameters are:
-
-ld     The session handle.
-
-entry  The entry whose attributes are to be stepped through, as returned
-       by ldap_first_entry() or ldap_next_entry().
-
-ptr    In ldap_first_attribute(), the address of a pointer used inter-
-       nally to keep track of the current position in the entry. In
-       ldap_next_attribute(), the pointer returned by a previous call to
-       ldap_first_attribute().  The BerElement type itself is an opaque
-       structure that is described in more detail later in this document
-       in the section "Encoded ASN.1 Value Manipulation".
-
-mem    A pointer to memory allocated by the LDAP library, such as the
-       attribute type names returned by ldap_first_attribute() and
-       ldap_next_attribute, or the DN returned by ldap_get_dn().  If mem
-
-
-
-Expires: May 2001                                              [Page 53]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-       is NULL, the ldap_memfree() call does nothing.
-
-ldap_first_attribute() and ldap_next_attribute() will return NULL when
-the end of the attributes is reached, or if there is an error, in which
-case the error parameters in the session handle ld will be set to indi-
-cate the error.
-
-Both routines return a pointer to an allocated buffer containing the
-current attribute name. This SHOULD be freed when no longer in use by
-calling ldap_memfree().
-
-ldap_first_attribute() will allocate and return in ptr a pointer to a
-BerElement used to keep track of the current position. This pointer MAY
-be passed in subsequent calls to ldap_next_attribute() to step through
-the entry's attributes. After a set of calls to ldap_first_attribute()
-and ldap_next_attribute(), if ptr is non-NULL, it SHOULD be freed by
-calling ber_free( ptr, 0 ). Note that it is very important to pass the
-second parameter as 0 (zero) in this call, since the buffer associated
-with the BerElement does not point to separately allocated memory.
-
-The attribute type names returned are suitable for passing in a call to
-ldap_get_values() and friends to retrieve the associated values.
-
-
-16.3.  Retrieving the Values of an Attribute
-
-ldap_get_values() and ldap_get_values_len() are used to retrieve the
-values of a given attribute from an entry. ldap_count_values() and
-ldap_count_values_len() are used to count the returned values.
-ldap_value_free() and ldap_value_free_len() are used to free the values.
-
-           char **ldap_get_values(
-                   LDAP            *ld,
-                   LDAPMessage     *entry,
-                   const char      *attr
-           );
-
-           struct berval **ldap_get_values_len(
-                   LDAP            *ld,
-                   LDAPMessage     *entry,
-                   const char      *attr
-           );
-
-           int ldap_count_values( char **vals );
-
-           int ldap_count_values_len( struct berval **vals );
-
-           void ldap_value_free( char **vals );
-
-
-
-Expires: May 2001                                              [Page 54]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-           void ldap_value_free_len( struct berval **vals );
-
-Parameters are:
-
-ld     The session handle.
-
-entry  The entry from which to retrieve values, as returned by
-       ldap_first_entry() or ldap_next_entry().
-
-attr   The attribute whose values are to be retrieved, as returned by
-       ldap_first_attribute() or ldap_next_attribute(), or a caller-
-       supplied string (e.g., "mail").
-
-vals   The values returned by a previous call to ldap_get_values() or
-       ldap_get_values_len().
-
-Two forms of the various calls are provided. The first form is only
-suitable for use with non-binary character string data. The second _len
-form is used with any kind of data.
-
-ldap_get_values() and ldap_get_values_len() return NULL if no values are
-found for attr or if an error occurs.
-
-ldap_count_values() and ldap_count_values_len() return -1 if an error
-occurs such as the vals parameter being invalid.
-
-If a NULL vals parameter is passed to ldap_value_free() or
-ldap_value_free_len(), nothing is done.
-
-Note that the values returned are dynamically allocated and SHOULD be
-freed by calling either ldap_value_free() or ldap_value_free_len() when
-no longer in use.
-
-
-16.4.  Retrieving the name of an entry
-
-ldap_get_dn() is used to retrieve the name of an entry.
-ldap_explode_dn() and ldap_explode_rdn() are used to break up a name
-into its component parts. ldap_dn2ufn() is used to convert the name into
-a more "user friendly" format.
-
-           char *ldap_get_dn( LDAP *ld, LDAPMessage *entry );
-
-           char **ldap_explode_dn( const char *dn, int notypes );
-
-           char **ldap_explode_rdn( const char *rdn, int notypes );
-
-           char *ldap_dn2ufn( const char *dn );
-
-
-
-Expires: May 2001                                              [Page 55]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-Parameters are:
-
-ld      The session handle.
-
-entry   The entry whose name is to be retrieved, as returned by
-        ldap_first_entry() or ldap_next_entry().
-
-dn      The dn to explode, such as returned by ldap_get_dn().  If NULL,
-        a zero length DN is used.
-
-rdn     The rdn to explode, such as returned in the components of the
-        array returned by ldap_explode_dn().  If NULL, a zero length DN
-        is used.
-
-notypes A boolean parameter, if non-zero indicating that the dn or rdn
-        components are to have their type information stripped off
-        (i.e., "cn=Babs" would become "Babs").
-
-ldap_get_dn() will return NULL if there is some error parsing the dn,
-setting error parameters in the session handle ld to indicate the error.
-It returns a pointer to newly allocated space that the caller SHOULD
-free by calling ldap_memfree() when it is no longer in use.  Note the
-format of the DNs returned is given by [5].  The root DN is returned as
-a zero length string ("").
-
-ldap_explode_dn() returns a NULL-terminated char * array containing the
-RDN components of the DN supplied, with or without types as indicated by
-the notypes parameter. The components are returned in the order they
-appear in the dn.  The array returned SHOULD be freed when it is no
-longer in use by calling ldap_value_free().
-
-ldap_explode_rdn() returns a NULL-terminated char * array containing the
-components of the RDN supplied, with or without types as indicated by
-the notypes parameter. The components are returned in the order they
-appear in the rdn.  The array returned SHOULD be freed when it is no
-longer in use by calling ldap_value_free().
-
-ldap_dn2ufn() converts the DN into the user friendly format described in
-[14]. The UFN returned is newly allocated space that SHOULD be freed by
-a call to ldap_memfree() when no longer in use.
-
-
-16.5.  Retrieving controls from an entry
-
-ldap_get_entry_controls() is used to extract LDAP controls from an
-entry.
-
-
-
-
-
-Expires: May 2001                                              [Page 56]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-           int ldap_get_entry_controls(
-                   LDAP            *ld,
-                   LDAPMessage     *entry,
-                   LDAPControl     ***serverctrlsp
-           );
-
-Parameters are:
-
-ld           The session handle.
-
-entry        The entry to extract controls from, as returned by
-             ldap_first_entry() or ldap_next_entry().
-
-serverctrlsp This result parameter will be filled in with an allocated
-             array of controls copied out of entry. The control array
-             SHOULD be freed by calling ldap_controls_free().  If ser-
-             verctrlsp is NULL, no controls are returned.  If no con-
-             trols were returned, *serverctrlsp is set to NULL.
-
-ldap_get_entry_controls() returns an LDAP result code that indicates
-whether the reference could be successfully parsed (LDAP_SUCCESS if all
-goes well). If ldap_get_entry_controls() returns a value other than
-LDAP_SUCCESS, the value of the serverctrlsp output parameter is unde-
-fined.
-
-
-
-16.6.  Parsing References
-
-ldap_parse_reference() is used to extract referrals and controls from a
-SearchResultReference message.
-
-
-           int ldap_parse_reference(
-                   LDAP            *ld,
-                   LDAPMessage     *ref,
-                   char            ***referralsp,
-                   LDAPControl     ***serverctrlsp,
-                   int             freeit
-           );
-
-Parameters are:
-
-ld           The session handle.
-
-ref          The reference to parse, as returned by ldap_result(),
-             ldap_first_reference(), or ldap_next_reference().
-
-
-
-
-Expires: May 2001                                              [Page 57]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-referralsp   This result parameter will be filled in with an allocated
-             array of character strings.  The elements of the array are
-             the referrals (typically LDAP URLs) contained in ref.  The
-             array SHOULD be freed when no longer in used by calling
-             ldap_value_free().  If referralsp is NULL, the referral
-             URLs are not returned.  If no referrals were returned,
-             *referralsp is set to NULL.
-
-serverctrlsp This result parameter will be filled in with an allocated
-             array of controls copied out of ref. The control array
-             SHOULD be freed by calling ldap_controls_free().  If ser-
-             verctrlsp is NULL, no controls are returned.  If no con-
-             trols were returned, *serverctrlsp is set to NULL.
-
-freeit       A boolean that determines whether the ref parameter is
-             disposed of or not.  Pass any non-zero value to have this
-             routine free ref after extracting the requested informa-
-             tion.  This is provided as a convenience; you can also use
-             ldap_msgfree() to free the result later.
-
-ldap_parse_reference() returns an LDAP result code that indicates
-whether the reference could be successfully parsed (LDAP_SUCCESS if all
-goes well).  If a value other than LDAP_SUCCESS is returned, the value
-of the referralsp and serverctrlsp result parameters are undefined.
-
-
-
-17.  Encoded ASN.1 Value Manipulation
-
-This section describes routines which MAY be used to encode and decode
-BER-encoded ASN.1 values, which are often used inside of control and
-extension values.
-
-With the exceptions of two new functions ber_flatten() and ber_init(),
-these functions are compatible with the University of Michigan LDAP 3.3
-implementation of BER.
-
-Note that the functions defined in this section all provide a method for
-determining success or failure but generally do not provide access to
-specific error codes.  Therefore, applications that require precise
-error information when encoding or decoding ASN.1 values SHOULD NOT use
-these functions.
-
-
-17.1.  BER Data Structures and Types
-
-The following additional integral types are defined for use in manipula-
-tion of BER encoded ASN.1 values:
-
-
-
-Expires: May 2001                                              [Page 58]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-       typedef <impl_tag_t> ber_tag_t;     /* for BER tags */
-
-       typedef <impl_int_t> ber_int_t;     /* for BER ints, enums, and Booleans */
-
-       typedef <impl_unit_t> ber_uint_t;   /* unsigned equivalent of ber_uint_t */
-
-       typedef <impl_slen_t> ber_slen_t;   /* signed equivalent of ber_len_t */
-
-Note that the actual definition for these four integral types is imple-
-mentation specific; that is, `<impl_tag_t>', `<impl_int_t>',
-`<impl_uint_t>', and `<impl_slen_t>' MUST each be replaced with an
-appropriate implementation-specific type.
-
-The `ber_tag_t' type is an unsigned integral data type that is large
-enough to hold the largest BER tag supported by the API implementation.
-The width (number of significant bits) of `ber_tag_t' MUST be at least
-32, greater than or equal to that of `unsigned int' (so that integer
-promotions won't promote it to `int'), and no wider than that of
-`unsigned long'.
-
-The `ber_int_t' and `ber_uint_t' types are the signed and unsigned vari-
-ants of an integral type that is large enough to hold integers for pur-
-poses of BER encoding and decoding.  The width of `ber_int_t' MUST be at
-least 32 and no larger than that of `long'.
-
-The `ber_slen_t' type is the signed variant of the `ber_len_t' integral
-type, i.e. if `ber_len_t' is unsigned long, then `ber_slen_t' is signed
-long.  The `<impl_slen_t>' in the `ber_len_t' typedef MUST be replaced
-with an appropriate type.  Note that `ber_slen_t' is not used directly
-in the C LDAP API but is provided for the convenience of application
-developers and for use by extensions to the API.
-
-           typedef struct berval {
-                   ber_len_t       bv_len;
-                   char            *bv_val;
-           } BerValue;
-
-As defined earlier in the section "Common Data Structures", a berval
-structure contains an arbitrary sequence of bytes and an indication of
-its length.  The bv_len element is an unsigned integer.  The bv_val is
-not necessarily zero-terminated.  Applications MAY allocate their own
-berval structures.
-
-As defined earlier in the section "Common Data Structures", the BerEle-
-ment structure is an opaque structure:
-
-           typedef struct berelement BerElement;
-
-
-
-
-Expires: May 2001                                              [Page 59]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-It contains not only a copy of the encoded value, but also state infor-
-mation used in encoding or decoding.  Applications cannot allocate their
-own BerElement structures.  The internal state is neither thread-
-specific nor locked, so two threads SHOULD NOT manipulate the same
-BerElement value simultaneously.
-
-A single BerElement value cannot be used for both encoding and decoding.
-
-17.2.  Memory Disposal and Utility Functions
-
-           void ber_bvfree( struct berval *bv );
-
-ber_bvfree() frees a berval structure returned from this API.  Both the
-bv->bv_val string and the berval structure itself are freed.  If bv is
-NULL, this call does nothing.
-
-           void ber_bvecfree( struct berval **bv );
-
-ber_bvecfree() frees an array of berval structures returned from this
-API.  Each of the berval structures in the array are freed using
-ber_bvfree(), then the array itself is freed.  If bv is NULL, this call
-does nothing.
-
-           struct berval *ber_bvdup( const struct berval *bv );
-
-ber_bvdup() returns a copy of a berval structure.  The bv_val field in
-the returned berval structure points to a different area of memory than
-the bv_val field in the bv argument.  The NULL pointer is returned on
-error (e.g. out of memory).
-
-           void ber_free( BerElement *ber, int fbuf );
-
-ber_free() frees a BerElement which is returned from the API calls
-ber_alloc_t() or ber_init().  Each BerElement SHOULD be freed by the
-caller.  The second argument fbuf SHOULD always be set to 1 to ensure
-that the internal buffer used by the BER functions is freed as well as
-the BerElement container itself.  If ber is NULL, this call does noth-
-ing.
-
-
-17.3.  Encoding
-
-           BerElement *ber_alloc_t( int options );
-
-ber_alloc_t() constructs and returns BerElement.  The NULL pointer is
-returned on error.  The options field contains a bitwise-or of options
-which are to be used when generating the encoding of this BerElement.
-One option is defined and SHOULD always be supplied:
-
-
-
-Expires: May 2001                                              [Page 60]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-           #define LBER_USE_DER 0x01
-
-When this option is present, lengths will always be encoded in the
-minimum number of octets.  Note that this option does not cause values
-of sets to be rearranged in tag and byte order or default values to be
-removed, so these functions are not sufficient for generating DER output
-as defined in X.509 and X.680.  If the caller takes responsibility for
-ordering values of sets correctly and removing default values, DER out-
-put as defined in X.509 and X.680 can be produced.
-
-Unrecognized option bits are ignored.
-
-The BerElement returned by ber_alloc_t() is initially empty.  Calls to
-ber_printf() will append bytes to the end of the ber_alloc_t().
-
-           int ber_printf( BerElement *ber, const char *fmt, ... );
-
-The ber_printf() routine is used to encode a BER element in much the
-same way that sprintf() works.  One important difference, though, is
-that state information is kept in the ber argument so that multiple
-calls can be made to ber_printf() to append to the end of the BER ele-
-ment. ber MUST be a pointer to a BerElement returned by ber_alloc_t().
-ber_printf() interprets and formats its arguments according to the for-
-mat string fmt.  ber_printf() returns -1 if there is an error during
-encoding and a non-negative number if successful.  As with sprintf(),
-each character in fmt refers to an argument to ber_printf().
-
-The format string can contain the following format characters:
-
-'t'     Tag.  The next argument is a ber_tag_t specifying the tag to
-        override the next element to be written to the ber.  This works
-        across calls.  The integer tag value SHOULD contain the tag
-        class, constructed bit, and tag value.  For example, a tag of
-        "[3]" for a constructed type is 0xA3U.  All implementations MUST
-        support tags that fit in a single octet (i.e., where the tag
-        value is less than 32) and they MAY support larger tags.
-
-'b'     Boolean.  The next argument is an ber_int_t, containing either 0
-        for FALSE or 0xff for TRUE.  A boolean element is output.  If
-        this format character is not preceded by the 't' format modif-
-        ier, the tag 0x01U is used for the element.
-
-'e'     Enumerated.  The next argument is a ber_int_t, containing the
-        enumerated value in the host's byte order.  An enumerated ele-
-        ment is output.  If this format character is not preceded by the
-        't' format modifier, the tag 0x0AU is used for the element.
-
-'i'     Integer.  The next argument is a ber_int_t, containing the
-
-
-
-Expires: May 2001                                              [Page 61]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-        integer in the host's byte order.  An integer element is output.
-        If this format character is not preceded by the 't' format
-        modifier, the tag 0x02U is used for the element.
-
-'B'     Bitstring.  The next two arguments are a char * pointer to the
-        start of the bitstring, followed by a ber_len_t containing the
-        number of bits in the bitstring.  A bitstring element is output,
-        in primitive form.  If this format character is not preceded by
-        the 't' format modifier, the tag 0x03U is used for the element.
-
-'X'     Reserved and not to be used.  In older revisions of this specif-
-        ication,
-
-'n'     Null.  No argument is needed.  An ASN.1 NULL element is output.
-        If this format character is not preceded by the 't' format
-        modifier, the tag 0x05U is used for the element.
-
-'o'     Octet string.  The next two arguments are a char *, followed by
-        a ber_len_t with the length of the string.  The string MAY con-
-        tain null bytes and are do not have to be zero-terminated.   An
-        octet string element is output, in primitive form.  If this for-
-        mat character is not preceded by the 't' format modifier, the
-        tag 0x04U is used for the element.
-
-'s'     Octet string.  The next argument is a char * pointing to a
-        zero-terminated string.  An octet string element in primitive
-        form is output, which does not include the trailing '\0' (null)
-        byte. If this format character is not preceded by the 't' format
-        modifier, the tag 0x04U is used for the element.
-
-'v'     Several octet strings.  The next argument is a char **, an array
-        of char * pointers to zero-terminated strings.  The last element
-        in the array MUST be a NULL pointer. The octet strings do not
-        include the trailing '\0' (null) byte.  Note that a construct
-        like '{v}' is used to get an actual SEQUENCE OF octet strings.
-        The 't' format modifier cannot be used with this format charac-
-        ter.
-
-'V'     Several octet strings.  A NULL-terminated array of struct berval
-        *'s is supplied.  Note that a construct like '{V}' is used to
-        get an actual SEQUENCE OF octet strings. The 't' format modifier
-        cannot be used with this format character.
-
-'{'     Begin sequence.  No argument is needed.  If this format charac-
-        ter is not preceded by the 't' format modifier, the tag 0x30U is
-        used.
-
-'}'     End sequence.  No argument is needed.  The 't' format modifier
-
-
-
-Expires: May 2001                                              [Page 62]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-        cannot be used with this format character.
-
-'['     Begin set.  No argument is needed.  If this format character is
-        not preceded by the 't' format modifier, the tag 0x31U is used.
-
-']'     End set.  No argument is needed.  The 't' format modifier cannot
-        be used with this format character.
-
-Each use of a '{' format character SHOULD be matched by a '}' character,
-either later in the format string, or in the format string of a subse-
-quent call to ber_printf() for that BerElement.  The same applies to the
-'[' and ']' format characters.
-
-Sequences and sets nest, and implementations of this API MUST maintain
-internal state to be able to properly calculate the lengths.
-
-           int ber_flatten( BerElement *ber, struct berval **bvPtr );
-
-The ber_flatten routine allocates a struct berval whose contents are a
-BER encoding taken from the ber argument. The bvPtr pointer points to
-the returned berval structure, which SHOULD be freed using ber_bvfree().
-This routine returns 0 on success and -1 on error.
-
-The ber_flatten API call is not present in U-M LDAP 3.3.
-
-The use of ber_flatten on a BerElement in which all '{' and '}' format
-modifiers have not been properly matched is an error (i.e., -1 will be
-returned by ber_flatten() if this situation is exists).
-
-
-17.4.  Encoding Example
-
-The following is an example of encoding the following ASN.1 data type:
-
-      Example1Request ::= SEQUENCE {
-           s     OCTET STRING, -- must be printable
-           val1  INTEGER,
-           val2  [0] INTEGER DEFAULT 0
-      }
-
-
-      int encode_example1(const char *s, ber_int_t val1, ber_int_t val2,
-               struct berval **bvPtr)
-      {
-           BerElement *ber;
-           int rc = -1;
-
-           *bvPtr = NULL;  /* in case of error */
-
-
-
-Expires: May 2001                                              [Page 63]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-           ber = ber_alloc_t(LBER_USE_DER);
-
-           if (ber == NULL) return -1;
-
-           if (ber_printf(ber,"{si",s,val1) == -1) {
-                   goto done;
-           }
-
-           if (val2 != 0) {
-                   if (ber_printf(ber,"ti",(ber_tag_t)0x80,val2) == -1) {
-                           goto done;
-                   }
-           }
-
-           if (ber_printf(ber,"}") == -1) {
-                   goto done;
-           }
-
-           rc = ber_flatten(ber,bvPtr);
-
-   done:
-           ber_free(ber,1);
-           return rc;
-      }
-
-
-17.5.  Decoding
-
-The following two macros are available to applications: LBER_ERROR and
-LBER_DEFAULT.  Both of these macros MUST be #define'd as ber_tag_t
-integral values that are treated as invalid tags by the API implementa-
-tion.  It is RECOMMENDED that the values of LBER_ERROR and LBER_DEFAULT
-be the same and that they be defined as values where all octets have the
-value 0xFF.  ISO C guarantees that these definitions will work:
-
-           #define LBER_ERROR   ((ber_tag_t)-1)
-           #define LBER_DEFAULT ((ber_tag_t)-1)
-
-The intent is that LBER_ERROR and LBER_DEFAULT are both defined as the
-integer value that has all octets set to 0xFF, as such a value is not a
-valid BER tag.
-
-           BerElement *ber_init( const struct berval *bv );
-
-The ber_init function constructs a BerElement and returns a new BerEle-
-ment containing a copy of the data in the bv argument.  ber_init returns
-the NULL pointer on error.
-
-
-
-
-Expires: May 2001                                              [Page 64]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-           ber_tag_t ber_scanf( BerElement *ber, const char *fmt, ... );
-
-The ber_scanf() routine is used to decode a BER element in much the same
-way that sscanf() works.  One important difference, though, is that some
-state information is kept with the ber argument so that multiple calls
-can be made to ber_scanf() to sequentially read from the BER element.
-The ber argument SHOULD be a pointer to a BerElement returned by
-ber_init().  ber_scanf interprets the bytes according to the format
-string fmt, and stores the results in its additional arguments.
-ber_scanf() returns LBER_ERROR on error, and a different value on suc-
-cess.  If an error occurred, the values of all the result parameters are
-undefined.
-
-The format string contains conversion specifications which are used to
-direct the interpretation of the BER element.  The format string can
-contain the following characters:
-
-'a'     Octet string.  A char ** argument MUST be supplied.  Memory is
-        allocated, filled with the contents of the octet string, zero-
-        terminated, and the pointer to the string is stored in the argu-
-        ment.  The returned value SHOULD be freed using ldap_memfree.
-        The tag of the element MUST indicate the primitive form (con-
-        structed strings are not supported) but is otherwise ignored and
-        discarded during the decoding.  This format cannot be used with
-        octet strings which could contain null bytes.
-
-'O'     Octet string.  A struct berval ** argument MUST be supplied,
-        which upon return points to an allocated struct berval contain-
-        ing the octet string and its length.  ber_bvfree() SHOULD be
-        called to free the allocated memory.  The tag of the element
-        MUST indicate the primitive form (constructed strings are not
-        supported) but is otherwise ignored during the decoding.
-
-'b'     Boolean.  A pointer to a ber_int_t MUST be supplied. The
-        ber_int_t value stored will be 0 for FALSE or nonzero for TRUE.
-        The tag of the element MUST indicate the primitive form but is
-        otherwise ignored during the decoding.
-
-'e'     Enumerated.  A pointer to a ber_int_t MUST be supplied. The
-        enumerated value stored will be in host byte order.  The tag of
-        the element MUST indicate the primitive form but is otherwise
-        ignored during the decoding.  ber_scanf() will return an error
-        if the value of the enumerated value cannot be stored in a
-        ber_int_t.
-
-'i'     Integer.  A pointer to a ber_int_t MUST be supplied. The
-        ber_int_t value stored will be in host byte order.  The tag of
-        the element MUST indicate the primitive form but is otherwise
-
-
-
-Expires: May 2001                                              [Page 65]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-        ignored during the decoding.  ber_scanf() will return an error
-        if the integer cannot be stored in a ber_int_t.
-
-'B'     Bitstring.  A char ** argument MUST be supplied which will point
-        to the allocated bits, followed by a ber_len_t * argument, which
-        will point to the length (in bits) of the bitstring returned.
-        ldap_memfree SHOULD be called to free the bitstring.  The tag of
-        the element MUST indicate the primitive form (constructed bit-
-        strings are not supported) but is otherwise ignored during the
-        decoding.
-
-'n'     Null.  No argument is needed.  The element is verified to have a
-        zero-length value and is skipped.  The tag is ignored.
-
-'t'     Tag.  A pointer to a ber_tag_t MUST be supplied.  The ber_tag_t
-        value stored will be the tag of the next element in the BerEle-
-        ment ber, represented so it can be written using the 't' format
-        of ber_printf().  The decoding position within the ber argument
-        is unchanged by this; that is, the fact that the tag has been
-        retrieved does not affect future use of ber.
-
-'v'     Several octet strings.  A char *** argument MUST be supplied,
-        which upon return points to an allocated NULL-terminated array
-        of char *'s containing the octet strings.  NULL is stored if the
-        sequence is empty.  ldap_memfree SHOULD be called to free each
-        element of the array and the array itself.  The tag of the
-        sequence and of the octet strings are ignored.
-
-'V'     Several octet strings (which could contain null bytes).  A
-        struct berval *** MUST be supplied, which upon return points to
-        a allocated NULL-terminated array of struct berval *'s contain-
-        ing the octet strings and their lengths.  NULL is stored if the
-        sequence is empty. ber_bvecfree() can be called to free the
-        allocated memory.  The tag of the sequence and of the octet
-        strings are ignored.
-
-'x'     Skip element.  The next element is skipped.  No argument is
-        needed.
-
-'{'     Begin sequence.  No argument is needed.  The initial sequence
-        tag and length are skipped.
-
-'}'     End sequence.  No argument is needed.
-
-'['     Begin set.  No argument is needed.  The initial set tag and
-        length are skipped.
-
-']'     End set.  No argument is needed.
-
-
-
-Expires: May 2001                                              [Page 66]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-           ber_tag_t ber_peek_tag( BerElement *ber,
-                   ber_len_t *lenPtr );
-
-ber_peek_tag() returns the tag of the next element to be parsed in the
-BerElement argument.  The length of this element is stored in the
-*lenPtr argument.  LBER_DEFAULT is returned if there is no further data
-to be read.  The decoding position within the ber argument is unchanged
-by this call; that is, the fact that ber_peek_tag() has been called does
-not affect future use of ber.
-
-           ber_tag_t ber_skip_tag( BerElement *ber, ber_len_t *lenPtr );
-
-ber_skip_tag() is similar to ber_peek_tag(), except that the state
-pointer in the BerElement argument is advanced past the first tag and
-length, and is pointed to the value part of the next element.  This rou-
-tine SHOULD only be used with constructed types and situations when a
-BER encoding is used as the value of an OCTET STRING.  The length of the
-value is stored in *lenPtr.
-
-           ber_tag_t ber_first_element( BerElement *ber,
-                   ber_len_t *lenPtr, char **opaquePtr );
-
-           ber_tag_t ber_next_element( BerElement *ber,
-                   ber_len_t *lenPtr, char *opaque );
-
-ber_first_element() and ber_next_element() are used to traverse a SET,
-SET OF, SEQUENCE or SEQUENCE OF data value. ber_first_element() calls
-ber_skip_tag(), stores internal information in *lenPtr and *opaquePtr,
-and calls ber_peek_tag() for the first element inside the constructed
-value. LBER_DEFAULT is returned if the constructed value is empty.
-ber_next_element() positions the state at the start of the next element
-in the constructed type.  LBER_DEFAULT is returned if there are no
-further values.
-
-The len and opaque values SHOULD NOT be used by applications other than
-as arguments to ber_next_element(), as shown in the example below.
-
-
-17.6.  Decoding Example
-
-The following is an example of decoding an ASN.1 data type:
-
-      Example2Request ::= SEQUENCE {
-           dn    OCTET STRING, -- must be printable
-           scope ENUMERATED { b (0), s (1), w (2) },
-           ali   ENUMERATED { n (0), s (1), f (2), a (3) },
-           size  INTEGER,
-           time  INTEGER,
-
-
-
-Expires: May 2001                                              [Page 67]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-           tonly BOOLEAN,
-           attrs SEQUENCE OF OCTET STRING, -- must be printable
-           [0] SEQUENCE OF SEQUENCE {
-              type  OCTET STRING -- must be printable,
-              crit  BOOLEAN DEFAULT FALSE,
-              value OCTET STRING
-           } OPTIONAL }
-
-      #define TAG_CONTROL_LIST 0xA0U /* context specific cons 0 */
-
-      int decode_example2(struct berval *bv)
-      {
-           BerElement *ber;
-           ber_len_t len;
-           ber_tag_t res;
-           ber_int_t scope, ali, size, time, tonly;
-           char *dn = NULL, **attrs = NULL;
-           int i,rc = 0;
-
-           ber = ber_init(bv);
-           if (ber == NULL) {
-                   fputs("ERROR ber_init failed\n", stderr);
-                   return -1;
-           }
-
-           res = ber_scanf(ber,"{aiiiib{v}",&dn,&scope,&ali,
-                           &size,&time,&tonly,&attrs);
-
-           if (res == LBER_ERROR) {
-                   fputs("ERROR ber_scanf failed\n", stderr);
-                   ber_free(ber,1);
-                   return -1;
-           }
-
-           /* *** use dn */
-           ldap_memfree(dn);
-
-           for (i = 0; attrs != NULL && attrs[i] != NULL; i++) {
-                   /* *** use attrs[i] */
-                   ldap_memfree(attrs[i]);
-           }
-           ldap_memfree((char *)attrs);
-
-           if (ber_peek_tag(ber,&len) == TAG_CONTROL_LIST) {
-                   char *opaque;
-                   ber_tag_t tag;
-
-                   for (tag = ber_first_element(ber,&len,&opaque);
-
-
-
-Expires: May 2001                                              [Page 68]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-                        tag != LBER_DEFAULT;
-                        tag = ber_next_element (ber,&len,opaque)) {
-
-                           ber_len_t tlen;
-                           ber_tag_t ttag;
-                           char *type;
-                           ber_int_t crit;
-                           struct berval *value;
-
-                           if (ber_scanf(ber,"{a",&type) == LBER_ERROR) {
-                                   fputs("ERROR cannot parse type\n", stderr);
-                                   break;
-                           }
-                           /* *** use type */
-                           ldap_memfree(type);
-
-                           ttag = ber_peek_tag(ber,&tlen);
-                           if (ttag == 0x01U) {  /* boolean */
-                                   if (ber_scanf(ber,"b",
-                                                 &crit) == LBER_ERROR) {
-                                           fputs("ERROR cannot parse crit\n",
-                                               stderr);
-                                           rc = -1;
-                                           break;
-                                   }
-                           } else if (ttag == 0x04U) { /* octet string */
-                                   crit = 0;
-                           } else {
-                                   fputs("ERROR extra field in controls\n",
-                                       stderr );
-                                   break;
-                           }
-
-                           if (ber_scanf(ber,"O}",&value) == LBER_ERROR) {
-                                   fputs("ERROR cannot parse value\n", stderr);
-                                   rc = -1;
-                                   break;
-                           }
-                           /* *** use value */
-                           ber_bvfree(value);
-                   }
-           }
-
-           if ( rc == 0 ) {        /* no errors so far */
-                   if (ber_scanf(ber,"}") == LBER_ERROR) {
-                           rc = -1;
-                   }
-           }
-
-
-
-Expires: May 2001                                              [Page 69]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-           ber_free(ber,1);
-
-           return rc;
-       }
-
-
-
-18.  Security Considerations
-
-LDAPv2 supports security through protocol-level authentication using
-clear-text passwords.  LDAPv3 adds support for SASL [12] (Simple Authen-
-tication Security Layer) methods.  LDAPv3 also supports operation over a
-secure transport layer using Transport Layer Security TLS [9].  Readers
-are referred to the protocol documents for discussion of related secu-
-rity considerations.
-
-Implementations of this API SHOULD be cautious when handling authentica-
-tion credentials.  In particular, keeping long-lived copies of creden-
-tials without the application's knowledge is discouraged.
-
-
-19.  Acknowledgements
-
-Many members of the IETF ASID and LDAPEXT working groups as well as
-members of the Internet at large have provided useful comments and
-suggestions that have been incorporated into this document.  Chris
-Weider deserves special mention for his contributions as co-author of
-earlier revisions of this document.
-
-The original material upon which this specification is based was sup-
-ported by the National Science Foundation under Grant No.  NCR-9416667.
-
-
-20.  Copyright
-
-Copyright (C) The Internet Society (1997-2000). All Rights Reserved.
-
-This document and translations of it may be copied and furnished to oth-
-ers, and derivative works that comment on or otherwise explain it or
-assist in its implementation may be prepared, copied, published and dis-
-tributed, in whole or in part, without restriction of any kind, provided
-that the above copyright notice and this paragraph are included on all
-such copies and derivative works.  However, this document itself may not
-be modified in any way, such as by removing the copyright notice or
-references to the Internet Society or other Internet organizations,
-except as needed for the  purpose of developing Internet standards in
-which case the procedures for copyrights defined in the Internet Stan-
-dards process must be followed, or as required to translate it into
-
-
-
-Expires: May 2001                                              [Page 70]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-languages other than English.
-
-The limited permissions granted above are perpetual and will not be
-revoked by the Internet Society or its successors or assigns.
-
-This document and the information contained herein is provided on an "AS
-IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK
-FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
-LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT
-INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FIT-
-NESS FOR A PARTICULAR PURPOSE.
-
-
-21.  Bibliography
-
-[1]  Bradner, S., "Key words for use in RFCs to Indicate Requirement
-     Levels", RFC 2119, March 1997.
-
-[2]  M. Wahl, T. Howes, S. Kille, "Lightweight Directory Access Protocol
-     (v3)", RFC 2251, December 1997.
-
-[3]  M. Wahl, A. Coulbeck, T. Howes, S. Kille, W. Yeong, C. Robbins,
-     "Lightweight Directory Access Protocol (v3): Attribute Syntax
-     Definitions", RFC 2252, December 1997.
-
-[4]  The Directory: Selected Attribute Syntaxes.  CCITT, Recommendation
-     X.520.
-
-[5]  M. Wahl, S. Kille, T. Howes, "Lightweight Directory Access Protocol
-     (v3): A UTF-8 String Representation of Distinguished Names", RFC
-     2253, December 1997.
-
-[6]  F. Yergeau, "UTF-8, a transformation format of Unicode and ISO
-     10646", RFC 2044, October 1996.
-
-[7]  K. Simonsen, "Character Mnemonics and Character Sets," RFC 1345,
-     June 1992.
-
-[8]  "Programming Languages - C", ANSI/ISO Standard 9899, revised 1997.
-
-[9]  J. Hodges, R. Morgan, M. Wahl, "Lightweight Directory Access Proto-
-     col (v3):  Extension for Transport Layer Security", INTERNET-DRAFT
-     (work in progress) <draft-ietf-ldapext-ldapv3-tls-05.txt>, June
-     1999.
-
-[10] R. Hinden, S. Deering, "IP Version 6 Addressing Architecture," RFC
-     1884, December 1995.
-
-
-
-
-Expires: May 2001                                              [Page 71]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-[11] A. Herron, T. Howes, M. Wahl, A. Anantha, "LDAP Control Extension
-     for Server Side Sorting of Search Results", INTERNET-DRAFT (work in
-     progress) <draft-ietf-ldapext-sorting-02.txt>, 5 April 1999.
-
-[12] J. Meyers, "Simple Authentication and Security Layer (SASL)", RFC
-     2222, October 1997.
-
-[13] T. Howes, "The String Representation of LDAP Search Filters," RFC
-     2254, December 1997.
-
-[14] S. Kille, "Using the OSI Directory to Achieve User Friendly Nam-
-     ing," RFC 1781, March 1995.
-
-
-22.  Authors' Addresses
-
-   Mark Smith (document editor)
-   Netscape Communications Corp.
-   901 San Antonio Rd.
-   Palo Alto, CA  94303-4900
-   Mail Stop SCA17 - 201
-   USA
-   +1 650 937-3477
-   mcs@netscape.com
-
-   Tim Howes
-   Loudcloud, Inc.
-   599 N. Mathilda Avenue
-   Sunnyvale, CA 94085
-   USA
-   +1 408 744-7300
-   howes@loudcloud.com
-
-   Andy Herron
-   Microsoft Corp.
-   1 Microsoft Way
-   Redmond, WA 98052
-   USA
-   +1 425 882-8080
-   andyhe@microsoft.com
-
-   Mark Wahl
-   Sun Microsystems, Inc.
-   8911 Capital of Texas Hwy, Suite 4140
-   Austin, TX 78759
-   USA
-   +1 626 919 3600
-   Mark.Wahl@sun.com
-
-
-
-Expires: May 2001                                              [Page 72]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-   Anoop Anantha
-   Microsoft Corp.
-   1 Microsoft Way
-   Redmond, WA 98052
-   USA
-   +1 425 882-8080
-   anoopa@microsoft.com
-
-
-23.  Appendix A - Sample C LDAP API Code
-
-   #include <stdio.h>
-   #include <ldap.h>
-
-   main()
-   {
-           LDAP            *ld;
-           LDAPMessage     *res, *e;
-           int             i, rc;
-           char            *a, *dn;
-           BerElement      *ptr;
-           char            **vals;
-
-           /* open an LDAP session */
-           if ( (ld = ldap_init( "dotted.host.name", LDAP_PORT )) == NULL )
-                   return 1;
-
-           /* authenticate as nobody */
-           if (( rc = ldap_simple_bind_s( ld, NULL, NULL )) != LDAP_SUCCESS ) {
-                   fprintf( stderr, "ldap_simple_bind_s: %s\n",
-                       ldap_err2string( rc ));
-                   ldap_unbind( ld );
-                   return 1;
-           }
-
-           /* search for entries with cn of "Babs Jensen", return all attrs  */
-           if (( rc = ldap_search_s( ld, "o=University of Michigan, c=US",
-               LDAP_SCOPE_SUBTREE, "(cn=Babs Jensen)", NULL, 0, &res ))
-               != LDAP_SUCCESS ) {
-                   fprintf( stderr, "ldap_search_s: %s\n",
-                       ldap_err2string( rc ));
-                   if ( res == NULL ) {
-                           ldap_unbind( ld );
-                           return 1;
-                   }
-           }
-
-           /* step through each entry returned */
-
-
-
-Expires: May 2001                                              [Page 73]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-           for ( e = ldap_first_entry( ld, res ); e != NULL;
-               e = ldap_next_entry( ld, e ) ) {
-                   /* print its name */
-                   dn = ldap_get_dn( ld, e );
-                   printf( "dn: %s\n", dn );
-                   ldap_memfree( dn );
-
-                   /* print each attribute */
-                   for ( a = ldap_first_attribute( ld, e, &ptr ); a != NULL;
-                       a = ldap_next_attribute( ld, e, ptr ) ) {
-                           printf( "\tattribute: %s\n", a );
-
-                           /* print each value */
-                           vals = ldap_get_values( ld, e, a );
-                           for ( i = 0; vals[i] != NULL; i++ ) {
-                                   printf( "\t\tvalue: %s\n", vals[i] );
-                           }
-                           ldap_value_free( vals );
-                           ldap_memfree( a );
-                   }
-                   if ( ptr != NULL ) {
-                           ber_free( ptr, 0 );
-                   }
-           }
-           /* free the search results */
-           ldap_msgfree( res );
-
-           /* close and free connection resources */
-           ldap_unbind( ld );
-
-           return 0;
-   }
-
-
-24.  Appendix B - Namespace Consumed By This Specification
-
-The following 2 prefixes are used in this specification to name func-
-tions:
-   ldap_
-   ber_
-
-The following 6 prefixes are used in this specification to name struc-
-tures, unions, and typedefs:
-   ldap
-   LDAP
-   mod_vals_u
-   ber
-   Ber
-
-
-
-Expires: May 2001                                              [Page 74]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-   timeval
-
-The following 3 prefixes are used in this specification to name #defined
-macros:
-   LDAP
-   LBER_
-   mod_
-
-
-25.  Appendix C - Summary of Requirements for API Extensions
-
-As the LDAP protocol is extended, this C LDAP API will need to be
-extended as well.  For example, an LDAPv3 control extension has already
-been defined for server-side sorting of search results [7].  This appen-
-dix summarizes the requirements for extending this API.
-
-25.1.  Compatibility
-
-Extensions to this document SHOULD NOT, by default, alter the behavior
-of any of the APIs specified in this document.  If an extension option-
-ally changes the behavior of any existing C LDAP API function calls, the
-behavior change MUST be well documented.  If an extension that operates
-on an LDAP session affects a chain of messages that was previously
-obtained by a call to ldap_result() or by calling a synchronous search
-routine, this MUST be well documented.
-
-25.2.  Style
-
-Extensions to this API SHOULD follow the general style and naming con-
-ventions used in this document.  For example, function names SHOULD
-start with "ldap_" or "ber_" and consist entirely of lowercase letters,
-digits, and underscore ('_') characters.  It is RECOMMENDED that private
-and experimental extensions use only the following prefixes for macros,
-types, and function names:
-       LDAP_X_
-       LBER_X_
-       ldap_x_
-       ber_x_
-and that these prefixes not be used by standard extensions.
-
-25.3.  Dependence on Externally Defined Types
-
-Extensions to this API SHOULD minimize dependencies on types and macros
-that are defined in system headers and generally use only intrinsic
-types that are part of the C language, types defined in this specifica-
-tion, or types defined in the extension document itself.
-
-
-
-
-
-Expires: May 2001                                              [Page 75]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-25.4.  Compile Time Information
-
-Extensions to this API SHOULD conform to the requirements contained in
-the "Retrieving Information at Compile Time" section of this document.
-That is, extensions SHOULD define a macro of the form:
-
-   #define LDAP_API_FEATURE_x level
-
-so that applications can detect the presence or absence of the extension
-at compile time and also test the version or level of the extension pro-
-vided by an API implementation.
-
-25.5.  Runtime Information
-
-Extensions to this API SHOULD conform to the requirements contained in
-the "Retrieving Information During Execution" section of this document.
-That is, each extension SHOULD be given a character string name and that
-name SHOULD appear in the ldapai_extensions array field of the LDAPAPI-
-Info structure following a successful call to ldap_get_option() with an
-option parameter value of LDAP_OPT_API_INFO.  In addition, information
-about the extension SHOULD be available via a call to ldap_get_option()
-with an option parameter value of LDAP_OPT_API_FEATURE_INFO.
-
-25.6.  Values Used for Session Handle Options
-
-Extensions to this API that add new session options (for use with the
-ldap_get_option() and ldap_set_option() functions) SHOULD meet the
-requirements contained in the last paragraph of the "LDAP Session Handle
-Options" section of this document.  Specifically, standards track docu-
-ments MUST use values for option macros that are between 0x1000 and
-0x3FFF inclusive and private and experimental extensions MUST use values
-for the option macros that are between 0x4000 and 0x7FFF inclusive.
-
-
-26.  Appendix D - Known Incompatibilities with RFC 1823
-
-This appendix lists known incompatibilities between this API specifica-
-tion and the one contained in RFC 1823, beyond the additional API func-
-tions added in support of LDAPv3.
-
-
-26.1.  Opaque LDAP Structure
-
-In RFC 1823, some fields in the LDAP structure were exposed to applica-
-tion programmers.  To provide a cleaner interface and to make it easier
-for implementations to evolve over time without sacrificing binary com-
-patibility with older applications, the LDAP structure is now entirely
-opaque.  The new ldap_set_option() and ldap_get_option() calls can be
-
-
-
-Expires: May 2001                                              [Page 76]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-used to manipulate per-session and global options.
-
-
-26.2.  Additional Result Codes
-
-The following new result code macros were introduced to support LDAPv3:
-   LDAP_REFERRAL
-   LDAP_ADMINLIMIT_EXCEEDED
-   LDAP_UNAVAILABLE_CRITICAL_EXTENSION
-   LDAP_CONFIDENTIALITY_REQUIRED
-   LDAP_SASL_BIND_IN_PROGRESS
-   LDAP_AFFECTS_MULTIPLE_DSAS
-   LDAP_CONNECT_ERROR
-   LDAP_NOT_SUPPORTED
-   LDAP_CONTROL_NOT_FOUND
-   LDAP_NO_RESULTS_RETURNED
-   LDAP_MORE_RESULTS_TO_RETURN
-   LDAP_CLIENT_LOOP
-   LDAP_REFERRAL_LIMIT_EXCEEDED
-
-
-26.3.  Freeing of String Data with ldap_memfree()
-
-All strings received from the API (e.g., those returned by the
-ldap_get_dn() or ldap_dn2ufn() functions) SHOULD be freed by calling
-ldap_memfree() not free().  RFC 1823 did not define an ldap_memfree()
-function.
-
-
-26.4.  Changes to ldap_result()
-
-The meaning of the all parameter to ldap_result has changed slightly.
-Nonzero values from RFC 1823 correspond to LDAP_MSG_ALL (0x01).  There
-is also a new possible value, LDAP_MSG_RECEIVED (0x02).
-
-The result type LDAP_RES_MODDN is now returned where RFC 1823 returned
-LDAP_RES_MODRDN.  The actual value for these two macros is the same
-(0x6D).
-
-
-26.5.  Changes to ldap_first_attribute() and ldap_next_attribute
-
-Each non-NULL return value SHOULD be freed by calling ldap_memfree()
-after use.  In RFC 1823, these two functions returned a pointer to a
-per-session buffer, which was not very thread-friendly.
-
-After the last call to ldap_first_attribute() or ldap_next_attribute(),
-the value set in the ptr parameter SHOULD be freed by calling ber_free(
-
-
-
-Expires: May 2001                                              [Page 77]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-ptr, 0 ).  RFC 1823 did not mention that the ptr value SHOULD be freed.
-
-The type of the ptr parameter was changed from void * to BerElement *.
-
-
-26.6.  Changes to ldap_modrdn() and ldap_modrdn_s() Functions
-
-In RFC 1823, the ldap_modrdn() and ldap_modrdn_s() functions include a
-parameter called deleteoldrdn.  This does not match the great majority
-of implementations, so in this specification the deleteoldrdn parameter
-was removed from ldap_modrdn() and ldap_modrdn_s().  Two additional
-functions that support deleteoldrdn and are widely implemented as well
-were added to this specification: ldap_modrdn2() and ldap_modrdn2_s().
-
-
-26.7.  Changes to the berval structure
-
-In RFC 1823, the bv_len element of the berval structure was defined as
-an `unsigned long'.  In this specification, the type is implementation-
-specific, although it MUST be an unsigned integral type that is at least
-32 bits in size.  See the appendix "Data Types and Legacy Implementa-
-tions" for additional considerations.
-
-
-26.8.  API Specification Clarified
-
-RFC 1823 left many things unspecified, including behavior of various
-memory disposal functions when a NULL pointer is presented, requirements
-for headers, values of many macros, and so on.  This specification is
-more complete and generally tighter than the one in RFC 1823.
-
-
-26.9.  Deprecated Functions
-
-A number of functions that are in RFC 1823 are labeled as "deprecated"
-in this specification.  In most cases, a replacement that provides
-equivalent functionality has been defined.  The deprecated functions
-are:
-
-   ldap_bind()
-           Use ldap_simple_bind() or ldap_sasl_bind() instead.
-
-   ldap_bind_s()
-           Use ldap_simple_bind_s() or ldap_sasl_bind_s() instead.
-
-   ldap_kerberos_bind() and ldap_kerberos_bind_s()
-           No equivalent functions are provided.
-
-
-
-
-Expires: May 2001                                              [Page 78]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-   ldap_modrdn() and ldap_modrdn2()
-           Use ldap_rename() instead.
-
-   ldap_modrdn_s() and ldap_modrdn2_s()
-           Use ldap_rename_s() instead.
-
-   ldap_open()
-           Use ldap_init() instead.
-
-   ldap_perror()
-           Use ldap_get_option( ld, LDAP_OPT_RESULT_CODE, &rc ) followed
-           by fprintf( stderr, "%s: %s", msg, ldap_err2string( rc ))
-           instead.
-
-   ldap_result2error()
-           Use ldap_parse_result() instead.
-
-
-27.  Appendix E - Data Types and Legacy Implementations
-
-The data types associated with the length of a ber value (ber_len_t),
-and the tag (ber_tag_t) have been defined in this specification as
-unsigned integral types of implementation-specific size.  The data type
-used for encoding and decoding ber integer, enumerated, and boolean
-values has been defined in this specification as a signed integral type
-of implementation-specific size.  This was done so that source and
-binary compatibility of the C LDAP API can be maintained across ILP32
-environments (where int, long, and pointers are all 32 bits in size) and
-LP64 environments (where ints remain 32 bits but longs and pointers grow
-to 64 bits).
-
-In older implementations of the C LDAP API, such as those based on RFC
-1823, implementors may have chosen to use an `unsigned long' for length
-and tag values.  If a long data type was used for either of these items,
-a port of an application to a 64-bit operating system using the LP64
-data model would find the size of the types used by the C LDAP API to
-increase.  Also, if the legacy implementation had chosen to implement
-the tag and types as an unsigned int, adoption of a specification that
-mandated use of unsigned longs would cause a source incompatibility in
-an LP64 application.  By using implementation-specific data types, the C
-LDAP API implementation is free to choose the correct data type and the
-ability to maintain source compatibility.
-
-For example, suppose a legacy implementation chose to define the return
-value of ber_skip_tag() as an unsigned long but wishes to have the
-library return a 32-bit quantity in both ILP32 and LP64 data models.
-The following typedefs for ber_tag_t will provide a fixed sized data
-structure while preserving existing ILP32 source -- all without
-
-
-
-Expires: May 2001                                              [Page 79]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-generating compiler warnings:
-           #include <limits.h>     /* provides UINT_MAX in ISO C */
-           #if UINT_MAX >= 0xffffffffU
-               typedef unsigned int ber_tag_t;
-           #else
-               typedef unsigned long ber_tag_t;
-           #endif
-
-Similar code can be used to define appropriate ber_len_t, ber_int_t,
-ber_slen_t and ber_uint_t types.
-
-
-28.  Appendix F - Changes Made Since Last Document Revision
-
-The previous version of this document was draft-ietf-ldapext-ldap-c-
-api-04.txt, dated 8 October 1999.  This appendix lists all of the
-changes made to that document to produce this one.
-
-28.1.  API Changes
-
-   "Header Requirements" section: added requirement that the simple pro-
-   gram provided must execute as well as compile without errors.
-
-   "LDAP Session Handle Options" section: changed the name of the
-   LDAP_OPT_ERROR_NUMBER option to LDAP_OPT_RESULT_CODE.  Allow
-   LDAP_OPT_ON to be defined as an implementation specific value (to
-   avoid problems on architectures where the value ((void *)1) is not
-   usable).
-
-   "Initializing an LDAP Session" section: allow use of the value zero
-   for the `portno' parameter to mean "use port 389."
-
-   "Searching" section: added LDAP_DEFAULT_SIZELIMIT (-1) to allow
-   application programmers to use the sizelimit from the LDAP session
-   handle with ldap_search_ext() and ldap_search_ext_s().
-
-   "Modifying an entry" section: moved mod_vals union out of LDAPMod and
-   added mod_vals_u_t typedef so users of the API can declare variables
-   using the union type.  "Handling Errors and Parsing Results" section:
-   added text to require that ldap_err2string() MUST NOT return NULL.
-
-   "A Client Control That Governs Referral Processing" section: modified
-   the text to specify that a ber_uint_t value should be used to hold
-   the flags.
-
-
-
-
-
-
-
-Expires: May 2001                                              [Page 80]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-28.2.  Editorial Changes and Clarifications
-
-   "Overview of LDAP API Use and General Requirements" section: added
-   text to clarify our use of the term "asynchronous."
-
-   "Retrieving Information During Execution" section: added text
-   describing the `ldapai_vendor_name' and `ldapai_vendor_version'
-   fields (text was accidently deleted during a previous round of
-   edits).
-
-   "LDAP Session Handle Options" section: improved the text that
-   describes the LDAP_OPT_TIMELIMIT, LDAP_OPT_SIZELIMIT, and
-   LDAP_OPT_RESULT_CODE options.  Provided details and an example of the
-   correct LDAP_OPT_HOST_NAME string to return when the `portno' passed
-   to ldap_init() is not zero or 389.
-
-   "Result Codes" section: renamed section (was "LDAP Error Codes").
-
-   "Authenticating to the directory" section: clarified that the `dn',
-   `cred', and `passwd' parameters can be NULL.  Added text indicate
-   that the `servercredp' is set to NULL if an API error occurs.
-
-   "Performing LDAP Operations" section: replaced "All functions take a
-   session handle" with "Most functions...."
-
-   "Search" section: removed the detailed discussion of the session han-
-   dle options (already covered in the "Retrieving Information During
-   Execution" section).  Also removed the word "global" when discussing
-   the session default value for the `timeout' parameter.  Also clari-
-   fied that a NULL `base' parameter means use a zero-length string for
-   the base DN.
-
-   "Comparing a Value Against an Entry" section: corrected the "success-
-   ful" return codes for ldap_compare_ext_s() and ldap_compare_s() (was
-   LDAP_SUCCESS; changed to LDAP_COMPARE_TRUE or LDAP_COMPARE_FALSE).
-
-   "Extended Operations" section: added text to indicate that the
-   `retoidp' and `retdatap' result parameters are set to NULL if an API
-   error occurs in ldap_extended_operation_s().
-
-   "Handling Errors and Parsing Results" section: added text to say that
-   the `matcheddnp' result parameter will be set to NULL if the server
-   does not return a matched DN string.  Added text to indicate that
-   serverctrlsp can be NULL.  Added text to indicate that *retoidpp,
-   *retdatap, *referralsp, and *serverctrlsp will be set to NULL if no
-   items of that type are returned.  Removed specific reference to
-   LDAP_NO_SUCH_OBJECT result code when discussing the `matcheddnp'
-   result parameter and added clarifying note about "" vs. NULL.
-
-
-
-Expires: May 2001                                              [Page 81]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-   "Parsing References" section: added text to indicate that *refer-
-   ralsp, and *serverctrlsp will be set to NULL if no items of that type
-   are returned.
-
-   "Obtaining Results and Peeking Inside LDAP Messages" section: added
-   text to say that LDAPMessage chains MAY be tied to a session handle.
-
-   "BER Data Structures and Types" section: removed note about
-   ber_uint_t not being used in this document (it is now).  Changed text
-   to simplify the description of ber_slen_t.  Removed misleading sen-
-   tence about the width of ber_uint_t.
-
-   "Encoded ASN.1 Value Manipulation / Encoding" section: added note
-   that 'X' is reserved.  Also fixed a few small bugs in the example
-   code.
-
-   "Encoded ASN.1 Value Manipulation / Decoding" section: clarified the
-   requirements for LBER_ERROR and LBER_DEFAULT (expressed using octets
-   instead of bits).  Also fixed a few small bugs in the example code.
-
-   Added the following text to all descriptions of the `serverctrls' and
-   `clientctrls' parameters: ", or NULL if no <server/client> controls
-   are to be used."
-
-   Added the following text to the description of all `dn' and `rdn'
-   parameters: "If NULL, a zero length DN is sent to the server."
-
-   Replaced many occurrences of the phrase "error code" with "result
-   code" throughout the document.
-
-   Added text to indicate that the value of the `msgidp' result parame-
-   ter is undefined if an error occurs in the following functions:
-   ldap_sasl_bind(), ldap_search_ext(), ldap_compare_ext(),
-   ldap_modify_ext(), ldap_add_ext(), ldap_delete_ext(),
-   ldap_extended_operation().
-
-   Added text to indicate that the `res' result parameter is set to NULL
-   if an API error occurs in the following functions: ldap_result(),
-   ldap_search_s(), ldap_search_st().
-
-   Added text to indicate that all result parameters have undefined
-   values if an API error is returned by the following functions:
-   ldap_parse_result(), ldap_parse_sasl_bind_result(),
-   ldap_parse_extended_result(), ldap_parse_reference(), ber_scanf().
-
-   Added angle brackets around ficticious impl_XXX_t types to make it
-   more obvious that these are not real "C" types, e.g., typedef
-   <impl_len_t> ber_len_t'.
-
-
-
-Expires: May 2001                                              [Page 82]
-
-C LDAP API        C LDAP Application Program Interface  17 November 2000
-
-
-   Appendix B: Added mod_vals_u and removed PLDAP from the struct,
-   unions, and typedefs prefix list.
-
-   Appendix C: Added note in "Compatibility" section about extensions
-   possible affecting chains of messages and the fact that that must be
-   well documented.  Appendix D: Improved text for ldap_perror() (what
-   to use instead).
-
-   "Authors" section: updated contact information for Mark Smith, Tim
-   Howes, and Mark Wahl.
-
-   Fixed a few obvious typos, improved indentation, added missing blank
-   lines, and so on.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires: May 2001                                              [Page 83]
-
+
+
+Network Working Group                                   M. Smith, Editor
+INTERNET-DRAFT                             Netscape Communications Corp.
+Intended Category: Standards Track                              T. Howes
+Obsoletes: RFC 1823                                      Loudcloud, Inc.
+Expires: May 2001                                              A. Herron
+                                                         Microsoft Corp.
+                                                                 M. Wahl
+                                                  Sun Microsystems, Inc.
+                                                              A. Anantha
+                                                         Microsoft Corp.
+
+
+                                                        17 November 2000
+
+                The C LDAP Application Program Interface
+                 <draft-ietf-ldapext-ldap-c-api-05.txt>
+
+
+1.  Status of this Memo
+
+This document is an Internet-Draft and is in full conformance with all
+provisions of Section 10 of RFC2026.  Internet-Drafts are working docu-
+ments of the Internet Engineering Task Force (IETF), its areas, and its
+working groups.  Note that other groups may also distribute working
+documents as Internet-Drafts.
+
+Internet-Drafts are draft documents valid for a maximum of six months
+and may be updated, replaced, or obsoleted by other documents at any
+time.  It is inappropriate to use Internet-Drafts as reference material
+or to cite them other than as "work in progress."
+
+The list of current Internet-Drafts can be accessed at
+http://www.ietf.org/ietf/1id-abstracts.txt.
+
+The list of Internet-Draft Shadow Directories can be accessed at
+http://www.ietf.org/shadow.html.
+
+This draft document will be submitted to the RFC Editor as a Standards
+Track document. Distribution of this memo is unlimited.  Technical dis-
+cussion of this document will take place on the IETF LDAP Extension
+Working Group mailing list <ietf-ldapext@netscape.com>.  Please send
+editorial comments directly to the authors.
+
+Copyright (C) The Internet Society (1997-1999). All Rights Reserved.
+
+Please see the Copyright section near the end of this document for more
+information.
+
+
+
+
+Expires: May 2001                                               [Page 1]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+2.  Introduction
+
+This document defines a C language application program interface (API)
+to the Lightweight Directory Access Protocol (LDAP). This document
+replaces the previous definition of this API, defined in RFC 1823,
+updating it to include support for features found in version 3 of the
+LDAP protocol.  New extended operation functions were added to support
+LDAPv3 features such as controls.  In addition, other LDAP API changes
+were made to support information hiding and thread safety.
+
+The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
+"SHOULD", "SHOULD NOT", "RECOMMENDED",  "MAY", and "OPTIONAL" in this
+document are to be interpreted as described in RFC 2119[1].
+
+The C LDAP API is designed to be powerful, yet simple to use. It defines
+compatible synchronous and asynchronous interfaces to LDAP to suit a
+wide variety of applications. This document gives a brief overview of
+the LDAP model, then an overview of how the API is used by an applica-
+tion program to obtain LDAP information.  The API calls are described in
+detail, followed by appendices that provide example code demonstrating
+use of the API, the namespace consumed by the API, a summary of require-
+ments for API extensions, known incompatibilities with RFC 1823, and a
+list of changes made since the last revision of this document.
+
+
+3.  Table of Contents
+
+1.     Status of this Memo............................................1
+2.     Introduction...................................................2
+3.     Table of Contents..............................................2
+4.     Overview of the LDAP Model.....................................4
+5.     Overview of LDAP API Use and General Requirements..............4
+6.     Header Requirements............................................6
+7.     Common Data Structures and Types...............................7
+8.     Memory Handling Overview.......................................9
+9.     Retrieving Information About the API Implementation............9
+9.1.      Retrieving Information at Compile Time......................10
+9.2.      Retrieving Information During Execution.....................11
+10.    Result Codes...................................................14
+11.    Performing LDAP Operations.....................................16
+11.1.     Initializing an LDAP Session................................16
+11.2.     LDAP Session Handle Options.................................17
+11.3.     Working With Controls.......................................23
+11.3.1.      A Client Control That Governs Referral Processing........24
+11.4.     Authenticating to the directory.............................25
+11.5.     Closing the session.........................................27
+11.6.     Searching...................................................28
+11.7.     Reading an Entry............................................32
+
+
+
+Expires: May 2001                                               [Page 2]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+
+11.8.     Listing the Children of an Entry............................32
+11.9.     Comparing a Value Against an Entry..........................33
+11.10.    Modifying an entry..........................................35
+11.11.    Modifying the Name of an Entry..............................37
+11.12.    Adding an entry.............................................39
+11.13.    Deleting an entry...........................................41
+11.14.    Extended Operations.........................................43
+12.    Abandoning An Operation........................................44
+13.    Obtaining Results and Peeking Inside LDAP Messages.............45
+14.    Handling Errors and Parsing Results............................47
+15.    Stepping Through a List of Results.............................51
+16.    Parsing Search Results.........................................51
+16.1.     Stepping Through a List of Entries or References............52
+16.2.     Stepping Through the Attributes of an Entry.................53
+16.3.     Retrieving the Values of an Attribute.......................54
+16.4.     Retrieving the name of an entry.............................55
+16.5.     Retrieving controls from an entry...........................56
+16.6.     Parsing References..........................................57
+17.    Encoded ASN.1 Value Manipulation...............................58
+17.1.     BER Data Structures and Types...............................58
+17.2.     Memory Disposal and Utility Functions.......................60
+17.3.     Encoding....................................................60
+17.4.     Encoding Example............................................63
+17.5.     Decoding....................................................64
+17.6.     Decoding Example............................................67
+18.    Security Considerations........................................70
+19.    Acknowledgements...............................................70
+20.    Copyright......................................................70
+21.    Bibliography...................................................71
+22.    Authors' Addresses.............................................72
+23.    Appendix A - Sample C LDAP API Code............................73
+24.    Appendix B - Namespace Consumed By This Specification..........74
+25.    Appendix C - Summary of Requirements for API Extensions........75
+25.1.     Compatibility...............................................75
+25.2.     Style.......................................................75
+25.3.     Dependence on Externally Defined Types......................75
+25.4.     Compile Time Information....................................76
+25.5.     Runtime Information.........................................76
+25.6.     Values Used for Session Handle Options......................76
+26.    Appendix D - Known Incompatibilities with RFC 1823.............76
+26.1.     Opaque LDAP Structure.......................................76
+26.2.     Additional Result Codes.....................................77
+26.3.     Freeing of String Data with ldap_memfree()..................77
+26.4.     Changes to ldap_result()....................................77
+26.5.     Changes to ldap_first_attribute() and ldap_next_attribute...77
+26.6.     Changes to ldap_modrdn() and ldap_modrdn_s() Functions......78
+26.7.     Changes to the berval structure.............................78
+26.8.     API Specification Clarified.................................78
+
+
+Expires: May 2001                                               [Page 3]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+26.9.     Deprecated Functions........................................78
+27.    Appendix E - Data Types and Legacy Implementations.............79
+28.    Appendix F - Changes Made Since Last Document Revision.........80
+28.1.     API Changes.................................................80
+28.2.     Editorial Changes and Clarifications........................81
+
+
+4.  Overview of the LDAP Model
+
+LDAP is the lightweight directory access protocol, described in [2] and
+[3]. It can provide a lightweight frontend to the X.500 directory [4],
+or a stand-alone service. In either mode, LDAP is based on a client-
+server model in which a client makes a TCP connection to an LDAP server,
+over which it sends requests and receives responses.
+
+The LDAP information model is based on the entry, which contains infor-
+mation about some object (e.g., a person).  Entries are composed of
+attributes, which have a type and one or more values. Each attribute has
+a syntax that determines what kinds of values are allowed in the attri-
+bute (e.g., ASCII characters, a jpeg photograph, etc.) and how those
+values behave during directory operations (e.g., is case significant
+during comparisons).
+
+Entries may be organized in a tree structure, usually based on politi-
+cal, geographical, and organizational boundaries. Each entry is uniquely
+named relative to its sibling entries by its relative distinguished name
+(RDN) consisting of one or more distinguished attribute values from the
+entry.  At most one value from each attribute may be used in the RDN.
+For example, the entry for the person Babs Jensen might be named with
+the "Barbara Jensen" value from the commonName attribute.
+
+A globally unique name for an entry, called a distinguished name or DN,
+is constructed by concatenating the sequence of RDNs from the entry up
+to the root of the tree. For example, if Babs worked for the University
+of Michigan, the DN of her U-M entry might be "cn=Barbara Jensen,
+o=University of Michigan, c=US". The DN format used by LDAP is defined
+in [5].
+
+Operations are provided to authenticate, search for and retrieve infor-
+mation, modify information, and add and delete entries from the tree.
+The next sections give an overview of how the API is used and detailed
+descriptions of the LDAP API calls that implement all of these func-
+tions.
+
+
+5.  Overview of LDAP API Use and General Requirements
+
+An application generally uses the C LDAP API in four simple steps.
+
+
+
+Expires: May 2001                                               [Page 4]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+   1.   Initialize an LDAP session with a primary LDAP server. The
+        ldap_init() function returns a handle to the session, allowing
+        multiple connections to be open at once.
+
+   2.   Authenticate to the LDAP server. The ldap_sasl_bind() function
+        and friends support a variety of authentication methods.
+
+   3.   Perform some LDAP operations and obtain some results.
+        ldap_search() and friends return results which can be parsed by
+        ldap_parse_result(), ldap_first_entry(), ldap_next_entry(), etc.
+
+   4.   Close the session. The ldap_unbind() function closes the connec-
+        tion.
+
+Operations can be performed either synchronously or asynchronously.  The
+names of the synchronous functions end in _s. For example, a synchronous
+search can be completed by calling ldap_search_s(). An asynchronous
+search can be initiated by calling ldap_search(). All synchronous rou-
+tines return an indication of the outcome of the operation (e.g, the
+constant LDAP_SUCCESS or some other result code).  The asynchronous rou-
+tines make available to the caller the message id of the operation ini-
+tiated. This id can be used in subsequent calls to ldap_result() to
+obtain the result(s) of the operation. An asynchronous operation can be
+abandoned by calling ldap_abandon() or ldap_abandon_ext().  Note that
+there is no requirement that an LDAP API implementation not block when
+handling asynchronous API functions; the term "asynchronous" as used in
+this document refers to the fact that the sending of LDAP requests can
+be separated from the receiving of LDAP responses.
+
+Results and errors are returned in an opaque structure called LDAPMes-
+sage.  Routines are provided to parse this structure, step through
+entries and attributes returned, etc. Routines are also provided to
+interpret errors. Later sections of this document describe these rou-
+tines in more detail.
+
+LDAP version 3 servers can return referrals and references to other
+servers.  By default, implementations of this API will attempt to follow
+referrals automatically for the application.  This behavior can be dis-
+abled globally (using the ldap_set_option() call) or on a per-request
+basis through the use of a client control.
+
+All DN and string attribute values passed into or produced by this C
+LDAP API are represented using the character set of the underlying LDAP
+protocol version in use.  When this API is used with LDAPv3, DN and
+string values are represented as UTF-8[6] characters.  When this API is
+used with LDAPv2, the US-ASCII[7] or T.61[7] character set are used.
+Future documents MAY specify additional APIs supporting other character
+sets.
+
+
+
+Expires: May 2001                                               [Page 5]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+For compatibility with existing applications, implementations of this
+API will by default use version 2 of the LDAP protocol.  Applications
+that intend to take advantage of LDAP version 3 features will need to
+use the ldap_set_option() call with a LDAP_OPT_PROTOCOL_VERSION to
+switch to version 3.
+
+Unless otherwise indicated, conformant implementations of this specifi-
+cation MUST implement all of the C LDAP API functions as described in
+this document, and they MUST use the function prototypes, macro defini-
+tions, and types defined in this document.
+
+Note that this API is designed for use in environments where the 'int'
+type is at least 32 bits in size.
+
+
+6.  Header Requirements
+
+To promote portability of applications, the following requirements are
+imposed on the headers used by applications to access the services of
+this API:
+
+Name and Inclusion
+        Applications only need to include a single header named ldap.h
+        to access all of the API services described in this document.
+        Therefore, the following C source program MUST compile and exe-
+        cute without errors:
+
+           #include <ldap.h>
+
+           int
+           main()
+           {
+               return 0;
+           }
+
+        The ldap.h header MAY include other implementation-specific
+        headers.
+
+Implementations SHOULD also provide a header named lber.h to facilitate
+development of applications desiring compatibility with older LDAP
+implementations.  The lber.h header MAY be empty.  Old applications that
+include lber.h in order to use BER facilities will need to include
+ldap.h.
+
+
+Idempotence
+        All headers SHOULD be idempotent; that is, if they are included
+        more than once the effect is as if they had only been included
+
+
+
+Expires: May 2001                                               [Page 6]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+        once.
+
+Must Be Included Before API Is Used
+        An application MUST include the ldap.h header before referencing
+        any of the function or type definitions described in this API
+        specification.
+
+Mutual Independence
+        Headers SHOULD be mutually independent with minimal dependence
+        on system or any other headers.
+
+Use of the 'const' Keyword
+        This API specification is defined in terms of ISO C[8].  It
+        makes use of function prototypes and the 'const' keyword.  The
+        use of 'const' in this specification is limited to simple, non-
+        array function parameters to avoid forcing applications to
+        declare parameters and variables that accept return values from
+        LDAP API functions as 'const.'  Implementations specifically
+        designed to be used with non-ISO C translators SHOULD provide
+        function declarations without prototypes or function prototypes
+        without specification of 'const' arguments.
+
+Definition of 'struct timeval'
+        This API specification uses the 'struct timeval' type.  Imple-
+        mentations of this API MUST ensure that the struct timeval type
+        is by default defined as a consequence of including the ldap.h
+        header.  Because struct timeval is usually defined in one or
+        more system headers, it is possible for header conflicts to
+        occur if ldap.h also defines it or arranges for it to be defined
+        by including another header.  Therefore, applications MAY want
+        to arrange for struct timeval to be defined before they include
+        ldap.h.  To support this, the ldap.h header MUST NOT itself
+        define struct timeval if the preprocessor symbol
+        LDAP_TYPE_TIMEVAL_DEFINED is defined before ldap.h is included.
+
+
+7.  Common Data Structures and Types
+
+Data structures and types that are common to several LDAP API functions
+are defined here:
+
+       typedef struct ldap LDAP;
+
+       typedef struct ldapmsg LDAPMessage;
+
+       typedef struct berelement BerElement;
+
+       typedef <impl_len_t> ber_len_t;
+
+
+
+Expires: May 2001                                               [Page 7]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+       typedef struct berval {
+           ber_len_t       bv_len;
+           char            *bv_val;
+       } BerValue;
+
+       struct timeval {
+           <impl_sec_t>    tv_sec;
+           <impl_usec_t>   tv_usec;
+       };
+
+The LDAP structure is an opaque data type that represents an LDAP ses-
+sion Typically this corresponds to a connection to a single server, but
+it MAY encompass several server connections in the face of LDAPv3 refer-
+rals.
+
+The LDAPMessage structure is an opaque data type that is used to return
+entry, reference, result, and error information.  An LDAPMessage struc-
+ture can represent the beginning of a list, or chain of messages that
+consists of a series of entries, references, and result messages as
+returned by LDAP operations such as search.  LDAP API functions such as
+ldap_parse_result() that operate on message chains that can contain more
+than one result message always operate on the first result message in
+the chain.  See the "Obtaining Results and Peeking Inside LDAP Messages"
+section of this document for more information.
+
+The BerElement structure is an opaque data type that is used to hold
+data and state information about encoded data.  It is described in more
+detail in the section "Encoded ASN.1 Value Manipulation" later in this
+document.
+
+The `ber_len_t' type is an unsigned integral data type that is large
+enough to contain the length of the largest piece of data supported by
+the API implementation.  The `<impl_len_t>' in the `ber_len_t' typedef
+MUST be replaced with an appropriate type.  The width (number of signi-
+ficant bits) of `ber_len_t' MUST be at least 32 and no larger than that
+of `unsigned long'.  See the appendix "Data Types and Legacy Implementa-
+tions" for additional considerations.
+
+The BerValue structure is used to represent arbitrary binary data and
+its fields have the following meanings:
+
+bv_len   Length of data in bytes.
+
+bv_val   A pointer to the data itself.
+
+
+The timeval structure is used to represent an interval of time and its
+fields have the following meanings:
+
+
+
+Expires: May 2001                                               [Page 8]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+tv_sec   Seconds component of time interval.
+
+tv_usec  Microseconds component of time interval.
+
+Note that because the struct timeval definition typically is derived
+from a system header, the types used for the tv_sec and tv_usec com-
+ponents are implementation-specific integral types.  Therefore,
+`<impl_sec_t>' and `<impl_usec_t>' in the struct timeval definition MUST
+be replaced with appropriate types.  See the earlier section "Header
+Requirements" for more information on struct timeval.
+
+
+8.  Memory Handling Overview
+
+All memory that is allocated by a function in this C LDAP API and
+returned to the caller SHOULD be disposed of by calling the appropriate
+"free" function provided by this API.  The correct "free" function to
+call is documented in each section of this document where a function
+that allocates memory is described.
+
+Memory that is allocated through means outside of the C LDAP API MUST
+NOT be disposed of using a function provided by this API.
+
+If a pointer value passed to one of the C LDAP API "free" functions is
+NULL, graceful failure (i.e, ignoring of the NULL pointer) MUST occur.
+
+The complete list of "free" functions that are used to dispose of allo-
+cated memory is:
+
+   ber_bvecfree()
+   ber_bvfree()
+   ber_free()
+   ldap_control_free()
+   ldap_controls_free()
+   ldap_memfree()
+   ldap_msgfree()
+   ldap_value_free()
+   ldap_value_free_len()
+
+
+9.  Retrieving Information About the API Implementation
+
+Applications developed to this specification need to be able to deter-
+mine information about the particular API implementation they are using
+both at compile time and during execution.
+
+
+
+
+
+
+Expires: May 2001                                               [Page 9]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+9.1.  Retrieving Information at Compile Time
+
+All conformant implementations MUST include the following five defini-
+tions in a header so compile time tests can be done by LDAP software
+developers:
+
+   #define LDAP_API_VERSION     level
+   #define LDAP_VERSION_MIN     min-version
+   #define LDAP_VERSION_MAX     max-version
+   #define LDAP_VENDOR_NAME     "vend-name"
+   #define LDAP_VENDOR_VERSION  vend-version
+
+where:
+
+     "level" is replaced with the RFC number given to this C LDAP API
+     specification when it is published as a standards track RFC.
+
+     min-version is replaced with the lowest LDAP protocol version sup-
+     ported by the implementation.
+
+     max-version is replaced with the highest LDAP protocol version sup-
+     ported by the implementation.  This SHOULD be 3.
+
+     "vend-name" is replaced with a text string that identifies the
+     party that supplies the API implementation.
+
+     "vend-version" is a supplier-specific version number multiplied
+     times 100.
+
+Note that the LDAP_VENDOR_NAME macro SHOULD be defined as "" if no ven-
+dor name is available and the LDAP_VENDOR_VERSION macro SHOULD be
+defined as 0 if no vendor-specific version information is available.
+
+For example, if this specification is published as RFC 88888, Netscape
+Communication's version 4.0 implementation that supports LDAPv2 and v3
+might include macro definitions like these:
+
+   #define LDAP_API_VERSION     88888      /* RFC 88888 compliant */
+   #define LDAP_VERSION_MIN     2
+   #define LDAP_VERSION_MAX     3
+   #define LDAP_VENDOR_NAME     "Netscape Communications Corp."
+   #define LDAP_VENDOR_VERSION  400        /* version 4.0 */
+
+and application code can test the C LDAP API version level using a
+construct such as this one:
+
+   #if (LDAP_API_VERSION >= 88888)
+           /* use features supported in RFC 88888 or later */
+
+
+
+Expires: May 2001                                              [Page 10]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+   #endif
+
+Until such time as this document is published as an RFC, implementations
+SHOULD use the value 2000 plus the revision number of this draft for
+LDAP_API_VERSION.  For example, the correct value for LDAP_API_VERSION
+for revision 05 of this draft is 2005.
+
+Documents that extend this specification SHOULD define a macro of the
+form:
+
+   #define LDAP_API_FEATURE_x level
+
+where "x" is replaced with a name (textual identifier) for the feature
+and "level" is replaced with the number of the RFC that specifies the
+API extension.  The name SHOULD NOT begin with the string "X_".
+
+For example, if C LDAP API extensions for Transport Layer Security [9]
+were published in RFC 99999, that RFC might require conformant implemen-
+tations to define a macro like this:
+
+   #define LDAP_API_FEATURE_TLS 99999
+
+
+Private or experimental API extensions SHOULD be indicated by defining a
+macro of this same form where "x" (the extension's name) begins with the
+string "X_" and "level" is replaced with a integer number that is
+specific to the extension.
+
+It is RECOMMENDED that private or experimental API extensions use only
+the following prefixes for macros, types, and function names:
+       LDAP_X_
+       LBER_X_
+       ldap_x_
+       ber_x_
+and that these prefixes not be used by standard extensions.
+
+
+9.2.  Retrieving Information During Execution
+
+The ldap_get_option() call (described in greater detail later in this
+document) can be used during execution in conjunction with an option
+parameter value of LDAP_OPT_API_INFO (0x00) to retrieve some basic
+information about the API and about the specific implementation being
+used.  The ld parameter to ldap_get_option() can be either NULL or a
+valid LDAP session handle which was obtained by calling ldap_init().
+The optdata parameter to ldap_get_option() SHOULD be the address of an
+LDAPAPIInfo structure which is defined as follows:
+
+
+
+
+Expires: May 2001                                              [Page 11]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+   typedef struct ldapapiinfo {
+       int  ldapai_info_version;     /* version of this struct (1) */
+       int  ldapai_api_version;      /* revision of API supported */
+       int  ldapai_protocol_version; /* highest LDAP version supported */
+       char **ldapai_extensions;     /* names of API extensions */
+       char *ldapai_vendor_name;     /* name of supplier */
+       int  ldapai_vendor_version;   /* supplier-specific version times 100 */
+   } LDAPAPIInfo;
+
+In addition, API implementations MUST include the following macro defin-
+ition:
+
+   #define LDAP_API_INFO_VERSION    1
+
+Note that the ldapai_info_version field of the LDAPAPIInfo structure
+SHOULD be set to the value LDAP_API_INFO_VERSION (1) before calling
+ldap_get_option() so that it can be checked for consistency.  All other
+fields are set by the ldap_get_option() function.
+
+The members of the LDAPAPIInfo structure are:
+
+ldapai_info_version
+          A number that identifies the version of the LDAPAPIInfo struc-
+          ture.  This SHOULD be set to the value LDAP_API_INFO_VERSION
+          (1) before calling ldap_get_option().  If the value received
+          is not recognized by the API implementation, the
+          ldap_get_option() function sets ldapai_info_version to a valid
+          value that would be recognized, sets the ldapai_api_version to
+          the correct value, and returns an error without filling in any
+          of the other fields in the LDAPAPIInfo structure.
+
+ldapai_api_version
+          A number that matches that assigned to the C LDAP API RFC sup-
+          ported by the API implementation.  This SHOULD match the value
+          of the LDAP_API_VERSION macro defined earlier.
+
+ldapai_protocol_version
+          The highest LDAP protocol version supported by the implementa-
+          tion.  For example, if LDAPv3 is the highest version supported
+          then this field will be set to 3.
+
+ldapai_vendor_name
+          A zero-terminated string that contains the name of the party
+          that produced the LDAP API implementation.  This field may be
+          set to NULL if no name is available.  If non-NULL, the caller
+          is responsible for disposing of the memory occupied by passing
+          this pointer to ldap_memfree() which is described later in
+          this document.  This value SHOULD match the value of the
+
+
+
+Expires: May 2001                                              [Page 12]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+          LDAP_VENDOR_NAME macro described earlier in this document.
+
+ldapai_vendor_version
+          An implementation-specific version number multiplied by 100.
+          For example, if the implementation version is 4.0 then this
+          field will be set to 400.  If no version information is avail-
+          able, this field will be set to 0.  This value SHOULD match
+          the value of the LDAP_VENDOR_VERSION macro described earlier
+          in this document.
+
+ldapai_extensions
+          A NULL-terminated array of character strings that lists the
+          names of the API extensions supported by the LDAP API imple-
+          mentation.  These names will typically match the textual iden-
+          tifiers that appear in the "x" portion of the
+          LDAP_API_FEATURE_x macros described above, although the pre-
+          cise value MUST be defined by documents that specify C LDAP
+          API extensions.  If no API extensions are supported, this
+          field will be set to NULL.  The caller is responsible for
+          disposing of the memory occupied by this array by passing it
+          to ldap_value_free() which is described later in this docu-
+          ment.  To retrieve more information about a particular exten-
+          sion, the ldap_get_option() call can be used with an option
+          parameter value of LDAP_OPT_API_FEATURE_INFO (0x15).  The opt-
+          data parameter to the ldap_get_option() SHOULD be the address
+          of an LDAPAPIFeatureInfo structure which is defined as fol-
+          lows:
+
+             typedef struct ldap_apifeature_info {
+                 int   ldapaif_info_version; /* version of this struct (1) */
+                 char  *ldapaif_name;        /* name of supported feature */
+                 int   ldapaif_version;      /* revision of supported feature */
+             } LDAPAPIFeatureInfo;
+
+          In addition, API implementations MUST include the following
+          macro definition:
+
+             #define LDAP_FEATURE_INFO_VERSION    1
+
+          Note that the ldapaif_info_version field of the LDAPAPI-
+          FeatureInfo structure SHOULD be set to the value
+          LDAP_FEATURE_INFO_VERSION (1) and the ldapaif_name field
+          SHOULD be set to the extension name string as described below
+          before ldap_get_option() is called.  The call will fill in the
+          ldapaif_version field of the LDAPAPIFeatureInfo structure.
+
+   The members of the LDAPAPIFeatureInfo structure are:
+
+
+
+
+Expires: May 2001                                              [Page 13]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+   ldapaif_info_version
+             A number that identifies the version of the LDAPAPI-
+             FeatureInfo structure.  This SHOULD be set to the value
+             LDAP_FEATURE_INFO_VERSION (1) before calling
+             ldap_get_option().  If the value received is not recognized
+             by the API implementation, the ldap_get_option() function
+             sets ldapaif_info_version to a valid value that would be
+             recognized and returns an error without filling in the
+             ldapaif_version field in the LDAPAPIFeatureInfo structure.
+
+   ldapaif_name
+             The name of an extension, as returned in the
+             ldapai_extensions array of the LDAPAPIInfo structure and as
+             specified in the document that describes the extension.
+
+   ldapaif_version
+             This field will be set as a result of calling
+             ldap_get_option().  It is a number that matches that
+             assigned to the C LDAP API extension RFC supported for this
+             extension.  For private or experimental API extensions, the
+             value is extension-specific.  In either case, the value of
+             ldapaxi_ext_version SHOULD be identical to the value of the
+             LDAP_API_FEATURE_x macro defined for the extension
+             (described above).
+
+
+10.  Result Codes
+
+Many of the LDAP API routines return result codes, some of which indi-
+cate local API errors and some of which are LDAP resultCodes that are
+returned by servers.  All of the result codes are non-negative integers.
+Supported result codes are as follows (hexadecimal values are given in
+parentheses after the constant):
+
+           LDAP_SUCCESS (0x00)
+           LDAP_OPERATIONS_ERROR (0x01)
+           LDAP_PROTOCOL_ERROR (0x02)
+           LDAP_TIMELIMIT_EXCEEDED (0x03)
+           LDAP_SIZELIMIT_EXCEEDED (0x04)
+           LDAP_COMPARE_FALSE (0x05)
+           LDAP_COMPARE_TRUE (0x06)
+           LDAP_STRONG_AUTH_NOT_SUPPORTED (0x07)
+           LDAP_STRONG_AUTH_REQUIRED (0x08)
+           LDAP_REFERRAL (0x0a)                            -- new in LDAPv3
+           LDAP_ADMINLIMIT_EXCEEDED (0x0b)                 -- new in LDAPv3
+           LDAP_UNAVAILABLE_CRITICAL_EXTENSION (0x0c)      -- new in LDAPv3
+           LDAP_CONFIDENTIALITY_REQUIRED (0x0d)            -- new in LDAPv3
+           LDAP_SASL_BIND_IN_PROGRESS (0x0e)               -- new in LDAPv3
+
+
+
+Expires: May 2001                                              [Page 14]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+           LDAP_NO_SUCH_ATTRIBUTE (0x10)
+           LDAP_UNDEFINED_TYPE (0x11)
+           LDAP_INAPPROPRIATE_MATCHING (0x12)
+           LDAP_CONSTRAINT_VIOLATION (0x13)
+           LDAP_TYPE_OR_VALUE_EXISTS (0x14)
+           LDAP_INVALID_SYNTAX (0x15)
+           LDAP_NO_SUCH_OBJECT (0x20)
+           LDAP_ALIAS_PROBLEM (0x21)
+           LDAP_INVALID_DN_SYNTAX (0x22)
+           LDAP_IS_LEAF (0x23)                             -- not used in LDAPv3
+           LDAP_ALIAS_DEREF_PROBLEM (0x24)
+           LDAP_INAPPROPRIATE_AUTH (0x30)
+           LDAP_INVALID_CREDENTIALS (0x31)
+           LDAP_INSUFFICIENT_ACCESS (0x32)
+           LDAP_BUSY (0x33)
+           LDAP_UNAVAILABLE (0x34)
+           LDAP_UNWILLING_TO_PERFORM (0x35)
+           LDAP_LOOP_DETECT (0x36)
+           LDAP_NAMING_VIOLATION (0x40)
+           LDAP_OBJECT_CLASS_VIOLATION (0x41)
+           LDAP_NOT_ALLOWED_ON_NONLEAF (0x42)
+           LDAP_NOT_ALLOWED_ON_RDN (0x43)
+           LDAP_ALREADY_EXISTS (0x44)
+           LDAP_NO_OBJECT_CLASS_MODS (0x45)
+           LDAP_RESULTS_TOO_LARGE (0x46)                   -- reserved for CLDAP
+           LDAP_AFFECTS_MULTIPLE_DSAS (0x47)               -- new in LDAPv3
+           LDAP_OTHER (0x50)
+           LDAP_SERVER_DOWN (0x51)
+           LDAP_LOCAL_ERROR (0x52)
+           LDAP_ENCODING_ERROR (0x53)
+           LDAP_DECODING_ERROR (0x54)
+           LDAP_TIMEOUT (0x55)
+           LDAP_AUTH_UNKNOWN (0x56)
+           LDAP_FILTER_ERROR (0x57)
+           LDAP_USER_CANCELLED (0x58)
+           LDAP_PARAM_ERROR (0x59)
+           LDAP_NO_MEMORY (0x5a)
+           LDAP_CONNECT_ERROR (0x5b)
+           LDAP_NOT_SUPPORTED (0x5c)
+           LDAP_CONTROL_NOT_FOUND (0x5d)
+           LDAP_NO_RESULTS_RETURNED (0x5e)
+           LDAP_MORE_RESULTS_TO_RETURN (0x5f)
+           LDAP_CLIENT_LOOP (0x60)
+           LDAP_REFERRAL_LIMIT_EXCEEDED (0x61)
+
+
+
+
+
+
+
+Expires: May 2001                                              [Page 15]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+11.  Performing LDAP Operations
+
+This section describes each LDAP operation API call in detail. Most
+functions take a "session handle," a pointer to an LDAP structure con-
+taining per-connection information.  Many routines return results in an
+LDAPMessage structure. These structures and others are described as
+needed below.
+
+
+11.1.  Initializing an LDAP Session
+
+ldap_init() initializes a session with an LDAP server. The server is not
+actually contacted until an operation is performed that requires it,
+allowing various options to be set after initialization.
+
+           LDAP *ldap_init(
+                   const char      *hostname,
+                   int             portno
+           );
+
+Use of the following routine is deprecated:
+
+           LDAP *ldap_open(
+                   const char      *hostname,
+                   int             portno
+           );
+
+Unlike ldap_init(), ldap_open() attempts to make a server connection
+before returning to the caller.  A more complete description can be
+found in RFC 1823.
+
+Parameters are:
+
+hostname Contains a space-separated list of hostnames or dotted strings
+         representing the IP address of hosts running an LDAP server to
+         connect to. Each hostname in the list MAY include a port number
+         which is separated from the host itself with a colon (:) char-
+         acter.  The hosts will be tried in the order listed, stopping
+         with the first one to which a successful connection is made.
+
+   Note: A suitable representation for including a literal IPv6[10]
+   address in the hostname parameter is desired, but has not yet been
+   determined or implemented in practice.
+
+portno   Contains the TCP port number to connect to. The default LDAP
+         port of 389 can be obtained by supplying the value zero (0) or
+         the macro LDAP_PORT (389).  If a host includes a port number
+         then this parameter is ignored.
+
+
+
+Expires: May 2001                                              [Page 16]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+ldap_init() and ldap_open() both return a "session handle," a pointer to
+an opaque structure that MUST be passed to subsequent calls pertaining
+to the session. These routines return NULL if the session cannot be ini-
+tialized in which case the operating system error reporting mechanism
+can be checked to see why the call failed.
+
+Note that if you connect to an LDAPv2 server, one of the LDAP bind calls
+described below SHOULD be completed before other operations can be per-
+formed on the session.  LDAPv3 does not require that a bind operation be
+completed before other operations can be performed.
+
+The calling program can set various attributes of the session by calling
+the routines described in the next section.
+
+
+11.2.  LDAP Session Handle Options
+
+The LDAP session handle returned by ldap_init() is a pointer to an
+opaque data type representing an LDAP session. In RFC 1823 this data
+type was a structure exposed to the caller, and various fields in the
+structure could be set to control aspects of the session, such as size
+and time limits on searches.
+
+In the interest of insulating callers from inevitable changes to this
+structure, these aspects of the session are now accessed through a pair
+of accessor functions, described below.
+
+ldap_get_option() is used to access the current value of various
+session-wide parameters. ldap_set_option() is used to set the value of
+these parameters.  Note that some options are READ-ONLY and cannot be
+set; it is an error to call ldap_set_option() and attempt to set a
+READ-ONLY option.
+
+Note that if automatic referral following is enabled (the default), any
+connections created during the course of following referrals will
+inherit the options associated with the session that sent the original
+request that caused the referrals to be returned.
+
+           int ldap_get_option(
+                   LDAP            *ld,
+                   int             option,
+                   void            *outvalue
+           );
+
+           int ldap_set_option(
+                   LDAP            *ld,
+                   int             option,
+                   const void      *invalue
+
+
+
+Expires: May 2001                                              [Page 17]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+           );
+
+           #define LDAP_OPT_ON     (<impl_void_star_value>)
+           #define LDAP_OPT_OFF    ((void *)0)
+
+   LDAP_OPT_ON MUST be defined as a non-null pointer to void;  that is,
+   <impl_void_star_value> MUST be replaced with a non-null pointer to
+   void, e.g., one could use:
+           #define LDAP_OPT_ON     ((void *)1)
+   if that value is safe to use on the architecture where the API is
+   implemented.
+
+Parameters are:
+
+ld     The session handle.  If this is NULL, a set of global defaults is
+       accessed.  New LDAP session handles created with ldap_init() or
+       ldap_open() inherit their characteristics from these global
+       defaults.
+
+option The name of the option being accessed or set. This parameter
+       SHOULD be one of the following constants, which have the indi-
+       cated meanings.  After the constant the actual hexadecimal value
+       of the constant is listed in parentheses.
+
+
+   LDAP_OPT_API_INFO (0x00)
+      Type for invalue parameter: not applicable (option is READ-ONLY)
+
+      Type for outvalue parameter: LDAPAPIInfo *
+
+      Description:
+           Used to retrieve some basic information about the LDAP API
+           implementation at execution time.  See the section "Retriev-
+           ing Information About the API Implementation" above for more
+           information.  This option is READ-ONLY and cannot be set.
+
+   LDAP_OPT_DEREF (0x02)
+      Type for invalue parameter: int *
+
+      Type for outvalue parameter: int *
+
+      Description:
+           Determines how aliases are handled during search. It SHOULD
+           have one of the following values: LDAP_DEREF_NEVER (0x00),
+           LDAP_DEREF_SEARCHING (0x01), LDAP_DEREF_FINDING (0x02), or
+           LDAP_DEREF_ALWAYS (0x03).  The LDAP_DEREF_SEARCHING value
+           means aliases are dereferenced during the search but not when
+           locating the base object of the search. The
+
+
+
+Expires: May 2001                                              [Page 18]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+           LDAP_DEREF_FINDING value means aliases are dereferenced when
+           locating the base object but not during the search.  The
+           default value for this option is LDAP_DEREF_NEVER.
+
+   LDAP_OPT_SIZELIMIT (0x03)
+      Type for invalue parameter: int *
+
+      Type for outvalue parameter: int *
+
+      Description:
+           A limit on the number of entries to return from a search. A
+           value of LDAP_NO_LIMIT (0) means no limit.  The default value
+           for this option is LDAP_NO_LIMIT.
+
+   LDAP_OPT_TIMELIMIT (0x04)
+      Type for invalue parameter: int *
+
+      Type for outvalue parameter: int *
+
+      Description:
+           A limit on the number of seconds to spend on a search. A
+           value of LDAP_NO_LIMIT (0) means no limit.  The default value
+           for this option is LDAP_NO_LIMIT.  This value is passed to
+           the server in the search request only; it does not affect how
+           long the C LDAP API implementation itself will wait locally
+           for search results.  Note that the timeout parameter passed
+           to the ldap_search_ext_s() or ldap_result() functions can be
+           used to specify a limit on how long the API implementation
+           will wait for results.
+
+   LDAP_OPT_REFERRALS (0x08)
+      Type for invalue parameter: void * (LDAP_OPT_ON or LDAP_OPT_OFF)
+
+      Type for outvalue parameter: int *
+
+      Description:
+           Determines whether the LDAP library automatically follows
+           referrals returned by LDAP servers or not. It MAY be set to
+           one of the constants LDAP_OPT_ON or LDAP_OPT_OFF; any non-
+           NULL pointer value passed to ldap_set_option() enables this
+           option.  When reading the current setting using
+           ldap_get_option(), a zero value means OFF and any non-zero
+           value means ON.  By default, this option is ON.
+
+   LDAP_OPT_RESTART (0x09)
+      Type for invalue parameter: void * (LDAP_OPT_ON or LDAP_OPT_OFF)
+
+      Type for outvalue parameter: int *
+
+
+
+Expires: May 2001                                              [Page 19]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+      Description:
+           Determines whether LDAP I/O operations are automatically res-
+           tarted if they abort prematurely. It MAY be set to one of the
+           constants LDAP_OPT_ON or LDAP_OPT_OFF; any non-NULL pointer
+           value passed to ldap_set_option() enables this option.  When
+           reading the current setting using ldap_get_option(), a zero
+           value means OFF and any non-zero value means ON. This option
+           is useful if an LDAP I/O operation can be interrupted prema-
+           turely, for example by a timer going off, or other interrupt.
+           By default, this option is OFF.
+
+   LDAP_OPT_PROTOCOL_VERSION (0x11)
+      Type for invalue parameter: int *
+
+      Type for outvalue parameter: int *
+
+      Description:
+           This option indicates the version of the LDAP protocol used
+           when communicating with the primary LDAP server. It SHOULD be
+           one of the constants LDAP_VERSION2 (2) or LDAP_VERSION3 (3).
+           If no version is set the default is LDAP_VERSION2 (2).
+
+   LDAP_OPT_SERVER_CONTROLS (0x12)
+      Type for invalue parameter: LDAPControl **
+
+      Type for outvalue parameter: LDAPControl ***
+
+      Description:
+           A default list of LDAP server controls to be sent with each
+           request.  See the Working With Controls section below.
+
+   LDAP_OPT_CLIENT_CONTROLS (0x13)
+      Type for invalue parameter: LDAPControl **
+
+      Type for outvalue parameter: LDAPControl ***
+
+      Description:
+           A default list of client controls that affect the LDAP ses-
+           sion.  See the Working With Controls section below.
+
+   LDAP_OPT_API_FEATURE_INFO (0x15)
+      Type for invalue parameter: not applicable (option is READ-ONLY)
+
+      Type for outvalue parameter: LDAPAPIFeatureInfo *
+
+      Description:
+           Used to retrieve version information about LDAP API extended
+           features at execution time.  See the section "Retrieving
+
+
+
+Expires: May 2001                                              [Page 20]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+           Information About the API Implementation" above for more
+           information.  This option is READ-ONLY and cannot be set.
+
+   LDAP_OPT_HOST_NAME (0x30)
+      Type for invalue parameter: char *
+
+      Type for outvalue parameter: char **
+
+      Description:
+           The host name (or list of hosts) for the primary LDAP server.
+           See the definition of the hostname parameter to ldap_init()
+           for the allowed syntax.  Note that if the portno parameter
+           passed to ldap_init() is a value other than 0 or 389
+           (LDAP_PORT), this value SHOULD include a string like
+           ":portno" after each hostname or IP address that did not have
+           one in the original hostname parameter that was passed to
+           ldap_init().  For example, if this hostname value was passed
+           to ldap_init():
+
+               "ldap.example.com:389 ldap2.example.com"
+
+           and the portno parameter passed to ldap_init() was 6389, then
+           the value returned for the LDAP_OPT_HOST_NAME option SHOULD
+           be:
+
+               "ldap.example.com:389 ldap2.example.com:6389"
+
+
+   LDAP_OPT_RESULT_CODE (0x31)
+      Type for invalue parameter: int *
+
+      Type for outvalue parameter: int *
+
+      Description:
+           The most recent local (API generated) or server returned LDAP
+           result code that occurred for this session.
+
+   LDAP_OPT_ERROR_STRING (0x32)
+      Type for invalue parameter: char *
+
+      Type for outvalue parameter: char **
+
+      Description:
+           The message returned with the most recent LDAP error that
+           occurred for this session.
+
+   LDAP_OPT_MATCHED_DN (0x33)
+      Type for invalue parameter: char *
+
+
+
+Expires: May 2001                                              [Page 21]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+      Type for outvalue parameter: char **
+
+      Description:
+           The matched DN value returned with the most recent LDAP error
+           that occurred for this session.
+
+
+outvalue The address of a place to put the value of the option. The
+         actual type of this parameter depends on the setting of the
+         option parameter.  For outvalues of type char ** and LDAPCon-
+         trol **, a copy of the data that is associated with the LDAP
+         session ld is returned; callers should dispose of the memory by
+         calling ldap_memfree() or ldap_controls_free(), depending on
+         the type of data returned.
+
+invalue  A pointer to the value the option is to be given. The actual
+         type of this parameter depends on the setting of the option
+         parameter. The data associated with invalue is copied by the
+         API implementation to allow callers of the API to dispose of or
+         otherwise change their copy of the data after a successful call
+         to ldap_set_option().  If a value passed for invalue is invalid
+         or cannot be accepted by the implementation, ldap_set_option()
+         should return -1 to indicate an error.
+
+Both ldap_get_option() and ldap_set_option() return 0 if successful and
+-1 if an error occurs.  If -1 is returned by either function, a specific
+result code MAY be retrieved by calling ldap_get_option() with an option
+value of LDAP_OPT_RESULT_CODE.  Note that there is no way to retrieve a
+more specific result code if a call to ldap_get_option() with an option
+value of LDAP_OPT_RESULT_CODE fails.
+
+When a call to ldap_get_option() succeeds, the API implementation MUST
+NOT change the state of the LDAP session handle or the state of the
+underlying implementation in a way that affects the behavior of future
+LDAP API calls.  When a call to ldap_get_option() fails, the only ses-
+sion handle change permitted is setting the LDAP result code (as
+returned by the LDAP_OPT_RESULT_CODE option).
+
+When a call to ldap_set_option() fails, it MUST NOT change the state of
+the LDAP session handle or the state of the underlying implementation in
+a way that affects the behavior of future LDAP API calls.
+
+Standards track documents that extend this specification and specify new
+options SHOULD use values for option macros that are between 0x1000 and
+0x3FFF inclusive.  Private and experimental extensions SHOULD use values
+for the option macros that are between 0x4000 and 0x7FFF inclusive.  All
+values below 0x1000 and above 0x7FFF that are not defined in this docu-
+ment are reserved and SHOULD NOT be used.  The following macro MUST be
+
+
+
+Expires: May 2001                                              [Page 22]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+defined by C LDAP API implementations to aid extension implementors:
+   #define LDAP_OPT_PRIVATE_EXTENSION_BASE 0x4000  /* to 0x7FFF inclusive */
+
+
+
+11.3.  Working With Controls
+
+LDAPv3 operations can be extended through the use of controls.  Controls
+can be sent to a server or returned to the client with any LDAP message.
+These controls are referred to as server controls.
+
+The LDAP API also supports a client-side extension mechanism through the
+use of client controls. These controls affect the behavior of the LDAP
+API only and are never sent to a server.  A common data structure is
+used to represent both types of controls:
+
+           typedef struct ldapcontrol {
+                   char            *ldctl_oid;
+                   struct berval   ldctl_value;
+                   char            ldctl_iscritical;
+           } LDAPControl;
+
+The fields in the ldapcontrol structure have the following meanings:
+
+ldctl_oid        The control type, represented as a string.
+
+ldctl_value      The data associated with the control (if any).  To
+                 specify a zero-length value, set ldctl_value.bv_len to
+                 zero and ldctl_value.bv_val to a zero-length string.
+                 To indicate that no data is associated with the con-
+                 trol, set ldctl_value.bv_val to NULL.
+
+ldctl_iscritical Indicates whether the control is critical of not. If
+                 this field is non-zero, the operation will only be car-
+                 ried out if the control is recognized by the server
+                 and/or client.  Note that the LDAP unbind and abandon
+                 operations have no server response, so clients SHOULD
+                 NOT mark server controls critical when used with these
+                 two operations.
+
+Some LDAP API calls allocate an ldapcontrol structure or a NULL-
+terminated array of ldapcontrol structures.  The following routines can
+be used to dispose of a single control or an array of controls:
+
+           void ldap_control_free( LDAPControl *ctrl );
+           void ldap_controls_free( LDAPControl **ctrls );
+If the ctrl or ctrls parameter is NULL, these calls do nothing.
+
+
+
+
+Expires: May 2001                                              [Page 23]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+A set of controls that affect the entire session can be set using the
+ldap_set_option() function (see above).  A list of controls can also be
+passed directly to some LDAP API calls such as ldap_search_ext(), in
+which case any controls set for the session through the use of
+ldap_set_option() are ignored. Control lists are represented as a NULL-
+terminated array of pointers to ldapcontrol structures.
+
+Server controls are defined by LDAPv3 protocol extension documents; for
+example, a control has been proposed to support server-side sorting of
+search results [11].
+
+One client control is defined in this document (described in the follow-
+ing section).  Other client controls MAY be defined in future revisions
+of this document or in documents that extend this API.
+
+
+11.3.1.  A Client Control That Governs Referral Processing
+
+As described previously in the section "LDAP Session Handle Options,"
+applications can enable and disable automatic chasing of referrals on a
+session-wide basic by using the ldap_set_option() function with the
+LDAP_OPT_REFERRALS option.  It is also useful to govern automatic refer-
+ral chasing on per-request basis.  A client control with an OID of
+1.2.840.113556.1.4.616 exists to provide this functionality.
+
+   /* OID for referrals client control */
+   #define LDAP_CONTROL_REFERRALS              "1.2.840.113556.1.4.616"
+
+   /* Flags for referrals client control value */
+   #define LDAP_CHASE_SUBORDINATE_REFERRALS    0x00000020U
+   #define LDAP_CHASE_EXTERNAL_REFERRALS       0x00000040U
+
+To create a referrals client control, the ldctl_oid field of an LDAPCon-
+trol structure MUST be set to LDAP_CONTROL_REFERRALS
+("1.2.840.113556.1.4.616") and the ldctl_value field MUST be set to a
+value that contains a set of flags.  The ldctl_value.bv_len field MUST
+be set to sizeof(ber_uint_t), and the ldctl_value.bv_val field MUST
+point to a ber_uint_t which contains the flags value." The ber_uint_t
+type is define in the section "BER Data Structures and Types" below.
+
+The flags value can be set to zero to disable automatic chasing of
+referrals and LDAPv3 references altogether.  Alternatively, the flags
+value can be set to the value LDAP_CHASE_SUBORDINATE_REFERRALS
+(0x00000020U) to indicate that only LDAPv3 search continuation refer-
+ences are to be automatically chased by the API implementation, to the
+value LDAP_CHASE_EXTERNAL_REFERRALS (0x00000040U) to indicate that only
+LDAPv3 referrals are to be automatically chased, or the logical OR of
+the two flag values (0x00000060U) to indicate that both referrals and
+
+
+
+Expires: May 2001                                              [Page 24]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+references are to be automatically chased.
+
+
+11.4.  Authenticating to the directory
+
+The following functions are used to authenticate an LDAP client to an
+LDAP directory server.
+
+The ldap_sasl_bind() and ldap_sasl_bind_s() functions can be used to do
+general and extensible authentication over LDAP through the use of the
+Simple Authentication Security Layer [12].  The routines both take the
+dn to bind as, the method to use, as a dotted-string representation of
+an OID identifying the method, and a struct berval holding the creden-
+tials. The special constant value LDAP_SASL_SIMPLE (NULL) can be passed
+to request simple authentication, or the simplified routines
+ldap_simple_bind() or ldap_simple_bind_s() can be used.
+
+           int ldap_sasl_bind(
+                   LDAP                    *ld,
+                   const char              *dn,
+                   const char              *mechanism,
+                   const struct berval     *cred,
+                   LDAPControl             **serverctrls,
+                   LDAPControl             **clientctrls,
+                   int                     *msgidp
+           );
+
+           int ldap_sasl_bind_s(
+                   LDAP                    *ld,
+                   const char              *dn,
+                   const char              *mechanism,
+                   const struct berval     *cred,
+                   LDAPControl             **serverctrls,
+                   LDAPControl             **clientctrls,
+                   struct berval           **servercredp
+           );
+
+           int ldap_simple_bind(
+                   LDAP                    *ld,
+                   const char              *dn,
+                   const char              *passwd
+           );
+
+           int ldap_simple_bind_s(
+                   LDAP                    *ld,
+                   const char              *dn,
+                   const char              *passwd
+           );
+
+
+
+Expires: May 2001                                              [Page 25]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+   The use of the following routines is deprecated and more complete
+   descriptions can be found in RFC 1823:
+
+           int ldap_bind( LDAP *ld, const char *dn, const char *cred,
+                   int method );
+
+           int ldap_bind_s( LDAP *ld, const char *dn, const char *cred,
+                   int method );
+
+           int ldap_kerberos_bind( LDAP *ld, const char *dn );
+
+           int ldap_kerberos_bind_s( LDAP *ld, const char *dn );
+
+Parameters are:
+
+ld           The session handle.
+
+dn           The name of the entry to bind as.  If NULL, a zero length
+             DN is sent to the server.
+
+mechanism    Either LDAP_SASL_SIMPLE (NULL) to get simple authentica-
+             tion, or a text string identifying the SASL method.
+
+cred         The credentials with which to authenticate. Arbitrary
+             credentials can be passed using this parameter. The format
+             and content of the credentials depends on the setting of
+             the mechanism parameter.  If the cred parameter is NULL and
+             the mechanism is LDAP_SASL_SIMPLE, a zero-length octet
+             string is sent to the server in the simple credentials
+             field of the bind request.  If the cred parameter is NULL
+             and the mechanism is anything else, no credentials are sent
+             to the server in the bind request.
+
+passwd       For ldap_simple_bind(), the password that is sent to the
+             server in the simple credentials field of the bind request.
+             If NULL, a zero length password is sent to the server.
+
+serverctrls  List of LDAP server controls, or NULL if no server controls
+             are used.
+
+clientctrls  List of client controls, or NULL if no client controls are
+             used.
+
+msgidp       This result parameter will be set to the message id of the
+             request if the ldap_sasl_bind() call succeeds.  The value
+             is undefined if a value other than LDAP_SUCCESS is
+             returned.
+
+
+
+
+Expires: May 2001                                              [Page 26]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+servercredp  This result parameter will be filled in with the creden-
+             tials passed back by the server for mutual authentication,
+             if given. An allocated berval structure is returned that
+             SHOULD be disposed of by calling ber_bvfree().  NULL SHOULD
+             be passed to ignore this field.  If an API error occurs or
+             the server did not return any credentials, *servercredp is
+             set to NULL.
+
+Additional parameters for the deprecated routines are not described.
+Interested readers are referred to RFC 1823.
+
+The ldap_sasl_bind() function initiates an asynchronous bind operation
+and returns the constant LDAP_SUCCESS if the request was successfully
+sent, or another LDAP result code if not.  See the section below on
+error handling for more information about possible errors and how to
+interpret them.  If successful, ldap_sasl_bind() places the message id
+of the request in *msgidp. A subsequent call to ldap_result(), described
+below, can be used to obtain the result of the bind.
+
+The ldap_simple_bind() function initiates a simple asynchronous bind
+operation and returns the message id of the operation initiated.  A sub-
+sequent call to ldap_result(), described below, can be used to obtain
+the result of the bind. In case of error, ldap_simple_bind() will return
+-1, setting the session error parameters in the LDAP structure appropri-
+ately.
+
+The synchronous ldap_sasl_bind_s() and ldap_simple_bind_s() functions
+both return the result of the operation, either the constant
+LDAP_SUCCESS if the operation was successful, or another LDAP result
+code if it was not. See the section below on error handling for more
+information about possible errors and how to interpret them.
+
+Note that if an LDAPv2 server is contacted, no other operations over the
+connection can be attempted before a bind call has successfully com-
+pleted.
+
+Subsequent bind calls can be used to re-authenticate over the same con-
+nection, and multistep SASL sequences can be accomplished through a
+sequence of calls to ldap_sasl_bind() or ldap_sasl_bind_s().
+
+
+11.5.  Closing the session
+
+The following functions are used to unbind from the directory, close
+open connections, and dispose of the session handle.
+
+           int ldap_unbind_ext( LDAP *ld, LDAPControl **serverctrls,
+                   LDAPControl **clientctrls );
+
+
+
+Expires: May 2001                                              [Page 27]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+           int ldap_unbind( LDAP *ld );
+
+           int ldap_unbind_s( LDAP *ld );
+
+Parameters are:
+
+ld           The session handle.
+
+serverctrls  List of LDAP server controls, or NULL if no server controls
+             are to be used.
+
+clientctrls  List of client controls, or NULL if no client controls are
+             to be used.
+
+The ldap_unbind_ext(), ldap_unbind() and ldap_unbind_s() all work syn-
+chronously in the sense that they send an unbind request to the server,
+close all open connections associated with the LDAP session handle, and
+dispose of all resources associated with the session handle before
+returning.  Note, however, that there is no server response to an LDAP
+unbind operation.  All three of the unbind functions return LDAP_SUCCESS
+(or another LDAP result code if the request cannot be sent to the LDAP
+server).  After a call to one of the unbind functions, the session han-
+dle ld is invalid and it is illegal to make any further LDAP API calls
+using ld.
+
+The ldap_unbind() and ldap_unbind_s() functions behave identically.  The
+ldap_unbind_ext() function allows server and client controls to be
+included explicitly, but note that since there is no server response to
+an unbind request there is no way to receive a response to a server con-
+trol sent with an unbind request.
+
+
+
+11.6.  Searching
+
+The following functions are used to search the LDAP directory, returning
+a requested set of attributes for each entry matched.  There are five
+variations.
+
+           int ldap_search_ext(
+                   LDAP            *ld,
+                   const char      *base,
+                   int             scope,
+                   const char      *filter,
+                   char            **attrs,
+                   int             attrsonly,
+                   LDAPControl     **serverctrls,
+                   LDAPControl     **clientctrls,
+
+
+
+Expires: May 2001                                              [Page 28]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+                   struct timeval  *timeout,
+                   int             sizelimit,
+                   int             *msgidp
+           );
+
+           int ldap_search_ext_s(
+                   LDAP            *ld,
+                   const char      *base,
+                   int             scope,
+                   const char      *filter,
+                   char            **attrs,
+                   int             attrsonly,
+                   LDAPControl     **serverctrls,
+                   LDAPControl     **clientctrls,
+                   struct timeval  *timeout,
+                   int             sizelimit,
+                   LDAPMessage     **res
+           );
+
+           int ldap_search(
+                   LDAP            *ld,
+                   const char      *base,
+                   int             scope,
+                   const char      *filter,
+                   char            **attrs,
+                   int             attrsonly
+           );
+
+           int ldap_search_s(
+                   LDAP            *ld,
+                   const char      *base,
+                   int             scope,
+                   const char      *filter,
+                   char            **attrs,
+                   int             attrsonly,
+                   LDAPMessage     **res
+           );
+
+           int ldap_search_st(
+                   LDAP            *ld,
+                   const char      *base,
+                   int             scope,
+                   const char      *filter,
+                   char            **attrs,
+                   int             attrsonly,
+                   struct timeval  *timeout,
+                   LDAPMessage     **res
+           );
+
+
+
+Expires: May 2001                                              [Page 29]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+Parameters are:
+
+ld           The session handle.
+
+base         The dn of the entry at which to start the search.  If NULL,
+             a zero length DN is sent to the server.
+
+scope        One of LDAP_SCOPE_BASE (0x00), LDAP_SCOPE_ONELEVEL (0x01),
+             or LDAP_SCOPE_SUBTREE (0x02), indicating the scope of the
+             search.
+
+filter       A character string as described in [13], representing the
+             search filter.  The value NULL can be passed to indicate
+             that the filter "(objectclass=*)" which matches all entries
+             is to be used.  Note that if the caller of the API is using
+             LDAPv2, only a subset of the filter functionality described
+             in [13] can be successfully used.
+
+attrs        A NULL-terminated array of strings indicating which attri-
+             butes to return for each matching entry. Passing NULL for
+             this parameter causes all available user attributes to be
+             retrieved.  The special constant string LDAP_NO_ATTRS
+             ("1.1") MAY be used as the only string in the array to
+             indicate that no attribute types are to be returned by the
+             server.  The special constant string LDAP_ALL_USER_ATTRS
+             ("*") can be used in the attrs array along with the names
+             of some operational attributes to indicate that all user
+             attributes plus the listed operational attributes are to be
+             returned.
+
+attrsonly    A boolean value that MUST be zero if both attribute types
+             and values are to be returned, and non-zero if only types
+             are wanted.
+
+timeout      For the ldap_search_st() function, this specifies the local
+             search timeout value (if it is NULL, the timeout is infin-
+             ite).  If a zero timeout (where tv_sec and tv_usec are both
+             zero) is passed, API implementations SHOULD return
+             LDAP_PARAM_ERROR.
+
+             For the ldap_search_ext() and ldap_search_ext_s() func-
+             tions, the timeout parameter specifies both the local
+             search timeout value and the operation time limit that is
+             sent to the server within the search request.  Passing a
+             NULL value for timeout causes the default timeout stored in
+             the LDAP session handle (set by using ldap_set_option()
+             with the LDAP_OPT_TIMELIMIT parameter) to be sent to the
+             server with the request but an infinite local search
+
+
+
+Expires: May 2001                                              [Page 30]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+             timeout to be used.  If a zero timeout (where tv_sec and
+             tv_usec are both zero) is passed in, API implementations
+             SHOULD return LDAP_PARAM_ERROR.  If a zero value for tv_sec
+             is used but tv_usec is non-zero, an operation time limit of
+             1 SHOULD be passed to the LDAP server as the operation time
+             limit.  For other values of tv_sec, the tv_sec value itself
+             SHOULD be passed to the LDAP server.
+
+sizelimit    For the ldap_search_ext() and ldap_search_ext_s() calls,
+             this is a limit on the number of entries to return from the
+             search.  A value of LDAP_NO_LIMIT (0) means no limit.  A
+             value of LDAP_DEFAULT_SIZELIMIT (-1) means use the default
+             timeout from the LDAP session handle (which is set by cal-
+             ling ldap_set_option() with the LDAP_OPT_SIZELIMIT parame-
+             ter).
+
+res          For the synchronous calls, this is a result parameter which
+             will contain the results of the search upon completion of
+             the call.  If an API error occurs or no results are
+             returned, *res is set to NULL.
+
+serverctrls  List of LDAP server controls, or NULL if no server controls
+             are to be used.
+
+clientctrls  List of client controls, or NULL if no client controls are
+             to be used.
+
+msgidp       This result parameter will be set to the message id of the
+             request if the ldap_search_ext() call succeeds. The value
+             is undefined if a value other than LDAP_SUCCESS is
+             returned.
+
+There are three options in the session handle ld which potentially
+affect how the search is performed. They are:
+
+        LDAP_OPT_SIZELIMIT
+        LDAP_OPT_TIMELIMIT
+        LDAP_OPT_DEREF
+
+These options are fully described in the earlier section "LDAP Session
+Handle Options."
+
+The ldap_search_ext() function initiates an asynchronous search opera-
+tion and returns the constant LDAP_SUCCESS if the request was success-
+fully sent, or another LDAP result code if not.  See the section below
+on error handling for more information about possible errors and how to
+interpret them.  If successful, ldap_search_ext() places the message id
+of the request in *msgidp. A subsequent call to ldap_result(), described
+
+
+
+Expires: May 2001                                              [Page 31]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+below, can be used to obtain the results from the search.  These results
+can be parsed using the result parsing routines described in detail
+later.
+
+Similar to ldap_search_ext(), the ldap_search() function initiates an
+asynchronous search operation and returns the message id of the opera-
+tion initiated.  As for ldap_search_ext(), a subsequent call to
+ldap_result(), described below, can be used to obtain the result of the
+bind. In case of error, ldap_search() will return -1, setting the ses-
+sion error parameters in the LDAP structure appropriately.
+
+The synchronous ldap_search_ext_s(), ldap_search_s(), and
+ldap_search_st() functions all return the result of the operation,
+either the constant LDAP_SUCCESS if the operation was successful, or
+another LDAP result code if it was not. See the section below on error
+handling for more information about possible errors and how to interpret
+them.  Entries returned from the search (if any) are contained in the
+res parameter. This parameter is opaque to the caller.  Entries, attri-
+butes, values, etc., can be extracted by calling the parsing routines
+described below. The results contained in res SHOULD be freed when no
+longer in use by calling ldap_msgfree(), described later.
+
+The ldap_search_ext() and ldap_search_ext_s() functions support LDAPv3
+server controls, client controls, and allow varying size and time limits
+to be easily specified for each search operation.  The ldap_search_st()
+function is identical to ldap_search_s() except that it takes an addi-
+tional parameter specifying a local timeout for the search.  The local
+search timeout is used to limit the amount of time the API implementa-
+tion will wait for a search to complete.  After the local search timeout
+expires, the API implementation will send an abandon operation to abort
+the search operation.
+
+11.7.  Reading an Entry
+
+LDAP does not support a read operation directly. Instead, this operation
+is emulated by a search with base set to the DN of the entry to read,
+scope set to LDAP_SCOPE_BASE, and filter set to "(objectclass=*)" or
+NULL. attrs contains the list of attributes to return.
+
+
+11.8.  Listing the Children of an Entry
+
+LDAP does not support a list operation directly. Instead, this operation
+is emulated by a search with base set to the DN of the entry to list,
+scope set to LDAP_SCOPE_ONELEVEL, and filter set to "(objectclass=*)" or
+NULL. attrs contains the list of attributes to return for each child
+entry.
+
+
+
+
+Expires: May 2001                                              [Page 32]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+11.9.  Comparing a Value Against an Entry
+
+The following routines are used to compare a given attribute value
+assertion against an LDAP entry.  There are four variations:
+
+           int ldap_compare_ext(
+                   LDAP                    *ld,
+                   const char              *dn,
+                   const char              *attr,
+                   const struct berval     *bvalue,
+                   LDAPControl             **serverctrls,
+                   LDAPControl             **clientctrls,
+                   int                     *msgidp
+           );
+
+           int ldap_compare_ext_s(
+                   LDAP                    *ld,
+                   const char              *dn,
+                   const char              *attr,
+                   const struct berval     *bvalue,
+                   LDAPControl             **serverctrls,
+                   LDAPControl             **clientctrls
+           );
+
+           int ldap_compare(
+                   LDAP                    *ld,
+                   const char              *dn,
+                   const char              *attr,
+                   const char              *value
+           );
+
+           int ldap_compare_s(
+                   LDAP                    *ld,
+                   const char              *dn,
+                   const char              *attr,
+                   const char              *value
+           );
+
+Parameters are:
+
+ld           The session handle.
+
+dn           The name of the entry to compare against.  If NULL, a zero
+             length DN is sent to the server.
+
+attr         The attribute to compare against.
+
+bvalue       The attribute value to compare against those found in the
+
+
+
+Expires: May 2001                                              [Page 33]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+             given entry. This parameter is used in the extended rou-
+             tines and is a pointer to a struct berval so it is possible
+             to compare binary values.
+
+value        A string attribute value to compare against, used by the
+             ldap_compare() and ldap_compare_s() functions.  Use
+             ldap_compare_ext() or ldap_compare_ext_s() if you need to
+             compare binary values.
+
+serverctrls  List of LDAP server controls, or NULL if no server controls
+             are to be used.
+
+clientctrls  List of client controls, or NULL if no client controls are
+             to be used.
+
+msgidp       This result parameter will be set to the message id of the
+             request if the ldap_compare_ext() call succeeds. The value
+             is undefined if a value other than LDAP_SUCCESS is
+             returned.
+
+The ldap_compare_ext() function initiates an asynchronous compare opera-
+tion and returns the constant LDAP_SUCCESS if the request was success-
+fully sent, or another LDAP result code if not.  See the section below
+on error handling for more information about possible errors and how to
+interpret them.  If successful, ldap_compare_ext() places the message id
+of the request in *msgidp. A subsequent call to ldap_result(), described
+below, can be used to obtain the result of the compare.
+
+Similar to ldap_compare_ext(), the ldap_compare() function initiates an
+asynchronous compare operation and returns the message id of the opera-
+tion initiated.  As for ldap_compare_ext(), a subsequent call to
+ldap_result(), described below, can be used to obtain the result of the
+bind. In case of error, ldap_compare() will return -1, setting the ses-
+sion error parameters in the LDAP structure appropriately.
+
+The synchronous ldap_compare_ext_s() and ldap_compare_s() functions both
+return the result of the operation: one of the constants
+LDAP_COMPARE_TRUE or LDAP_COMPARE_FALSE if the operation was successful,
+or another LDAP result code if it was not.  See the section below on
+error handling for more information about possible errors and how to
+interpret them.
+
+The ldap_compare_ext() and ldap_compare_ext_s() functions support LDAPv3
+server controls and client controls.
+
+
+
+
+
+
+
+Expires: May 2001                                              [Page 34]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+11.10.  Modifying an entry
+
+The following routines are used to modify an existing LDAP entry.  There
+are four variations:
+
+           typedef union mod_vals_u {
+                   char            **modv_strvals;
+                   struct berval   **modv_bvals;
+           } mod_vals_u_t;
+
+           typedef struct ldapmod {
+                   int             mod_op;
+                   char            *mod_type;
+                   mod_vals_u_t    mod_vals;
+           } LDAPMod;
+           #define mod_values      mod_vals.modv_strvals
+           #define mod_bvalues     mod_vals.modv_bvals
+
+           int ldap_modify_ext(
+                   LDAP            *ld,
+                   const char      *dn,
+                   LDAPMod         **mods,
+                   LDAPControl     **serverctrls,
+                   LDAPControl     **clientctrls,
+                   int             *msgidp
+           );
+
+           int ldap_modify_ext_s(
+                   LDAP            *ld,
+                   const char      *dn,
+                   LDAPMod         **mods,
+                   LDAPControl     **serverctrls,
+                   LDAPControl     **clientctrls
+           );
+
+           int ldap_modify(
+                   LDAP            *ld,
+                   const char      *dn,
+                   LDAPMod         **mods
+           );
+
+           int ldap_modify_s(
+                   LDAP            *ld,
+                   const char      *dn,
+                   LDAPMod         **mods
+           );
+
+Parameters are:
+
+
+
+Expires: May 2001                                              [Page 35]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+ld           The session handle.
+
+dn           The name of the entry to modify.  If NULL, a zero length DN
+             is sent to the server.
+
+mods         A NULL-terminated array of modifications to make to the
+             entry.
+
+serverctrls  List of LDAP server controls, or NULL if no server controls
+             are to be used.
+
+clientctrls  List of client controls, or NULL if no client controls are
+             to be used.
+
+msgidp       This result parameter will be set to the message id of the
+             request if the ldap_modify_ext() call succeeds. The value
+             is undefined if a value other than LDAP_SUCCESS is
+             returned.
+
+The fields in the LDAPMod structure have the following meanings:
+
+mod_op       The modification operation to perform. It MUST be one of
+             LDAP_MOD_ADD (0x00), LDAP_MOD_DELETE (0x01), or
+             LDAP_MOD_REPLACE (0x02).  This field also indicates the
+             type of values included in the mod_vals union. It is logi-
+             cally ORed with LDAP_MOD_BVALUES (0x80) to select the
+             mod_bvalues form. Otherwise, the mod_values form is used.
+
+mod_type     The type of the attribute to modify.
+
+mod_vals     The values (if any) to add, delete, or replace. Only one of
+             the mod_values or mod_bvalues variants can be used,
+             selected by ORing the mod_op field with the constant
+             LDAP_MOD_BVALUES. mod_values is a NULL-terminated array of
+             zero-terminated strings and mod_bvalues is a NULL-
+             terminated array of berval structures that can be used to
+             pass binary values such as images.
+
+For LDAP_MOD_ADD modifications, the given values are added to  the
+entry, creating the attribute if necessary.
+
+For LDAP_MOD_DELETE modifications, the given values are deleted from the
+entry, removing the attribute if no values remain. If the entire attri-
+bute is to be deleted, the mod_vals field can be set to NULL.
+
+For LDAP_MOD_REPLACE modifications, the attribute will have the listed
+values after the modification, having been created if necessary, or
+removed if the mod_vals field is NULL. All modifications are performed
+
+
+
+Expires: May 2001                                              [Page 36]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+in the order in which they are listed.
+
+The ldap_modify_ext() function initiates an asynchronous modify opera-
+tion and returns the constant LDAP_SUCCESS if the request was success-
+fully sent, or another LDAP result code if not.  See the section below
+on error handling for more information about possible errors and how to
+interpret them.  If successful, ldap_modify_ext() places the message id
+of the request in *msgidp. A subsequent call to ldap_result(), described
+below, can be used to obtain the result of the modify.
+
+Similar to ldap_modify_ext(), the ldap_modify() function initiates an
+asynchronous modify operation and returns the message id of the opera-
+tion initiated.  As for ldap_modify_ext(), a subsequent call to
+ldap_result(), described below, can be used to obtain the result of the
+modify. In case of error, ldap_modify() will return -1, setting the ses-
+sion error parameters in the LDAP structure appropriately.
+
+The synchronous ldap_modify_ext_s() and ldap_modify_s() functions both
+return the result of the operation, either the constant LDAP_SUCCESS if
+the operation was successful, or another LDAP result code if it was not.
+See the section below on error handling for more information about pos-
+sible errors and how to interpret them.
+
+The ldap_modify_ext() and ldap_modify_ext_s() functions support LDAPv3
+server controls and client controls.
+
+
+11.11.  Modifying the Name of an Entry
+
+In LDAPv2, the ldap_modrdn(), ldap_modrdn_s(), ldap_modrdn2(), and
+ldap_modrdn2_s() routines were used to change the name of an LDAP entry.
+They could only be used to change the least significant component of a
+name (the RDN or relative distinguished name). LDAPv3 provides the
+Modify DN protocol operation that allows more general name change
+access. The ldap_rename() and ldap_rename_s() routines are used to
+change the name of an entry, and the use of the ldap_modrdn(),
+ldap_modrdn_s(), ldap_modrdn2(), and ldap_modrdn2_s() routines is depre-
+cated.
+
+           int ldap_rename(
+                   LDAP            *ld,
+                   const char      *dn,
+                   const char      *newrdn,
+                   const char      *newparent,
+                   int             deleteoldrdn,
+                   LDAPControl     **serverctrls,
+                   LDAPControl     **clientctrls,
+                   int             *msgidp
+
+
+
+Expires: May 2001                                              [Page 37]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+           );
+           int ldap_rename_s(
+                   LDAP            *ld,
+                   const char      *dn,
+                   const char      *newrdn,
+                   const char      *newparent,
+                   int             deleteoldrdn,
+                   LDAPControl     **serverctrls,
+                   LDAPControl     **clientctrls
+           );
+
+   The use of the following routines is deprecated and more complete
+   descriptions can be found in RFC 1823:
+
+           int ldap_modrdn(
+                   LDAP            *ld,
+                   const char      *dn,
+                   const char      *newrdn
+           );
+           int ldap_modrdn_s(
+                   LDAP            *ld,
+                   const char      *dn,
+                   const char      *newrdn
+           );
+           int ldap_modrdn2(
+                   LDAP            *ld,
+                   const char      *dn,
+                   const char      *newrdn,
+                   int             deleteoldrdn
+           );
+           int ldap_modrdn2_s(
+                   LDAP            *ld,
+                   const char      *dn,
+                   const char      *newrdn,
+                   int             deleteoldrdn
+           );
+
+Parameters are:
+
+ld           The session handle.
+
+dn           The name of the entry whose DN is to be changed.  If NULL,
+             a zero length DN is sent to the server.
+
+newrdn       The new RDN to give the entry.
+
+newparent    The new parent, or superior entry.  If this parameter is
+             NULL, only the RDN of the entry is changed.  The root DN
+
+
+
+Expires: May 2001                                              [Page 38]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+             SHOULD be specified by passing a zero length string, "".
+             The newparent parameter SHOULD always be NULL when using
+             version 2 of the LDAP protocol; otherwise the server's
+             behavior is undefined.
+
+deleteoldrdn This parameter only has meaning on the rename routines if
+             newrdn is different than the old RDN. It is a boolean
+             value, if non-zero indicating that the old RDN value(s) is
+             to be removed, if zero indicating that the old RDN value(s)
+             is to be retained as non-distinguished values of the entry.
+
+serverctrls  List of LDAP server controls, or NULL if no server controls
+             are to be used.
+
+clientctrls  List of client controls, or NULL if no client controls are
+             to be used.
+
+msgidp       This result parameter will be set to the message id of the
+             request if the ldap_rename() call succeeds. The value is
+             undefined if a value other than LDAP_SUCCESS is returned.
+
+The ldap_rename() function initiates an asynchronous modify DN operation
+and returns the constant LDAP_SUCCESS if the request was successfully
+sent, or another LDAP result code if not.  See the section below on
+error handling for more information about possible errors and how to
+interpret them.  If successful, ldap_rename() places the DN message id
+of the request in *msgidp. A subsequent call to ldap_result(), described
+below, can be used to obtain the result of the rename.
+
+The synchronous ldap_rename_s() returns the result of the operation,
+either the constant LDAP_SUCCESS if the operation was successful, or
+another LDAP result code if it was not.  See the section below on error
+handling for more information about possible errors and how to interpret
+them.
+
+The ldap_rename() and ldap_rename_s() functions both support LDAPv3
+server controls and client controls.
+
+
+11.12.  Adding an entry
+
+The following functions are used to add entries to the LDAP directory.
+There are four variations:
+
+           int ldap_add_ext(
+                   LDAP            *ld,
+                   const char      *dn,
+                   LDAPMod         **attrs,
+
+
+
+Expires: May 2001                                              [Page 39]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+                   LDAPControl     **serverctrls,
+                   LDAPControl     **clientctrls,
+                   int             *msgidp
+           );
+
+           int ldap_add_ext_s(
+                   LDAP            *ld,
+                   const char      *dn,
+                   LDAPMod         **attrs,
+                   LDAPControl     **serverctrls,
+                   LDAPControl     **clientctrls
+           );
+
+           int ldap_add(
+                   LDAP            *ld,
+                   const char      *dn,
+                   LDAPMod         **attrs
+           );
+
+           int ldap_add_s(
+                   LDAP            *ld,
+                   const char      *dn,
+                   LDAPMod         **attrs
+           );
+
+Parameters are:
+
+ld           The session handle.
+
+dn           The name of the entry to add.  If NULL, a zero length DN is
+             sent to the server.
+
+attrs        The entry's attributes, specified using the LDAPMod struc-
+             ture defined for ldap_modify(). The mod_type and mod_vals
+             fields MUST be filled in.  The mod_op field is ignored
+             unless ORed with the constant LDAP_MOD_BVALUES, used to
+             select the mod_bvalues case of the mod_vals union.
+
+serverctrls  List of LDAP server controls, or NULL if no server controls
+             are to be used.
+
+clientctrls  List of client controls, or NULL if no client controls are
+             to be used.
+
+msgidp       This result parameter will be set to the message id of the
+             request if the ldap_add_ext() call succeeds. The value is
+             undefined if a value other than LDAP_SUCCESS is returned.
+
+
+
+
+Expires: May 2001                                              [Page 40]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+Note that the parent of the entry being added must already exist or the
+parent must be empty (i.e., equal to the root DN) for an add to succeed.
+
+The ldap_add_ext() function initiates an asynchronous add operation and
+returns the constant LDAP_SUCCESS if the request was successfully sent,
+or another LDAP result code if not.  See the section below on error han-
+dling for more information about possible errors and how to interpret
+them.  If successful, ldap_add_ext() places the message id of the
+request in *msgidp. A subsequent call to ldap_result(), described below,
+can be used to obtain the result of the add.
+
+Similar to ldap_add_ext(), the ldap_add() function initiates an asyn-
+chronous add operation and returns the message id of the operation ini-
+tiated.  As for ldap_add_ext(), a subsequent call to ldap_result(),
+described below, can be used to obtain the result of the add. In case of
+error, ldap_add() will return -1, setting the session error parameters
+in the LDAP structure appropriately.
+
+The synchronous ldap_add_ext_s() and ldap_add_s() functions both return
+the result of the operation, either the constant LDAP_SUCCESS if the
+operation was successful, or another LDAP result code if it was not.
+See the section below on error handling for more information about pos-
+sible errors and how to interpret them.
+
+The ldap_add_ext() and ldap_add_ext_s() functions support LDAPv3 server
+controls and client controls.
+
+
+
+11.13.  Deleting an entry
+
+The following functions are used to delete a leaf entry from the LDAP
+directory.  There are four variations:
+
+           int ldap_delete_ext(
+                   LDAP            *ld,
+                   const char      *dn,
+                   LDAPControl     **serverctrls,
+                   LDAPControl     **clientctrls,
+                   int             *msgidp
+           );
+
+           int ldap_delete_ext_s(
+                   LDAP            *ld,
+                   const char      *dn,
+                   LDAPControl     **serverctrls,
+                   LDAPControl     **clientctrls
+           );
+
+
+
+Expires: May 2001                                              [Page 41]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+
+           int ldap_delete(
+                   LDAP            *ld,
+                   const char      *dn
+           );
+
+           int ldap_delete_s(
+                   LDAP            *ld,
+                   const char      *dn
+           );
+
+Parameters are:
+
+ld           The session handle.
+
+dn           The name of the entry to delete.  If NULL, a zero length DN
+             is sent to the server.
+
+serverctrls  List of LDAP server controls, or NULL if no server controls
+             are to be used.
+
+clientctrls  List of client controls, or NULL if no client controls are
+             to be used.
+
+msgidp       This result parameter will be set to the message id of the
+             request if the ldap_delete_ext() call succeeds. The value
+             is undefined if a value other than LDAP_SUCCESS is
+             returned.
+
+Note that the entry to delete must be a leaf entry (i.e., it must have
+no children). Deletion of entire subtrees in a single operation is not
+supported by LDAP.
+
+The ldap_delete_ext() function initiates an asynchronous delete opera-
+tion and returns the constant LDAP_SUCCESS if the request was success-
+fully sent, or another LDAP result code if not.  See the section below
+on error handling for more information about possible errors and how to
+interpret them.  If successful, ldap_delete_ext() places the message id
+of the request in *msgidp. A subsequent call to ldap_result(), described
+below, can be used to obtain the result of the delete.
+
+Similar to ldap_delete_ext(), the ldap_delete() function initiates an
+asynchronous delete operation and returns the message id of the opera-
+tion initiated.  As for ldap_delete_ext(), a subsequent call to
+ldap_result(), described below, can be used to obtain the result of the
+delete. In case of error, ldap_delete() will return -1, setting the ses-
+sion error parameters in the LDAP structure appropriately.
+
+
+
+
+Expires: May 2001                                              [Page 42]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+The synchronous ldap_delete_ext_s() and ldap_delete_s() functions both
+return the result of the operation, either the constant LDAP_SUCCESS if
+the operation was successful, or another LDAP result code if it was not.
+See the section below on error handling for more information about pos-
+sible errors and how to interpret them.
+
+The ldap_delete_ext() and ldap_delete_ext_s() functions support LDAPv3
+server controls and client controls.
+
+
+11.14.  Extended Operations
+
+The ldap_extended_operation() and ldap_extended_operation_s() routines
+allow extended LDAP operations to be passed to the server, providing a
+general protocol extensibility mechanism.
+
+           int ldap_extended_operation(
+                   LDAP                    *ld,
+                   const char              *requestoid,
+                   const struct berval     *requestdata,
+                   LDAPControl             **serverctrls,
+                   LDAPControl             **clientctrls,
+                   int                     *msgidp
+           );
+
+           int ldap_extended_operation_s(
+                   LDAP                    *ld,
+                   const char              *requestoid,
+                   const struct berval     *requestdata,
+                   LDAPControl             **serverctrls,
+                   LDAPControl             **clientctrls,
+                   char                    **retoidp,
+                   struct berval           **retdatap
+           );
+
+Parameters are:
+
+ld           The session handle.
+
+requestoid   The dotted-OID text string naming the request.
+
+requestdata  The arbitrary data needed by the operation (if NULL, no
+             data is sent to the server).
+
+serverctrls  List of LDAP server controls, or NULL if no server controls
+             are to be used.
+
+clientctrls  List of client controls, or NULL if no client controls are
+
+
+
+Expires: May 2001                                              [Page 43]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+             to be used.
+
+msgidp       This result parameter will be set to the message id of the
+             request if the ldap_extended_operation() call succeeds. The
+             value is undefined if a value other than LDAP_SUCCESS is
+             returned.
+
+retoidp      Pointer to a character string that will be set to an allo-
+             cated, dotted-OID text string returned by the server.  This
+             string SHOULD be disposed of using the ldap_memfree() func-
+             tion.  If an API error occurs or no OID is returned by the
+             server, *retoidp is set to NULL.
+
+retdatap     Pointer to a berval structure pointer that will be set an
+             allocated copy of the data returned by the server.  This
+             struct berval SHOULD be disposed of using ber_bvfree().  If
+             an API error occurs or no data is returned by the server,
+             *retdatap is set to NULL.
+
+The ldap_extended_operation() function initiates an asynchronous
+extended operation and returns the constant LDAP_SUCCESS if the request
+was successfully sent, or another LDAP result code if not.  See the sec-
+tion below on error handling for more information about possible errors
+and how to interpret them.  If successful, ldap_extended_operation()
+places the message id of the request in *msgidp. A subsequent call to
+ldap_result(), described below, can be used to obtain the result of the
+extended operation which can be passed to ldap_parse_extended_result()
+to obtain the OID and data contained in the response.
+
+The synchronous ldap_extended_operation_s() function returns the result
+of the operation, either the constant LDAP_SUCCESS if the operation was
+successful, or another LDAP result code if it was not.  See the section
+below on error handling for more information about possible errors and
+how to interpret them.  The retoid and retdata parameters are filled in
+with the OID and data from the response.
+
+The ldap_extended_operation() and ldap_extended_operation_s() functions
+both support LDAPv3 server controls and client controls.
+
+
+12.  Abandoning An Operation
+
+The following calls are used to abandon an operation in progress:
+
+           int ldap_abandon_ext(
+                   LDAP            *ld,
+                   int             msgid,
+                   LDAPControl     **serverctrls,
+
+
+
+Expires: May 2001                                              [Page 44]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+                   LDAPControl     **clientctrls
+           );
+
+           int ldap_abandon(
+                   LDAP            *ld,
+                   int             msgid
+           );
+
+
+ld           The session handle.
+
+msgid        The message id of the request to be abandoned.
+
+serverctrls  List of LDAP server controls, or NULL if no server controls
+             are to be used.
+
+clientctrls  List of client controls, or NULL if no client controls are
+             to be used.
+
+ldap_abandon_ext() abandons the operation with message id msgid and
+returns the constant LDAP_SUCCESS if the abandon was successful or
+another LDAP result code if not.  See the section below on error han-
+dling for more information about possible errors and how to interpret
+them.
+
+ldap_abandon() is identical to ldap_abandon_ext() except that it does
+not accept client or server controls and it returns zero if the abandon
+was successful, -1 otherwise.
+
+After a successful call to ldap_abandon() or ldap_abandon_ext(), results
+with the given message id are never returned from a subsequent call to
+ldap_result().  There is no server response to LDAP abandon operations.
+
+
+13.  Obtaining Results and Peeking Inside LDAP Messages
+
+ldap_result() is used to obtain the result of a previous asynchronously
+initiated operation. Note that depending on how it is called,
+ldap_result() can actually return a list or "chain" of result messages.
+The ldap_result() function only returns messages for a single request,
+so for all LDAP operations other than search only one result message is
+expected; that is, the only time the "result chain" can contain more
+than one message is if results from a search operation are returned.
+Once a chain of messages has been returned to the caller, it is no
+longer tied in any caller-visible way to the LDAP request that produced
+it.  However, it MAY be tied to the session handle.  Therefore, a chain
+of messages returned by calling ldap_result() or by calling a synchro-
+nous search routine will never be affected by subsequent LDAP API calls
+
+
+
+Expires: May 2001                                              [Page 45]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+except for ldap_msgfree() (which is used to dispose of a chain of mes-
+sages) and the unbind calls (which dispose of a session handle):
+ldap_unbind(), ldap_unbind_s(), or ldap_unbind_ext(), or functions
+defined by extensions of this API.
+
+ldap_msgfree() frees the result messages (possibly an entire chain of
+messages) obtained from a previous call to ldap_result() or from a call
+to a synchronous search routine.
+
+ldap_msgtype() returns the type of an LDAP message.
+
+ldap_msgid() returns the message ID of an LDAP message.
+
+           int ldap_result(
+                   LDAP            *ld,
+                   int             msgid,
+                   int             all,
+                   struct timeval  *timeout,
+                   LDAPMessage     **res
+           );
+
+           int ldap_msgfree( LDAPMessage *res );
+
+           int ldap_msgtype( LDAPMessage *res );
+
+           int ldap_msgid( LDAPMessage *res );
+
+Parameters are:
+
+ld       The session handle.
+
+msgid    The message id of the operation whose results are to be
+         returned, the constant LDAP_RES_UNSOLICITED (0) if an unsoli-
+         cited result is desired, or or the constant LDAP_RES_ANY (-1)
+         if any result is desired.
+
+all      Specifies how many messages will be retrieved in a single call
+         to ldap_result().  This parameter only has meaning for search
+         results.  Pass the constant LDAP_MSG_ONE (0x00) to retrieve one
+         message at a time.  Pass LDAP_MSG_ALL (0x01) to request that
+         all results of a search be received before returning all
+         results in a single chain.  Pass LDAP_MSG_RECEIVED (0x02) to
+         indicate that all messages retrieved so far are to be returned
+         in the result chain.
+
+timeout  A timeout specifying how long to wait for results to be
+         returned.  A NULL value causes ldap_result() to block until
+         results are available.  A timeout value of zero seconds
+
+
+
+Expires: May 2001                                              [Page 46]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+         specifies a polling behavior.
+
+res      For ldap_result(), a result parameter that will contain the
+         result(s) of the operation. If an API error occurs or no
+         results are returned, *res is set to NULL.  For ldap_msgfree(),
+         the result chain to be freed, obtained from a previous call to
+         ldap_result(), ldap_search_s(), or ldap_search_st().  If res is
+         NULL, nothing is done and ldap_msgfree() returns zero.
+
+Upon successful completion, ldap_result() returns the type of the first
+result returned in the res parameter. This will be one of the following
+constants.
+
+             LDAP_RES_BIND (0x61)
+             LDAP_RES_SEARCH_ENTRY (0x64)
+             LDAP_RES_SEARCH_REFERENCE (0x73)      -- new in LDAPv3
+             LDAP_RES_SEARCH_RESULT (0x65)
+             LDAP_RES_MODIFY (0x67)
+             LDAP_RES_ADD (0x69)
+             LDAP_RES_DELETE (0x6B)
+             LDAP_RES_MODDN (0x6D)
+             LDAP_RES_COMPARE (0x6F)
+             LDAP_RES_EXTENDED (0x78)              -- new in LDAPv3
+
+ldap_result() returns 0 if the timeout expired and -1 if an error
+occurs, in which case the error parameters of the LDAP session handle
+will be set accordingly.
+
+ldap_msgfree() frees each message in the result chain pointed to by res
+and returns the type of the last message in the chain.  If res is NULL,
+nothing is done and the value zero is returned.
+
+ldap_msgtype() returns the type of the LDAP message it is passed as a
+parameter. The type will be one of the types listed above, or -1 on
+error.
+
+ldap_msgid() returns the message ID associated with the LDAP message
+passed as a parameter, or -1 on error.
+
+
+14.  Handling Errors and Parsing Results
+
+The following calls are used to extract information from results and
+handle errors returned by other LDAP API routines.  Note that
+ldap_parse_sasl_bind_result() and ldap_parse_extended_result() must typ-
+ically be used in addition to ldap_parse_result() to retrieve all the
+result information from SASL Bind and Extended Operations respectively.
+
+
+
+
+Expires: May 2001                                              [Page 47]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+           int ldap_parse_result(
+                   LDAP            *ld,
+                   LDAPMessage     *res,
+                   int             *errcodep,
+                   char            **matcheddnp,
+                   char            **errmsgp,
+                   char            ***referralsp,
+                   LDAPControl     ***serverctrlsp,
+                   int             freeit
+           );
+
+           int ldap_parse_sasl_bind_result(
+                   LDAP            *ld,
+                   LDAPMessage     *res,
+                   struct berval   **servercredp,
+                   int             freeit
+           );
+
+           int ldap_parse_extended_result(
+                   LDAP            *ld,
+                   LDAPMessage     *res,
+                   char            **retoidp,
+                   struct berval   **retdatap,
+                   int             freeit
+           );
+
+           #define LDAP_NOTICE_OF_DISCONNECTION    "1.3.6.1.4.1.1466.20036"
+
+           char *ldap_err2string( int err );
+
+   The use of the following routines is deprecated and more complete
+   descriptions can be found in RFC 1823:
+
+           int ldap_result2error(
+                   LDAP            *ld,
+                   LDAPMessage     *res,
+                   int             freeit
+           );
+
+           void ldap_perror( LDAP *ld, const char *msg );
+
+Parameters are:
+
+ld           The session handle.
+
+res          The result of an LDAP operation as returned by
+             ldap_result() or one of the synchronous API operation
+             calls.
+
+
+
+Expires: May 2001                                              [Page 48]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+errcodep     This result parameter will be filled in with the LDAP
+             resultCode field from the LDAPMessage message.  This is the
+             indication from the server of the outcome of the operation.
+             NULL SHOULD be passed to ignore this field.
+
+matcheddnp   If the server returned a matchedDN string to indicate how
+             much of a name passed in a request was recognized, this
+             result parameter will be filled in with that matchedDN
+             string.  Otherwise, this field will be set to NULL.  NULL
+             SHOULD be passed to ignore this field.  The matched DN
+             string SHOULD be freed by calling ldap_memfree() which is
+             described later in this document.  Note that the server may
+             return a zero length matchedDN (in which case *matchednp is
+             set to an allocated copy of "") which is different than not
+             returning a value at all (in which case *matcheddnp is set
+             to NULL).
+
+errmsgp      This result parameter will be filled in with the contents
+             of the error message field from the LDAPMessage message.
+             The error message string SHOULD be freed by calling
+             ldap_memfree() which is described later in this document.
+             NULL SHOULD be passed to ignore this field.
+
+referralsp   This result parameter will be filled in with the contents
+             of the referrals field from the LDAPMessage message, indi-
+             cating zero or more alternate LDAP servers where the
+             request is to be retried.  The referrals array SHOULD be
+             freed by calling ldap_value_free() which is described later
+             in this document.  NULL SHOULD be passed to ignore this
+             field.  If no referrals were returned, *referralsp is set
+             to NULL.
+
+serverctrlsp This result parameter will be filled in with an allocated
+             array of controls copied out of the LDAPMessage message.
+             If serverctrlsp is NULL, no controls are returned.  The
+             control array SHOULD be freed by calling
+             ldap_controls_free() which was described earlier.  If no
+             controls were returned, *serverctrlsp is set to NULL.
+
+freeit       A boolean that determines whether the res parameter is
+             disposed of or not.  Pass any non-zero value to have these
+             routines free res after extracting the requested informa-
+             tion.  This is provided as a convenience; you can also use
+             ldap_msgfree() to free the result later.  If freeit is
+             non-zero, the entire chain of messages represented by res
+             is disposed of.
+
+servercredp  For SASL bind results, this result parameter will be filled
+
+
+
+Expires: May 2001                                              [Page 49]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+             in with the credentials passed back by the server for
+             mutual authentication, if given. An allocated berval struc-
+             ture is returned that SHOULD be disposed of by calling
+             ber_bvfree().  NULL SHOULD be passed to ignore this field.
+
+retoidp      For extended results, this result parameter will be filled
+             in with the dotted-OID text representation of the name of
+             the extended operation response.  This string SHOULD be
+             disposed of by calling ldap_memfree().  NULL SHOULD be
+             passed to ignore this field.  If no OID was returned,
+             *retoidp is set to NULL.  The LDAP_NOTICE_OF_DISCONNECTION
+             macro is defined as a convenience for clients that wish to
+             check an OID to see if it matches the one used for the
+             unsolicited Notice of Disconnection (defined in RFC 2251[2]
+             section 4.4.1).
+
+retdatap     For extended results, this result parameter will be filled
+             in with a pointer to a struct berval containing the data in
+             the extended operation response.  It SHOULD be disposed of
+             by calling ber_bvfree(). NULL SHOULD be passed to ignore
+             this field.  If no data is returned, *retdatap is set to
+             NULL.
+
+err          For ldap_err2string(), an LDAP result code, as returned by
+             ldap_parse_result() or another LDAP API call.
+
+Additional parameters for the deprecated routines are not described.
+Interested readers are referred to RFC 1823.
+
+The ldap_parse_result(), ldap_parse_sasl_bind_result(), and
+ldap_parse_extended_result() functions all skip over messages of type
+LDAP_RES_SEARCH_ENTRY and LDAP_RES_SEARCH_REFERENCE when looking for a
+result message to parse.  They return the constant LDAP_SUCCESS if the
+result was successfully parsed and another LDAP API result code if not.
+If a value other than LDAP_SUCCESS is returned, the values of all the
+result parameters are undefined.  Note that the LDAP result code that
+indicates the outcome of the operation performed by the server is placed
+in the errcodep ldap_parse_result() parameter.  If a chain of messages
+that contains more than one result message is passed to these routines
+they always operate on the first result in the chain.
+
+ldap_err2string() is used to convert a numeric LDAP result code, as
+returned by ldap_parse_result(), ldap_parse_sasl_bind_result(),
+ldap_parse_extended_result() or one of the synchronous API operation
+calls, into an informative zero-terminated character string message
+describing the error.  It returns a pointer to static data and it MUST
+NOT return NULL; the value returned is always a valid null-terminated
+"C" string.
+
+
+
+Expires: May 2001                                              [Page 50]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+15.  Stepping Through a List of Results
+
+The ldap_first_message() and ldap_next_message() routines are used to
+step through the list of messages in a result chain returned by
+ldap_result().  For search operations, the result chain can actually
+include referral messages, entry messages, and result messages.
+ldap_count_messages() is used to count the number of messages returned.
+The ldap_msgtype() function, described above, can be used to distinguish
+between the different message types.
+
+           LDAPMessage *ldap_first_message( LDAP *ld, LDAPMessage *res );
+
+           LDAPMessage *ldap_next_message( LDAP *ld, LDAPMessage *msg );
+
+           int ldap_count_messages( LDAP *ld, LDAPMessage *res );
+
+Parameters are:
+
+ld     The session handle.
+
+res    The result chain, as obtained by a call to one of the synchronous
+       search routines or ldap_result().
+
+msg    The message returned by a previous call to ldap_first_message()
+       or ldap_next_message().
+
+ldap_first_message() and ldap_next_message() will return NULL when no
+more messages exist in the result set to be returned.  NULL is also
+returned if an error occurs while stepping through the entries, in which
+case the error parameters in the session handle ld will be set to indi-
+cate the error.
+
+If successful, ldap_count_messages() returns the number of messages con-
+tained in a chain of results; if an error occurs such as the res parame-
+ter being invalid, -1 is returned.  The ldap_count_messages() call can
+also be used to count the number of messages that remain in a chain if
+called with a message, entry, or reference returned by
+ldap_first_message(), ldap_next_message(), ldap_first_entry(),
+ldap_next_entry(), ldap_first_reference(), ldap_next_reference().
+
+
+16.  Parsing Search Results
+
+The following calls are used to parse the entries and references
+returned by ldap_search() and friends. These results are returned in an
+opaque structure that MAY be accessed by calling the routines described
+below. Routines are provided to step through the entries and references
+returned, step through the attributes of an entry, retrieve the name of
+
+
+
+Expires: May 2001                                              [Page 51]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+an entry, and retrieve the values associated with a given attribute in
+an entry.
+
+
+16.1.  Stepping Through a List of Entries or References
+
+The ldap_first_entry() and ldap_next_entry() routines are used to step
+through and retrieve the list of entries from a search result chain.
+The ldap_first_reference() and ldap_next_reference() routines are used
+to step through and retrieve the list of continuation references from a
+search result chain.  ldap_count_entries() is used to count the number
+of entries returned. ldap_count_references() is used to count the number
+of references returned.
+
+           LDAPMessage *ldap_first_entry( LDAP *ld, LDAPMessage *res );
+
+           LDAPMessage *ldap_next_entry( LDAP *ld, LDAPMessage *entry );
+
+           LDAPMessage *ldap_first_reference( LDAP *ld, LDAPMessage *res );
+
+           LDAPMessage *ldap_next_reference( LDAP *ld, LDAPMessage *ref );
+
+           int ldap_count_entries( LDAP *ld, LDAPMessage *res );
+
+           int ldap_count_references( LDAP *ld, LDAPMessage *res );
+
+Parameters are:
+
+ld     The session handle.
+
+res    The search result, as obtained by a call to one of the synchro-
+       nous search routines or ldap_result().
+
+entry  The entry returned by a previous call to ldap_first_entry() or
+       ldap_next_entry().
+
+ref    The reference returned by a previous call to
+       ldap_first_reference() or ldap_next_reference().
+
+ldap_first_entry(), ldap_next_entry(), ldap_first_reference() and
+ldap_next_reference() all return NULL when no more entries or references
+exist in the result set to be returned.  NULL is also returned if an
+error occurs while stepping through the entries or references, in which
+case the error parameters in the session handle ld will be set to indi-
+cate the error.
+
+ldap_count_entries() returns the number of entries contained in a chain
+of entries; if an error occurs such as the res parameter being invalid,
+
+
+
+Expires: May 2001                                              [Page 52]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+-1 is returned.  The ldap_count_entries() call can also be used to count
+the number of entries that remain in a chain if called with a message,
+entry or reference returned by ldap_first_message(),
+ldap_next_message(), ldap_first_entry(), ldap_next_entry(),
+ldap_first_reference(), ldap_next_reference().
+
+ldap_count_references() returns the number of references contained in a
+chain of search results; if an error occurs such as the res parameter
+being invalid, -1 is returned.  The ldap_count_references() call can
+also be used to count the number of references that remain in a chain.
+
+
+16.2.  Stepping Through the Attributes of an Entry
+
+The ldap_first_attribute() and ldap_next_attribute() calls are used to
+step through the list of attribute types returned with an entry.
+
+           char *ldap_first_attribute(
+                   LDAP            *ld,
+                   LDAPMessage     *entry,
+                   BerElement      **ptr
+           );
+
+           char *ldap_next_attribute(
+                   LDAP            *ld,
+                   LDAPMessage     *entry,
+                   BerElement      *ptr
+           );
+
+           void ldap_memfree( char *mem );
+
+Parameters are:
+
+ld     The session handle.
+
+entry  The entry whose attributes are to be stepped through, as returned
+       by ldap_first_entry() or ldap_next_entry().
+
+ptr    In ldap_first_attribute(), the address of a pointer used inter-
+       nally to keep track of the current position in the entry. In
+       ldap_next_attribute(), the pointer returned by a previous call to
+       ldap_first_attribute().  The BerElement type itself is an opaque
+       structure that is described in more detail later in this document
+       in the section "Encoded ASN.1 Value Manipulation".
+
+mem    A pointer to memory allocated by the LDAP library, such as the
+       attribute type names returned by ldap_first_attribute() and
+       ldap_next_attribute, or the DN returned by ldap_get_dn().  If mem
+
+
+
+Expires: May 2001                                              [Page 53]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+       is NULL, the ldap_memfree() call does nothing.
+
+ldap_first_attribute() and ldap_next_attribute() will return NULL when
+the end of the attributes is reached, or if there is an error, in which
+case the error parameters in the session handle ld will be set to indi-
+cate the error.
+
+Both routines return a pointer to an allocated buffer containing the
+current attribute name. This SHOULD be freed when no longer in use by
+calling ldap_memfree().
+
+ldap_first_attribute() will allocate and return in ptr a pointer to a
+BerElement used to keep track of the current position. This pointer MAY
+be passed in subsequent calls to ldap_next_attribute() to step through
+the entry's attributes. After a set of calls to ldap_first_attribute()
+and ldap_next_attribute(), if ptr is non-NULL, it SHOULD be freed by
+calling ber_free( ptr, 0 ). Note that it is very important to pass the
+second parameter as 0 (zero) in this call, since the buffer associated
+with the BerElement does not point to separately allocated memory.
+
+The attribute type names returned are suitable for passing in a call to
+ldap_get_values() and friends to retrieve the associated values.
+
+
+16.3.  Retrieving the Values of an Attribute
+
+ldap_get_values() and ldap_get_values_len() are used to retrieve the
+values of a given attribute from an entry. ldap_count_values() and
+ldap_count_values_len() are used to count the returned values.
+ldap_value_free() and ldap_value_free_len() are used to free the values.
+
+           char **ldap_get_values(
+                   LDAP            *ld,
+                   LDAPMessage     *entry,
+                   const char      *attr
+           );
+
+           struct berval **ldap_get_values_len(
+                   LDAP            *ld,
+                   LDAPMessage     *entry,
+                   const char      *attr
+           );
+
+           int ldap_count_values( char **vals );
+
+           int ldap_count_values_len( struct berval **vals );
+
+           void ldap_value_free( char **vals );
+
+
+
+Expires: May 2001                                              [Page 54]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+           void ldap_value_free_len( struct berval **vals );
+
+Parameters are:
+
+ld     The session handle.
+
+entry  The entry from which to retrieve values, as returned by
+       ldap_first_entry() or ldap_next_entry().
+
+attr   The attribute whose values are to be retrieved, as returned by
+       ldap_first_attribute() or ldap_next_attribute(), or a caller-
+       supplied string (e.g., "mail").
+
+vals   The values returned by a previous call to ldap_get_values() or
+       ldap_get_values_len().
+
+Two forms of the various calls are provided. The first form is only
+suitable for use with non-binary character string data. The second _len
+form is used with any kind of data.
+
+ldap_get_values() and ldap_get_values_len() return NULL if no values are
+found for attr or if an error occurs.
+
+ldap_count_values() and ldap_count_values_len() return -1 if an error
+occurs such as the vals parameter being invalid.
+
+If a NULL vals parameter is passed to ldap_value_free() or
+ldap_value_free_len(), nothing is done.
+
+Note that the values returned are dynamically allocated and SHOULD be
+freed by calling either ldap_value_free() or ldap_value_free_len() when
+no longer in use.
+
+
+16.4.  Retrieving the name of an entry
+
+ldap_get_dn() is used to retrieve the name of an entry.
+ldap_explode_dn() and ldap_explode_rdn() are used to break up a name
+into its component parts. ldap_dn2ufn() is used to convert the name into
+a more "user friendly" format.
+
+           char *ldap_get_dn( LDAP *ld, LDAPMessage *entry );
+
+           char **ldap_explode_dn( const char *dn, int notypes );
+
+           char **ldap_explode_rdn( const char *rdn, int notypes );
+
+           char *ldap_dn2ufn( const char *dn );
+
+
+
+Expires: May 2001                                              [Page 55]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+Parameters are:
+
+ld      The session handle.
+
+entry   The entry whose name is to be retrieved, as returned by
+        ldap_first_entry() or ldap_next_entry().
+
+dn      The dn to explode, such as returned by ldap_get_dn().  If NULL,
+        a zero length DN is used.
+
+rdn     The rdn to explode, such as returned in the components of the
+        array returned by ldap_explode_dn().  If NULL, a zero length DN
+        is used.
+
+notypes A boolean parameter, if non-zero indicating that the dn or rdn
+        components are to have their type information stripped off
+        (i.e., "cn=Babs" would become "Babs").
+
+ldap_get_dn() will return NULL if there is some error parsing the dn,
+setting error parameters in the session handle ld to indicate the error.
+It returns a pointer to newly allocated space that the caller SHOULD
+free by calling ldap_memfree() when it is no longer in use.  Note the
+format of the DNs returned is given by [5].  The root DN is returned as
+a zero length string ("").
+
+ldap_explode_dn() returns a NULL-terminated char * array containing the
+RDN components of the DN supplied, with or without types as indicated by
+the notypes parameter. The components are returned in the order they
+appear in the dn.  The array returned SHOULD be freed when it is no
+longer in use by calling ldap_value_free().
+
+ldap_explode_rdn() returns a NULL-terminated char * array containing the
+components of the RDN supplied, with or without types as indicated by
+the notypes parameter. The components are returned in the order they
+appear in the rdn.  The array returned SHOULD be freed when it is no
+longer in use by calling ldap_value_free().
+
+ldap_dn2ufn() converts the DN into the user friendly format described in
+[14]. The UFN returned is newly allocated space that SHOULD be freed by
+a call to ldap_memfree() when no longer in use.
+
+
+16.5.  Retrieving controls from an entry
+
+ldap_get_entry_controls() is used to extract LDAP controls from an
+entry.
+
+
+
+
+
+Expires: May 2001                                              [Page 56]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+           int ldap_get_entry_controls(
+                   LDAP            *ld,
+                   LDAPMessage     *entry,
+                   LDAPControl     ***serverctrlsp
+           );
+
+Parameters are:
+
+ld           The session handle.
+
+entry        The entry to extract controls from, as returned by
+             ldap_first_entry() or ldap_next_entry().
+
+serverctrlsp This result parameter will be filled in with an allocated
+             array of controls copied out of entry. The control array
+             SHOULD be freed by calling ldap_controls_free().  If ser-
+             verctrlsp is NULL, no controls are returned.  If no con-
+             trols were returned, *serverctrlsp is set to NULL.
+
+ldap_get_entry_controls() returns an LDAP result code that indicates
+whether the reference could be successfully parsed (LDAP_SUCCESS if all
+goes well). If ldap_get_entry_controls() returns a value other than
+LDAP_SUCCESS, the value of the serverctrlsp output parameter is unde-
+fined.
+
+
+
+16.6.  Parsing References
+
+ldap_parse_reference() is used to extract referrals and controls from a
+SearchResultReference message.
+
+
+           int ldap_parse_reference(
+                   LDAP            *ld,
+                   LDAPMessage     *ref,
+                   char            ***referralsp,
+                   LDAPControl     ***serverctrlsp,
+                   int             freeit
+           );
+
+Parameters are:
+
+ld           The session handle.
+
+ref          The reference to parse, as returned by ldap_result(),
+             ldap_first_reference(), or ldap_next_reference().
+
+
+
+
+Expires: May 2001                                              [Page 57]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+referralsp   This result parameter will be filled in with an allocated
+             array of character strings.  The elements of the array are
+             the referrals (typically LDAP URLs) contained in ref.  The
+             array SHOULD be freed when no longer in used by calling
+             ldap_value_free().  If referralsp is NULL, the referral
+             URLs are not returned.  If no referrals were returned,
+             *referralsp is set to NULL.
+
+serverctrlsp This result parameter will be filled in with an allocated
+             array of controls copied out of ref. The control array
+             SHOULD be freed by calling ldap_controls_free().  If ser-
+             verctrlsp is NULL, no controls are returned.  If no con-
+             trols were returned, *serverctrlsp is set to NULL.
+
+freeit       A boolean that determines whether the ref parameter is
+             disposed of or not.  Pass any non-zero value to have this
+             routine free ref after extracting the requested informa-
+             tion.  This is provided as a convenience; you can also use
+             ldap_msgfree() to free the result later.
+
+ldap_parse_reference() returns an LDAP result code that indicates
+whether the reference could be successfully parsed (LDAP_SUCCESS if all
+goes well).  If a value other than LDAP_SUCCESS is returned, the value
+of the referralsp and serverctrlsp result parameters are undefined.
+
+
+
+17.  Encoded ASN.1 Value Manipulation
+
+This section describes routines which MAY be used to encode and decode
+BER-encoded ASN.1 values, which are often used inside of control and
+extension values.
+
+With the exceptions of two new functions ber_flatten() and ber_init(),
+these functions are compatible with the University of Michigan LDAP 3.3
+implementation of BER.
+
+Note that the functions defined in this section all provide a method for
+determining success or failure but generally do not provide access to
+specific error codes.  Therefore, applications that require precise
+error information when encoding or decoding ASN.1 values SHOULD NOT use
+these functions.
+
+
+17.1.  BER Data Structures and Types
+
+The following additional integral types are defined for use in manipula-
+tion of BER encoded ASN.1 values:
+
+
+
+Expires: May 2001                                              [Page 58]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+       typedef <impl_tag_t> ber_tag_t;     /* for BER tags */
+
+       typedef <impl_int_t> ber_int_t;     /* for BER ints, enums, and Booleans */
+
+       typedef <impl_unit_t> ber_uint_t;   /* unsigned equivalent of ber_uint_t */
+
+       typedef <impl_slen_t> ber_slen_t;   /* signed equivalent of ber_len_t */
+
+Note that the actual definition for these four integral types is imple-
+mentation specific; that is, `<impl_tag_t>', `<impl_int_t>',
+`<impl_uint_t>', and `<impl_slen_t>' MUST each be replaced with an
+appropriate implementation-specific type.
+
+The `ber_tag_t' type is an unsigned integral data type that is large
+enough to hold the largest BER tag supported by the API implementation.
+The width (number of significant bits) of `ber_tag_t' MUST be at least
+32, greater than or equal to that of `unsigned int' (so that integer
+promotions won't promote it to `int'), and no wider than that of
+`unsigned long'.
+
+The `ber_int_t' and `ber_uint_t' types are the signed and unsigned vari-
+ants of an integral type that is large enough to hold integers for pur-
+poses of BER encoding and decoding.  The width of `ber_int_t' MUST be at
+least 32 and no larger than that of `long'.
+
+The `ber_slen_t' type is the signed variant of the `ber_len_t' integral
+type, i.e. if `ber_len_t' is unsigned long, then `ber_slen_t' is signed
+long.  The `<impl_slen_t>' in the `ber_len_t' typedef MUST be replaced
+with an appropriate type.  Note that `ber_slen_t' is not used directly
+in the C LDAP API but is provided for the convenience of application
+developers and for use by extensions to the API.
+
+           typedef struct berval {
+                   ber_len_t       bv_len;
+                   char            *bv_val;
+           } BerValue;
+
+As defined earlier in the section "Common Data Structures", a berval
+structure contains an arbitrary sequence of bytes and an indication of
+its length.  The bv_len element is an unsigned integer.  The bv_val is
+not necessarily zero-terminated.  Applications MAY allocate their own
+berval structures.
+
+As defined earlier in the section "Common Data Structures", the BerEle-
+ment structure is an opaque structure:
+
+           typedef struct berelement BerElement;
+
+
+
+
+Expires: May 2001                                              [Page 59]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+It contains not only a copy of the encoded value, but also state infor-
+mation used in encoding or decoding.  Applications cannot allocate their
+own BerElement structures.  The internal state is neither thread-
+specific nor locked, so two threads SHOULD NOT manipulate the same
+BerElement value simultaneously.
+
+A single BerElement value cannot be used for both encoding and decoding.
+
+17.2.  Memory Disposal and Utility Functions
+
+           void ber_bvfree( struct berval *bv );
+
+ber_bvfree() frees a berval structure returned from this API.  Both the
+bv->bv_val string and the berval structure itself are freed.  If bv is
+NULL, this call does nothing.
+
+           void ber_bvecfree( struct berval **bv );
+
+ber_bvecfree() frees an array of berval structures returned from this
+API.  Each of the berval structures in the array are freed using
+ber_bvfree(), then the array itself is freed.  If bv is NULL, this call
+does nothing.
+
+           struct berval *ber_bvdup( const struct berval *bv );
+
+ber_bvdup() returns a copy of a berval structure.  The bv_val field in
+the returned berval structure points to a different area of memory than
+the bv_val field in the bv argument.  The NULL pointer is returned on
+error (e.g. out of memory).
+
+           void ber_free( BerElement *ber, int fbuf );
+
+ber_free() frees a BerElement which is returned from the API calls
+ber_alloc_t() or ber_init().  Each BerElement SHOULD be freed by the
+caller.  The second argument fbuf SHOULD always be set to 1 to ensure
+that the internal buffer used by the BER functions is freed as well as
+the BerElement container itself.  If ber is NULL, this call does noth-
+ing.
+
+
+17.3.  Encoding
+
+           BerElement *ber_alloc_t( int options );
+
+ber_alloc_t() constructs and returns BerElement.  The NULL pointer is
+returned on error.  The options field contains a bitwise-or of options
+which are to be used when generating the encoding of this BerElement.
+One option is defined and SHOULD always be supplied:
+
+
+
+Expires: May 2001                                              [Page 60]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+           #define LBER_USE_DER 0x01
+
+When this option is present, lengths will always be encoded in the
+minimum number of octets.  Note that this option does not cause values
+of sets to be rearranged in tag and byte order or default values to be
+removed, so these functions are not sufficient for generating DER output
+as defined in X.509 and X.680.  If the caller takes responsibility for
+ordering values of sets correctly and removing default values, DER out-
+put as defined in X.509 and X.680 can be produced.
+
+Unrecognized option bits are ignored.
+
+The BerElement returned by ber_alloc_t() is initially empty.  Calls to
+ber_printf() will append bytes to the end of the ber_alloc_t().
+
+           int ber_printf( BerElement *ber, const char *fmt, ... );
+
+The ber_printf() routine is used to encode a BER element in much the
+same way that sprintf() works.  One important difference, though, is
+that state information is kept in the ber argument so that multiple
+calls can be made to ber_printf() to append to the end of the BER ele-
+ment. ber MUST be a pointer to a BerElement returned by ber_alloc_t().
+ber_printf() interprets and formats its arguments according to the for-
+mat string fmt.  ber_printf() returns -1 if there is an error during
+encoding and a non-negative number if successful.  As with sprintf(),
+each character in fmt refers to an argument to ber_printf().
+
+The format string can contain the following format characters:
+
+'t'     Tag.  The next argument is a ber_tag_t specifying the tag to
+        override the next element to be written to the ber.  This works
+        across calls.  The integer tag value SHOULD contain the tag
+        class, constructed bit, and tag value.  For example, a tag of
+        "[3]" for a constructed type is 0xA3U.  All implementations MUST
+        support tags that fit in a single octet (i.e., where the tag
+        value is less than 32) and they MAY support larger tags.
+
+'b'     Boolean.  The next argument is an ber_int_t, containing either 0
+        for FALSE or 0xff for TRUE.  A boolean element is output.  If
+        this format character is not preceded by the 't' format modif-
+        ier, the tag 0x01U is used for the element.
+
+'e'     Enumerated.  The next argument is a ber_int_t, containing the
+        enumerated value in the host's byte order.  An enumerated ele-
+        ment is output.  If this format character is not preceded by the
+        't' format modifier, the tag 0x0AU is used for the element.
+
+'i'     Integer.  The next argument is a ber_int_t, containing the
+
+
+
+Expires: May 2001                                              [Page 61]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+        integer in the host's byte order.  An integer element is output.
+        If this format character is not preceded by the 't' format
+        modifier, the tag 0x02U is used for the element.
+
+'B'     Bitstring.  The next two arguments are a char * pointer to the
+        start of the bitstring, followed by a ber_len_t containing the
+        number of bits in the bitstring.  A bitstring element is output,
+        in primitive form.  If this format character is not preceded by
+        the 't' format modifier, the tag 0x03U is used for the element.
+
+'X'     Reserved and not to be used.  In older revisions of this specif-
+        ication,
+
+'n'     Null.  No argument is needed.  An ASN.1 NULL element is output.
+        If this format character is not preceded by the 't' format
+        modifier, the tag 0x05U is used for the element.
+
+'o'     Octet string.  The next two arguments are a char *, followed by
+        a ber_len_t with the length of the string.  The string MAY con-
+        tain null bytes and are do not have to be zero-terminated.   An
+        octet string element is output, in primitive form.  If this for-
+        mat character is not preceded by the 't' format modifier, the
+        tag 0x04U is used for the element.
+
+'s'     Octet string.  The next argument is a char * pointing to a
+        zero-terminated string.  An octet string element in primitive
+        form is output, which does not include the trailing '\0' (null)
+        byte. If this format character is not preceded by the 't' format
+        modifier, the tag 0x04U is used for the element.
+
+'v'     Several octet strings.  The next argument is a char **, an array
+        of char * pointers to zero-terminated strings.  The last element
+        in the array MUST be a NULL pointer. The octet strings do not
+        include the trailing '\0' (null) byte.  Note that a construct
+        like '{v}' is used to get an actual SEQUENCE OF octet strings.
+        The 't' format modifier cannot be used with this format charac-
+        ter.
+
+'V'     Several octet strings.  A NULL-terminated array of struct berval
+        *'s is supplied.  Note that a construct like '{V}' is used to
+        get an actual SEQUENCE OF octet strings. The 't' format modifier
+        cannot be used with this format character.
+
+'{'     Begin sequence.  No argument is needed.  If this format charac-
+        ter is not preceded by the 't' format modifier, the tag 0x30U is
+        used.
+
+'}'     End sequence.  No argument is needed.  The 't' format modifier
+
+
+
+Expires: May 2001                                              [Page 62]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+        cannot be used with this format character.
+
+'['     Begin set.  No argument is needed.  If this format character is
+        not preceded by the 't' format modifier, the tag 0x31U is used.
+
+']'     End set.  No argument is needed.  The 't' format modifier cannot
+        be used with this format character.
+
+Each use of a '{' format character SHOULD be matched by a '}' character,
+either later in the format string, or in the format string of a subse-
+quent call to ber_printf() for that BerElement.  The same applies to the
+'[' and ']' format characters.
+
+Sequences and sets nest, and implementations of this API MUST maintain
+internal state to be able to properly calculate the lengths.
+
+           int ber_flatten( BerElement *ber, struct berval **bvPtr );
+
+The ber_flatten routine allocates a struct berval whose contents are a
+BER encoding taken from the ber argument. The bvPtr pointer points to
+the returned berval structure, which SHOULD be freed using ber_bvfree().
+This routine returns 0 on success and -1 on error.
+
+The ber_flatten API call is not present in U-M LDAP 3.3.
+
+The use of ber_flatten on a BerElement in which all '{' and '}' format
+modifiers have not been properly matched is an error (i.e., -1 will be
+returned by ber_flatten() if this situation is exists).
+
+
+17.4.  Encoding Example
+
+The following is an example of encoding the following ASN.1 data type:
+
+      Example1Request ::= SEQUENCE {
+           s     OCTET STRING, -- must be printable
+           val1  INTEGER,
+           val2  [0] INTEGER DEFAULT 0
+      }
+
+
+      int encode_example1(const char *s, ber_int_t val1, ber_int_t val2,
+               struct berval **bvPtr)
+      {
+           BerElement *ber;
+           int rc = -1;
+
+           *bvPtr = NULL;  /* in case of error */
+
+
+
+Expires: May 2001                                              [Page 63]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+           ber = ber_alloc_t(LBER_USE_DER);
+
+           if (ber == NULL) return -1;
+
+           if (ber_printf(ber,"{si",s,val1) == -1) {
+                   goto done;
+           }
+
+           if (val2 != 0) {
+                   if (ber_printf(ber,"ti",(ber_tag_t)0x80,val2) == -1) {
+                           goto done;
+                   }
+           }
+
+           if (ber_printf(ber,"}") == -1) {
+                   goto done;
+           }
+
+           rc = ber_flatten(ber,bvPtr);
+
+   done:
+           ber_free(ber,1);
+           return rc;
+      }
+
+
+17.5.  Decoding
+
+The following two macros are available to applications: LBER_ERROR and
+LBER_DEFAULT.  Both of these macros MUST be #define'd as ber_tag_t
+integral values that are treated as invalid tags by the API implementa-
+tion.  It is RECOMMENDED that the values of LBER_ERROR and LBER_DEFAULT
+be the same and that they be defined as values where all octets have the
+value 0xFF.  ISO C guarantees that these definitions will work:
+
+           #define LBER_ERROR   ((ber_tag_t)-1)
+           #define LBER_DEFAULT ((ber_tag_t)-1)
+
+The intent is that LBER_ERROR and LBER_DEFAULT are both defined as the
+integer value that has all octets set to 0xFF, as such a value is not a
+valid BER tag.
+
+           BerElement *ber_init( const struct berval *bv );
+
+The ber_init function constructs a BerElement and returns a new BerEle-
+ment containing a copy of the data in the bv argument.  ber_init returns
+the NULL pointer on error.
+
+
+
+
+Expires: May 2001                                              [Page 64]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+           ber_tag_t ber_scanf( BerElement *ber, const char *fmt, ... );
+
+The ber_scanf() routine is used to decode a BER element in much the same
+way that sscanf() works.  One important difference, though, is that some
+state information is kept with the ber argument so that multiple calls
+can be made to ber_scanf() to sequentially read from the BER element.
+The ber argument SHOULD be a pointer to a BerElement returned by
+ber_init().  ber_scanf interprets the bytes according to the format
+string fmt, and stores the results in its additional arguments.
+ber_scanf() returns LBER_ERROR on error, and a different value on suc-
+cess.  If an error occurred, the values of all the result parameters are
+undefined.
+
+The format string contains conversion specifications which are used to
+direct the interpretation of the BER element.  The format string can
+contain the following characters:
+
+'a'     Octet string.  A char ** argument MUST be supplied.  Memory is
+        allocated, filled with the contents of the octet string, zero-
+        terminated, and the pointer to the string is stored in the argu-
+        ment.  The returned value SHOULD be freed using ldap_memfree.
+        The tag of the element MUST indicate the primitive form (con-
+        structed strings are not supported) but is otherwise ignored and
+        discarded during the decoding.  This format cannot be used with
+        octet strings which could contain null bytes.
+
+'O'     Octet string.  A struct berval ** argument MUST be supplied,
+        which upon return points to an allocated struct berval contain-
+        ing the octet string and its length.  ber_bvfree() SHOULD be
+        called to free the allocated memory.  The tag of the element
+        MUST indicate the primitive form (constructed strings are not
+        supported) but is otherwise ignored during the decoding.
+
+'b'     Boolean.  A pointer to a ber_int_t MUST be supplied. The
+        ber_int_t value stored will be 0 for FALSE or nonzero for TRUE.
+        The tag of the element MUST indicate the primitive form but is
+        otherwise ignored during the decoding.
+
+'e'     Enumerated.  A pointer to a ber_int_t MUST be supplied. The
+        enumerated value stored will be in host byte order.  The tag of
+        the element MUST indicate the primitive form but is otherwise
+        ignored during the decoding.  ber_scanf() will return an error
+        if the value of the enumerated value cannot be stored in a
+        ber_int_t.
+
+'i'     Integer.  A pointer to a ber_int_t MUST be supplied. The
+        ber_int_t value stored will be in host byte order.  The tag of
+        the element MUST indicate the primitive form but is otherwise
+
+
+
+Expires: May 2001                                              [Page 65]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+        ignored during the decoding.  ber_scanf() will return an error
+        if the integer cannot be stored in a ber_int_t.
+
+'B'     Bitstring.  A char ** argument MUST be supplied which will point
+        to the allocated bits, followed by a ber_len_t * argument, which
+        will point to the length (in bits) of the bitstring returned.
+        ldap_memfree SHOULD be called to free the bitstring.  The tag of
+        the element MUST indicate the primitive form (constructed bit-
+        strings are not supported) but is otherwise ignored during the
+        decoding.
+
+'n'     Null.  No argument is needed.  The element is verified to have a
+        zero-length value and is skipped.  The tag is ignored.
+
+'t'     Tag.  A pointer to a ber_tag_t MUST be supplied.  The ber_tag_t
+        value stored will be the tag of the next element in the BerEle-
+        ment ber, represented so it can be written using the 't' format
+        of ber_printf().  The decoding position within the ber argument
+        is unchanged by this; that is, the fact that the tag has been
+        retrieved does not affect future use of ber.
+
+'v'     Several octet strings.  A char *** argument MUST be supplied,
+        which upon return points to an allocated NULL-terminated array
+        of char *'s containing the octet strings.  NULL is stored if the
+        sequence is empty.  ldap_memfree SHOULD be called to free each
+        element of the array and the array itself.  The tag of the
+        sequence and of the octet strings are ignored.
+
+'V'     Several octet strings (which could contain null bytes).  A
+        struct berval *** MUST be supplied, which upon return points to
+        a allocated NULL-terminated array of struct berval *'s contain-
+        ing the octet strings and their lengths.  NULL is stored if the
+        sequence is empty. ber_bvecfree() can be called to free the
+        allocated memory.  The tag of the sequence and of the octet
+        strings are ignored.
+
+'x'     Skip element.  The next element is skipped.  No argument is
+        needed.
+
+'{'     Begin sequence.  No argument is needed.  The initial sequence
+        tag and length are skipped.
+
+'}'     End sequence.  No argument is needed.
+
+'['     Begin set.  No argument is needed.  The initial set tag and
+        length are skipped.
+
+']'     End set.  No argument is needed.
+
+
+
+Expires: May 2001                                              [Page 66]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+           ber_tag_t ber_peek_tag( BerElement *ber,
+                   ber_len_t *lenPtr );
+
+ber_peek_tag() returns the tag of the next element to be parsed in the
+BerElement argument.  The length of this element is stored in the
+*lenPtr argument.  LBER_DEFAULT is returned if there is no further data
+to be read.  The decoding position within the ber argument is unchanged
+by this call; that is, the fact that ber_peek_tag() has been called does
+not affect future use of ber.
+
+           ber_tag_t ber_skip_tag( BerElement *ber, ber_len_t *lenPtr );
+
+ber_skip_tag() is similar to ber_peek_tag(), except that the state
+pointer in the BerElement argument is advanced past the first tag and
+length, and is pointed to the value part of the next element.  This rou-
+tine SHOULD only be used with constructed types and situations when a
+BER encoding is used as the value of an OCTET STRING.  The length of the
+value is stored in *lenPtr.
+
+           ber_tag_t ber_first_element( BerElement *ber,
+                   ber_len_t *lenPtr, char **opaquePtr );
+
+           ber_tag_t ber_next_element( BerElement *ber,
+                   ber_len_t *lenPtr, char *opaque );
+
+ber_first_element() and ber_next_element() are used to traverse a SET,
+SET OF, SEQUENCE or SEQUENCE OF data value. ber_first_element() calls
+ber_skip_tag(), stores internal information in *lenPtr and *opaquePtr,
+and calls ber_peek_tag() for the first element inside the constructed
+value. LBER_DEFAULT is returned if the constructed value is empty.
+ber_next_element() positions the state at the start of the next element
+in the constructed type.  LBER_DEFAULT is returned if there are no
+further values.
+
+The len and opaque values SHOULD NOT be used by applications other than
+as arguments to ber_next_element(), as shown in the example below.
+
+
+17.6.  Decoding Example
+
+The following is an example of decoding an ASN.1 data type:
+
+      Example2Request ::= SEQUENCE {
+           dn    OCTET STRING, -- must be printable
+           scope ENUMERATED { b (0), s (1), w (2) },
+           ali   ENUMERATED { n (0), s (1), f (2), a (3) },
+           size  INTEGER,
+           time  INTEGER,
+
+
+
+Expires: May 2001                                              [Page 67]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+           tonly BOOLEAN,
+           attrs SEQUENCE OF OCTET STRING, -- must be printable
+           [0] SEQUENCE OF SEQUENCE {
+              type  OCTET STRING -- must be printable,
+              crit  BOOLEAN DEFAULT FALSE,
+              value OCTET STRING
+           } OPTIONAL }
+
+      #define TAG_CONTROL_LIST 0xA0U /* context specific cons 0 */
+
+      int decode_example2(struct berval *bv)
+      {
+           BerElement *ber;
+           ber_len_t len;
+           ber_tag_t res;
+           ber_int_t scope, ali, size, time, tonly;
+           char *dn = NULL, **attrs = NULL;
+           int i,rc = 0;
+
+           ber = ber_init(bv);
+           if (ber == NULL) {
+                   fputs("ERROR ber_init failed\n", stderr);
+                   return -1;
+           }
+
+           res = ber_scanf(ber,"{aiiiib{v}",&dn,&scope,&ali,
+                           &size,&time,&tonly,&attrs);
+
+           if (res == LBER_ERROR) {
+                   fputs("ERROR ber_scanf failed\n", stderr);
+                   ber_free(ber,1);
+                   return -1;
+           }
+
+           /* *** use dn */
+           ldap_memfree(dn);
+
+           for (i = 0; attrs != NULL && attrs[i] != NULL; i++) {
+                   /* *** use attrs[i] */
+                   ldap_memfree(attrs[i]);
+           }
+           ldap_memfree((char *)attrs);
+
+           if (ber_peek_tag(ber,&len) == TAG_CONTROL_LIST) {
+                   char *opaque;
+                   ber_tag_t tag;
+
+                   for (tag = ber_first_element(ber,&len,&opaque);
+
+
+
+Expires: May 2001                                              [Page 68]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+                        tag != LBER_DEFAULT;
+                        tag = ber_next_element (ber,&len,opaque)) {
+
+                           ber_len_t tlen;
+                           ber_tag_t ttag;
+                           char *type;
+                           ber_int_t crit;
+                           struct berval *value;
+
+                           if (ber_scanf(ber,"{a",&type) == LBER_ERROR) {
+                                   fputs("ERROR cannot parse type\n", stderr);
+                                   break;
+                           }
+                           /* *** use type */
+                           ldap_memfree(type);
+
+                           ttag = ber_peek_tag(ber,&tlen);
+                           if (ttag == 0x01U) {  /* boolean */
+                                   if (ber_scanf(ber,"b",
+                                                 &crit) == LBER_ERROR) {
+                                           fputs("ERROR cannot parse crit\n",
+                                               stderr);
+                                           rc = -1;
+                                           break;
+                                   }
+                           } else if (ttag == 0x04U) { /* octet string */
+                                   crit = 0;
+                           } else {
+                                   fputs("ERROR extra field in controls\n",
+                                       stderr );
+                                   break;
+                           }
+
+                           if (ber_scanf(ber,"O}",&value) == LBER_ERROR) {
+                                   fputs("ERROR cannot parse value\n", stderr);
+                                   rc = -1;
+                                   break;
+                           }
+                           /* *** use value */
+                           ber_bvfree(value);
+                   }
+           }
+
+           if ( rc == 0 ) {        /* no errors so far */
+                   if (ber_scanf(ber,"}") == LBER_ERROR) {
+                           rc = -1;
+                   }
+           }
+
+
+
+Expires: May 2001                                              [Page 69]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+           ber_free(ber,1);
+
+           return rc;
+       }
+
+
+
+18.  Security Considerations
+
+LDAPv2 supports security through protocol-level authentication using
+clear-text passwords.  LDAPv3 adds support for SASL [12] (Simple Authen-
+tication Security Layer) methods.  LDAPv3 also supports operation over a
+secure transport layer using Transport Layer Security TLS [9].  Readers
+are referred to the protocol documents for discussion of related secu-
+rity considerations.
+
+Implementations of this API SHOULD be cautious when handling authentica-
+tion credentials.  In particular, keeping long-lived copies of creden-
+tials without the application's knowledge is discouraged.
+
+
+19.  Acknowledgements
+
+Many members of the IETF ASID and LDAPEXT working groups as well as
+members of the Internet at large have provided useful comments and
+suggestions that have been incorporated into this document.  Chris
+Weider deserves special mention for his contributions as co-author of
+earlier revisions of this document.
+
+The original material upon which this specification is based was sup-
+ported by the National Science Foundation under Grant No.  NCR-9416667.
+
+
+20.  Copyright
+
+Copyright (C) The Internet Society (1997-2000). All Rights Reserved.
+
+This document and translations of it may be copied and furnished to oth-
+ers, and derivative works that comment on or otherwise explain it or
+assist in its implementation may be prepared, copied, published and dis-
+tributed, in whole or in part, without restriction of any kind, provided
+that the above copyright notice and this paragraph are included on all
+such copies and derivative works.  However, this document itself may not
+be modified in any way, such as by removing the copyright notice or
+references to the Internet Society or other Internet organizations,
+except as needed for the  purpose of developing Internet standards in
+which case the procedures for copyrights defined in the Internet Stan-
+dards process must be followed, or as required to translate it into
+
+
+
+Expires: May 2001                                              [Page 70]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+languages other than English.
+
+The limited permissions granted above are perpetual and will not be
+revoked by the Internet Society or its successors or assigns.
+
+This document and the information contained herein is provided on an "AS
+IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK
+FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT
+INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FIT-
+NESS FOR A PARTICULAR PURPOSE.
+
+
+21.  Bibliography
+
+[1]  Bradner, S., "Key words for use in RFCs to Indicate Requirement
+     Levels", RFC 2119, March 1997.
+
+[2]  M. Wahl, T. Howes, S. Kille, "Lightweight Directory Access Protocol
+     (v3)", RFC 2251, December 1997.
+
+[3]  M. Wahl, A. Coulbeck, T. Howes, S. Kille, W. Yeong, C. Robbins,
+     "Lightweight Directory Access Protocol (v3): Attribute Syntax
+     Definitions", RFC 2252, December 1997.
+
+[4]  The Directory: Selected Attribute Syntaxes.  CCITT, Recommendation
+     X.520.
+
+[5]  M. Wahl, S. Kille, T. Howes, "Lightweight Directory Access Protocol
+     (v3): A UTF-8 String Representation of Distinguished Names", RFC
+     2253, December 1997.
+
+[6]  F. Yergeau, "UTF-8, a transformation format of Unicode and ISO
+     10646", RFC 2044, October 1996.
+
+[7]  K. Simonsen, "Character Mnemonics and Character Sets," RFC 1345,
+     June 1992.
+
+[8]  "Programming Languages - C", ANSI/ISO Standard 9899, revised 1997.
+
+[9]  J. Hodges, R. Morgan, M. Wahl, "Lightweight Directory Access Proto-
+     col (v3):  Extension for Transport Layer Security", INTERNET-DRAFT
+     (work in progress) <draft-ietf-ldapext-ldapv3-tls-05.txt>, June
+     1999.
+
+[10] R. Hinden, S. Deering, "IP Version 6 Addressing Architecture," RFC
+     1884, December 1995.
+
+
+
+
+Expires: May 2001                                              [Page 71]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+[11] A. Herron, T. Howes, M. Wahl, A. Anantha, "LDAP Control Extension
+     for Server Side Sorting of Search Results", INTERNET-DRAFT (work in
+     progress) <draft-ietf-ldapext-sorting-02.txt>, 5 April 1999.
+
+[12] J. Meyers, "Simple Authentication and Security Layer (SASL)", RFC
+     2222, October 1997.
+
+[13] T. Howes, "The String Representation of LDAP Search Filters," RFC
+     2254, December 1997.
+
+[14] S. Kille, "Using the OSI Directory to Achieve User Friendly Nam-
+     ing," RFC 1781, March 1995.
+
+
+22.  Authors' Addresses
+
+   Mark Smith (document editor)
+   Netscape Communications Corp.
+   901 San Antonio Rd.
+   Palo Alto, CA  94303-4900
+   Mail Stop SCA17 - 201
+   USA
+   +1 650 937-3477
+   mcs@netscape.com
+
+   Tim Howes
+   Loudcloud, Inc.
+   599 N. Mathilda Avenue
+   Sunnyvale, CA 94085
+   USA
+   +1 408 744-7300
+   howes@loudcloud.com
+
+   Andy Herron
+   Microsoft Corp.
+   1 Microsoft Way
+   Redmond, WA 98052
+   USA
+   +1 425 882-8080
+   andyhe@microsoft.com
+
+   Mark Wahl
+   Sun Microsystems, Inc.
+   8911 Capital of Texas Hwy, Suite 4140
+   Austin, TX 78759
+   USA
+   +1 626 919 3600
+   Mark.Wahl@sun.com
+
+
+
+Expires: May 2001                                              [Page 72]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+   Anoop Anantha
+   Microsoft Corp.
+   1 Microsoft Way
+   Redmond, WA 98052
+   USA
+   +1 425 882-8080
+   anoopa@microsoft.com
+
+
+23.  Appendix A - Sample C LDAP API Code
+
+   #include <stdio.h>
+   #include <ldap.h>
+
+   main()
+   {
+           LDAP            *ld;
+           LDAPMessage     *res, *e;
+           int             i, rc;
+           char            *a, *dn;
+           BerElement      *ptr;
+           char            **vals;
+
+           /* open an LDAP session */
+           if ( (ld = ldap_init( "dotted.host.name", LDAP_PORT )) == NULL )
+                   return 1;
+
+           /* authenticate as nobody */
+           if (( rc = ldap_simple_bind_s( ld, NULL, NULL )) != LDAP_SUCCESS ) {
+                   fprintf( stderr, "ldap_simple_bind_s: %s\n",
+                       ldap_err2string( rc ));
+                   ldap_unbind( ld );
+                   return 1;
+           }
+
+           /* search for entries with cn of "Babs Jensen", return all attrs  */
+           if (( rc = ldap_search_s( ld, "o=University of Michigan, c=US",
+               LDAP_SCOPE_SUBTREE, "(cn=Babs Jensen)", NULL, 0, &res ))
+               != LDAP_SUCCESS ) {
+                   fprintf( stderr, "ldap_search_s: %s\n",
+                       ldap_err2string( rc ));
+                   if ( res == NULL ) {
+                           ldap_unbind( ld );
+                           return 1;
+                   }
+           }
+
+           /* step through each entry returned */
+
+
+
+Expires: May 2001                                              [Page 73]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+           for ( e = ldap_first_entry( ld, res ); e != NULL;
+               e = ldap_next_entry( ld, e ) ) {
+                   /* print its name */
+                   dn = ldap_get_dn( ld, e );
+                   printf( "dn: %s\n", dn );
+                   ldap_memfree( dn );
+
+                   /* print each attribute */
+                   for ( a = ldap_first_attribute( ld, e, &ptr ); a != NULL;
+                       a = ldap_next_attribute( ld, e, ptr ) ) {
+                           printf( "\tattribute: %s\n", a );
+
+                           /* print each value */
+                           vals = ldap_get_values( ld, e, a );
+                           for ( i = 0; vals[i] != NULL; i++ ) {
+                                   printf( "\t\tvalue: %s\n", vals[i] );
+                           }
+                           ldap_value_free( vals );
+                           ldap_memfree( a );
+                   }
+                   if ( ptr != NULL ) {
+                           ber_free( ptr, 0 );
+                   }
+           }
+           /* free the search results */
+           ldap_msgfree( res );
+
+           /* close and free connection resources */
+           ldap_unbind( ld );
+
+           return 0;
+   }
+
+
+24.  Appendix B - Namespace Consumed By This Specification
+
+The following 2 prefixes are used in this specification to name func-
+tions:
+   ldap_
+   ber_
+
+The following 6 prefixes are used in this specification to name struc-
+tures, unions, and typedefs:
+   ldap
+   LDAP
+   mod_vals_u
+   ber
+   Ber
+
+
+
+Expires: May 2001                                              [Page 74]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+   timeval
+
+The following 3 prefixes are used in this specification to name #defined
+macros:
+   LDAP
+   LBER_
+   mod_
+
+
+25.  Appendix C - Summary of Requirements for API Extensions
+
+As the LDAP protocol is extended, this C LDAP API will need to be
+extended as well.  For example, an LDAPv3 control extension has already
+been defined for server-side sorting of search results [7].  This appen-
+dix summarizes the requirements for extending this API.
+
+25.1.  Compatibility
+
+Extensions to this document SHOULD NOT, by default, alter the behavior
+of any of the APIs specified in this document.  If an extension option-
+ally changes the behavior of any existing C LDAP API function calls, the
+behavior change MUST be well documented.  If an extension that operates
+on an LDAP session affects a chain of messages that was previously
+obtained by a call to ldap_result() or by calling a synchronous search
+routine, this MUST be well documented.
+
+25.2.  Style
+
+Extensions to this API SHOULD follow the general style and naming con-
+ventions used in this document.  For example, function names SHOULD
+start with "ldap_" or "ber_" and consist entirely of lowercase letters,
+digits, and underscore ('_') characters.  It is RECOMMENDED that private
+and experimental extensions use only the following prefixes for macros,
+types, and function names:
+       LDAP_X_
+       LBER_X_
+       ldap_x_
+       ber_x_
+and that these prefixes not be used by standard extensions.
+
+25.3.  Dependence on Externally Defined Types
+
+Extensions to this API SHOULD minimize dependencies on types and macros
+that are defined in system headers and generally use only intrinsic
+types that are part of the C language, types defined in this specifica-
+tion, or types defined in the extension document itself.
+
+
+
+
+
+Expires: May 2001                                              [Page 75]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+25.4.  Compile Time Information
+
+Extensions to this API SHOULD conform to the requirements contained in
+the "Retrieving Information at Compile Time" section of this document.
+That is, extensions SHOULD define a macro of the form:
+
+   #define LDAP_API_FEATURE_x level
+
+so that applications can detect the presence or absence of the extension
+at compile time and also test the version or level of the extension pro-
+vided by an API implementation.
+
+25.5.  Runtime Information
+
+Extensions to this API SHOULD conform to the requirements contained in
+the "Retrieving Information During Execution" section of this document.
+That is, each extension SHOULD be given a character string name and that
+name SHOULD appear in the ldapai_extensions array field of the LDAPAPI-
+Info structure following a successful call to ldap_get_option() with an
+option parameter value of LDAP_OPT_API_INFO.  In addition, information
+about the extension SHOULD be available via a call to ldap_get_option()
+with an option parameter value of LDAP_OPT_API_FEATURE_INFO.
+
+25.6.  Values Used for Session Handle Options
+
+Extensions to this API that add new session options (for use with the
+ldap_get_option() and ldap_set_option() functions) SHOULD meet the
+requirements contained in the last paragraph of the "LDAP Session Handle
+Options" section of this document.  Specifically, standards track docu-
+ments MUST use values for option macros that are between 0x1000 and
+0x3FFF inclusive and private and experimental extensions MUST use values
+for the option macros that are between 0x4000 and 0x7FFF inclusive.
+
+
+26.  Appendix D - Known Incompatibilities with RFC 1823
+
+This appendix lists known incompatibilities between this API specifica-
+tion and the one contained in RFC 1823, beyond the additional API func-
+tions added in support of LDAPv3.
+
+
+26.1.  Opaque LDAP Structure
+
+In RFC 1823, some fields in the LDAP structure were exposed to applica-
+tion programmers.  To provide a cleaner interface and to make it easier
+for implementations to evolve over time without sacrificing binary com-
+patibility with older applications, the LDAP structure is now entirely
+opaque.  The new ldap_set_option() and ldap_get_option() calls can be
+
+
+
+Expires: May 2001                                              [Page 76]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+used to manipulate per-session and global options.
+
+
+26.2.  Additional Result Codes
+
+The following new result code macros were introduced to support LDAPv3:
+   LDAP_REFERRAL
+   LDAP_ADMINLIMIT_EXCEEDED
+   LDAP_UNAVAILABLE_CRITICAL_EXTENSION
+   LDAP_CONFIDENTIALITY_REQUIRED
+   LDAP_SASL_BIND_IN_PROGRESS
+   LDAP_AFFECTS_MULTIPLE_DSAS
+   LDAP_CONNECT_ERROR
+   LDAP_NOT_SUPPORTED
+   LDAP_CONTROL_NOT_FOUND
+   LDAP_NO_RESULTS_RETURNED
+   LDAP_MORE_RESULTS_TO_RETURN
+   LDAP_CLIENT_LOOP
+   LDAP_REFERRAL_LIMIT_EXCEEDED
+
+
+26.3.  Freeing of String Data with ldap_memfree()
+
+All strings received from the API (e.g., those returned by the
+ldap_get_dn() or ldap_dn2ufn() functions) SHOULD be freed by calling
+ldap_memfree() not free().  RFC 1823 did not define an ldap_memfree()
+function.
+
+
+26.4.  Changes to ldap_result()
+
+The meaning of the all parameter to ldap_result has changed slightly.
+Nonzero values from RFC 1823 correspond to LDAP_MSG_ALL (0x01).  There
+is also a new possible value, LDAP_MSG_RECEIVED (0x02).
+
+The result type LDAP_RES_MODDN is now returned where RFC 1823 returned
+LDAP_RES_MODRDN.  The actual value for these two macros is the same
+(0x6D).
+
+
+26.5.  Changes to ldap_first_attribute() and ldap_next_attribute
+
+Each non-NULL return value SHOULD be freed by calling ldap_memfree()
+after use.  In RFC 1823, these two functions returned a pointer to a
+per-session buffer, which was not very thread-friendly.
+
+After the last call to ldap_first_attribute() or ldap_next_attribute(),
+the value set in the ptr parameter SHOULD be freed by calling ber_free(
+
+
+
+Expires: May 2001                                              [Page 77]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+ptr, 0 ).  RFC 1823 did not mention that the ptr value SHOULD be freed.
+
+The type of the ptr parameter was changed from void * to BerElement *.
+
+
+26.6.  Changes to ldap_modrdn() and ldap_modrdn_s() Functions
+
+In RFC 1823, the ldap_modrdn() and ldap_modrdn_s() functions include a
+parameter called deleteoldrdn.  This does not match the great majority
+of implementations, so in this specification the deleteoldrdn parameter
+was removed from ldap_modrdn() and ldap_modrdn_s().  Two additional
+functions that support deleteoldrdn and are widely implemented as well
+were added to this specification: ldap_modrdn2() and ldap_modrdn2_s().
+
+
+26.7.  Changes to the berval structure
+
+In RFC 1823, the bv_len element of the berval structure was defined as
+an `unsigned long'.  In this specification, the type is implementation-
+specific, although it MUST be an unsigned integral type that is at least
+32 bits in size.  See the appendix "Data Types and Legacy Implementa-
+tions" for additional considerations.
+
+
+26.8.  API Specification Clarified
+
+RFC 1823 left many things unspecified, including behavior of various
+memory disposal functions when a NULL pointer is presented, requirements
+for headers, values of many macros, and so on.  This specification is
+more complete and generally tighter than the one in RFC 1823.
+
+
+26.9.  Deprecated Functions
+
+A number of functions that are in RFC 1823 are labeled as "deprecated"
+in this specification.  In most cases, a replacement that provides
+equivalent functionality has been defined.  The deprecated functions
+are:
+
+   ldap_bind()
+           Use ldap_simple_bind() or ldap_sasl_bind() instead.
+
+   ldap_bind_s()
+           Use ldap_simple_bind_s() or ldap_sasl_bind_s() instead.
+
+   ldap_kerberos_bind() and ldap_kerberos_bind_s()
+           No equivalent functions are provided.
+
+
+
+
+Expires: May 2001                                              [Page 78]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+   ldap_modrdn() and ldap_modrdn2()
+           Use ldap_rename() instead.
+
+   ldap_modrdn_s() and ldap_modrdn2_s()
+           Use ldap_rename_s() instead.
+
+   ldap_open()
+           Use ldap_init() instead.
+
+   ldap_perror()
+           Use ldap_get_option( ld, LDAP_OPT_RESULT_CODE, &rc ) followed
+           by fprintf( stderr, "%s: %s", msg, ldap_err2string( rc ))
+           instead.
+
+   ldap_result2error()
+           Use ldap_parse_result() instead.
+
+
+27.  Appendix E - Data Types and Legacy Implementations
+
+The data types associated with the length of a ber value (ber_len_t),
+and the tag (ber_tag_t) have been defined in this specification as
+unsigned integral types of implementation-specific size.  The data type
+used for encoding and decoding ber integer, enumerated, and boolean
+values has been defined in this specification as a signed integral type
+of implementation-specific size.  This was done so that source and
+binary compatibility of the C LDAP API can be maintained across ILP32
+environments (where int, long, and pointers are all 32 bits in size) and
+LP64 environments (where ints remain 32 bits but longs and pointers grow
+to 64 bits).
+
+In older implementations of the C LDAP API, such as those based on RFC
+1823, implementors may have chosen to use an `unsigned long' for length
+and tag values.  If a long data type was used for either of these items,
+a port of an application to a 64-bit operating system using the LP64
+data model would find the size of the types used by the C LDAP API to
+increase.  Also, if the legacy implementation had chosen to implement
+the tag and types as an unsigned int, adoption of a specification that
+mandated use of unsigned longs would cause a source incompatibility in
+an LP64 application.  By using implementation-specific data types, the C
+LDAP API implementation is free to choose the correct data type and the
+ability to maintain source compatibility.
+
+For example, suppose a legacy implementation chose to define the return
+value of ber_skip_tag() as an unsigned long but wishes to have the
+library return a 32-bit quantity in both ILP32 and LP64 data models.
+The following typedefs for ber_tag_t will provide a fixed sized data
+structure while preserving existing ILP32 source -- all without
+
+
+
+Expires: May 2001                                              [Page 79]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+generating compiler warnings:
+           #include <limits.h>     /* provides UINT_MAX in ISO C */
+           #if UINT_MAX >= 0xffffffffU
+               typedef unsigned int ber_tag_t;
+           #else
+               typedef unsigned long ber_tag_t;
+           #endif
+
+Similar code can be used to define appropriate ber_len_t, ber_int_t,
+ber_slen_t and ber_uint_t types.
+
+
+28.  Appendix F - Changes Made Since Last Document Revision
+
+The previous version of this document was draft-ietf-ldapext-ldap-c-
+api-04.txt, dated 8 October 1999.  This appendix lists all of the
+changes made to that document to produce this one.
+
+28.1.  API Changes
+
+   "Header Requirements" section: added requirement that the simple pro-
+   gram provided must execute as well as compile without errors.
+
+   "LDAP Session Handle Options" section: changed the name of the
+   LDAP_OPT_ERROR_NUMBER option to LDAP_OPT_RESULT_CODE.  Allow
+   LDAP_OPT_ON to be defined as an implementation specific value (to
+   avoid problems on architectures where the value ((void *)1) is not
+   usable).
+
+   "Initializing an LDAP Session" section: allow use of the value zero
+   for the `portno' parameter to mean "use port 389."
+
+   "Searching" section: added LDAP_DEFAULT_SIZELIMIT (-1) to allow
+   application programmers to use the sizelimit from the LDAP session
+   handle with ldap_search_ext() and ldap_search_ext_s().
+
+   "Modifying an entry" section: moved mod_vals union out of LDAPMod and
+   added mod_vals_u_t typedef so users of the API can declare variables
+   using the union type.  "Handling Errors and Parsing Results" section:
+   added text to require that ldap_err2string() MUST NOT return NULL.
+
+   "A Client Control That Governs Referral Processing" section: modified
+   the text to specify that a ber_uint_t value should be used to hold
+   the flags.
+
+
+
+
+
+
+
+Expires: May 2001                                              [Page 80]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+28.2.  Editorial Changes and Clarifications
+
+   "Overview of LDAP API Use and General Requirements" section: added
+   text to clarify our use of the term "asynchronous."
+
+   "Retrieving Information During Execution" section: added text
+   describing the `ldapai_vendor_name' and `ldapai_vendor_version'
+   fields (text was accidently deleted during a previous round of
+   edits).
+
+   "LDAP Session Handle Options" section: improved the text that
+   describes the LDAP_OPT_TIMELIMIT, LDAP_OPT_SIZELIMIT, and
+   LDAP_OPT_RESULT_CODE options.  Provided details and an example of the
+   correct LDAP_OPT_HOST_NAME string to return when the `portno' passed
+   to ldap_init() is not zero or 389.
+
+   "Result Codes" section: renamed section (was "LDAP Error Codes").
+
+   "Authenticating to the directory" section: clarified that the `dn',
+   `cred', and `passwd' parameters can be NULL.  Added text indicate
+   that the `servercredp' is set to NULL if an API error occurs.
+
+   "Performing LDAP Operations" section: replaced "All functions take a
+   session handle" with "Most functions...."
+
+   "Search" section: removed the detailed discussion of the session han-
+   dle options (already covered in the "Retrieving Information During
+   Execution" section).  Also removed the word "global" when discussing
+   the session default value for the `timeout' parameter.  Also clari-
+   fied that a NULL `base' parameter means use a zero-length string for
+   the base DN.
+
+   "Comparing a Value Against an Entry" section: corrected the "success-
+   ful" return codes for ldap_compare_ext_s() and ldap_compare_s() (was
+   LDAP_SUCCESS; changed to LDAP_COMPARE_TRUE or LDAP_COMPARE_FALSE).
+
+   "Extended Operations" section: added text to indicate that the
+   `retoidp' and `retdatap' result parameters are set to NULL if an API
+   error occurs in ldap_extended_operation_s().
+
+   "Handling Errors and Parsing Results" section: added text to say that
+   the `matcheddnp' result parameter will be set to NULL if the server
+   does not return a matched DN string.  Added text to indicate that
+   serverctrlsp can be NULL.  Added text to indicate that *retoidpp,
+   *retdatap, *referralsp, and *serverctrlsp will be set to NULL if no
+   items of that type are returned.  Removed specific reference to
+   LDAP_NO_SUCH_OBJECT result code when discussing the `matcheddnp'
+   result parameter and added clarifying note about "" vs. NULL.
+
+
+
+Expires: May 2001                                              [Page 81]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+   "Parsing References" section: added text to indicate that *refer-
+   ralsp, and *serverctrlsp will be set to NULL if no items of that type
+   are returned.
+
+   "Obtaining Results and Peeking Inside LDAP Messages" section: added
+   text to say that LDAPMessage chains MAY be tied to a session handle.
+
+   "BER Data Structures and Types" section: removed note about
+   ber_uint_t not being used in this document (it is now).  Changed text
+   to simplify the description of ber_slen_t.  Removed misleading sen-
+   tence about the width of ber_uint_t.
+
+   "Encoded ASN.1 Value Manipulation / Encoding" section: added note
+   that 'X' is reserved.  Also fixed a few small bugs in the example
+   code.
+
+   "Encoded ASN.1 Value Manipulation / Decoding" section: clarified the
+   requirements for LBER_ERROR and LBER_DEFAULT (expressed using octets
+   instead of bits).  Also fixed a few small bugs in the example code.
+
+   Added the following text to all descriptions of the `serverctrls' and
+   `clientctrls' parameters: ", or NULL if no <server/client> controls
+   are to be used."
+
+   Added the following text to the description of all `dn' and `rdn'
+   parameters: "If NULL, a zero length DN is sent to the server."
+
+   Replaced many occurrences of the phrase "error code" with "result
+   code" throughout the document.
+
+   Added text to indicate that the value of the `msgidp' result parame-
+   ter is undefined if an error occurs in the following functions:
+   ldap_sasl_bind(), ldap_search_ext(), ldap_compare_ext(),
+   ldap_modify_ext(), ldap_add_ext(), ldap_delete_ext(),
+   ldap_extended_operation().
+
+   Added text to indicate that the `res' result parameter is set to NULL
+   if an API error occurs in the following functions: ldap_result(),
+   ldap_search_s(), ldap_search_st().
+
+   Added text to indicate that all result parameters have undefined
+   values if an API error is returned by the following functions:
+   ldap_parse_result(), ldap_parse_sasl_bind_result(),
+   ldap_parse_extended_result(), ldap_parse_reference(), ber_scanf().
+
+   Added angle brackets around ficticious impl_XXX_t types to make it
+   more obvious that these are not real "C" types, e.g., typedef
+   <impl_len_t> ber_len_t'.
+
+
+
+Expires: May 2001                                              [Page 82]
+
+C LDAP API        C LDAP Application Program Interface  17 November 2000
+
+
+   Appendix B: Added mod_vals_u and removed PLDAP from the struct,
+   unions, and typedefs prefix list.
+
+   Appendix C: Added note in "Compatibility" section about extensions
+   possible affecting chains of messages and the fact that that must be
+   well documented.  Appendix D: Improved text for ldap_perror() (what
+   to use instead).
+
+   "Authors" section: updated contact information for Mark Smith, Tim
+   Howes, and Mark Wahl.
+
+   Fixed a few obvious typos, improved indentation, added missing blank
+   lines, and so on.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Expires: May 2001                                              [Page 83]
+
--- mozilla-firefox-1.0.4.orig/accessible/src/base/nsBaseWidgetAccessible.cpp
+++ mozilla-firefox-1.0.4/accessible/src/base/nsBaseWidgetAccessible.cpp
@@ -247,9 +247,9 @@
     if (IsALink()) {
       nsCOMPtr<nsIPresContext> presContext(GetPresContext());
       if (presContext) {
-        nsMouseEvent linkClickEvent(NS_MOUSE_LEFT_CLICK);
+        nsMouseEvent linkClickEvent(PR_TRUE, NS_MOUSE_LEFT_CLICK, nsnull);
 
-        nsEventStatus eventStatus =  nsEventStatus_eIgnore;
+        nsEventStatus eventStatus = nsEventStatus_eIgnore;
         mLinkContent->HandleDOMEvent(presContext, 
                                      &linkClickEvent, 
                                      nsnull, 
--- mozilla-firefox-1.0.4.orig/modules/libpr0n/decoders/bmp/nsBMPDecoder.cpp
+++ mozilla-firefox-1.0.4/modules/libpr0n/decoders/bmp/nsBMPDecoder.cpp
@@ -73,7 +73,7 @@
 nsBMPDecoder::~nsBMPDecoder()
 {
     delete[] mColors;
-    delete[] mRow;
+    free(mRow);
     if (mAlpha)
         free(mAlpha);
     if (mDecoded)
@@ -286,7 +286,7 @@
         NS_ENSURE_SUCCESS(rv, rv);
         mCurLine = real_height;
 
-        mRow = new PRUint8[(mBIH.width * mBIH.bpp)/8 + 4];
+        mRow = (PRUint8*)malloc((mBIH.width * mBIH.bpp)/8 + 4);
         // +4 because the line is padded to a 4 bit boundary, but I don't want
         // to make exact calculations here, that's unnecessary.
         // Also, it compensates rounding error.
--- mozilla-firefox-1.0.4.orig/modules/libpr0n/decoders/bmp/nsICODecoder.cpp
+++ mozilla-firefox-1.0.4/modules/libpr0n/decoders/bmp/nsICODecoder.cpp
@@ -40,6 +40,8 @@
 /* This is a Cross-Platform ICO Decoder, which should work everywhere, including
  * Big-Endian machines like the PowerPC. */
 
+#include <stdlib.h>
+
 #include "nsICODecoder.h"
 
 #include "nsIInputStream.h"
@@ -102,7 +104,7 @@
   // In case the decoder and frame have different sized alpha buffers, we
   // take the smaller of the two row length values as the row length to copy.
   PRUint32 rowCopyLen = PR_MIN(bpr, mDirEntry.mWidth);
-  PRUint8* alphaRow = new PRUint8[rowCopyLen];
+  PRUint8* alphaRow = (PRUint8*)malloc(rowCopyLen);
   if (!alphaRow)
     return NS_ERROR_OUT_OF_MEMORY;
 
@@ -123,7 +125,7 @@
     frameOffset += bpr;
     alphaBufferPos += decoderRowSize;
   }
-  delete[] alphaRow;
+  free(alphaRow);
   return NS_OK;
 }
 
@@ -139,6 +141,7 @@
 {
   mPos = mNumColors = mRowBytes = mImageOffset = mCurrIcon = mNumIcons = 0;
   mCurLine = 1; // Otherwise decoder will never start
+  mStatus = NS_OK;
   mColors = nsnull;
   mRow = nsnull;
   mHaveAlphaData = 0;
@@ -186,12 +189,12 @@
   mCurrIcon = 0;
   mNumIcons = 0;
 
-  delete[] mRow;
+  free(mRow);
   mRow = nsnull;
 
   mDecodingAndMask = PR_FALSE;
-  delete[] mDecodedBuffer;
-  delete[] mAlphaBuffer;
+  free(mDecodedBuffer);
+  free(mAlphaBuffer);
 
   return NS_OK;
 }
@@ -212,14 +215,17 @@
 NS_METHOD nsICODecoder::ReadSegCb(nsIInputStream* aIn, void* aClosure,
                              const char* aFromRawSegment, PRUint32 aToOffset,
                              PRUint32 aCount, PRUint32 *aWriteCount) {
-    nsICODecoder *decoder = NS_REINTERPRET_CAST(nsICODecoder*, aClosure);
-    *aWriteCount = aCount;
-    return decoder->ProcessData(aFromRawSegment, aCount);
+  nsICODecoder *decoder = NS_REINTERPRET_CAST(nsICODecoder*, aClosure);
+  *aWriteCount = aCount;
+  decoder->mStatus = decoder->ProcessData(aFromRawSegment, aCount);
+  return decoder->mStatus;
 }
 
 NS_IMETHODIMP nsICODecoder::WriteFrom(nsIInputStream *aInStr, PRUint32 aCount, PRUint32 *aRetval)
 {
-    return aInStr->ReadSegments(ReadSegCb, this, aCount, aRetval);
+  nsresult rv = aInStr->ReadSegments(ReadSegCb, this, aCount, aRetval);
+  NS_ENSURE_SUCCESS(rv, rv);
+  return mStatus;
 }
 
 nsresult nsICODecoder::ProcessData(const char* aBuffer, PRUint32 aCount) {
@@ -227,6 +233,11 @@
     return NS_OK;
 
   while (aCount && (mPos < ICONCOUNTOFFSET)) { // Skip to the # of icons.
+    if (mPos == 2) { // if the third byte is 1: This is an icon, 2: a cursor
+      if ((*aBuffer != 1) && (*aBuffer != 2)) {
+        return NS_ERROR_FAILURE;
+      }
+    }
     mPos++; aBuffer++; aCount--;
   }
 
@@ -262,6 +273,12 @@
       if ((e.mWidth == PREFICONSIZE && e.mHeight == PREFICONSIZE && e.mBitCount >= colorDepth)
            || (mCurrIcon == mNumIcons && mImageOffset == 0)) {
         mImageOffset = e.mImageOffset;
+
+        // ensure mImageOffset is >= the size of the direntry headers (bug #245631)
+        PRUint32 minImageOffset = DIRENTRYOFFSET + mNumIcons*sizeof(mDirEntryArray);
+        if (mImageOffset < minImageOffset)
+          return NS_ERROR_FAILURE;
+
         colorDepth = e.mBitCount;
         memcpy(&mDirEntry, &e, sizeof(IconDirEntry));
       }
@@ -312,7 +329,7 @@
     NS_ENSURE_SUCCESS(rv, rv);
 
     mCurLine = mDirEntry.mHeight;
-    mRow = new PRUint8[(mDirEntry.mWidth * mBIH.bpp)/8 + 4];
+    mRow = (PRUint8*)malloc((mDirEntry.mWidth * mBIH.bpp)/8 + 4);
     // +4 because the line is padded to a 4 bit boundary, but I don't want
     // to make exact calculations here, that's unnecessary.
     // Also, it compensates rounding error.
@@ -358,9 +375,9 @@
       // Increment mPos to avoid reprocessing the info header.
       mPos++;
 #if defined(XP_MAC) || defined(XP_MACOSX)
-      mDecodedBuffer = new PRUint8[mDirEntry.mHeight*mDirEntry.mWidth*4];
+      mDecodedBuffer = (PRUint8*)malloc(mDirEntry.mHeight*mDirEntry.mWidth*4);
 #else
-      mDecodedBuffer = new PRUint8[mDirEntry.mHeight*mDirEntry.mWidth*3];
+      mDecodedBuffer = (PRUint8*)malloc(mDirEntry.mHeight*mDirEntry.mWidth*3);
 #endif
       if (!mDecodedBuffer)
         return NS_ERROR_OUT_OF_MEMORY;
@@ -374,6 +391,13 @@
         return NS_ERROR_OUT_OF_MEMORY;
     }
 
+    // Ensure memory has been allocated before decoding. If we get this far 
+    // without allocated memory, the file is most likely invalid.
+    NS_ASSERTION(mRow, "mRow is null");
+    NS_ASSERTION(mDecodedBuffer, "mDecodedBuffer is null");
+    if (!mRow || !mDecodedBuffer)
+      return NS_ERROR_FAILURE;
+
     PRUint32 rowSize = (mBIH.bpp * mDirEntry.mWidth + 7) / 8; // +7 to round up
     if (rowSize % 4)
       rowSize += (4 - (rowSize % 4)); // Pad to DWORD Boundary
@@ -467,12 +491,22 @@
       mPos++;
       mRowBytes = 0;
       mCurLine = mDirEntry.mHeight;
-      delete []mRow;
-      mRow = new PRUint8[rowSize];
-      mAlphaBuffer = new PRUint8[mDirEntry.mHeight*rowSize];
+      free(mRow);
+      mRow = (PRUint8*)malloc(rowSize);
+      if (!mRow)
+        return NS_ERROR_OUT_OF_MEMORY;
+      mAlphaBuffer = (PRUint8*)malloc(mDirEntry.mHeight*rowSize);
+      if (!mAlphaBuffer)
+        return NS_ERROR_OUT_OF_MEMORY;
       memset(mAlphaBuffer, 0xff, mDirEntry.mHeight*rowSize);
     }
 
+    // Ensure memory has been allocated before decoding.
+    NS_ASSERTION(mRow, "mRow is null");
+    NS_ASSERTION(mAlphaBuffer, "mAlphaBuffer is null");
+    if (!mRow || !mAlphaBuffer)
+      return NS_ERROR_FAILURE;
+
     PRUint32 toCopy;
     do {
         if (mCurLine == 0) {
--- mozilla-firefox-1.0.4.orig/modules/libpr0n/decoders/bmp/nsICODecoder.h
+++ mozilla-firefox-1.0.4/modules/libpr0n/decoders/bmp/nsICODecoder.h
@@ -121,6 +121,8 @@
   PRUint32 mRowBytes; // How many bytes of the row were already received
   PRInt32 mCurLine;
 
+  nsresult mStatus;
+
   PRUint8* mDecodedBuffer;
   PRUint8* mAlphaBuffer;
 };
--- mozilla-firefox-1.0.4.orig/modules/libpr0n/decoders/xbm/nsXBMDecoder.cpp
+++ mozilla-firefox-1.0.4/modules/libpr0n/decoders/xbm/nsXBMDecoder.cpp
@@ -68,10 +68,10 @@
         free(mBuf);
 
     if (mRow)
-        delete[] mRow;
+        free(mRow);
 
     if (mAlphaRow)
-        delete[] mAlphaRow;
+        free(mAlphaRow);
 }
 
 NS_IMETHODIMP nsXBMDecoder::Init(imgILoad *aLoad)
@@ -104,11 +104,11 @@
     mFrame = nsnull;
 
     if (mRow) {
-        delete[] mRow;
+        free(mRow);
         mRow = nsnull;
     }
     if (mAlphaRow) {
-        delete[] mAlphaRow;
+        free(mAlphaRow);
         mAlphaRow = nsnull;
     }
 
@@ -173,9 +173,8 @@
         PRUint32 abpr;
         mFrame->GetAlphaBytesPerRow(&abpr);
 
-        mRow = new PRUint8[bpr];
-        memset(mRow, 0, bpr);
-        mAlphaRow = new PRUint8[abpr];
+        mRow = (PRUint8*)calloc(bpr, 1);
+        mAlphaRow = (PRUint8*)malloc(abpr);
 
         mState = RECV_SEEK;
 
--- mozilla-firefox-1.0.4.orig/modules/libpref/src/init/all.js
+++ mozilla-firefox-1.0.4/modules/libpref/src/init/all.js
@@ -49,8 +49,8 @@
 
 pref("keyword.URL", "http://www.google.com/search?ie=UTF-8&oe=utf-8&q=");
 pref("keyword.enabled", false);
-pref("general.useragent.locale", "chrome://navigator/locale/navigator.properties");
-pref("general.useragent.contentlocale", "chrome://navigator-region/locale/region.properties");
+pref("general.useragent.locale", "chrome://global/locale/intl.properties");
+pref("general.useragent.contentlocale", "chrome://browser-region/locale/region.properties");
 
 pref("general.config.obscure_value", 13); // for MCD .cfg files
 
@@ -645,31 +645,30 @@
 pref("converter.html2txt.structs",          true); // Output structured phrases (strong, em, code, sub, sup, b, i, u)
 pref("converter.html2txt.header_strategy",  1); // 0 = no indention; 1 = indention, increased with header level; 2 = numbering and slight indention
 
-pref("intl.accept_languages",               "chrome://navigator/locale/navigator.properties");
+pref("intl.accept_languages",               "chrome://global/locale/intl.properties");
 pref("intl.accept_charsets",                "iso-8859-1,*,utf-8");
-pref("intl.collationOption",                "chrome://navigator-platform/locale/navigator.properties");
-pref("intl.menuitems.alwaysappendaccesskeys","chrome://navigator/locale/navigator.properties");
-pref("intl.charsetmenu.browser.static",     "chrome://navigator/locale/navigator.properties");
-pref("intl.charsetmenu.browser.more1",      "chrome://navigator/locale/navigator.properties");
-pref("intl.charsetmenu.browser.more2",      "chrome://navigator/locale/navigator.properties");
-pref("intl.charsetmenu.browser.more3",      "chrome://navigator/locale/navigator.properties");
-pref("intl.charsetmenu.browser.more4",      "chrome://navigator/locale/navigator.properties");
-pref("intl.charsetmenu.browser.more5",      "chrome://navigator/locale/navigator.properties");
-pref("intl.charsetmenu.browser.unicode",    "chrome://navigator/locale/navigator.properties");
-pref("intl.charsetmenu.mailedit",           "chrome://navigator/locale/navigator.properties");
+pref("intl.collationOption",                "chrome://global-platform/locale/intl.properties");
+pref("intl.menuitems.alwaysappendaccesskeys","chrome://global/locale/intl.properties");
+pref("intl.charsetmenu.browser.static",     "chrome://global/locale/intl.properties");
+pref("intl.charsetmenu.browser.more1",      "chrome://global/locale/intl.properties");
+pref("intl.charsetmenu.browser.more2",      "chrome://global/locale/intl.properties");
+pref("intl.charsetmenu.browser.more3",      "chrome://global/locale/intl.properties");
+pref("intl.charsetmenu.browser.more4",      "chrome://global/locale/intl.properties");
+pref("intl.charsetmenu.browser.more5",      "chrome://global/locale/intl.properties");
+pref("intl.charsetmenu.browser.unicode",    "chrome://global/locale/intl.properties");
+pref("intl.charsetmenu.mailedit",           "chrome://global/locale/intl.properties");
 pref("intl.charsetmenu.browser.cache",      "");
 pref("intl.charsetmenu.mailview.cache",     "");
 pref("intl.charsetmenu.composer.cache",     "");
 pref("intl.charsetmenu.browser.cache.size", 5);
-pref("intl.charset.detector",               "chrome://navigator/locale/navigator.properties");
-pref("intl.charset.default",                "chrome://navigator-platform/locale/navigator.properties");
-pref("intl.content.langcode",               "chrome://communicator-region/locale/region.properties");
+pref("intl.charset.detector",               "chrome://global/locale/intl.properties");
+pref("intl.charset.default",                "chrome://global-platform/locale/intl.properties");
 pref("intl.locale.matchOS",                 false);
 // fallback charset list for Unicode conversion (converting from Unicode)
 // currently used for mail send only to handle symbol characters (e.g Euro, trademark, smartquotes)
 // for ISO-8859-1
 pref("intl.fallbackCharsetList.ISO-8859-1", "windows-1252");
-pref("font.language.group",                 "chrome://navigator/locale/navigator.properties");
+pref("font.language.group",                 "chrome://global/locale/intl.properties");
 
 pref("images.dither", "auto");
 pref("security.directory",              "");
@@ -725,6 +724,16 @@
 pref("mousewheel.horizscroll.withaltkey.numlines",-1);
 pref("mousewheel.horizscroll.withaltkey.sysnumlines",false);
 
+pref("mousebuttonsextended.buttonlist", "67");
+pref("mousebuttonsextended.buttons.6.action.up", 2);
+pref("mousebuttonsextended.buttons.6.numlines.up", -1);
+pref("mousebuttonsextended.buttons.6.action.down", -1);
+pref("mousebuttonsextended.buttons.6.numlines.down", -1);
+pref("mousebuttonsextended.buttons.7.action.up", 2);
+pref("mousebuttonsextended.buttons.7.numlines.up", 1);
+pref("mousebuttonsextended.buttons.7.action.down", -1);
+pref("mousebuttonsextended.buttons.7.numlines.down", -1);
+
 pref("profile.confirm_automigration",true);
 // profile.migration_behavior determines how the profiles root is set
 // 0 - use NS_APP_USER_PROFILES_ROOT_DIR
--- mozilla-firefox-1.0.4.orig/modules/plugin/base/src/nsPluginsDirUnix.cpp
+++ mozilla-firefox-1.0.4/modules/plugin/base/src/nsPluginsDirUnix.cpp
@@ -60,6 +60,11 @@
 #include "nsILocalFile.h"
 #include "nsIPref.h"
 static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
+#ifdef AIX
+#include "nsPluginLogging.h"
+#include "prprf.h"
+#define LOG(args)  PLUGIN_LOG(PLUGIN_LOG_NORMAL, args)
+#endif
 
 #define LOCAL_PLUGIN_DLL_SUFFIX ".so"
 #if defined(__hpux)
@@ -283,6 +288,66 @@
     // nada
 }
 
+#ifdef AIX
+/**
+ * This code is necessary for Java 1.4.2 SR2 and later on AIX, as the
+ * loadquery() function is no longer used to determine the path to the
+ * installed JVM, so we need to manually set the LIBPATH variable to
+ * include the proper directories needed to run the Java plug-in.
+ *
+ * See Bug 297807 for more information.
+ */
+static char *javaLibPath = NULL;
+
+static void SetJavaLibPath(const nsCString& pluginPath)
+{
+    // If javaLibPath is non-NULL, that means we have already set the LIBPATH
+    // variable once this session, so we don't need to do it again.
+    if (javaLibPath)
+        return;
+
+    nsCAutoString javaDir, newLibPath;
+
+    PRInt32 pos = pluginPath.RFindChar('/');
+    if (pos == kNotFound || pos == 0)
+        return;
+
+    javaDir = Substring(pluginPath, 0, pos);
+    LOG(("AIX: Java dir is %s\n", javaDir.get()));
+
+    // Add jre/bin to new LIBPATH
+    newLibPath += javaDir;
+
+    // Check for existance of jre/bin/classic dir, and append it to
+    // LIBPATH if found
+    PRFileInfo info;
+    javaDir.Append(NS_LITERAL_CSTRING("/classic"));
+    if (PR_GetFileInfo(javaDir.get(), &info) == PR_SUCCESS &&
+        info.type == PR_FILE_DIRECTORY)
+    {
+        newLibPath.Append(':');
+        newLibPath.Append(javaDir);
+    }
+
+    // Get the current LIBPATH, and append it to the new LIBPATH
+    const char *currentLibPath = PR_GetEnv("LIBPATH");
+    LOG(("AIX: current LIBPATH=%s\n", currentLibPath));
+    if (currentLibPath && *currentLibPath) {
+        newLibPath.Append(':');
+        newLibPath.Append(currentLibPath);
+    }
+
+    // Set the LIBPATH to include the path to the JRE directories.
+    // NOTE: We are leaking javaLibPath here, as it needs to remain in memory
+    // for PR_SetEnv to work properly.
+    javaLibPath = PR_smprintf("LIBPATH=%s", newLibPath.get());
+    if (javaLibPath) {
+        LOG(("AIX: new LIBPATH=%s\n", newLibPath.get()));
+        PR_SetEnv(javaLibPath);
+    }
+}
+#endif
+
 /**
  * Loads the plugin into memory using NSPR's shared-library loading
  * mechanism. Handles platform differences in loading shared libraries.
@@ -302,6 +367,16 @@
     if (NS_FAILED(rv))
         return rv;
 
+#ifdef AIX
+    nsCAutoString leafName;
+    rv = mPlugin->GetNativeLeafName(leafName);
+    if (NS_FAILED(rv))
+        return rv;
+
+    if (StringBeginsWith(leafName, NS_LITERAL_CSTRING("libjavaplugin_oji")))
+        SetJavaLibPath(path);
+#endif
+
     libSpec.value.pathname = path.get();
 
 #if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_GTK2)
--- mozilla-firefox-1.0.4.orig/calendar/resources/content/datepicker/calendar.css
+++ mozilla-firefox-1.0.4/calendar/resources/content/datepicker/calendar.css
@@ -1,119 +1,119 @@
-
-calendar {
-	-moz-binding: url("calendar.xml#calendar");
-}
-/*
-.cal-menu { 
-	font-family: Arial;
-	font-size: 10pt;
-	color: #ffffff;
-	border: 1px outset #ffffff;
-}
-
-.cal-menu:hover { 
-	font-family: Arial;
-	font-size: 10pt;
-	color: #ffffff;
-	border: 2px outset #ffffff;
-}
-
-.cal-popup {
-	min-width: 130px;
-	background-color: #ffffff;
-	border: 1px outset #ffffff;
-	padding: 0px;
-}
-*/
-
-.cal-mainbox {
-	min-width: 130px;
-	background-color: #ffffff;
-	border: 1px outset #ffffff;
-	padding: 0px;
-}
-
-.cal-month-box {
-	background-color: #EEEEEE;
-}
-
-.cal-month-name {
-	font-family: Arial;
-	font-size: 12pt;
-	font-weight: bold;
-	color: #000000;
-	text-align: center;
-}
-
-.cal-navbtn {
-	min-width: 10px;
-	-moz-binding: url("calendar.xml#cal-navbtn");
-}
-
-.cal-navbtn[dir="-1"] {
-	background: url("image/left-arrow.gif") no-repeat 50% 50%;
-}
-
-.cal-navbtn[dir="1"] {
-	background: url("image/right-arrow.gif") no-repeat 50% 50%;
-}
-
-.cal-navbtn[dir="-1"]:hover {
-	background: url("image/left-arrow-hover.gif") no-repeat 50% 50%;
-}
-
-.cal-navbtn[dir="1"]:hover {
-	background: url("image/right-arrow-hover.gif") no-repeat 50% 50%;
-}
-
-.cal-navbtn:active {
-	left: 2px;
-	top: 2px;
-}
-
-.cal-cal-box {
-}
-
-.cal-header {
-	font-family: Arial;
-	color: blue;
-	text-align: center;
-}
-
-.cal-row-body {
-}
-
-.cal-day {
-	font-family: Arial;
-	color: #000000;
-	border: 1px solid transparent;
-	text-align: center;
-	-moz-binding: url("calendar.xml#cal-day");
-}
-
-.cal-day[othermonth="true"] {
-	color: #d2d2d2;
-}
-
-.cal-day[budy="true"] {
-	font-weight : bold;
-}
-
-.cal-day[selected="true"] {
-	background-color: #778899;
-	color: #ffffff;
-}
-
-.cal-day[busy="true"]
-{
-   font-weight    : bold;
-}
-
-.cal-day:hover {
-	color: #ff0000;
-	border: 1px solid #d2d2d2;
-}
-
-.cal-day:active {
-	background-color: #d2d2d2;
-}
-
+
+calendar {
+	-moz-binding: url("calendar.xml#calendar");
+}
+/*
+.cal-menu { 
+	font-family: Arial;
+	font-size: 10pt;
+	color: #ffffff;
+	border: 1px outset #ffffff;
+}
+
+.cal-menu:hover { 
+	font-family: Arial;
+	font-size: 10pt;
+	color: #ffffff;
+	border: 2px outset #ffffff;
+}
+
+.cal-popup {
+	min-width: 130px;
+	background-color: #ffffff;
+	border: 1px outset #ffffff;
+	padding: 0px;
+}
+*/
+
+.cal-mainbox {
+	min-width: 130px;
+	background-color: #ffffff;
+	border: 1px outset #ffffff;
+	padding: 0px;
+}
+
+.cal-month-box {
+	background-color: #EEEEEE;
+}
+
+.cal-month-name {
+	font-family: Arial;
+	font-size: 12pt;
+	font-weight: bold;
+	color: #000000;
+	text-align: center;
+}
+
+.cal-navbtn {
+	min-width: 10px;
+	-moz-binding: url("calendar.xml#cal-navbtn");
+}
+
+.cal-navbtn[dir="-1"] {
+	background: url("image/left-arrow.gif") no-repeat 50% 50%;
+}
+
+.cal-navbtn[dir="1"] {
+	background: url("image/right-arrow.gif") no-repeat 50% 50%;
+}
+
+.cal-navbtn[dir="-1"]:hover {
+	background: url("image/left-arrow-hover.gif") no-repeat 50% 50%;
+}
+
+.cal-navbtn[dir="1"]:hover {
+	background: url("image/right-arrow-hover.gif") no-repeat 50% 50%;
+}
+
+.cal-navbtn:active {
+	left: 2px;
+	top: 2px;
+}
+
+.cal-cal-box {
+}
+
+.cal-header {
+	font-family: Arial;
+	color: blue;
+	text-align: center;
+}
+
+.cal-row-body {
+}
+
+.cal-day {
+	font-family: Arial;
+	color: #000000;
+	border: 1px solid transparent;
+	text-align: center;
+	-moz-binding: url("calendar.xml#cal-day");
+}
+
+.cal-day[othermonth="true"] {
+	color: #d2d2d2;
+}
+
+.cal-day[budy="true"] {
+	font-weight : bold;
+}
+
+.cal-day[selected="true"] {
+	background-color: #778899;
+	color: #ffffff;
+}
+
+.cal-day[busy="true"]
+{
+   font-weight    : bold;
+}
+
+.cal-day:hover {
+	color: #ff0000;
+	border: 1px solid #d2d2d2;
+}
+
+.cal-day:active {
+	background-color: #d2d2d2;
+}
+
--- mozilla-firefox-1.0.4.orig/calendar/resources/content/datepicker/datepicker.css
+++ mozilla-firefox-1.0.4/calendar/resources/content/datepicker/datepicker.css
@@ -1,25 +1,25 @@
-
-datepicker {
-	-moz-binding: url("datepicker.xml#datepicker");
-	max-height: 200px;
-}
-
-menu.datepicker-button {
-	background-image : url( "chrome://calendar/skin/ca-event-dialog/calendar_up.gif" );
-   background-repeat   : no-repeat;
-}
-
-.datepicker-button:hover {
-    /*background-image : url( "chrome://calendar/skin/ca-event-dialog/calendar_hover.gif" );
-    background-repeat   : no-repeat;*/
-}
-
-.datepicker-button[open="true"] {
-    /*background-image : url( "chrome://calendar/skin/ca-event-dialog/calendar_down.gif" );
-    background-repeat   : no-repeat;*/
-}
-
-.menu-right
-{
-   visibility        : hidden;
-}
+
+datepicker {
+	-moz-binding: url("datepicker.xml#datepicker");
+	max-height: 200px;
+}
+
+menu.datepicker-button {
+	background-image : url( "chrome://calendar/skin/ca-event-dialog/calendar_up.gif" );
+   background-repeat   : no-repeat;
+}
+
+.datepicker-button:hover {
+    /*background-image : url( "chrome://calendar/skin/ca-event-dialog/calendar_hover.gif" );
+    background-repeat   : no-repeat;*/
+}
+
+.datepicker-button[open="true"] {
+    /*background-image : url( "chrome://calendar/skin/ca-event-dialog/calendar_down.gif" );
+    background-repeat   : no-repeat;*/
+}
+
+.menu-right
+{
+   visibility        : hidden;
+}
--- mozilla-firefox-1.0.4.orig/toolkit/components/alerts/resources/skin/alert.css
+++ mozilla-firefox-1.0.4/toolkit/components/alerts/resources/skin/alert.css
@@ -75,10 +75,10 @@
 .alertText[clickable="true"]:hover:active {
   color: #424F63;
 }
-
-.alertTextBox
-{
-  padding-right: 10px;
-  padding-top: 5px;
-}
-
+
+.alertTextBox
+{
+  padding-right: 10px;
+  padding-top: 5px;
+}
+
--- mozilla-firefox-1.0.4.orig/toolkit/components/autocomplete/src/nsAutoCompleteController.cpp
+++ mozilla-firefox-1.0.4/toolkit/components/autocomplete/src/nsAutoCompleteController.cpp
@@ -329,9 +329,22 @@
   } else if (aKey == nsIAutoCompleteController::KEY_LEFT ||
              aKey == nsIAutoCompleteController::KEY_RIGHT)
   {
-    // When the user arrows to the side, close the popup
-    ClearSearchTimer();
-    ClosePopup();
+    // The user hit a left or right arrow key
+    PRBool isOpen;
+    mInput->GetPopupOpen(&isOpen);
+    if (isOpen) {
+      PRInt32 selectedIndex;
+      popup->GetSelectedIndex(&selectedIndex);
+      if (selectedIndex >= 0) {
+        // The pop-up is open and has a selection, take its value
+        nsAutoString value;
+        if (NS_SUCCEEDED(GetResultValueAt(selectedIndex, PR_TRUE, value)))
+          CompleteValue(value, PR_FALSE);
+      }
+      // Close the pop-up even if nothing was selected
+      ClearSearchTimer();
+      ClosePopup();
+    }
   }
   
   return NS_OK;
--- mozilla-firefox-1.0.4.orig/toolkit/components/help/content/help.js
+++ mozilla-firefox-1.0.4/toolkit/components/help/content/help.js
@@ -575,27 +575,6 @@
       document.getElementById("findText").focus();
 }
 
-function findParentNode(node, parentNode)
-{
-  if (node && node.nodeType == Node.TEXT_NODE) {
-    node = node.parentNode;
-  }
-  while (node) {
-    var nodeName = node.localName;
-    if (!nodeName)
-      return null;
-    nodeName = nodeName.toLowerCase();
-    if (nodeName == "body" || nodeName == "html" ||
-        nodeName == "#document") {
-      return null;
-    }
-    if (nodeName == parentNode)
-      return node;
-    node = node.parentNode;
-  }
-  return null;
-}
-
 function onselect_loadURI(tree) {
     try {
         var resource = tree.view.getResourceAtIndex(tree.currentIndex);
--- mozilla-firefox-1.0.4.orig/toolkit/components/satchel/src/nsFormFillController.cpp
+++ mozilla-firefox-1.0.4/toolkit/components/satchel/src/nsFormFillController.cpp
@@ -53,6 +53,7 @@
 #include "nsIContentViewer.h"
 #include "nsIDOMEventTarget.h"
 #include "nsIDOMKeyEvent.h"
+#include "nsIPrivateDOMEvent.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMNSHTMLInputElement.h"
@@ -451,6 +452,15 @@
   }
 
   event->InitEvent(NS_LITERAL_STRING("DOMAutoComplete"), PR_TRUE, PR_TRUE);
+
+  nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));
+  if (privateEvent) {
+    // XXXjst: We mark this event as a trusted event, it's up to the
+    // callers of this to ensure that it's only called from trusted
+    // code.
+    privateEvent->SetTrusted(PR_TRUE);
+  }
+
   nsCOMPtr<nsIDOMEventTarget> targ = do_QueryInterface(mFocusedInput);
 
   PRBool noDefault;
--- mozilla-firefox-1.0.4.orig/toolkit/content/widgets/browser.xml
+++ mozilla-firefox-1.0.4/toolkit/content/widgets/browser.xml
@@ -577,6 +577,7 @@
           
           this.securityUI = null;
           this._fastFind = null;
+          this._webBrowserFind = null;
 
           this.removeEventListener("load", this.onLoad, true);
           this.removeEventListener("unload", this.onUnload, true);
--- mozilla-firefox-1.0.4.orig/toolkit/content/widgets/tabbrowser.xml
+++ mozilla-firefox-1.0.4/toolkit/content/widgets/tabbrowser.xml
@@ -1148,7 +1148,15 @@
             // clean up the before/afterselected attributes before removing the tab
             oldTab.selected = false;
 
-            // XXX browser's destructor isn't always called, so we force a cleanup ourselves
+            // Because of the way XBL works (fields just set JS
+            // properties on the element) and the code we have in place
+            // to preserve the JS objects for any elements that have
+            // JS properties set on them, the browser element won't be
+            // destroyed until the document goes away.
+            // This has to hapen before we remove the child so that the
+            // XBL implementation of nsIObserver still works.  But
+            // clearing focusedWindow happens below because it gets
+            // reset by updateCurrentBrowser.
             oldBrowser.destroy();
             
             this.mTabContainer.removeChild(oldTab);
@@ -1158,6 +1166,10 @@
             this.mPanelContainer.selectedIndex = newIndex;
             
             this.updateCurrentBrowser();
+
+            // see comment above destroy above
+            oldBrowser.focusedWindow = null;
+            oldBrowser.focusedElement = null;
             }
           ]]>
         </body>
@@ -1601,7 +1613,7 @@
           ]]>
         </body>
       </method>
-
+      
       <method name="dragDropSecurityCheck">
         <parameter name="aEvent"/>
         <parameter name="aDragSession"/>
--- mozilla-firefox-1.0.4.orig/toolkit/mozapps/downloads/src/nsHelperAppDlg.js.in
+++ mozilla-firefox-1.0.4/toolkit/mozapps/downloads/src/nsHelperAppDlg.js.in
@@ -481,7 +481,9 @@
         {
           // wasn't a fileURL
           var tmpurl = url.clone(); // don't want to change the real url
-          tmpurl.userPass = "";
+          try {
+            tmpurl.userPass = "";
+          } catch (ex) {}
           pathString = tmpurl.prePath;
         }
 
--- mozilla-firefox-1.0.4.orig/toolkit/mozapps/extensions/content/extensions.js
+++ mozilla-firefox-1.0.4/toolkit/mozapps/extensions/content/extensions.js
@@ -678,7 +678,8 @@
       return !selectedItem ||
              (selectedItem &&
               selectedItem.getAttribute("toBeUninstalled") != "true" &&
-              selectedItem.getAttribute("toBeInstalled") != "true");
+              selectedItem.getAttribute("toBeInstalled") != "true" &&
+	      selectedItem.getAttribute("locked") != "true");
     case "cmd_reallyEnable":
     // controls whether to show Enable or Disable in extensions' context menu
       return selectedItem && 
@@ -694,8 +695,7 @@
     case "cmd_disable":
       return selectedItem &&
              !selectedItem.disabled &&
-             selectedItem.getAttribute("toBeUninstalled") != "true" &&
-             selectedItem.getAttribute("locked") != "true";
+             selectedItem.getAttribute("toBeUninstalled") != "true";
     case "cmd_movetop":
       return selectedItem && (gExtensionsView.children[0] != selectedItem);
     case "cmd_moveup":
--- mozilla-firefox-1.0.4.orig/toolkit/mozapps/extensions/src/nsExtensionManager.js.in
+++ mozilla-firefox-1.0.4/toolkit/mozapps/extensions/src/nsExtensionManager.js.in
@@ -20,6 +20,7 @@
  *
  * Contributor(s):
  *  Ben Goodger <ben@bengoodger.com>
+ *  Mike Hommey <mh@glandium.org>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -144,6 +145,19 @@
 }
 
 // Returns the file at the appropriate point in a directory hierarchy under
+// the specified key. Does NOT create the file NOR the directories along the
+// way.
+function getFileNoCreateDir(aKey, aPathToFile)
+{
+  var subdirs = [];
+  for (var i = 0; i < aPathToFile.length - 1; ++i)
+    subdirs.push(aPathToFile[i]);
+  var file = getDirNoCreate(aKey, subdirs);
+  file.append(aPathToFile[aPathToFile.length - 1]);
+  return file;
+}
+
+// Returns the file at the appropriate point in a directory hierarchy under
 // the specified key, creating directories along the way if necessary. Does
 // NOT create the file.
 function getFile(aKey, aPathToFile)
@@ -675,9 +689,17 @@
 function nsInstallLogReader(aExtensionID, aIsProfile, aListener)
 {
   this._isProfile = aIsProfile;
-  this.uninstallLog = getFile(getDirKey(aIsProfile),
+  this.uninstallLog = getFileNoCreateDir(getDirKey(aIsProfile),
                               [DIR_EXTENSIONS, aExtensionID, 
                                DIR_UNINSTALL, FILE_UNINSTALL_LOG]);
+  // If the uninstall Log doesn't exist in profile, let's give a try in
+  // global extension pool.
+  if (aIsProfile && !this.uninstallLog.exists()) {
+    this._isProfile = false;
+    this.uninstallLog = getFileNoCreateDir(getDirKey(false),
+                                           [DIR_EXTENSIONS, aExtensionID,
+                                            DIR_UNINSTALL, FILE_UNINSTALL_LOG]);
+  }
   this._listener = aListener
 }
 
@@ -829,26 +851,20 @@
   {
     // extension,{GUID} or theme,{GUID}
     var parts = aLine.split(",");
-    var manifest = getFile(KEY_APPDIR, 
+    var manifest = getFileNoCreateDir(KEY_APPDIR, 
                            [DIR_EXTENSIONS, parts[1], FILE_INSTALL_MANIFEST]);
     if (parts.length != 2)
       return;
       
-    if (!manifest.exists()) {
-      defaultManifest = defaultFile = getFile(KEY_DEFAULTS, 
-                                              [DIR_DEFAULTS_EXTENSIONS, parts[1], FILE_INSTALL_MANIFEST]);
-      var extensionDir = getDir(KEY_APPDIR, [DIR_EXTENSIONS, parts[1]]);
-      defaultManifest.copyTo(extensionDir, FILE_INSTALL_MANIFEST);
-      manifest = getFile(KEY_APPDIR, 
-                         [DIR_EXTENSIONS, parts[1], FILE_INSTALL_MANIFEST]);
-    }
-    switch (parts[0]) {
-    case this.TOKEN_EXTENSION:
-      this._manager.ensurePreConfiguredItem(parts[1], nsIUpdateItem.TYPE_EXTENSION, manifest);
-      break;
-    case this.TOKEN_THEME:
-      this._manager.ensurePreConfiguredItem(parts[1], nsIUpdateItem.TYPE_THEME, manifest);
-      break;
+    if (manifest.exists()) {
+      switch (parts[0]) {
+      case this.TOKEN_EXTENSION:
+        this._manager.ensurePreConfiguredItem(parts[1], nsIUpdateItem.TYPE_EXTENSION, manifest);
+        break;
+      case this.TOKEN_THEME:
+        this._manager.ensurePreConfiguredItem(parts[1], nsIUpdateItem.TYPE_THEME, manifest);
+        break;
+      }
     }
   }
 };
@@ -929,7 +945,7 @@
     this._installExtensionFiles();
     
     // Load the metadata datasource
-    var metadataFile = getFile(this._extDirKey, 
+    var metadataFile = getFileNoCreateDir(this._extDirKey, 
                                [DIR_EXTENSIONS, aExtensionID, FILE_INSTALL_MANIFEST]);
     
     this._metadataDS = getInstallManifest(metadataFile);
@@ -969,10 +985,12 @@
   
   _installExtensionFiles: function nsExtensionInstaller__installExtensionFiles ()
   {
-    var sourceXPI = getFile(this._extDirKey, 
+    var sourceXPI = getFileNoCreateDir(this._extDirKey, 
                             [DIR_EXTENSIONS, DIR_TEMP, 
                              this._extensionID, 
                              this._extensionID + ".xpi"]);
+    if (!sourceXPI.exists())
+      return;
     var zipReader = Components.classes["@mozilla.org/libjar/zip-reader;1"]
                               .createInstance(Components.interfaces.nsIZipReader);
     zipReader.init(sourceXPI);
@@ -1752,6 +1770,9 @@
       // Write bin/components.ini
       var manifest = getFile(KEY_APPDIR, [FILE_COMPONENT_MANIFEST]);
       this._writeProfileFile(manifest, this._getComponentsDir, false);
+
+      // Update the Defaults Manifest
+      this._writeDefaults(false);
     }
   },
 
@@ -1823,7 +1844,7 @@
         cr.selectSkin(KEY_DEFAULT_THEME, true);
       }
       catch (e) {
-        dump("*** nsExtensionManager::_disableObsoleteExtensions - failure, catching exception so finalize window can close\n");
+//        dump("*** nsExtensionManager::_disableObsoleteExtensions - failure, catching exception so finalize window can close\n");
       }
       win.close();
       
@@ -2000,8 +2021,41 @@
   ensurePreConfiguredItem: function nsExtensionManager_ensurePreConfiguredItem (aItemID, aItemType, aManifest)
   {
     this._ds.insertForthcomingItem(aItemID, aItemType, false);
-    var metadataDS = getInstallManifest(aManifest);
+    try {
+      var metadataDS = getInstallManifest(aManifest);
+    }
+    catch (e) {
+      return;
+    }
     this._ds.addItemMetadata(aItemID, aItemType, metadataDS, false);
+
+    // Check whether the extension is installable (firefox_version fitting between
+    // em:MaxVersion and em:MinVersion)
+    var extensionID = this.canInstallItem(metadataDS);
+    // |extensionID| must be a GUID string, not a number - a number means failure.
+    if (isNaN(parseInt(extensionID))) {
+      // Do install the extension, meaning we register its chrome and components
+      if (!this._extInstaller)
+          this._extInstaller = new nsExtensionInstaller(this._ds);
+      try {
+          this._extInstaller.install(aItemID, false);
+      }
+      catch (e) {
+          // If the installation failed, we disable the extension in addition
+	  // to _not_ uninstalling it (which would fail anyway because it
+	  // would be done at launch time... as a user).
+	  this._ds.setItemProperty(aItemID, this._ds._emR("toBeUninstalled"),
+	                           null, false, aItemType);
+          this._ds.setItemProperty(aItemID, this._ds._emR("disabled"),
+                                   this._ds._emL("true"), false, aItemType);
+      }
+    } else {
+      // disable extensions that aren't installable
+      this._ds.setItemProperty(aItemID, this._ds._emR("disabled"),
+                              this._ds._emL("true"), false, aItemType);
+    }
+    // Force locking pre-configured items.
+    this._ds.lockUnlockItem(aItemID, true);
   },
   
   checkForMismatches: function nsExtensionManager_checkForMismatches () 
@@ -2028,22 +2082,31 @@
       if (items.length > 0) {
         for (var i = 0; i < items.length; ++i) {
           // Now disable the extension so it won't hurt anything. 
+	  var alreadyDisabled = this._ds.getItemProperty(items[i].id, "disabled");
           var itemType = getItemType(this._ds._getResourceForItem(items[i].id).Value);
           if (itemType != -1 && itemType & nsIUpdateItem.TYPE_EXTENSION)
-            this.disableExtension(items[i].id);
+            if (!alreadyDisabled) this.disableExtension(items[i].id);
           else if (itemType & nsIUpdateItem.TYPE_THEME) {
             if (gPref.prefHasUserValue(PREF_GENERAL_SKINS_SELECTEDSKIN))
               gPref.clearUserPref(PREF_GENERAL_SKINS_SELECTEDSKIN);
-            this._ds.disableTheme(items[i].id);
+            if (!alreadyDisabled) this._ds.disableTheme(items[i].id);
           }
         }
-        var updates = Components.classes["@mozilla.org/updates/update-service;1"]
-                                .getService(Components.interfaces.nsIUpdateService);
-        updates.checkForUpdates(items, items.length, nsIUpdateItem.TYPE_ADDON, 
-                                nsIUpdateService.SOURCE_EVENT_MISMATCH,
-                                null);
+	// We want to eliminate locked extensions
+	newitems = [];
+	for (var i = 0; i < items.length; ++i) {
+	  if (!this._ds.getItemProperty(items[i].id, "locked"))
+	    newitems.push(items[i]);
+	}
+	if (newitems.length > 0) {
+          var updates = Components.classes["@mozilla.org/updates/update-service;1"]
+                                  .getService(Components.interfaces.nsIUpdateService);
+          updates.checkForUpdates(newitems, newitems.length, nsIUpdateItem.TYPE_ADDON, 
+                                  nsIUpdateService.SOURCE_EVENT_MISMATCH,
+                                  null);
         
-        needsRestart = true;
+          needsRestart = true;
+	}
       }
     }
     
@@ -2087,7 +2150,7 @@
       this._writeDefaults(false);
     }
     catch (e) { 
-      dump("*** ExtensionManager:_updateManifests: no access privileges to application directory, skipping.\n"); 
+//      dump("*** ExtensionManager:_updateManifests: no access privileges to application directory, skipping.\n"); 
     };
     this._writeComponentManifest(true);
     this._writeDefaults(true);
@@ -2133,6 +2196,11 @@
         validExtensions.push({ sourceDir: sourceDir, isProfile: isProfile });
     }
     
+    // Debian hook to insert defaults/syspref into defaults.ini
+    if ((aFile.leafName == FILE_DEFAULTS) && aIsProfile == false) {
+      validExtensions.push({ sourceDir: getDirNoCreate(getDirKey(false), [DIR_DEFAULTS, "syspref"]), isProfile: false });
+    }
+
     var lines = ["[Extra Files]\r\n",
                  "Count=" + validExtensions.length + "\r\n"];
     for (i = 0; i < lines.length; ++i)
@@ -2545,16 +2613,16 @@
       this._extEnabler = new nsExtensionEnabler(this._ds);
       
     var isProfile = this._ds.isProfileItem(aExtensionID);
-    this._extEnabler.enable(aExtensionID, isProfile, aDisable);
+    this._extEnabler.enable(aExtensionID, true, aDisable);
 
     // clear temporary flags
     this._ds.setItemProperty(aExtensionID, 
                              this._ds._emR("toBeEnabled"),
-                             null, isProfile,
+                             null, true,
                              nsIUpdateItem.TYPE_EXTENSION);
     this._ds.setItemProperty(aExtensionID, 
                              this._ds._emR("toBeDisabled"),
-                             null, isProfile,
+                             null, true,
                              nsIUpdateItem.TYPE_EXTENSION);
   },
   
@@ -3090,8 +3158,10 @@
   checkForUpdates: function (aItem, aVersionUpdateOnly)
   {
     // A preference setting can disable updating for this item
+    // We'll also skip locked items.
     try {
-      if (!gPref.getBoolPref(PREF_EM_ITEM_UPDATE_ENABLED.replace(/%UUID%/, aItem.id))) {
+      if (this._updater._emDS.getItemProperty(aItem.id, "locked") ||
+          !gPref.getBoolPref(PREF_EM_ITEM_UPDATE_ENABLED.replace(/%UUID%/, aItem.id))) {
         gOS.notifyObservers(null, "Update:Extension:Item-Ended", "");
         this._updater._checkForDone();
         return;
@@ -3557,7 +3627,7 @@
   
   isProfileItem: function nsExtensionsDataSource_isProfileItem (aItemID)
   {
-    return this.getItemProperty(aItemID, "installLocation") != "global";
+    return this.getItemProperty(aItemID, "installLocation") == "profile";
   },
   
   _setProperty: function nsExtensionsDataSource__setProperty (aDS, aSource, aProperty, aNewValue)
@@ -3845,26 +3915,26 @@
   enableExtension: function nsExtensionsDataSource_enableExtension (aExtensionID)
   {
     this.setItemProperty(aExtensionID, this._emR("toBeEnabled"), 
-                         this._emL("true"), this.isProfileItem(aExtensionID), 
+                         this._emL("true"), true,
                          nsIUpdateItem.TYPE_EXTENSION);
     this.setItemProperty(aExtensionID, this._emR("toBeDisabled"), 
-                         null, this.isProfileItem(aExtensionID), 
+                         null, true,
                          nsIUpdateItem.TYPE_EXTENSION);
     this.setItemProperty(aExtensionID, this._emR("disabled"), 
-                         null, this.isProfileItem(aExtensionID), 
+                         null, true,
                          nsIUpdateItem.TYPE_EXTENSION);
   },
   
   disableExtension: function nsExtensionsDataSource_disableExtension (aExtensionID)
   {
     this.setItemProperty(aExtensionID, this._emR("toBeDisabled"), 
-                         this._emL("true"), this.isProfileItem(aExtensionID), 
+                         this._emL("true"), true,
                          nsIUpdateItem.TYPE_EXTENSION);
     this.setItemProperty(aExtensionID, this._emR("toBeEnabled"), 
-                         null, this.isProfileItem(aExtensionID), 
+                         null, true,
                          nsIUpdateItem.TYPE_EXTENSION);
     this.setItemProperty(aExtensionID, this._emR("disabled"), 
-                         this._emL("true"), this.isProfileItem(aExtensionID), 
+                         this._emL("true"), true, 
                          nsIUpdateItem.TYPE_EXTENSION);
   },
   
--- mozilla-firefox-1.0.4.orig/toolkit/mozapps/installer/windows/wizard/setup/dialogs.c
+++ mozilla-firefox-1.0.4/toolkit/mozapps/installer/windows/wizard/setup/dialogs.c
@@ -2055,7 +2055,7 @@
   LPNMHDR notifyMessage;
   HWND ctrl;
   static BOOL launchAppChecked = TRUE;
-  static BOOL resetHomepageChecked = TRUE;
+  static BOOL resetHomepageChecked = FALSE;
   DWORD result;
   HKEY theKey;
   
--- mozilla-firefox-1.0.4.orig/toolkit/mozapps/installer/windows/wizard/setup/extra.c
+++ mozilla-firefox-1.0.4/toolkit/mozapps/installer/windows/wizard/setup/extra.c
@@ -3786,7 +3786,7 @@
 {
   diDialog->bShowDialog = FALSE;
   diDialog->bLaunchAppChecked = TRUE;
-  diDialog->bResetHomepageChecked = TRUE;
+  diDialog->bResetHomepageChecked = FALSE;
   if((diDialog->szTitle = NS_GlobalAlloc(MAX_BUF)) == NULL)
     return(1);
   if((diDialog->szMessage0 = NS_GlobalAlloc(MAX_BUF)) == NULL)
--- mozilla-firefox-1.0.4.orig/toolkit/mozapps/update/content/update.xul
+++ mozilla-firefox-1.0.4/toolkit/mozapps/update/content/update.xul
@@ -249,7 +249,7 @@
     <separator/>
 
     <vbox align="start">
-      <checkbox id="resetHomepage" checked="true"
+      <checkbox id="resetHomepage" checked="false"
                 label="&resetHomepage.label;" accesskey="&resetHomepage.accesskey;"/>
     </vbox>
 #endif
--- mozilla-firefox-1.0.4.orig/toolkit/mozapps/update/src/nsUpdateService.js.in
+++ mozilla-firefox-1.0.4/toolkit/mozapps/update/src/nsUpdateService.js.in
@@ -178,9 +178,10 @@
       if (aRequestedTypes & nsIUpdateItem.TYPE_THEME)
         types |= nsIUpdateItem.TYPE_THEME;
     }
-    if (appUpdateEnabled && 
-        (aRequestedTypes & nsIUpdateItem.TYPE_APP))
-      types |= nsIUpdateItem.TYPE_APP;
+    // Disable application updates
+    //if (appUpdateEnabled && 
+    //    (aRequestedTypes & nsIUpdateItem.TYPE_APP))
+    //  types |= nsIUpdateItem.TYPE_APP;
 
     return types;
   },
--- mozilla-firefox-1.0.4.orig/toolkit/themes/pinstripe/global/checkbox.css
+++ mozilla-firefox-1.0.4/toolkit/themes/pinstripe/global/checkbox.css
@@ -1,2 +1,67 @@
-/*
 * The contents of this file are subject to the Netscape Public
 * License Version 1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of
 * the License at http://www.mozilla.org/NPL/
 *
 * Software distributed under the License is distributed on an "AS
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * rights and limitations under the License.
 *
 * The Original Code is Mozilla Communicator client code, released
 * March 31, 1998.
 *
 * The Initial Developer of the Original Code is Netscape
 * Communications Corporation. Portions created by Netscape are
 * Copyright (C) 1998-1999 Netscape Communications Corporation. All
 * Rights Reserved.
 *
 * Contributor(s):
 *
 */

/* ===== checkbox.css ===================================================
  == Styles used by the XUL checkbox element.
  ======================================================================= */

@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

/* ::::: checkbox ::::: */

checkbox {
  -moz-appearance: checkbox-container;
  -moz-user-focus: ignore;
  -moz-box-align: center;
  margin: 2px 2px 4px 2px;
}

.checkbox-label-box {
  margin-left: 0px;
  padding: 0px;
}

.checkbox-icon {
  margin-right: 2px;
}

.checkbox-label {
  margin: 0 !important;
-  padding-bottom: 1px;
}

/* ..... disabled state ..... */

checkbox[disabled="true"] {
  color: GrayText !important;
}

/* ::::: checkmark image ::::: */

.checkbox-check {
  -moz-appearance: checkbox;
  width: 14px;
  height: 12px;
}
  

\ No newline at end of file
+/*
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998-1999 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+
+/* ===== checkbox.css ===================================================
+  == Styles used by the XUL checkbox element.
+  ======================================================================= */
+
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+
+/* ::::: checkbox ::::: */
+
+checkbox {
+  -moz-appearance: checkbox-container;
+  -moz-user-focus: ignore;
+  -moz-box-align: center;
+  margin: 2px 2px 4px 2px;
+}
+
+.checkbox-label-box {
+  margin-left: 0px;
+  padding: 0px;
+}
+
+.checkbox-icon {
+  margin-right: 2px;
+}
+
+.checkbox-label {
+  margin: 0 !important;
+  padding-bottom: 1px;
+}
+
+/* ..... disabled state ..... */
+
+checkbox[disabled="true"] {
+  color: GrayText !important;
+}
+
+/* ::::: checkmark image ::::: */
+
+.checkbox-check {
+  -moz-appearance: checkbox;
+  width: 14px;
+  height: 12px;
+}
+  
+
--- mozilla-firefox-1.0.4.orig/toolkit/themes/pinstripe/global/colorpicker.css
+++ mozilla-firefox-1.0.4/toolkit/themes/pinstripe/global/colorpicker.css
@@ -1,2 +1,66 @@
-/*
 * The contents of this file are subject to the Netscape Public
 * License Version 1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of
 * the License at http://www.mozilla.org/NPL/
 *
 * Software distributed under the License is distributed on an "AS
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * rights and limitations under the License.
 *
 * The Original Code is Mozilla Communicator client code, released
 * March 31, 1998.
 *
 * The Initial Developer of the Original Code is Netscape
 * Communications Corporation. Portions created by Netscape are
 * Copyright (C) 1998-1999 Netscape Communications Corporation. All
 * Rights Reserved.
 *
 * Contributor(s):
 *
 */

/* ===== colorpicker.css ================================================
  == Styles used by the XUL colorpicker element.
  ======================================================================= */

@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

/* ::::: colorpicker button ::::: */
 
/* colorpicker button */

colorpicker[type="button"] {
  width: 38px;
  height: 24px;
  border: 1px solid #a7a7a7;
  background-color: ThreeDFace;
  padding: 3px;
-  -moz-appearance: button-bevel;
}

.colorpicker-button-colorbox {
  border: 1px solid #000000;
}

/* ::::: colorpicker tiles ::::: */

.colorpickertile {
  width                 : 20px;
  height                : 20px;
  margin                : 1px;
}

.colorpickertile[selected="true"] {
  border : 1px outset #C0C0C0;

}

.colorpickertile[hover="true"] {
  border : 1px dotted #A7A7A7;
}

.cp-light[hover="true"] {
  border : 1px dotted #000000;
}
\ No newline at end of file
+/*
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998-1999 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+
+/* ===== colorpicker.css ================================================
+  == Styles used by the XUL colorpicker element.
+  ======================================================================= */
+
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+
+/* ::::: colorpicker button ::::: */
+ 
+/* colorpicker button */
+
+colorpicker[type="button"] {
+  width: 38px;
+  height: 24px;
+  border: 1px solid #a7a7a7;
+  background-color: ThreeDFace;
+  padding: 3px;
+  -moz-appearance: button-bevel;
+}
+
+.colorpicker-button-colorbox {
+  border: 1px solid #000000;
+}
+
+/* ::::: colorpicker tiles ::::: */
+
+.colorpickertile {
+  width                 : 20px;
+  height                : 20px;
+  margin                : 1px;
+}
+
+.colorpickertile[selected="true"] {
+  border : 1px outset #C0C0C0;
+
+}
+
+.colorpickertile[hover="true"] {
+  border : 1px dotted #A7A7A7;
+}
+
+.cp-light[hover="true"] {
+  border : 1px dotted #000000;
+}
--- mozilla-firefox-1.0.4.orig/toolkit/themes/pinstripe/global/filepicker.css
+++ mozilla-firefox-1.0.4/toolkit/themes/pinstripe/global/filepicker.css
@@ -1 +1,62 @@
-/*
 * The contents of this file are subject to the Netscape Public
 * License Version 1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of
 * the License at http://www.mozilla.org/NPL/
 *
 * Software distributed under the License is distributed on an "AS
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * rights and limitations under the License.
 *
 * The Original Code is Mozilla Communicator client code, released
 * March 31, 1998.
 *
 * The Initial Developer of the Original Code is Netscape
 * Communications Corporation. Portions created by Netscape are
 * Copyright (C) 1998-2001 Netscape Communications Corporation. All
 * Rights Reserved.
 *
 * Contributor(s):
 *   Joe Hewitt (hewitt@netscape.com)
 *   Brian Ryner (bryner@netscape.com)
 */

/* ===== filepicker.css =================================================
  == Styles used by the File Picker dialog.
  ======================================================================= */

@import url("chrome://global/skin/");

@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

/* ::::: column widths ::::: */

#FilenameColumn,
#ContentLengthColumn,
#LastModifiedDateColumn {
  width: 100px;
}

/* ::::: file/directory items ::::: */

treechildren::-moz-tree-image(FilenameColumn, directory) {
  margin-right: 2px;
  list-style-image: url("chrome://global/skin/filepicker/dir-closed.gif");
}

treechildren::-moz-tree-image(FilenameColumn, file) {
  list-style-image: url("chrome://global/skin/filepicker/blank.gif");
}

/* ::::: button items ::::: */

.up-button {
  list-style-image: url("chrome://global/skin/filepicker/folder-up.gif");
  max-width: 36px;
}

.home-button {
  list-style-image: url("chrome://global/skin/filepicker/folder-home.gif");
  max-width: 36px;
}
\ No newline at end of file
+/*
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998-2001 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *   Joe Hewitt (hewitt@netscape.com)
+ *   Brian Ryner (bryner@netscape.com)
+ */
+
+/* ===== filepicker.css =================================================
+  == Styles used by the File Picker dialog.
+  ======================================================================= */
+
+@import url("chrome://global/skin/");
+
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+
+/* ::::: column widths ::::: */
+
+#FilenameColumn,
+#ContentLengthColumn,
+#LastModifiedDateColumn {
+  width: 100px;
+}
+
+/* ::::: file/directory items ::::: */
+
+treechildren::-moz-tree-image(FilenameColumn, directory) {
+  margin-right: 2px;
+  list-style-image: url("chrome://global/skin/filepicker/dir-closed.gif");
+}
+
+treechildren::-moz-tree-image(FilenameColumn, file) {
+  list-style-image: url("chrome://global/skin/filepicker/blank.gif");
+}
+
+/* ::::: button items ::::: */
+
+.up-button {
+  list-style-image: url("chrome://global/skin/filepicker/folder-up.gif");
+  max-width: 36px;
+}
+
+.home-button {
+  list-style-image: url("chrome://global/skin/filepicker/folder-home.gif");
+  max-width: 36px;
+}
\ No newline at end of file
--- mozilla-firefox-1.0.4.orig/toolkit/themes/pinstripe/global/linkTree.css
+++ mozilla-firefox-1.0.4/toolkit/themes/pinstripe/global/linkTree.css
@@ -1 +1,28 @@
-@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

/** 
 * All the properties in this rule are important to avoid having to create 
 * a special type of tree. This stylesheet can be loaded into a document with
 * a single tree that is a link tree. Hardly elegant but it's efficient.
 */  
treeitem[selected="true"] > treerow
  {
    background            : transparent !important;
    border                : none !important;
    color                 : -moz-FieldText !important;
  }
  
treecell:hover
  {
    text-decoration       : underline !important;
    color                 : #000080 !important;
    cursor                : pointer;
  }
  
treecell:hover:active
  {
    text-decoration       : underline !important;
    color                 : red !important;
  } 
  
  
\ No newline at end of file
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+
+/** 
+ * All the properties in this rule are important to avoid having to create 
+ * a special type of tree. This stylesheet can be loaded into a document with
+ * a single tree that is a link tree. Hardly elegant but it's efficient.
+ */  
+treeitem[selected="true"] > treerow
+  {
+    background            : transparent !important;
+    border                : none !important;
+    color                 : -moz-FieldText !important;
+  }
+  
+treecell:hover
+  {
+    text-decoration       : underline !important;
+    color                 : #000080 !important;
+    cursor                : pointer;
+  }
+  
+treecell:hover:active
+  {
+    text-decoration       : underline !important;
+    color                 : red !important;
+  } 
+  
+  
--- mozilla-firefox-1.0.4.orig/toolkit/themes/pinstripe/global/listbox.css
+++ mozilla-firefox-1.0.4/toolkit/themes/pinstripe/global/listbox.css
@@ -1,8 +1,156 @@
-/*
 * The contents of this file are subject to the Netscape Public
 * License Version 1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of
 * the License at http://www.mozilla.org/NPL/
 *
 * Software distributed under the License is distributed on an "AS
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * rights and limitations under the License.
 *
 * The Original Code is Mozilla Communicator client code, released
 * March 31, 1998.
 *
 * The Initial Developer of the Original Code is Netscape
 * Communications Corporation. Portions created by Netscape are
 * Copyright (C) 1998-2001 Netscape Communications Corporation. All
 * Rights Reserved.
 *
 * Contributor(s):
 *   Joe Hewitt (hewitt@netscape.com)
- *   Kevin Gerich (webmail@kmgerich.com)
 */

/* ===== listbox.css =======================================================
  == Styles used by XUL listbox-related elements.
  ======================================================================= */

@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

/* ::::: listbox ::::: */

listbox {
  margin: 2px 4px;
  border-top: 1px solid #A1A1A1;
+/*
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998-2001 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *   Joe Hewitt (hewitt@netscape.com)
+ *   Kevin Gerich (webmail@kmgerich.com)
+ */
+
+/* ===== listbox.css =======================================================
+  == Styles used by XUL listbox-related elements.
+  ======================================================================= */
+
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+
+/* ::::: listbox ::::: */
+
+listbox {
+  margin: 2px 4px;
+  border-top: 1px solid #A1A1A1;
   border-right: 1px solid #C3C3C3;
   border-bottom: 1px solid #DDDDDD;
   border-left: 1px solid #C3C3C3;
-  background-color: #FFFFFF;
  color: -moz-FieldText;
}

.listcell-label {
  margin: 0px !important;
  padding: 0px 0px 1px 4px;
  white-space: nowrap;
}

/* ::::: listitem ::::: */

listitem {
  border: 1px solid transparent;
}

listbox:focus > listitem[selected="true"][current="true"] {
}

listitem[selected="true"] {
  background-color: -moz-Dialog;
  color: -moz-DialogText;
}

listbox:focus > listitem[selected="true"] {  
+  background-color: #FFFFFF;
+  color: -moz-FieldText;
+}
+
+.listcell-label {
+  margin: 0px !important;
+  padding: 0px 0px 1px 4px;
+  white-space: nowrap;
+}
+
+/* ::::: listitem ::::: */
+
+listitem {
+  border: 1px solid transparent;
+}
+
+listbox:focus > listitem[selected="true"][current="true"] {
+}
+
+listitem[selected="true"] {
+  background-color: -moz-Dialog;
+  color: -moz-DialogText;
+}
+
+listbox:focus > listitem[selected="true"] {  
    background-color: #3874D1;
-   color: #FFFFFF;
}

/* ::::: listheader ::::: */

listheader { 
  -moz-appearance: treeheadercell;
  -moz-box-align: center;
  border: 2px solid;
  -moz-border-top-colors: ThreeDHighlight ThreeDLightShadow;
  -moz-border-right-colors: ThreeDDarkShadow ThreeDShadow;
  -moz-border-bottom-colors: ThreeDDarkShadow ThreeDShadow;
  -moz-border-left-colors: ThreeDHighlight ThreeDLightShadow;
  background-color: -moz-Dialog;
  color: -moz-DialogText;
  padding: 0 4px;
}

listheader[sortable="true"]:hover:active {
  border-top: 2px solid;
  border-right: 1px solid;
  border-bottom: 1px solid;
  border-left: 2px solid;
  -moz-border-top-colors: ThreeDShadow -moz-Dialog;
  -moz-border-right-colors: ThreeDShadow;
  -moz-border-bottom-colors: ThreeDShadow;
  -moz-border-left-colors: ThreeDShadow -moz-Dialog;
  padding: 1px 4px 0px 5px;
}

.listheader-icon {
  margin-right: 2px;
}

.listheader-label {
  margin: 0px !important;
}

/* ..... sort direction icon ..... */

.listheader-sortdirection {
  -moz-appearance: treeheadersortarrow;
  list-style-image: none;
}

.listheader-sortdirection[sortDirection="ascending"] {
  list-style-image: url("chrome://global/skin/tree/sort-asc.gif");
}

.listheader-sortdirection[sortDirection="descending"] {
  list-style-image: url("chrome://global/skin/tree/sort-dsc.gif");
}

/* ::::: listcell ::::: */

.listcell-label {
  margin: 0px !important;
  padding: 0px 0px 1px 4px;
  white-space: nowrap;
}

.listcell-icon {
  margin-right: 2px;
}

.listcell-label[disabled="true"] {
  color: GrayText;
}

/* ::::: listcell checkbox ::::: */

.listcell-check {
  -moz-appearance: checkbox;
  -moz-box-align: center;
  margin: 0px 2px;
  border: 1px solid -moz-DialogText;
  min-width: 13px;
  min-height: 13px;
  background: -moz-Field url("chrome://global/skin/checkbox/cbox.gif") no-repeat 50% 50%;
}

.listcell-check[checked="true"] {
  background-image: url("chrome://global/skin/checkbox/cbox-check.gif");
}

.listcell-check[disabled="true"] {
  border-color: GrayText;
}

.listcell-check[disabled="true"][checked="true"] {
  background-image: url("chrome://global/skin/checkbox/cbox-check-dis.gif");
}
\ No newline at end of file
+   color: #FFFFFF;
+}
+
+/* ::::: listheader ::::: */
+
+listheader { 
+  -moz-appearance: treeheadercell;
+  -moz-box-align: center;
+  border: 2px solid;
+  -moz-border-top-colors: ThreeDHighlight ThreeDLightShadow;
+  -moz-border-right-colors: ThreeDDarkShadow ThreeDShadow;
+  -moz-border-bottom-colors: ThreeDDarkShadow ThreeDShadow;
+  -moz-border-left-colors: ThreeDHighlight ThreeDLightShadow;
+  background-color: -moz-Dialog;
+  color: -moz-DialogText;
+  padding: 0 4px;
+}
+
+listheader[sortable="true"]:hover:active {
+  border-top: 2px solid;
+  border-right: 1px solid;
+  border-bottom: 1px solid;
+  border-left: 2px solid;
+  -moz-border-top-colors: ThreeDShadow -moz-Dialog;
+  -moz-border-right-colors: ThreeDShadow;
+  -moz-border-bottom-colors: ThreeDShadow;
+  -moz-border-left-colors: ThreeDShadow -moz-Dialog;
+  padding: 1px 4px 0px 5px;
+}
+
+.listheader-icon {
+  margin-right: 2px;
+}
+
+.listheader-label {
+  margin: 0px !important;
+}
+
+/* ..... sort direction icon ..... */
+
+.listheader-sortdirection {
+  -moz-appearance: treeheadersortarrow;
+  list-style-image: none;
+}
+
+.listheader-sortdirection[sortDirection="ascending"] {
+  list-style-image: url("chrome://global/skin/tree/sort-asc.gif");
+}
+
+.listheader-sortdirection[sortDirection="descending"] {
+  list-style-image: url("chrome://global/skin/tree/sort-dsc.gif");
+}
+
+/* ::::: listcell ::::: */
+
+.listcell-label {
+  margin: 0px !important;
+  padding: 0px 0px 1px 4px;
+  white-space: nowrap;
+}
+
+.listcell-icon {
+  margin-right: 2px;
+}
+
+.listcell-label[disabled="true"] {
+  color: GrayText;
+}
+
+/* ::::: listcell checkbox ::::: */
+
+.listcell-check {
+  -moz-appearance: checkbox;
+  -moz-box-align: center;
+  margin: 0px 2px;
+  border: 1px solid -moz-DialogText;
+  min-width: 13px;
+  min-height: 13px;
+  background: -moz-Field url("chrome://global/skin/checkbox/cbox.gif") no-repeat 50% 50%;
+}
+
+.listcell-check[checked="true"] {
+  background-image: url("chrome://global/skin/checkbox/cbox-check.gif");
+}
+
+.listcell-check[disabled="true"] {
+  border-color: GrayText;
+}
+
+.listcell-check[disabled="true"][checked="true"] {
+  background-image: url("chrome://global/skin/checkbox/cbox-check-dis.gif");
+}
\ No newline at end of file
--- mozilla-firefox-1.0.4.orig/toolkit/themes/pinstripe/global/menulist.css
+++ mozilla-firefox-1.0.4/toolkit/themes/pinstripe/global/menulist.css
@@ -1,14 +1,146 @@
-/*
 * The contents of this file are subject to the Netscape Public
 * License Version 1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of
 * the License at http://www.mozilla.org/NPL/
 *
 * Software distributed under the License is distributed on an "AS
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * rights and limitations under the License.
 *
 * The Original Code is Mozilla Communicator client code, released
 * March 31, 1998.
 *
 * The Initial Developer of the Original Code is Netscape
 * Communications Corporation. Portions created by Netscape are
 * Copyright (C) 1998-1999 Netscape Communications Corporation. All
 * Rights Reserved.
 *
 * Contributor(s):
 *   Joe Hewitt (hewitt@netscape.com)
- *   Kevin Gerich (webmail@kmgerich.com)
 */

/* ===== menulist.css ===================================================
  == Styles used by the XUL menulist element.
  ======================================================================= */

@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
@namespace html url("http://www.w3.org/1999/xhtml");

/* :::::::::: menulist :::::::::: */

menulist {
  -moz-appearance: menulist;
  -moz-user-focus: ignore;
  margin: 2px 4px;
+/*
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998-1999 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *   Joe Hewitt (hewitt@netscape.com)
+ *   Kevin Gerich (webmail@kmgerich.com)
+ */
+
+/* ===== menulist.css ===================================================
+  == Styles used by the XUL menulist element.
+  ======================================================================= */
+
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+@namespace html url("http://www.w3.org/1999/xhtml");
+
+/* :::::::::: menulist :::::::::: */
+
+menulist {
+  -moz-appearance: menulist;
+  -moz-user-focus: ignore;
+  margin: 2px 4px;
   height: 20px !important;
-}

.menulist-label-box {
  -moz-appearance: menulist-text;
  -moz-box-align: center;
  -moz-box-pack: center;
  background-color: #CCCCCC;
-border: 1px solid blue;
}

.menulist-label {
  margin: 1px 3px !important;
 }
-
/* ..... dropmarker ..... */

.menulist-dropmarker {
  -moz-appearance: menulist-button;
}

/* ..... disabled state ..... */

menulist[disabled="true"] {
  color: #777777 !important;
}

menulist[disabled="true"] > .menulist-dropmarker {
  padding-left: 7px !important;
}

/* ::::: editable menulists ::::: */

menulist[editable="true"] {
  -moz-user-focus: normal;
}

menulist[editable="true"] > .menulist-dropmarker {
  -moz-border-left-colors: #000000 #CCCCCC #FFFFFF;
  -moz-border-radius: 2px;
}

menulist[editable="true"][open="true"] > .menulist-dropmarker {
  -moz-border-left-colors: #000000 #454545 #555555;
}

.menulist-editable-box {
  margin-right: 4px;
  border-top: 1px solid #A1A1A1;
+
+.menulist-label-box {
+  -moz-appearance: menulist-text;
+  -moz-box-align: center;
+  -moz-box-pack: center;
+  background-color: #CCCCCC;
+border: 1px solid blue;
+}
+
+.menulist-label {
+  margin: 1px 3px !important;
+}
+
+/* ..... dropmarker ..... */
+
+.menulist-dropmarker {
+  -moz-appearance: menulist-button;
+}
+
+/* ..... disabled state ..... */
+
+menulist[disabled="true"] {
+  color: #777777 !important;
+}
+
+menulist[disabled="true"] > .menulist-dropmarker {
+  padding-left: 7px !important;
+}
+
+/* ::::: editable menulists ::::: */
+
+menulist[editable="true"] {
+  -moz-user-focus: normal;
+}
+
+menulist[editable="true"] > .menulist-dropmarker {
+  -moz-border-left-colors: #000000 #CCCCCC #FFFFFF;
+  -moz-border-radius: 2px;
+}
+
+menulist[editable="true"][open="true"] > .menulist-dropmarker {
+  -moz-border-left-colors: #000000 #454545 #555555;
+}
+
+.menulist-editable-box {
+  margin-right: 4px;
+  border-top: 1px solid #A1A1A1;
   border-right: 1px solid #C3C3C3;
   border-bottom: 1px solid #DDDDDD;
-  border-left: 1px solid #C3C3C3;
  padding: 1px 0px 1px 2px;
  background-color: -moz-Field;
  color: -moz-FieldText;
}

menulist[editable="true"][focused="true"] > .menulist-editable-box {
  -moz-border-top-colors: -moz-mac-focusring -moz-mac-focusring #000000;
  -moz-border-right-colors: -moz-mac-focusring -moz-mac-focusring #000000;
  -moz-border-bottom-colors: -moz-mac-focusring -moz-mac-focusring #000000;
  -moz-border-left-colors: -moz-mac-focusring -moz-mac-focusring #000000;
}

html|*.menulist-editable-input {
  margin: 0px !important;
  border: none !important;
  padding: 0px !important;
  background: inherit;
  font: inherit;
}

/* ::::: compact menulists ::::: */

.menulist-compact {
  -moz-box-align: center;
  -moz-box-pack: center;
  margin: 0;
  border: 2px solid;
  -moz-border-top-colors: ThreeDLightShadow ThreeDHighlight;
  -moz-border-right-colors: ThreeDDarkShadow ThreeDShadow;
  -moz-border-bottom-colors: ThreeDDarkShadow ThreeDShadow;
  -moz-border-left-colors: ThreeDLightShadow ThreeDHighlight;
  background-color: -moz-Dialog;
}

.menulist-compact > .menulist-label {
  margin: 0 3px !important;
  text-align: right;
-  -mox-box-flex: 1;
}  

.menulist-compact > .menulist-dropmarker {
  margin-left: 2px;
  border: none;
  padding: 0 !important;
  background: transparent;
}

.menulist-compact[open="true"] {
  -moz-border-top-colors: ThreeDDarkShadow ThreeDShadow;
  -moz-border-right-colors: ThreeDDarkShadow ThreeDShadow;
  -moz-border-bottom-colors: ThreeDDarkShadow ThreeDShadow;
  -moz-border-left-colors: ThreeDDarkShadow ThreeDShadow;
  background-color: ThreeDShadow;
}
+  border-left: 1px solid #C3C3C3;
+  padding: 1px 0px 1px 2px;
+  background-color: -moz-Field;
+  color: -moz-FieldText;
+}
+
+menulist[editable="true"][focused="true"] > .menulist-editable-box {
+  -moz-border-top-colors: -moz-mac-focusring -moz-mac-focusring #000000;
+  -moz-border-right-colors: -moz-mac-focusring -moz-mac-focusring #000000;
+  -moz-border-bottom-colors: -moz-mac-focusring -moz-mac-focusring #000000;
+  -moz-border-left-colors: -moz-mac-focusring -moz-mac-focusring #000000;
+}
+
+html|*.menulist-editable-input {
+  margin: 0px !important;
+  border: none !important;
+  padding: 0px !important;
+  background: inherit;
+  font: inherit;
+}
+
+/* ::::: compact menulists ::::: */
+
+.menulist-compact {
+  -moz-box-align: center;
+  -moz-box-pack: center;
+  margin: 0;
+  border: 2px solid;
+  -moz-border-top-colors: ThreeDLightShadow ThreeDHighlight;
+  -moz-border-right-colors: ThreeDDarkShadow ThreeDShadow;
+  -moz-border-bottom-colors: ThreeDDarkShadow ThreeDShadow;
+  -moz-border-left-colors: ThreeDLightShadow ThreeDHighlight;
+  background-color: -moz-Dialog;
+}
+
+.menulist-compact > .menulist-label {
+  margin: 0 3px !important;
+  text-align: right;
+  -mox-box-flex: 1;
+}  
+
+.menulist-compact > .menulist-dropmarker {
+  margin-left: 2px;
+  border: none;
+  padding: 0 !important;
+  background: transparent;
+}
+
+.menulist-compact[open="true"] {
+  -moz-border-top-colors: ThreeDDarkShadow ThreeDShadow;
+  -moz-border-right-colors: ThreeDDarkShadow ThreeDShadow;
+  -moz-border-bottom-colors: ThreeDDarkShadow ThreeDShadow;
+  -moz-border-left-colors: ThreeDDarkShadow ThreeDShadow;
+  background-color: ThreeDShadow;
+}
 
 listbox menulist:not([disabled]) {
 	color: #000;
--- mozilla-firefox-1.0.4.orig/toolkit/themes/pinstripe/global/progressmeter.css
+++ mozilla-firefox-1.0.4/toolkit/themes/pinstripe/global/progressmeter.css
@@ -1,16 +1,77 @@
-/* ***** BEGIN LICENSE BLOCK *****
 * Version: NPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Netscape Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/NPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is mozilla.org code.
 *
 * The Initial Developer of the Original Code is 
 * Netscape Communications Corporation.
 * Portions created by the Initial Developer are Copyright (C) 1998
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *  Joe Hewitt <hewitt@netscape.com>
- *   Kevin Gerich (webmail@kmgerich.com)
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or 
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the NPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the NPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

/* ===== progressmeter.css ==============================================
  == Styles used by the XUL progressmeter element.
  ======================================================================= */

@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

/* ::::: progressmeter ::::: */

progressmeter {
  -moz-appearance: progressbar;
  margin: 2px 4px;
  min-width: 128px;
  height: 12px;
-}
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: NPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Netscape Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is 
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *  Joe Hewitt <hewitt@netscape.com>
+ *   Kevin Gerich (webmail@kmgerich.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or 
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the NPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the NPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* ===== progressmeter.css ==============================================
+  == Styles used by the XUL progressmeter element.
+  ======================================================================= */
+
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+
+/* ::::: progressmeter ::::: */
+
+progressmeter {
+  -moz-appearance: progressbar;
+  margin: 2px 4px;
+  min-width: 128px;
+  height: 12px;
+}
 
 
-.progress-remainder[flex="100"], .progress-remainder[flex="0"] {
+.progress-remainder[flex="100"], .progress-remainder[flex="0"] {
   background-image: none !important;
-  -moz-appearance: none;
}
-
/* ::::: statusbar progressmeter ::::: */

.progressmeter-statusbar {
  margin: 0;
  border-width: 1px;
}
+  -moz-appearance: none;
+}
+
+/* ::::: statusbar progressmeter ::::: */
+
+.progressmeter-statusbar {
+  margin: 0;
+  border-width: 1px;
+}
+
+.progressmeter-statusbar > .progressmeter-remainder {
+}
+/* ::::: statusbar progressmeter ::::: */
 
-.progressmeter-statusbar > .progressmeter-remainder {
}
-/* ::::: statusbar progressmeter ::::: */

-.progressmeter-statusbar[mode="determined"]  {
 margin: 0;
  border-width: 1px;
}
+.progressmeter-statusbar[mode="determined"]  {
+ margin: 0;
+  border-width: 1px;
+}
 
 
 /* :::::: download progress meter :::::::: */
--- mozilla-firefox-1.0.4.orig/toolkit/themes/pinstripe/global/spinbuttons.css
+++ mozilla-firefox-1.0.4/toolkit/themes/pinstripe/global/spinbuttons.css
@@ -1 +1,37 @@
-/*
 * The contents of this file are subject to the Mozilla Public
 * License Version 1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of
 * the License at http://www.mozilla.org/MPL/
 * 
 * Software distributed under the License is distributed on an "AS
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * rights and limitations under the License.
 * 
 * The Original Code is mozilla.org code.
 * 
 * The Initial Developer of the Original Code is Håkan Waara
 * Portions created by Håkan Waara are Copyright (C) 
 * Håkan Waara.  All Rights Reserved.
 * 
 * Contributor(s): Håkan Waara (Original Author) 
 */

@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

.up {
  list-style-image: url("chrome://global/skin/spinbtn-up.gif")
}

.up:hover:active {
  list-style-image: url("chrome://global/skin/spinbtn-up-act.gif")
}

.down {
  list-style-image: url("chrome://global/skin/spinbtn-dn.gif")
}

.down:hover:active {
  list-style-image: url("chrome://global/skin/spinbtn-dn-act.gif")
}
\ No newline at end of file
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is mozilla.org code.
+ * 
+ * The Initial Developer of the Original Code is Håkan Waara
+ * Portions created by Håkan Waara are Copyright (C) 
+ * Håkan Waara.  All Rights Reserved.
+ * 
+ * Contributor(s): Håkan Waara (Original Author) 
+ */
+
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+
+.up {
+  list-style-image: url("chrome://global/skin/spinbtn-up.gif")
+}
+
+.up:hover:active {
+  list-style-image: url("chrome://global/skin/spinbtn-up-act.gif")
+}
+
+.down {
+  list-style-image: url("chrome://global/skin/spinbtn-dn.gif")
+}
+
+.down:hover:active {
+  list-style-image: url("chrome://global/skin/spinbtn-dn-act.gif")
+}
--- mozilla-firefox-1.0.4.orig/toolkit/themes/pinstripe/global/textbox.css
+++ mozilla-firefox-1.0.4/toolkit/themes/pinstripe/global/textbox.css
@@ -1,6 +1,100 @@
-/*
 * The contents of this file are subject to the Netscape Public
 * License Version 1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of
 * the License at http://www.mozilla.org/NPL/
 *
 * Software distributed under the License is distributed on an "AS
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * rights and limitations under the License.
 *
 * The Original Code is Mozilla Communicator client code, released
 * March 31, 1998.
 *
 * The Initial Developer of the Original Code is Netscape
 * Communications Corporation. Portions created by Netscape are
 * Copyright (C) 1998-2001 Netscape Communications Corporation. All
 * Rights Reserved.
 *
 * Contributor(s):
 *   Joe Hewitt (hewitt@netscape.com)
 */

/* ===== textbox.css ==================================================
  == Styles used by the XUL textbox element.
  ======================================================================= */

@import url("chrome://global/content/autocomplete.css");
  
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
@namespace html url("http://www.w3.org/1999/xhtml");

/* ::::: textbox ::::: */

textbox {
  -moz-appearance: textfield;
  cursor: text;
  margin: 4px 4px;
  border: 3px solid;
  -moz-border-top-colors: transparent #888888 #000000;
  -moz-border-right-colors: transparent #FFFFFF #000000;
  -moz-border-bottom-colors: transparent #FFFFFF #000000;
  -moz-border-left-colors: transparent #888888 #000000;
  -moz-border-radius-topright: 2px;
  -moz-border-radius-bottomleft: 2px;
  /*padding: 1px 0px 1px 2px ;*/
  padding: 0px;
-  background-color: -moz-Field;
  color: -moz-FieldText;
}
    
html|*.textbox-input, 
html|*.textbox-textarea {
-  margin: 0px !important;
  border: none !important;
  padding: 0px !important;
  background-color: inherit;
  color: inherit;
  font: inherit;
}

/* ..... focused state ..... */

textbox[focused="true"] {
  -moz-border-top-colors: -moz-mac-focusring -moz-mac-focusring #000000;
  -moz-border-right-colors: -moz-mac-focusring -moz-mac-focusring #000000;
  -moz-border-bottom-colors: -moz-mac-focusring -moz-mac-focusring #000000;
  -moz-border-left-colors: -moz-mac-focusring -moz-mac-focusring #000000;
}

/* ..... readonly state ..... */

textbox[readonly="true"] {
  background-color: -moz-Dialog;
  color: -moz-DialogText;
}

/* ..... disabled state ..... */

textbox[disabled="true"] {
  cursor: default;
  -moz-border-top-colors: transparent ThreeDShadow -moz-Dialog;
  -moz-border-right-colors: transparent ThreeDShadow -moz-Dialog;
  -moz-border-bottom-colors: transparent ThreeDShadow -moz-Dialog;
  -moz-border-left-colors: transparent ThreeDShadow -moz-Dialog;
  background-color: -moz-Dialog;
  color: GrayText;
} 

/* ::::: plain textbox ::::: */

textbox.plain {
  -moz-appearance: none !important;
  padding: 0px !important;
  margin: 0px !important;
  border: none !important;
}
+/*
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998-2001 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *   Joe Hewitt (hewitt@netscape.com)
+ */
+
+/* ===== textbox.css ==================================================
+  == Styles used by the XUL textbox element.
+  ======================================================================= */
+
+@import url("chrome://global/content/autocomplete.css");
+  
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+@namespace html url("http://www.w3.org/1999/xhtml");
+
+/* ::::: textbox ::::: */
+
+textbox {
+  -moz-appearance: textfield;
+  cursor: text;
+  margin: 4px 4px;
+  border: 3px solid;
+  -moz-border-top-colors: transparent #888888 #000000;
+  -moz-border-right-colors: transparent #FFFFFF #000000;
+  -moz-border-bottom-colors: transparent #FFFFFF #000000;
+  -moz-border-left-colors: transparent #888888 #000000;
+  -moz-border-radius-topright: 2px;
+  -moz-border-radius-bottomleft: 2px;
+  /*padding: 1px 0px 1px 2px ;*/
+  padding: 0px;
+  background-color: -moz-Field;
+  color: -moz-FieldText;
+}
+    
+html|*.textbox-input, 
+html|*.textbox-textarea {
+  margin: 0px !important;
+  border: none !important;
+  padding: 0px !important;
+  background-color: inherit;
+  color: inherit;
+  font: inherit;
+}
+
+/* ..... focused state ..... */
+
+textbox[focused="true"] {
+  -moz-border-top-colors: -moz-mac-focusring -moz-mac-focusring #000000;
+  -moz-border-right-colors: -moz-mac-focusring -moz-mac-focusring #000000;
+  -moz-border-bottom-colors: -moz-mac-focusring -moz-mac-focusring #000000;
+  -moz-border-left-colors: -moz-mac-focusring -moz-mac-focusring #000000;
+}
+
+/* ..... readonly state ..... */
+
+textbox[readonly="true"] {
+  background-color: -moz-Dialog;
+  color: -moz-DialogText;
+}
+
+/* ..... disabled state ..... */
+
+textbox[disabled="true"] {
+  cursor: default;
+  -moz-border-top-colors: transparent ThreeDShadow -moz-Dialog;
+  -moz-border-right-colors: transparent ThreeDShadow -moz-Dialog;
+  -moz-border-bottom-colors: transparent ThreeDShadow -moz-Dialog;
+  -moz-border-left-colors: transparent ThreeDShadow -moz-Dialog;
+  background-color: -moz-Dialog;
+  color: GrayText;
+} 
+
+/* ::::: plain textbox ::::: */
+
+textbox.plain {
+  -moz-appearance: none !important;
+  padding: 0px !important;
+  margin: 0px !important;
+  border: none !important;
+}
 
 /* ::::: rounded search box, coming soon ::::: */
 
--- mozilla-firefox-1.0.4.orig/toolkit/themes/pinstripe/global/wizardOverlay.css
+++ mozilla-firefox-1.0.4/toolkit/themes/pinstripe/global/wizardOverlay.css
@@ -1 +1,27 @@
-@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

#wiz-back-button {
  list-style-image            : url("chrome://global/skin/scroll-left.gif");
}
#wiz-back-button[disabled] {
  list-style-image            : url("chrome://global/skin/scroll-left-disabled.gif");
}
#wiz-next-button {
  list-style-image            : url("chrome://global/skin/scroll-right.gif");
}
#wiz-next-button[disabled] {
  list-style-image            : url("chrome://global/skin/scroll-right-disabled.gif");
}

#wizardButtons 
  {
    margin-bottom             : 0.4em;
  }

.box-wizardcontent
  {
    margin-left               : 44px;
    margin-right              : 44px;
    width                     : 30em;
  } 

\ No newline at end of file
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+
+#wiz-back-button {
+  list-style-image            : url("chrome://global/skin/scroll-left.gif");
+}
+#wiz-back-button[disabled] {
+  list-style-image            : url("chrome://global/skin/scroll-left-disabled.gif");
+}
+#wiz-next-button {
+  list-style-image            : url("chrome://global/skin/scroll-right.gif");
+}
+#wiz-next-button[disabled] {
+  list-style-image            : url("chrome://global/skin/scroll-right-disabled.gif");
+}
+
+#wizardButtons 
+  {
+    margin-bottom             : 0.4em;
+  }
+
+.box-wizardcontent
+  {
+    margin-left               : 44px;
+    margin-right              : 44px;
+    width                     : 30em;
+  } 
+
--- mozilla-firefox-1.0.4.orig/toolkit/themes/pinstripe/global/console/console.css
+++ mozilla-firefox-1.0.4/toolkit/themes/pinstripe/global/console/console.css
@@ -29,7 +29,8 @@
 
 .console-box {
   background-color: -moz-Field;
-  color: -moz-FieldText;
  overflow: auto;
+  color: -moz-FieldText;
+  overflow: auto;
 }
  
 /* ::::: console rows ::::: */
--- mozilla-firefox-1.0.4.orig/toolkit/themes/pinstripe/mozapps/pref/pref.css
+++ mozilla-firefox-1.0.4/toolkit/themes/pinstripe/mozapps/pref/pref.css
@@ -38,11 +38,13 @@
 */
 
 .listBox {
-  margin: 2px 4px;
  border-top: 1px solid #A1A1A1 !important;
+  margin: 2px 4px;
+  border-top: 1px solid #A1A1A1 !important;
   border-right: 1px solid #C3C3C3 !important;
   border-bottom: 1px solid #DDDDDD !important;
   border-left: 1px solid #C3C3C3 !important;
-  background-color: #FFFFFF;
  color: -moz-FieldText;
+  background-color: #FFFFFF;
+  color: -moz-FieldText;
 }
 
 .indent {
@@ -98,4 +100,5 @@
 
 #defaultAppName {
   margin-left: 6px !important; 
-}

\ No newline at end of file
+}
+
--- mozilla-firefox-1.0.4.orig/toolkit/themes/qute/mozapps/pref/pref.css
+++ mozilla-firefox-1.0.4/toolkit/themes/qute/mozapps/pref/pref.css
@@ -101,12 +101,24 @@
 
 #defaultAppName {
   margin-left: 6px !important; 
-}

/* 
#fileHandlersListContainer {
  -moz-binding: url("chrome://mozapps/skin/downloads/downloads.xml#download-view");
+}
+
+/* 
+#fileHandlersListContainer {
+  -moz-binding: url("chrome://mozapps/skin/downloads/downloads.xml#download-view");
   -moz-appearance: listbox;
   -moz-user-focus: normal;
-}

 * We apply the background to both of these elements since the tree leaves a 2-3px
 * strip on its right side unpainted. We can't just paint the background layer either
 * because the tree erases its background with white, obscuring the bottom layer. 
#fileHandlersList, #fileHandlersListContainer > .downloadViewInner1 {
  background-image: url("chrome://mozapps/skin/downloads/downloadsBG.png");
+}
+
+ * We apply the background to both of these elements since the tree leaves a 2-3px
+ * strip on its right side unpainted. We can't just paint the background layer either
+ * because the tree erases its background with white, obscuring the bottom layer. 
+#fileHandlersList, #fileHandlersListContainer > .downloadViewInner1 {
+  background-image: url("chrome://mozapps/skin/downloads/downloadsBG.png");
   background-attachment: fixed;
   background-repeat: no-repeat;
-  background-position: bottom right;  
  -moz-appearance: none;
  border: none;
+  background-position: bottom right;  
+  -moz-appearance: none;
+  border: none;
 }
 */
--- mozilla-firefox-1.0.4.orig/toolkit/themes/winstripe/global/printPreview.css
+++ mozilla-firefox-1.0.4/toolkit/themes/winstripe/global/printPreview.css
@@ -1,40 +1,40 @@
-/* ..... page navigation ..... */
-
-.home-arrow {
-  list-style-image: url("chrome://global/skin/arrow/arrow-lft-sharp-end.gif");
-}
-
-.end-arrow {
-  list-style-image: url("chrome://global/skin/arrow/arrow-rit-sharp-end.gif");
-}
-
-.left-arrow {
-  list-style-image: url("chrome://global/skin/arrow/arrow-lft-sharp.gif");
-}
-
-.right-arrow {
-  list-style-image: url("chrome://global/skin/arrow/arrow-rit-sharp.gif");
-}
-
-/* ...... scale in/decrement ..... */
-
-.up-arrow {
-  list-style-image: url("chrome://global/skin/arrow/arrow-up-sharp.gif");
-}
-
-.down-arrow {
-  list-style-image: url("chrome://global/skin/arrow/arrow-dn-sharp.gif");
-}
-
-
-/* ..... orientation ..... */
-
-.toolbar-portrait-page {
-  list-style-image: url("chrome://global/skin/icons/Print-preview.png");
-  -moz-image-region: rect(0px 16px 16px 0px);
-}
-
-.toolbar-landscape-page {
-  list-style-image: url("chrome://global/skin/icons/Print-preview.png");
-  -moz-image-region: rect(0px 32px 16px 16px);
-}
+/* ..... page navigation ..... */
+
+.home-arrow {
+  list-style-image: url("chrome://global/skin/arrow/arrow-lft-sharp-end.gif");
+}
+
+.end-arrow {
+  list-style-image: url("chrome://global/skin/arrow/arrow-rit-sharp-end.gif");
+}
+
+.left-arrow {
+  list-style-image: url("chrome://global/skin/arrow/arrow-lft-sharp.gif");
+}
+
+.right-arrow {
+  list-style-image: url("chrome://global/skin/arrow/arrow-rit-sharp.gif");
+}
+
+/* ...... scale in/decrement ..... */
+
+.up-arrow {
+  list-style-image: url("chrome://global/skin/arrow/arrow-up-sharp.gif");
+}
+
+.down-arrow {
+  list-style-image: url("chrome://global/skin/arrow/arrow-dn-sharp.gif");
+}
+
+
+/* ..... orientation ..... */
+
+.toolbar-portrait-page {
+  list-style-image: url("chrome://global/skin/icons/Print-preview.png");
+  -moz-image-region: rect(0px 16px 16px 0px);
+}
+
+.toolbar-landscape-page {
+  list-style-image: url("chrome://global/skin/icons/Print-preview.png");
+  -moz-image-region: rect(0px 32px 16px 16px);
+}
--- mozilla-firefox-1.0.4.orig/toolkit/themes/winstripe/global/toolbar.css
+++ mozilla-firefox-1.0.4/toolkit/themes/winstripe/global/toolbar.css
@@ -1,118 +1,118 @@
-/*
- * The contents of this file are subject to the Netscape Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/NPL/
- *
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Code is Mozilla Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is Netscape
- * Communications Corporation. Portions created by Netscape are
- * Copyright (C) 1998-2001 Netscape Communications Corporation. All
- * Rights Reserved.
- *
- * Contributor(s):
- *   Joe Hewitt (hewitt@netscape.com)
- */
-
-/* ===== toolbar.css ====================================================
-  == Styles used by XUL toolbar-related elements.
-  ======================================================================= */
-
-@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
-
-/* ::::: toolbox ::::: */
-
-toolbox {
-  -moz-appearance: toolbox;
-  background-color: -moz-Dialog;
-}
-
-/* ::::: toolbar & menubar ::::: */
-
-toolbar {
-  min-width: 1px;
-  min-height: 20px;
-  border-top: 1px solid ThreeDHighlight;
-  border-bottom: 1px solid ThreeDShadow;
-}
-
-toolbar[type="menubar"], menubar {
-  min-width: 1px;
-  min-height: 20px;
-  border-bottom: 1px solid ThreeDShadow;
-  border-top: 0px !important;
-}
-
-/* ::::: toolbar decorations ::::: */
-
-toolbarseparator {
-  margin : 2px 0.2em;
-  border-right : 1px solid ThreeDHighlight;
-  border-left : 1px solid ThreeDShadow;
-  width : 2px;
-}
-
-toolbarspacer {
-  width: 15px;
-}
-
-/* ::::: toolbarpaletteitem ::::: */
-
-toolbarpaletteitem {
-  cursor: -moz-grab;
-}
-
-.toolbarpaletteitem-box[type="spacer"],
-.toolbarpaletteitem-box[type="spring"] {
-  border: 1px solid #808080;
-  background-color: #FFF !important;
-}
-
-toolbarpaletteitem[place="toolbar"] {
-  margin-left: -2px;
-  margin-right: -2px;
-  border-left: 2px solid transparent;
-  border-right: 2px solid transparent;
-}
-
-toolbarpaletteitem[place="toolbar"] > toolbarspacer {
-  width: 11px;
-}
-
-.toolbarpaletteitem-box[type="spacer"][place="toolbar"],
-.toolbarpaletteitem-box[type="spring"][place="toolbar"] {
-  margin: 2px 2px 2px 0;
-}
-
-.toolbarpaletteitem-box[type="separator"][place="palette"] {
-  width: 2px;
-  height: 50px;
-}
-
-.toolbarpaletteitem-box[type="spacer"][place="palette"],
-.toolbarpaletteitem-box[type="spring"][place="palette"] {
-  margin-bottom: 2px;
-  width: 50px;
-  height: 50px;
-}
-
-.toolbarpaletteitem-box[type="spring"][place="palette"] {
-  background: url("chrome://global/skin/toolbar/spring.gif") no-repeat center;
-}
-
-/* ..... drag and drop feedback ..... */
-
-toolbarpaletteitem[dragover="left"] {
-  border-left-color: #000000;
-}
-
-toolbarpaletteitem[dragover="right"] {
-  border-right-color: #000000;
-}
+/*
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998-2001 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *   Joe Hewitt (hewitt@netscape.com)
+ */
+
+/* ===== toolbar.css ====================================================
+  == Styles used by XUL toolbar-related elements.
+  ======================================================================= */
+
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+
+/* ::::: toolbox ::::: */
+
+toolbox {
+  -moz-appearance: toolbox;
+  background-color: -moz-Dialog;
+}
+
+/* ::::: toolbar & menubar ::::: */
+
+toolbar {
+  min-width: 1px;
+  min-height: 20px;
+  border-top: 1px solid ThreeDHighlight;
+  border-bottom: 1px solid ThreeDShadow;
+}
+
+toolbar[type="menubar"], menubar {
+  min-width: 1px;
+  min-height: 20px;
+  border-bottom: 1px solid ThreeDShadow;
+  border-top: 0px !important;
+}
+
+/* ::::: toolbar decorations ::::: */
+
+toolbarseparator {
+  margin : 2px 0.2em;
+  border-right : 1px solid ThreeDHighlight;
+  border-left : 1px solid ThreeDShadow;
+  width : 2px;
+}
+
+toolbarspacer {
+  width: 15px;
+}
+
+/* ::::: toolbarpaletteitem ::::: */
+
+toolbarpaletteitem {
+  cursor: -moz-grab;
+}
+
+.toolbarpaletteitem-box[type="spacer"],
+.toolbarpaletteitem-box[type="spring"] {
+  border: 1px solid #808080;
+  background-color: #FFF !important;
+}
+
+toolbarpaletteitem[place="toolbar"] {
+  margin-left: -2px;
+  margin-right: -2px;
+  border-left: 2px solid transparent;
+  border-right: 2px solid transparent;
+}
+
+toolbarpaletteitem[place="toolbar"] > toolbarspacer {
+  width: 11px;
+}
+
+.toolbarpaletteitem-box[type="spacer"][place="toolbar"],
+.toolbarpaletteitem-box[type="spring"][place="toolbar"] {
+  margin: 2px 2px 2px 0;
+}
+
+.toolbarpaletteitem-box[type="separator"][place="palette"] {
+  width: 2px;
+  height: 50px;
+}
+
+.toolbarpaletteitem-box[type="spacer"][place="palette"],
+.toolbarpaletteitem-box[type="spring"][place="palette"] {
+  margin-bottom: 2px;
+  width: 50px;
+  height: 50px;
+}
+
+.toolbarpaletteitem-box[type="spring"][place="palette"] {
+  background: url("chrome://global/skin/toolbar/spring.gif") no-repeat center;
+}
+
+/* ..... drag and drop feedback ..... */
+
+toolbarpaletteitem[dragover="left"] {
+  border-left-color: #000000;
+}
+
+toolbarpaletteitem[dragover="right"] {
+  border-right-color: #000000;
+}
--- mozilla-firefox-1.0.4.orig/toolkit/themes/winstripe/mozapps/pref/pref.css
+++ mozilla-firefox-1.0.4/toolkit/themes/winstripe/mozapps/pref/pref.css
@@ -101,12 +101,24 @@
 
 #defaultAppName {
   margin-left: 6px !important; 
-}

/* 
#fileHandlersListContainer {
  -moz-binding: url("chrome://mozapps/skin/downloads/downloads.xml#download-view");
+}
+
+/* 
+#fileHandlersListContainer {
+  -moz-binding: url("chrome://mozapps/skin/downloads/downloads.xml#download-view");
   -moz-appearance: listbox;
   -moz-user-focus: normal;
-}

 * We apply the background to both of these elements since the tree leaves a 2-3px
 * strip on its right side unpainted. We can't just paint the background layer either
 * because the tree erases its background with white, obscuring the bottom layer. 
#fileHandlersList, #fileHandlersListContainer > .downloadViewInner1 {
  background-image: url("chrome://mozapps/skin/downloads/downloadsBG.png");
+}
+
+ * We apply the background to both of these elements since the tree leaves a 2-3px
+ * strip on its right side unpainted. We can't just paint the background layer either
+ * because the tree erases its background with white, obscuring the bottom layer. 
+#fileHandlersList, #fileHandlersListContainer > .downloadViewInner1 {
+  background-image: url("chrome://mozapps/skin/downloads/downloadsBG.png");
   background-attachment: fixed;
   background-repeat: no-repeat;
-  background-position: bottom right;  
  -moz-appearance: none;
  border: none;
+  background-position: bottom right;  
+  -moz-appearance: none;
+  border: none;
 }
 */
--- mozilla-firefox-1.0.4.orig/toolkit/xre/nsAppRunner.cpp
+++ mozilla-firefox-1.0.4/toolkit/xre/nsAppRunner.cpp
@@ -1580,7 +1580,7 @@
     DosSetMaxFH(256);
   }
 
-  ScopedFPHandler handler();
+  ScopedFPHandler handler;
 #endif /* XP_OS2 */
 
 #if defined(XP_BEOS)
--- mozilla-firefox-1.0.4.orig/chrome/src/nsChromeProtocolHandler.cpp
+++ mozilla-firefox-1.0.4/chrome/src/nsChromeProtocolHandler.cpp
@@ -754,7 +754,8 @@
         rv = url->GetFileExtension(fileExtension);
         if (PL_strcasecmp(fileExtension.get(), "xul") == 0 ||
             PL_strcasecmp(fileExtension.get(), "html") == 0 ||
-            PL_strcasecmp(fileExtension.get(), "xml") == 0)
+            PL_strcasecmp(fileExtension.get(), "xml") == 0 ||
+            PL_strcasecmp(fileExtension.get(), "xbl") == 0)
         {
             nsCOMPtr<nsIScriptSecurityManager> securityManager =
                      do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
--- mozilla-firefox-1.0.4.orig/extensions/help/resources/locale/en-US/cs_nav_dialogs.html
+++ mozilla-firefox-1.0.4/extensions/help/resources/locale/en-US/cs_nav_dialogs.html
@@ -1,19 +1,38 @@
-<html>

-<head>

-<title>Mozilla dialog box Help</title>

-

-<link rel="stylesheet" href="chrome://communicator/locale/help/content_style.css" type="text/css">

-<!--link rel="stylesheet" href="../style.css" type="text/css" -->

-

-</head>

-

-<body bgcolor="white">

-

-

-<p>Content to be supplied.</p>

-

-<hr>

-<p><i>Beta Draft</i></p>

-

-</body>

-</html>

+<html>
+
+<head>
+
+<title>Mozilla dialog box Help</title>
+
+
+
+<link rel="stylesheet" href="chrome://communicator/locale/help/content_style.css" type="text/css">
+
+<!--link rel="stylesheet" href="../style.css" type="text/css" -->
+
+
+
+</head>
+
+
+
+<body bgcolor="white">
+
+
+
+
+
+<p>Content to be supplied.</p>
+
+
+
+<hr>
+
+<p><i>Beta Draft</i></p>
+
+
+
+</body>
+
+</html>
+
--- mozilla-firefox-1.0.4.orig/extensions/transformiix/source/base/Double.cpp
+++ mozilla-firefox-1.0.4/extensions/transformiix/source/base/Double.cpp
@@ -74,14 +74,7 @@
 #define CPU_IS_ARM
 #endif
 
-#if (__GNUC__ == 2 && __GNUC_MINOR__ > 95) || __GNUC__ > 2
-/**
- * This version of the macros is safe for the alias optimizations
- * that gcc does, but uses gcc-specific extensions.
- */
-
 typedef union txdpun {
-    PRFloat64 d;
     struct {
 #if defined(IS_LITTLE_ENDIAN) && !defined(CPU_IS_ARM)
         PRUint32 lo, hi;
@@ -89,8 +82,14 @@
         PRUint32 hi, lo;
 #endif
     } s;
+    PRFloat64 d;
 } txdpun;
 
+#if (__GNUC__ == 2 && __GNUC_MINOR__ > 95) || __GNUC__ > 2
+/**
+ * This version of the macros is safe for the alias optimizations
+ * that gcc does, but uses gcc-specific extensions.
+ */
 #define TX_DOUBLE_HI32(x) (__extension__ ({ txdpun u; u.d = (x); u.s.hi; }))
 #define TX_DOUBLE_LO32(x) (__extension__ ({ txdpun u; u.d = (x); u.s.lo; }))
 
@@ -116,20 +115,20 @@
 
 //-- Initialize Double related constants
 #ifdef IS_BIG_ENDIAN
-const PRUint32 nanMask[2] =    {TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_MANTMASK,
-                                0xffffffff};
-const PRUint32 infMask[2] =    {TX_DOUBLE_HI32_EXPMASK, 0};
-const PRUint32 negInfMask[2] = {TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_SIGNBIT, 0};
+const txdpun nanMask =    {TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_MANTMASK,
+                           0xffffffff};
+const txdpun infMask =    {TX_DOUBLE_HI32_EXPMASK, 0};
+const txdpun negInfMask = {TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_SIGNBIT, 0};
 #else
-const PRUint32 nanMask[2] =    {0xffffffff,
-                                TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_MANTMASK};
-const PRUint32 infMask[2] =    {0, TX_DOUBLE_HI32_EXPMASK};
-const PRUint32 negInfMask[2] = {0, TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_SIGNBIT};
+const txdpun nanMask = {0xffffffff,
+                        TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_MANTMASK};
+const txdpun infMask =    {0, TX_DOUBLE_HI32_EXPMASK};
+const txdpun negInfMask = {0, TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_SIGNBIT};
 #endif
 
-const double Double::NaN = *((double*)nanMask);
-const double Double::POSITIVE_INFINITY = *((double*)infMask);
-const double Double::NEGATIVE_INFINITY = *((double*)negInfMask);
+const double Double::NaN = nanMask.d;
+const double Double::POSITIVE_INFINITY = infMask.d;
+const double Double::NEGATIVE_INFINITY = negInfMask.d;
 
 /*
  * Determines whether the given double represents positive or negative
--- mozilla-firefox-1.0.4.orig/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp
+++ mozilla-firefox-1.0.4/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp
@@ -773,6 +773,13 @@
   privevent->SetCurrentTarget(this);
   privevent->SetOriginalTarget(this);
 
+  // We're not marking these events trusted as there is no way for us
+  // to tell if we're called through the code that normally calls us
+  // (i.e. necko) or if script on a webpage QI'd this object to say,
+  // nsIProgressEventSink and called onProgress(...).
+  //
+  // privevent->SetTrusted(?);
+
   return NS_OK;
 }
 
@@ -1345,7 +1352,7 @@
   }
 
   // We need to create the event before nulling out mDocument
-  nsEvent evt(NS_PAGE_LOAD);
+  nsEvent evt(PR_TRUE, NS_PAGE_LOAD);
   nsCOMPtr<nsIDOMEvent> domevent;
   rv = CreateEvent(&evt, getter_AddRefs(domevent));
 
@@ -1703,7 +1710,7 @@
   // We need to create the event before nulling out mDocument
   nsCOMPtr<nsIDOMEvent> event(do_QueryInterface(aEvent));
   // There is no NS_PAGE_ERROR event but NS_SCRIPT_ERROR should be ok.
-  nsEvent evt(NS_SCRIPT_ERROR);
+  nsEvent evt(PR_TRUE, NS_SCRIPT_ERROR);
   if (!event) {
     CreateEvent(&evt, getter_AddRefs(event));
   }
@@ -1813,7 +1820,7 @@
   if (mOnProgressListener)
   {
     nsCOMPtr<nsIDOMEvent> event;
-    nsEvent evt(NS_EVENT_NULL ); // what name do we make up here? 
+    nsEvent evt(PR_TRUE, NS_EVENT_NULL); // what name do we make up here? 
     nsresult rv = CreateEvent(&evt, getter_AddRefs(event));
     NS_ENSURE_SUCCESS(rv, rv);
     
--- mozilla-firefox-1.0.4.orig/caps/idl/nsIPrincipal.idl
+++ mozilla-firefox-1.0.4/caps/idl/nsIPrincipal.idl
@@ -153,3 +153,27 @@
      */
     attribute string commonName;
 };
+
+[uuid(a67c4736-9a95-4ce1-9ffc-3f88c0913a34)]
+interface nsISubsumingPrincipal : nsIPrincipal
+{
+    /**
+     * Returns whether the other principal is equal to or weaker than this
+     * principal.  Principals are equal if they are the same object, they
+     * have the same origin, or they have the same certificate ID.
+     *
+     * Thus a principal subsumes itself if it is equal to itself.
+     *
+     * The system principal subsumes itself and all other principals except
+     * the non-principal.
+     *
+     * The non-principal is not equal to itself or any other principal, and
+     * therefore does not subsume itself.
+     *
+     * Both codebase and certificate principals are subsumed by the system
+     * principal, but no codebase or certificate principal yet subsumes any
+     * other codebase or certificate principal.  This may change in a future
+     * release; note that nsIPrincipal is unfrozen, not slated to be frozen.
+     */
+    boolean subsumes(in nsIPrincipal other);
+};
--- mozilla-firefox-1.0.4.orig/caps/src/nsJSPrincipals.cpp
+++ mozilla-firefox-1.0.4/caps/src/nsJSPrincipals.cpp
@@ -50,17 +50,34 @@
 #include "nsMemory.h"
 
 JS_STATIC_DLL_CALLBACK(void *)
-nsGetPrincipalArray(JSContext *cx, struct JSPrincipals *prin)
+nsGetPrincipalArray(JSContext *cx, JSPrincipals *prin)
 {
     return nsnull;
 }
 
 JS_STATIC_DLL_CALLBACK(JSBool)
-nsGlobalPrivilegesEnabled(JSContext *cx , struct JSPrincipals *jsprin)
+nsGlobalPrivilegesEnabled(JSContext *cx, JSPrincipals *jsprin)
 {
     return JS_TRUE;
 }
 
+JS_STATIC_DLL_CALLBACK(JSBool)
+nsJSPrincipalsSubsume(JSPrincipals *jsprin, JSPrincipals *other)
+{
+    nsJSPrincipals *nsjsprin = NS_STATIC_CAST(nsJSPrincipals *, jsprin);
+    nsJSPrincipals *nsother  = NS_STATIC_CAST(nsJSPrincipals *, other);
+
+    nsCOMPtr<nsISubsumingPrincipal> subjsprin =
+        do_QueryInterface(nsjsprin->nsIPrincipalPtr);
+    if (!subjsprin) {
+        return JS_FALSE;
+    }
+
+    JSBool result;
+    nsresult rv = subjsprin->Subsumes(nsother->nsIPrincipalPtr, &result);
+    return NS_SUCCEEDED(rv) && result;
+}
+
 JS_STATIC_DLL_CALLBACK(void)
 nsDestroyJSPrincipals(JSContext *cx, struct JSPrincipals *jsprin)
 {
@@ -182,6 +199,7 @@
     globalPrivilegesEnabled = nsGlobalPrivilegesEnabled;
     refcount = 0;
     destroy = nsDestroyJSPrincipals;
+    subsume = nsJSPrincipalsSubsume;
     nsIPrincipalPtr = nsnull;
 }
 
--- mozilla-firefox-1.0.4.orig/caps/src/nsPrincipal.cpp
+++ mozilla-firefox-1.0.4/caps/src/nsPrincipal.cpp
@@ -64,11 +64,13 @@
   NS_INTERFACE_MAP_ENTRY(nsIPrincipal)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISerializable, nsIPrincipal)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPrincipal)
+  NS_INTERFACE_MAP_ENTRY(nsISubsumingPrincipal)
   NS_INTERFACE_MAP_ENTRY(nsIPrincipalObsolete)
   NS_IMPL_QUERY_CLASSINFO(nsPrincipal)
 NS_INTERFACE_MAP_END
 
-NS_IMPL_CI_INTERFACE_GETTER2(nsPrincipal,
+NS_IMPL_CI_INTERFACE_GETTER3(nsPrincipal,
+                             nsISubsumingPrincipal,
                              nsIPrincipal,
                              nsISerializable)
 
@@ -145,6 +147,7 @@
 nsPrincipal::~nsPrincipal(void)
 {
   mAnnotations.EnumerateForwards(deleteElement, nsnull);
+  SetSecurityPolicy(nsnull); 
 }
 
 NS_IMETHODIMP
@@ -201,14 +204,25 @@
 NS_IMETHODIMP
 nsPrincipal::GetSecurityPolicy(void** aSecurityPolicy)
 {
-  *aSecurityPolicy = mSecurityPolicy;
+  if (mSecurityPolicy && mSecurityPolicy->IsInvalid()) 
+    SetSecurityPolicy(nsnull);
+  
+  *aSecurityPolicy = (void *) mSecurityPolicy;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsPrincipal::SetSecurityPolicy(void* aSecurityPolicy)
 {
-  mSecurityPolicy = aSecurityPolicy;
+  DomainPolicy *newPolicy = NS_REINTERPRET_CAST(
+                              DomainPolicy *, aSecurityPolicy);
+  if (newPolicy)
+    newPolicy->Hold();
+ 
+  if (mSecurityPolicy)
+    mSecurityPolicy->Drop();
+  
+  mSecurityPolicy = newPolicy;
   return NS_OK;
 }
 
@@ -252,6 +266,11 @@
   return NS_OK;
 }
 
+NS_IMETHODIMP
+nsPrincipal::Subsumes(nsIPrincipal *aOther, PRBool *aResult)
+{
+  return Equals(aOther, aResult);
+}
 
 NS_IMETHODIMP
 nsPrincipal::CanEnableCapability(const char *capability, PRInt16 *result)
@@ -563,7 +582,7 @@
 {
   mDomain = aDomain;
   // Domain has changed, forget cached security policy
-  mSecurityPolicy = nsnull;
+  SetSecurityPolicy(nsnull);
 
   return NS_OK;
 }
--- mozilla-firefox-1.0.4.orig/caps/src/nsScriptSecurityManager.cpp
+++ mozilla-firefox-1.0.4/caps/src/nsScriptSecurityManager.cpp
@@ -121,6 +121,17 @@
         JS_SetPendingException(cx, STRING_TO_JSVAL(str));
 }
 
+// DomainPolicy members
+#ifdef DEBUG_CAPS_DomainPolicyLifeCycle
+PRUint32 DomainPolicy::sObjects=0;
+void DomainPolicy::_printPopulationInfo()
+{
+    printf("CAPS.DomainPolicy: Gen. %d, %d DomainPolicy objects.\n",
+        sGeneration, sObjects);
+}
+#endif
+PRUint32 DomainPolicy::sGeneration = 0;
+
 // Helper class to get stuff from the ClassInfo and not waste extra time with
 // virtual method calls for things it has already gotten
 class ClassInfoData
@@ -451,11 +462,8 @@
     //    a different trust domain.
     // 2. A user-defined getter or setter function accessible on another
     //    trust domain's window or document object.
-    // If *vp is not a primitive, some new JS engine call to this hook was
-    // added, but we can handle that case too -- if a primitive value in a
-    // property of obj is being accessed, we should use obj as the target
+    // *vp can be a primitive, in that case, we use obj as the target
     // object.
-    NS_ASSERTION(!JSVAL_IS_PRIMITIVE(*vp), "unexpected target property value");
     JSObject* target = JSVAL_IS_PRIMITIVE(*vp) ? obj : JSVAL_TO_OBJECT(*vp);
 
     // Do the same-origin check -- this sets a JS exception if the check fails.
@@ -1165,7 +1173,6 @@
             return NS_ERROR_FAILURE;
         const char* page = spec.get() + sizeof(aboutScheme);
         if ((strcmp(page, "blank") == 0)   ||
-            (strcmp(page, "") == 0)        ||
             (strcmp(page, "mozilla") == 0) ||
             (strcmp(page, "logo") == 0)    ||
             (strcmp(page, "credits") == 0))
@@ -2991,25 +2998,36 @@
 nsresult
 nsScriptSecurityManager::InitPolicies()
 {
-    // Reset the "dirty" flag
-    mPolicyPrefsChanged = PR_FALSE;
-
     // Clear any policies cached on XPConnect wrappers
     NS_ENSURE_STATE(sXPConnect);
     nsresult rv = sXPConnect->ClearAllWrappedNativeSecurityPolicies();
     if (NS_FAILED(rv)) return rv;
 
-    //-- Reset mOriginToPolicyMap
+    //-- Clear mOriginToPolicyMap: delete mapped DomainEntry items,
+    //-- whose dtor decrements refcount of stored DomainPolicy object
     delete mOriginToPolicyMap;
+    
+    //-- Marks all the survivor DomainPolicy objects (those cached
+    //-- by nsPrincipal objects) as invalid: they will be released
+    //-- on first nsPrincipal::GetSecurityPolicy() attempt.
+    DomainPolicy::InvalidateAll();
+    
+    //-- Release old default policy
+    if(mDefaultPolicy)
+        mDefaultPolicy->Drop();
+    
+    //-- Initialize a new mOriginToPolicyMap
     mOriginToPolicyMap =
       new nsObjectHashtable(nsnull, nsnull, DeleteDomainEntry, nsnull);
+    if (!mOriginToPolicyMap)
+        return NS_ERROR_OUT_OF_MEMORY;
 
-    //-- Reset and initialize the default policy
-    delete mDefaultPolicy;
+    //-- Create, refcount and initialize a new default policy 
     mDefaultPolicy = new DomainPolicy();
-    if (!mOriginToPolicyMap || !mDefaultPolicy)
+    if (!mDefaultPolicy)
         return NS_ERROR_OUT_OF_MEMORY;
 
+    mDefaultPolicy->Hold();
     if (!mDefaultPolicy->Init())
         return NS_ERROR_UNEXPECTED;
 
@@ -3140,6 +3158,9 @@
             return rv;
     }
 
+    // Reset the "dirty" flag
+    mPolicyPrefsChanged = PR_FALSE;
+
 #ifdef DEBUG_CAPS_HACKER
     PrintPolicyDB();
 #endif
--- mozilla-firefox-1.0.4.orig/caps/src/nsSystemPrincipal.cpp
+++ mozilla-firefox-1.0.4/caps/src/nsSystemPrincipal.cpp
@@ -54,11 +54,13 @@
     NS_INTERFACE_MAP_ENTRY(nsIPrincipal)
     NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISerializable, nsIPrincipal)
     NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPrincipal)
+    NS_INTERFACE_MAP_ENTRY(nsISubsumingPrincipal)
     NS_INTERFACE_MAP_ENTRY(nsIPrincipalObsolete)
     NS_IMPL_QUERY_CLASSINFO(nsSystemPrincipal)
 NS_INTERFACE_MAP_END
 
-NS_IMPL_CI_INTERFACE_GETTER2(nsSystemPrincipal,
+NS_IMPL_CI_INTERFACE_GETTER3(nsSystemPrincipal,
+                             nsISubsumingPrincipal,
                              nsIPrincipal,
                              nsISerializable)
 
@@ -110,6 +112,13 @@
 }
 
 NS_IMETHODIMP
+nsSystemPrincipal::Subsumes(nsIPrincipal *other, PRBool *result)
+{
+    *result = PR_TRUE;
+    return NS_OK;
+}
+
+NS_IMETHODIMP
 nsSystemPrincipal::GetHashValue(PRUint32 *result)
 {
     *result = NS_PTR_TO_INT32(this);
--- mozilla-firefox-1.0.4.orig/caps/include/nsPrincipal.h
+++ mozilla-firefox-1.0.4/caps/include/nsPrincipal.h
@@ -49,7 +49,7 @@
 class nsIObjectInputStream;
 class nsIObjectOutputStream;
 
-class nsPrincipal : public nsIPrincipal,
+class nsPrincipal : public nsISubsumingPrincipal,
                     public nsIPrincipalObsolete
 {
 public:
@@ -64,8 +64,9 @@
   NS_DECL_ISUPPORTS_INHERITED
 public:
 
-  NS_DECL_NSIPRINCIPAL
   NS_DECL_NSISERIALIZABLE
+  NS_DECL_NSIPRINCIPAL
+  NS_DECL_NSISUBSUMINGPRINCIPAL
 
   // nsIPrincipalObsolete declarations, written out because some of them
   // overlap with nsIPrincipal.
@@ -122,7 +123,7 @@
   // it is very rare that we actually have a certificate.
   nsAutoPtr<Certificate> mCert;
 
-  void* mSecurityPolicy;
+  DomainPolicy* mSecurityPolicy;
 
   nsCOMPtr<nsIURI> mCodebase;
   nsCOMPtr<nsIURI> mDomain;
--- mozilla-firefox-1.0.4.orig/caps/include/nsScriptSecurityManager.h
+++ mozilla-firefox-1.0.4/caps/include/nsScriptSecurityManager.h
@@ -261,6 +261,13 @@
     DomainPolicy() : mWildcardPolicy(nsnull),
                      mRefCount(0)
     {
+        mGeneration = sGeneration;
+
+#ifdef DEBUG_CAPS_DomainPolicyLifeCycle
+        ++sObjects;
+        _printPopulationInfo();
+#endif
+
     }
 
     PRBool Init()
@@ -285,6 +292,12 @@
     ~DomainPolicy()
     {
         PL_DHashTableFinish(this);
+
+#ifdef DEBUG_CAPS_DomainPolicyLifeCycle
+        --sObjects;
+        _printPopulationInfo();
+#endif
+
     }
 
     void Hold()
@@ -297,11 +310,29 @@
         if (--mRefCount == 0)
             delete this;
     }
-
+    
+    static void InvalidateAll()
+    {
+        sGeneration++;
+    }
+    
+    PRBool IsInvalid()
+    {
+        return mGeneration != sGeneration; 
+    }
+    
     ClassPolicy* mWildcardPolicy;
 
 private:
     PRUint32 mRefCount;
+    PRUint32 mGeneration;
+    static PRUint32 sGeneration;
+    
+#ifdef DEBUG_CAPS_DomainPolicyLifeCycle
+    static PRUint32 sObjects;
+    static void _printPopulationInfo();
+#endif
+
 };
 
 /////////////////////////////
--- mozilla-firefox-1.0.4.orig/caps/include/nsSystemPrincipal.h
+++ mozilla-firefox-1.0.4/caps/include/nsSystemPrincipal.h
@@ -52,13 +52,14 @@
 #define NS_SYSTEMPRINCIPAL_CONTRACTID "@mozilla.org/systemprincipal;1"
 
 
-class nsSystemPrincipal : public nsIPrincipal,
+class nsSystemPrincipal : public nsISubsumingPrincipal,
                           public nsIPrincipalObsolete
 {
 public:
     NS_DECL_ISUPPORTS_INHERITED
-    NS_DECL_NSIPRINCIPAL
     NS_DECL_NSISERIALIZABLE
+    NS_DECL_NSIPRINCIPAL
+    NS_DECL_NSISUBSUMINGPRINCIPAL
 
     // nsIPrincipalObsolete declarations, written out because some of them
     // overlap with nsIPrincipal.
--- mozilla-firefox-1.0.4.orig/configure
+++ mozilla-firefox-1.0.4/configure
@@ -5357,8 +5357,7 @@
         MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
     ;;
     mips*)
-        CFLAGS="$CFLAGS -Wa,-xgot"
-        CXXFLAGS="$CXXFLAGS -Wa,-xgot"
+        MOZ_DEBUG_FLAGS="-g"   # We want inlining
     ;;
     esac
     ;;
--- mozilla-firefox-1.0.4.orig/configure.in
+++ mozilla-firefox-1.0.4/configure.in
@@ -1112,8 +1112,7 @@
         MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
     ;;
     mips*)
-        CFLAGS="$CFLAGS -Wa,-xgot"
-        CXXFLAGS="$CXXFLAGS -Wa,-xgot"
+        MOZ_DEBUG_FLAGS="-g"   # We want inlining
     ;;
     esac
     ;;
--- mozilla-firefox-1.0.4.orig/config/autoconf.mk.in
+++ mozilla-firefox-1.0.4/config/autoconf.mk.in
@@ -38,7 +38,7 @@
 mandir		= @mandir@
 idldir		= @datadir@/idl/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
 
-mozappdir	= $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
+mozappdir	= $(libdir)/mozilla-firefox
 mredir		= $(libdir)/mre/mre-$(MOZ_APP_VERSION)
 mrelibdir	= $(mredir)/lib
 
--- mozilla-firefox-1.0.4.orig/config/milestone.txt
+++ mozilla-firefox-1.0.4/config/milestone.txt
@@ -11,4 +11,4 @@
 #--------------------------------------------------------
 
 
-1.7.8
+1.7.10
--- mozilla-firefox-1.0.4.orig/config/rules.mk
+++ mozilla-firefox-1.0.4/config/rules.mk
@@ -455,7 +455,7 @@
 
 ifeq ($(OS_ARCH),Linux)
 ifneq (,$(filter mips mipsel,$(OS_TEST)))
-ifeq ($(MODULE),layout)
+ifneq (,$(filter layout content xul xuldoc xultmpl svg_doc view dom jsurl,$(MODULE)))
 OS_CFLAGS += -Wa,-xgot
 OS_CXXFLAGS += -Wa,-xgot
 endif
--- mozilla-firefox-1.0.4.orig/config/mkdepend/imakemdep.h
+++ mozilla-firefox-1.0.4/config/mkdepend/imakemdep.h
@@ -277,6 +277,9 @@
 # ifdef __i386__
 	"-D__i386__",
 # endif
+# ifdef __x86_64__
+	"-D__x86_64__",
+# endif
 # ifdef __GNUC__
 	"-traditional",
 # endif
--- mozilla-firefox-1.0.4.orig/docshell/base/nsDocShell.cpp
+++ mozilla-firefox-1.0.4/docshell/base/nsDocShell.cpp
@@ -460,6 +460,9 @@
     case nsIDocShellLoadInfo::loadNormalReplace:
         loadType = LOAD_NORMAL_REPLACE;
         break;
+    case nsIDocShellLoadInfo::loadNormalExternal:
+        loadType = LOAD_NORMAL_EXTERNAL;
+        break;
     case nsIDocShellLoadInfo::loadHistory:
         loadType = LOAD_HISTORY;
         break;
@@ -504,6 +507,9 @@
     case LOAD_NORMAL_REPLACE:
         docShellLoadType = nsIDocShellLoadInfo::loadNormalReplace;
         break;
+    case LOAD_NORMAL_EXTERNAL:
+        docShellLoadType = nsIDocShellLoadInfo::loadNormalExternal;
+        break;
     case LOAD_HISTORY:
         docShellLoadType = nsIDocShellLoadInfo::loadHistory;
         break;
@@ -615,7 +621,9 @@
                 if (mCurrentURI == nsnull) {
                     // This is a newly created frame. Check for exception cases first. 
                     // By default the subframe will inherit the parent's loadType.
-                    if (shEntry && (parentLoadType == LOAD_NORMAL || parentLoadType == LOAD_LINK)) {
+                    if (shEntry && (parentLoadType == LOAD_NORMAL ||
+                                    parentLoadType == LOAD_LINK   ||
+                                    parentLoadType == LOAD_NORMAL_EXTERNAL)) {
                         // The parent was loaded normally. In this case, this *brand new* child really shouldn't
                         // have a SHEntry. If it does, it could be because the parent is replacing an
                         // existing frame with a new frame, in the onLoadHandler. We don't want this
@@ -5519,6 +5527,25 @@
         return NS_ERROR_FAILURE;
     }
 
+    // Before going any further vet loads initiated by external programs.
+    if (aLoadType == LOAD_NORMAL_EXTERNAL) {
+        // Disallow external chrome: loads targetted at content windows
+        PRBool isChrome = PR_FALSE;
+        if (NS_SUCCEEDED(aURI->SchemeIs("chrome", &isChrome)) && isChrome) {
+            NS_WARNING("blocked external chrome: url -- use '-chrome' option");
+            return NS_ERROR_FAILURE;
+        }
+
+        // clear the decks to prevent context bleed-through (bug 298255)
+        rv = CreateAboutBlankContentViewer();
+        if (NS_FAILED(rv))
+            return NS_ERROR_FAILURE;
+
+        // reset loadType so we don't have to add lots of tests for
+        // LOAD_NORMAL_EXTERNAL after this point
+        aLoadType = LOAD_NORMAL;
+    }
+
     rv = CheckLoadingPermissions();
     if (NS_FAILED(rv)) {
         return rv;
--- mozilla-firefox-1.0.4.orig/docshell/base/nsDocShell.h
+++ mozilla-firefox-1.0.4/docshell/base/nsDocShell.h
@@ -97,6 +97,7 @@
 enum LoadType {
     LOAD_NORMAL = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_NORMAL, nsIWebNavigation::LOAD_FLAGS_NONE),
     LOAD_NORMAL_REPLACE = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_NORMAL, nsIWebNavigation::LOAD_FLAGS_REPLACE_HISTORY),
+    LOAD_NORMAL_EXTERNAL = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_NORMAL, nsIWebNavigation::LOAD_FLAGS_FROM_EXTERNAL),
     LOAD_HISTORY = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_HISTORY, nsIWebNavigation::LOAD_FLAGS_NONE),
     LOAD_RELOAD_NORMAL = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_RELOAD, nsIWebNavigation::LOAD_FLAGS_NONE),
     LOAD_RELOAD_BYPASS_CACHE = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_RELOAD, nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE),
@@ -114,6 +115,7 @@
     {
     case LOAD_NORMAL:
     case LOAD_NORMAL_REPLACE:
+    case LOAD_NORMAL_EXTERNAL:
     case LOAD_HISTORY:
     case LOAD_RELOAD_NORMAL:
     case LOAD_RELOAD_BYPASS_CACHE:
--- mozilla-firefox-1.0.4.orig/docshell/base/nsIDocShellLoadInfo.idl
+++ mozilla-firefox-1.0.4/docshell/base/nsIDocShellLoadInfo.idl
@@ -63,6 +63,8 @@
     const long loadReloadCharsetChange = 9;
     const long loadBypassHistory = 10;
 
+    const long loadNormalExternal = 13;
+
     /** Contains a load type as specified by the load* constants */
     attribute nsDocShellInfoLoadType loadType;
 
--- mozilla-firefox-1.0.4.orig/docshell/base/nsIWebNavigation.idl
+++ mozilla-firefox-1.0.4/docshell/base/nsIWebNavigation.idl
@@ -127,6 +127,11 @@
   const unsigned long LOAD_FLAGS_CHARSET_CHANGE  = 0x0400; // Reload because of charset change, 
 
  /**
+  * A hint this load was prompted by an external program: take care!
+  */
+  const unsigned long LOAD_FLAGS_FROM_EXTERNAL   = 0x1000;
+
+ /**
   * Loads a given URI.  This will give priority to loading the requested URI
   * in the object implementing	this interface.  If it can't be loaded here
   * however, the URL dispatcher will go through its normal process of content
--- mozilla-firefox-1.0.4.orig/embedding/base/nsEmbedOS2.cpp
+++ mozilla-firefox-1.0.4/embedding/base/nsEmbedOS2.cpp
@@ -1,39 +1,39 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- *
- * The contents of this file are subject to the Mozilla Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- * 
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- * 
- * The Original Code is the Mozilla browser.
- * 
- * The Initial Developer of the Original Code is Netscape
- * Communications, Inc.  Portions created by Netscape are
- * Copyright (C) 1999, Mozilla.  All Rights Reserved.
- * 
- * Author:
- *   Adam Lock <adamlock@netscape.com>
- *
- * Contributor(s):
- */
-
-#include "nsEmbedAPI.h"
-
-#ifndef OS2
-#error This file is for OS/2!
-#endif
-
-#ifdef MOZ_SUPPORTS_EMBEDDING_EVENT_PROCESSING
-
-nsresult NS_HandleEmbeddingEvent(nsEmbedNativeEvent &aEvent, PRBool &aWasHandled)
-{
-    aWasHandled = PR_FALSE;
-    return NS_OK;
-}
-
-#endif /* MOZ_SUPPORTS_EMBEDDING_EVENT_PROCESSING */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is the Mozilla browser.
+ * 
+ * The Initial Developer of the Original Code is Netscape
+ * Communications, Inc.  Portions created by Netscape are
+ * Copyright (C) 1999, Mozilla.  All Rights Reserved.
+ * 
+ * Author:
+ *   Adam Lock <adamlock@netscape.com>
+ *
+ * Contributor(s):
+ */
+
+#include "nsEmbedAPI.h"
+
+#ifndef OS2
+#error This file is for OS/2!
+#endif
+
+#ifdef MOZ_SUPPORTS_EMBEDDING_EVENT_PROCESSING
+
+nsresult NS_HandleEmbeddingEvent(nsEmbedNativeEvent &aEvent, PRBool &aWasHandled)
+{
+    aWasHandled = PR_FALSE;
+    return NS_OK;
+}
+
+#endif /* MOZ_SUPPORTS_EMBEDDING_EVENT_PROCESSING */
--- mozilla-firefox-1.0.4.orig/embedding/components/windowwatcher/src/nsWindowWatcher.cpp
+++ mozilla-firefox-1.0.4/embedding/components/windowwatcher/src/nsWindowWatcher.cpp
@@ -345,7 +345,7 @@
   JSContextAutoPopper();
   ~JSContextAutoPopper();
 
-  nsresult   Push();
+  nsresult   Push(JSContext *cx = nsnull);
   JSContext *get() { return mContext; }
 
 protected:
@@ -368,16 +368,21 @@
   }
 }
 
-nsresult JSContextAutoPopper::Push()
+nsresult JSContextAutoPopper::Push(JSContext *cx)
 {
-  nsresult rv;
+  nsresult rv = NS_OK;
 
   if (mContext) // only once
     return NS_ERROR_FAILURE;
 
   mService = do_GetService(sJSStackContractID);
   if(mService) {
-    rv = mService->GetSafeJSContext(&mContext);
+    if (cx) {
+      mContext = cx;
+    } else {
+      rv = mService->GetSafeJSContext(&mContext);
+    }
+
     if (NS_SUCCEEDED(rv) && mContext) {
       rv = mService->Push(mContext);
       if (NS_FAILED(rv))
@@ -492,7 +497,7 @@
   nsCOMPtr<nsIDocShellTreeOwner>  parentTreeOwner;  // from the parent window, if any
   nsCOMPtr<nsIDocShellTreeItem>   newDocShellItem;  // from the new window
   EventQueueAutoPopper            queueGuard;
-  JSContextAutoPopper             contextGuard;
+  JSContextAutoPopper             callerContextGuard;
 
   NS_ENSURE_ARG_POINTER(_retval);
   *_retval = 0;
@@ -521,12 +526,6 @@
     features.StripWhitespace();
   }
 
-  nsCOMPtr<nsIDOMChromeWindow> chromeParent(do_QueryInterface(aParent));
-
-  chromeFlags = CalculateChromeFlags(features.get(), featuresSpecified,
-                                     aDialog, uriToLoadIsChrome,
-                                     !aParent || chromeParent);
-
   // try to find an extant window with the given name
   if (nameSpecified) {
     nsCOMPtr<nsIJSContextStack> stack =
@@ -563,6 +562,33 @@
                        getter_AddRefs(newDocShellItem));
   }
 
+  nsCOMPtr<nsIDOMChromeWindow> chromeParent(do_QueryInterface(aParent));
+
+  // Make sure we call CalculateChromeFlags() *before* we push the
+  // callee context onto the context stack so that
+  // CalculateChromeFlags() sees the actual caller when doing it's
+  // security checks.
+  chromeFlags = CalculateChromeFlags(features.get(), featuresSpecified,
+                                     aDialog, uriToLoadIsChrome,
+                                     !aParent || chromeParent);
+
+  PRBool isCallerChrome = PR_FALSE;
+  nsCOMPtr<nsIScriptSecurityManager>
+    sm(do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID));
+  if (sm)
+    sm->SubjectPrincipalIsSystem(&isCallerChrome);
+
+  JSContext *cx = GetJSContextFromWindow(aParent);
+
+  if (isCallerChrome && !chromeParent && cx) {
+    // open() is called from chrome on a non-chrome window, push
+    // the context of the callee onto the context stack to
+    // prevent the caller's priveleges from leaking into code
+    // that runs while opening the new window.
+
+    callerContextGuard.Push(cx);
+  }
+
   // no extant window? make a new one.
   if (!newDocShellItem) {
     windowIsNew = PR_TRUE;
@@ -608,8 +634,6 @@
         // chrome is always allowed, so clear the flag if the opener is chrome
         if (popupConditions) {
           PRBool isChrome = PR_FALSE;
-          nsCOMPtr<nsIScriptSecurityManager>
-            sm(do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID));
           if (sm)
             sm->SubjectPrincipalIsSystem(&isChrome);
           popupConditions = !isChrome;
@@ -716,7 +740,9 @@
   }
 
   if (uriToLoad) { // get the script principal and pass it to docshell
-    JSContext *cx = GetJSContextFromCallStack();
+    JSContextAutoPopper contextGuard;
+
+    cx = GetJSContextFromCallStack();
 
     // get the security manager
     if (!cx)
@@ -733,11 +759,8 @@
     NS_ENSURE_TRUE(loadInfo, NS_ERROR_FAILURE);
 
     if (!uriToLoadIsChrome) {
-      nsCOMPtr<nsIScriptSecurityManager> secMan =
-        do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID);
-
       nsCOMPtr<nsIPrincipal> principal;
-      if (NS_FAILED(secMan->GetSubjectPrincipal(getter_AddRefs(principal))))
+      if (NS_FAILED(sm->GetSubjectPrincipal(getter_AddRefs(principal))))
         return NS_ERROR_FAILURE;
 
       if (principal) {
@@ -782,7 +805,8 @@
   }
 
   if (windowIsNew)
-    SizeOpenedDocShellItem(newDocShellItem, aParent, features.get(), chromeFlags);
+    SizeOpenedDocShellItem(newDocShellItem, aParent, features.get(),
+                           chromeFlags);
 
   if (windowIsModal) {
     nsCOMPtr<nsIDocShellTreeOwner> newTreeOwner;
--- mozilla-firefox-1.0.4.orig/embedding/config/basebrowser-installer-win.pkg
+++ mozilla-firefox-1.0.4/embedding/config/basebrowser-installer-win.pkg
@@ -243,7 +243,6 @@
 res\arrowd.gif
 res\loading-image.gif
 res\broken-image.gif
-res\builtin\platformHTMLBindings.xml
 res\entityTables\html40Special.properties
 res\entityTables\htmlEntityVersions.properties
 res\entityTables\html40Latin1.properties
--- mozilla-firefox-1.0.4.orig/embedding/config/basebrowser-mac-macho
+++ mozilla-firefox-1.0.4/embedding/config/basebrowser-mac-macho
@@ -241,7 +241,6 @@
 res/arrowd.gif
 res/loading-image.gif
 res/broken-image.gif
-res/builtin/*
 res/entityTables/html40Special.properties
 res/entityTables/htmlEntityVersions.properties
 res/entityTables/html40Latin1.properties
--- mozilla-firefox-1.0.4.orig/embedding/config/basebrowser-qnx
+++ mozilla-firefox-1.0.4/embedding/config/basebrowser-qnx
@@ -245,7 +245,6 @@
 res/arrowd.gif
 res/loading-image.gif
 res/broken-image.gif
-res/builtin/*
 res/entityTables/html40Special.properties
 res/entityTables/htmlEntityVersion.properties
 res/entityTables/html40Latin1.properties
--- mozilla-firefox-1.0.4.orig/embedding/config/basebrowser-unix
+++ mozilla-firefox-1.0.4/embedding/config/basebrowser-unix
@@ -247,7 +247,6 @@
 res/arrowd.gif
 res/loading-image.gif
 res/broken-image.gif
-res/builtin/*
 res/entityTables/html40Special.properties
 res/entityTables/htmlEntityVersion.properties
 res/entityTables/html40Latin1.properties
--- mozilla-firefox-1.0.4.orig/embedding/config/basebrowser-win
+++ mozilla-firefox-1.0.4/embedding/config/basebrowser-win
@@ -258,7 +258,6 @@
 res\arrowd.gif
 res\loading-image.gif
 res\broken-image.gif
-res\builtin\platformHTMLBindings.xml
 res\entityTables\html40Special.properties
 res\entityTables\htmlEntityVersions.properties
 res\entityTables\html40Latin1.properties
--- mozilla-firefox-1.0.4.orig/embedding/config/minimo-qnx
+++ mozilla-firefox-1.0.4/embedding/config/minimo-qnx
@@ -191,7 +191,6 @@
 res/arrowd.gif
 res/loading-image.gif
 res/broken-image.gif
-res/builtin/*
 res/entityTables/html40Special.properties
 res/entityTables/htmlEntityVersion.properties
 res/entityTables/html40Latin1.properties
--- mozilla-firefox-1.0.4.orig/embedding/config/minimo-unix
+++ mozilla-firefox-1.0.4/embedding/config/minimo-unix
@@ -189,7 +189,6 @@
 res/arrowd.gif
 res/loading-image.gif
 res/broken-image.gif
-res/builtin/*
 res/entityTables/html40Special.properties
 res/entityTables/htmlEntityVersion.properties
 res/entityTables/html40Latin1.properties
--- mozilla-firefox-1.0.4.orig/embedding/qa/testembed/DomWindow.cpp
+++ mozilla-firefox-1.0.4/embedding/qa/testembed/DomWindow.cpp
@@ -1,510 +1,510 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: NPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Netscape Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/NPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is 
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Ashish Bhatt <ashishbhatt@netscape.com> 
- *
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the NPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the NPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-// File Overview....
-//
-// Test cases for the nsIDOMWindow Interface
-
-
-#include "stdafx.h"
-#include "QaUtils.h"
-#include <stdio.h>
-#include "domWindow.h"
-#include "resource.h"
-
-
-CDomWindow::CDomWindow(nsIWebBrowser* mWebBrowser)
-{
-	qaWebBrowser = mWebBrowser ;
-}
-
-CDomWindow::~CDomWindow()
-{
-
-}
-
-
-void CDomWindow::OnStartTests(UINT nMenuID)
-{
-	// Calls  all or indivdual test cases on the basis of the 
-	// option selected from menu.
-
-	switch(nMenuID)
-	{
-	case ID_INTERFACES_NSIDOMWINDOW_RUNALLTESTS :
-		RunAllTests();
-		break;
-	case ID_INTERFACES_NSIDOMWINDOW_GETDOMDOCUMENT :
-		GetDocument();
-		break;
-	case ID_INTERFACES_NSIDOMWINDOW_GETPARENT : 
-		GetParent();
-		break;
-	case ID_INTERFACES_NSIDOMWINDOW_GETSCROLLBARS :
-		GetScrollbars();
-		break;
-	case ID_INTERFACES_NSIDOMWINDOW_GETFRAMES :
-		GetFrames();
-		break;
-	case ID_INTERFACES_NSIDOMWINDOW_GETNAME :
-		//GetName();
-		break;
-	case ID_INTERFACES_NSIDOMWINDOW_GETTEXTZOOM : 
-		GetTextZoom();
-		break;
-	case ID_INTERFACES_NSIDOMWINDOW_SETTEXTZOOM : 
-		SetTextZoom();
-		break;
-	case ID_INTERFACES_NSIDOMWINDOW_GETSCSOLLX : 
-		GetScrollX();
-		break;
-	case ID_INTERFACES_NSIDOMWINDOW_GETSCROLLY :
-		GetScrollY();
-		break;
-	case ID_INTERFACES_NSIDOMWINDOW_SCROLLTO :
-		ScrollTo();
-		break;
-	case ID_INTERFACES_NSIDOMWINDOW_SCROLLBY :
-		ScrollBy();
-		break;
-	case ID_INTERFACES_NSIDOMWINDOW_GETSELECTION :
-		GetSelection();
-		break;
-	case ID_INTERFACES_NSIDOMWINDOW_SCROLLBYLINES :
-		ScrollByLines();
-		break;
-	case ID_INTERFACES_NSIDOMWINDOW_SCROLLBYPAGES :
-		ScrollByPages();
-		break;
-	case ID_INTERFACES_NSIDOMWINDOW_SIZETOCONTENT :
-		SizeToContent();
-		break;
-	default :
-		AfxMessageBox("Not added menu handler for this menu item");
-		break;
-	}
-}
-void CDomWindow::RunAllTests()
-{
-	PRInt32 scrollX = 0 ;
-	PRInt32 scrollY = 0;
-	PRInt32 bVisible =0;
-	float fTextZoom = 0.0;
-
-	nsCOMPtr<nsIDOMWindow> oDomWindow;
-	//nsCOMPtr<nsIDOMWindow> oDomWindowTop;
-	//nsCOMPtr<nsIDOMWindow> oDomWindowParent;
-
-	nsCOMPtr<nsIDOMBarProp> oDomBarProp;
-	nsCOMPtr<nsIDOMWindowCollection> oDomWindowCol;
-	nsCOMPtr<nsIDOMDocument> oDomDocument;
-	nsCOMPtr<nsISelection> oSelection;
-	
-	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
-    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 1);
-	if (!oDomWindow)
-	{
-		AfxMessageBox("Cannot create Dom Window Object");
-		return;
-	}
-
-/*	rv = oDomWindow->GetTop(getter_AddRefs(oDomWindowTop));
-    RvTestResult(rv, "nsIDOMWindow::GetTop()' rv test", 1);
-	if (!oDomWindowTop)
-	{
-		AfxMessageBox("Cannot create Dom Window Top Object");
-		return;
-	}
-
-	rv = oDomWindow->GetParent(getter_AddRefs(oDomWindow));
-    RvTestResult(rv, "nsIDOMWindow::GetParent()' rv test", 1);
-	if (!oDomWindow)
-	{
-		AfxMessageBox("Cannot create Dom Window Parent Object");
-		return;
-	}
-
-*/
-
-	rv = oDomWindow->GetScrollbars(getter_AddRefs(oDomBarProp));
-    RvTestResult(rv, "nsIDOMWindow::GetScrollbars()' rv test", 1);
-	if (!oDomBarProp)
-	{
-		AfxMessageBox("Cannot create Dom Window Scroll Bar Object");
-		return;
-	}
-
-	rv = oDomWindow->GetFrames(getter_AddRefs(oDomWindowCol));
-    RvTestResult(rv, "nsIDOMWindow::GetFrames()' rv test", 1);
-	if (!oDomWindowCol)
-	{
-		AfxMessageBox("Cannot create Dom Window Collection Object");
-		return;
-	}
-
-	rv = oDomWindow->GetDocument(getter_AddRefs(oDomDocument));
-    RvTestResult(rv, "nsIDOMWindow::GetDocument()' rv test", 1);
-	if (!oDomDocument)
-	{
-		AfxMessageBox("Cannot create Dom Document Object");
-		return;
-	}
-
-	rv = oDomWindow->GetSelection(getter_AddRefs(oSelection));
-    RvTestResult(rv, "nsIDOMWindow::GetSelection()' rv test", 1);
-	if (!oSelection)
-	{
-		AfxMessageBox("Cannot get the  Selection Object");
-		return;
-	}
-
-	//  nsIDOMBarProp's only attribute
-	//rv = oDomBarProp->GetVisible(&bVisible);
-
-
-	rv = oDomWindow->GetTextZoom(&fTextZoom);
-	    RvTestResult(rv, "nsIDOMWindow::GetTextZoom()' rv test", 1);
-
-	rv = oDomWindow->SetTextZoom(12.0);
-	//fTextZoom = 4.0 ;
-	rv = oDomWindow->SetTextZoom(fTextZoom);
-	    RvTestResult(rv, "nsIDOMWindow::SetTextZoom()' rv test", 1);
-
-	rv = oDomWindow->GetScrollX(&scrollX);
-	   RvTestResult(rv, "nsIDOMWindow::GetScrollX()' rv test", 1);
-
-	rv = oDomWindow->GetScrollY(&scrollY);
-	   RvTestResult(rv, "nsIDOMWindow::GetScrollY()' rv test", 1);
-
-	rv = oDomWindow->ScrollTo(100,100);
-	   RvTestResult(rv, "nsIDOMWindow::ScrollTo()' rv test", 1);
-
-
-	rv = oDomWindow->ScrollBy(5, 5);
-	   RvTestResult(rv, "nsIDOMWindow::ScrollBy()' rv test", 1);
-
-	rv = oDomWindow->ScrollByLines(5);
-	   RvTestResult(rv, "nsIDOMWindow::ScrollByLines()' rv test", 1);
-
-	rv = oDomWindow->ScrollByPages(1);
-	   RvTestResult(rv, "nsIDOMWindow::ScrollByPages()' rv test", 1);
-
-	//rv = oDomWindow->SizeToContent();
-	//   RvTestResult(rv, "nsIDOMWindow::SizeToContent()' rv test", 1);
-
-}
-
-void CDomWindow::GetTop()
-{
-	nsCOMPtr<nsIDOMWindow> oDomWindow;
-	nsCOMPtr<nsIDOMWindow> oDomWindowTop;
-	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
-    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
-	if (!oDomWindow)
-	{
-		AfxMessageBox("Cannot create Dom Window Object");
-		return;
-	}
-
-    rv = oDomWindow->GetTop(getter_AddRefs(oDomWindowTop));
-    RvTestResult(rv, "nsIDOMWindow::GetTop()' rv test", 1);
-	if (!oDomWindowTop)
-	{
-		AfxMessageBox("Cannot create Dom Window Top Object");
-		return;
-	}
-}
-
-void CDomWindow::GetParent()
-{
-	nsCOMPtr<nsIDOMWindow> oDomWindow;
-	nsCOMPtr<nsIDOMWindow> oDomWindowParent;
-
-	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
-    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
-	if (!oDomWindow)
-	{
-		AfxMessageBox("Cannot create Dom Window Object");
-		return;
-	}
-
-	rv = oDomWindow->GetParent(getter_AddRefs(oDomWindow));
-    RvTestResult(rv, "nsIDOMWindow::GetParent()' rv test", 0);
-	if (!oDomWindow)
-	{
-		AfxMessageBox("Cannot create Dom Window Parent Object");
-		return;
-	}
-
-}
-
-
-void CDomWindow::GetScrollbars()
-{
-	nsCOMPtr<nsIDOMWindow> oDomWindow;
-	nsCOMPtr<nsIDOMBarProp> oDomBarProp;
-
-	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
-    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
-	if (!oDomWindow)
-	{
-		AfxMessageBox("Cannot create Dom Window Object");
-		return;
-	}
-
-	rv = oDomWindow->GetScrollbars(getter_AddRefs(oDomBarProp));
-    RvTestResult(rv, "nsIDOMWindow::GetScrollbars()' rv test", 0);
-	if (!oDomBarProp)
-	{
-		AfxMessageBox("Cannot create Dom Window Scroll Bar Object");
-		return;
-	}
-
-}
-
-void CDomWindow::GetFrames()
-{
-	nsCOMPtr<nsIDOMWindow> oDomWindow;
-	nsCOMPtr<nsIDOMWindowCollection> oDomWindowCol;
-
-	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
-    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
-	if (!oDomWindow)
-	{
-		AfxMessageBox("Cannot create Dom Window Object");
-		return;
-	}
-	rv = oDomWindow->GetFrames(getter_AddRefs(oDomWindowCol));
-    RvTestResult(rv, "nsIDOMWindow::GetFrames()' rv test", 0);
-	if (!oDomWindowCol)
-	{
-		AfxMessageBox("Cannot create Dom Window Collection Object");
-		return;
-	}
-}
-
-void CDomWindow::GetDocument()
-{
-	nsCOMPtr<nsIDOMWindow> oDomWindow;
-	nsCOMPtr<nsIDOMDocument> oDomDocument;
-
-	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
-    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
-	if (!oDomWindow)
-	{
-		AfxMessageBox("Cannot create Dom Window Object");
-		return;
-	}
-
-	rv = oDomWindow->GetDocument(getter_AddRefs(oDomDocument));
-    RvTestResult(rv, "nsIDOMWindow::GetDocument()' rv test",0);
-	if (!oDomDocument)
-	{
-		AfxMessageBox("Cannot create Dom Document Object");
-		return;
-	}
-}
-
-void CDomWindow::GetSelection()
-{
-	nsCOMPtr<nsIDOMWindow> oDomWindow;
-	nsCOMPtr<nsISelection> oSelection;
-
-	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
-    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test",0);
-
-	if (!oDomWindow)
-	{
-		AfxMessageBox("Cannot create Dom Window Object");
-		return;
-	}
-
-	rv = oDomWindow->GetSelection(getter_AddRefs(oSelection));
-    RvTestResult(rv, "nsIDOMWindow::GetSelection()' rv test", 0);
-	if (!oSelection)
-	{
-		AfxMessageBox("Cannot get the  Selection Object");
-		return;
-	}
-}
-
-void CDomWindow::GetTextZoom()
-{
-	float fTextZoom = 0.0 ;
-	nsCOMPtr<nsIDOMWindow> oDomWindow;
-	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
-    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
-
-	if (!oDomWindow)
-	{
-		AfxMessageBox("Cannot create Dom Window Object");
-		return;
-	}
-	rv = oDomWindow->GetTextZoom(&fTextZoom);
-	RvTestResult(rv, "nsIDOMWindow::GetTextZoom()' rv test", 0);
-}
-
-void CDomWindow::SetTextZoom()
-{
-	float fTextZoom = 0.0 ;
-
-	fTextZoom = 12.0;
-	rv = GetDOMOWindowObject()->SetTextZoom(fTextZoom);
-	RvTestResult(rv, "nsIDOMWindow::SetTextZoom()' rv test", 0);
-}
-
-void CDomWindow::GetScrollX()
-{
-	PRInt32 scrollX = 0 ;
-	nsCOMPtr<nsIDOMWindow> oDomWindow;
-	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
-    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
-
-	if (!oDomWindow)
-	{
-		AfxMessageBox("Cannot create Dom Window Object");
-		return;
-	}
-	rv = oDomWindow->GetScrollX(&scrollX);
-	RvTestResult(rv, "nsIDOMWindow::GetScrollX()' rv test", 0);
-}
-
-void CDomWindow::GetScrollY()
-{	
-	PRInt32 scrollY = 0 ;
-	nsCOMPtr<nsIDOMWindow> oDomWindow;
-	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
-    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
-
-	if (!oDomWindow)
-	{
-		AfxMessageBox("Cannot create Dom Window Object");
-		return;
-	}
-	rv = oDomWindow->GetScrollY(&scrollY);
-	RvTestResult(rv, "nsIDOMWindow::GetScrollY()' rv test", 0);
-}
-
-void CDomWindow::ScrollTo()
-{
-	nsCOMPtr<nsIDOMWindow> oDomWindow;
-	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
-    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
-
-	if (!oDomWindow)
-	{
-		AfxMessageBox("Cannot create Dom Window Object");
-		return;
-	}
-	rv = oDomWindow->ScrollTo(100,100);
-    RvTestResult(rv, "nsIDOMWindow::ScrollTo()' rv test", 0);
-}
-
-
-void CDomWindow::ScrollBy()
-{
-	nsCOMPtr<nsIDOMWindow> oDomWindow;
-	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
-    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
-
-	if (!oDomWindow)
-	{
-		AfxMessageBox("Cannot create Dom Window Object");
-		return;
-	}
-	rv = oDomWindow->ScrollBy(5, 5);
-	RvTestResult(rv, "nsIDOMWindow::ScrollBy()' rv test", 0);
-}
-
-void CDomWindow::ScrollByLines()
-{
-	nsCOMPtr<nsIDOMWindow> oDomWindow;
-	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
-    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
-
-	if (!oDomWindow)
-	{
-		AfxMessageBox("Cannot create Dom Window Object");
-		return;
-	}
-	rv = oDomWindow->ScrollByLines(5);
-    RvTestResult(rv, "nsIDOMWindow::ScrollByLines()' rv test",0);
-
-}
-
-void CDomWindow::ScrollByPages()
-{
-	nsCOMPtr<nsIDOMWindow> oDomWindow;
-	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
-    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
-
-	if (!oDomWindow)
-	{
-		AfxMessageBox("Cannot create Dom Window Object");
-		return;
-	}
-	rv = oDomWindow->ScrollByPages(1);
-	RvTestResult(rv, "nsIDOMWindow::ScrollByPages()' rv test", 0);
-}
-
-void CDomWindow::SizeToContent()
-{
-	nsCOMPtr<nsIDOMWindow> oDomWindow;
-	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
-    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
-
-	if (!oDomWindow)
-	{
-		AfxMessageBox("Cannot create Dom Window Object");
-		return;
-	}
-	rv = oDomWindow->SizeToContent();
-	RvTestResult(rv, "nsIDOMWindow::SizeToContent()' rv test", 0);
-}
-
-
-nsIDOMWindow* CDomWindow::GetDOMOWindowObject()
-{
-	nsCOMPtr<nsIDOMWindow> oDomWindow;
-	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
-	if (!oDomWindow)
-		AfxMessageBox("Cannot create Dom Window Object");
-	return oDomWindow;
-
-}
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: NPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Netscape Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is 
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Ashish Bhatt <ashishbhatt@netscape.com> 
+ *
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the NPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the NPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+// File Overview....
+//
+// Test cases for the nsIDOMWindow Interface
+
+
+#include "stdafx.h"
+#include "QaUtils.h"
+#include <stdio.h>
+#include "domWindow.h"
+#include "resource.h"
+
+
+CDomWindow::CDomWindow(nsIWebBrowser* mWebBrowser)
+{
+	qaWebBrowser = mWebBrowser ;
+}
+
+CDomWindow::~CDomWindow()
+{
+
+}
+
+
+void CDomWindow::OnStartTests(UINT nMenuID)
+{
+	// Calls  all or indivdual test cases on the basis of the 
+	// option selected from menu.
+
+	switch(nMenuID)
+	{
+	case ID_INTERFACES_NSIDOMWINDOW_RUNALLTESTS :
+		RunAllTests();
+		break;
+	case ID_INTERFACES_NSIDOMWINDOW_GETDOMDOCUMENT :
+		GetDocument();
+		break;
+	case ID_INTERFACES_NSIDOMWINDOW_GETPARENT : 
+		GetParent();
+		break;
+	case ID_INTERFACES_NSIDOMWINDOW_GETSCROLLBARS :
+		GetScrollbars();
+		break;
+	case ID_INTERFACES_NSIDOMWINDOW_GETFRAMES :
+		GetFrames();
+		break;
+	case ID_INTERFACES_NSIDOMWINDOW_GETNAME :
+		//GetName();
+		break;
+	case ID_INTERFACES_NSIDOMWINDOW_GETTEXTZOOM : 
+		GetTextZoom();
+		break;
+	case ID_INTERFACES_NSIDOMWINDOW_SETTEXTZOOM : 
+		SetTextZoom();
+		break;
+	case ID_INTERFACES_NSIDOMWINDOW_GETSCSOLLX : 
+		GetScrollX();
+		break;
+	case ID_INTERFACES_NSIDOMWINDOW_GETSCROLLY :
+		GetScrollY();
+		break;
+	case ID_INTERFACES_NSIDOMWINDOW_SCROLLTO :
+		ScrollTo();
+		break;
+	case ID_INTERFACES_NSIDOMWINDOW_SCROLLBY :
+		ScrollBy();
+		break;
+	case ID_INTERFACES_NSIDOMWINDOW_GETSELECTION :
+		GetSelection();
+		break;
+	case ID_INTERFACES_NSIDOMWINDOW_SCROLLBYLINES :
+		ScrollByLines();
+		break;
+	case ID_INTERFACES_NSIDOMWINDOW_SCROLLBYPAGES :
+		ScrollByPages();
+		break;
+	case ID_INTERFACES_NSIDOMWINDOW_SIZETOCONTENT :
+		SizeToContent();
+		break;
+	default :
+		AfxMessageBox("Not added menu handler for this menu item");
+		break;
+	}
+}
+void CDomWindow::RunAllTests()
+{
+	PRInt32 scrollX = 0 ;
+	PRInt32 scrollY = 0;
+	PRInt32 bVisible =0;
+	float fTextZoom = 0.0;
+
+	nsCOMPtr<nsIDOMWindow> oDomWindow;
+	//nsCOMPtr<nsIDOMWindow> oDomWindowTop;
+	//nsCOMPtr<nsIDOMWindow> oDomWindowParent;
+
+	nsCOMPtr<nsIDOMBarProp> oDomBarProp;
+	nsCOMPtr<nsIDOMWindowCollection> oDomWindowCol;
+	nsCOMPtr<nsIDOMDocument> oDomDocument;
+	nsCOMPtr<nsISelection> oSelection;
+	
+	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
+    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 1);
+	if (!oDomWindow)
+	{
+		AfxMessageBox("Cannot create Dom Window Object");
+		return;
+	}
+
+/*	rv = oDomWindow->GetTop(getter_AddRefs(oDomWindowTop));
+    RvTestResult(rv, "nsIDOMWindow::GetTop()' rv test", 1);
+	if (!oDomWindowTop)
+	{
+		AfxMessageBox("Cannot create Dom Window Top Object");
+		return;
+	}
+
+	rv = oDomWindow->GetParent(getter_AddRefs(oDomWindow));
+    RvTestResult(rv, "nsIDOMWindow::GetParent()' rv test", 1);
+	if (!oDomWindow)
+	{
+		AfxMessageBox("Cannot create Dom Window Parent Object");
+		return;
+	}
+
+*/
+
+	rv = oDomWindow->GetScrollbars(getter_AddRefs(oDomBarProp));
+    RvTestResult(rv, "nsIDOMWindow::GetScrollbars()' rv test", 1);
+	if (!oDomBarProp)
+	{
+		AfxMessageBox("Cannot create Dom Window Scroll Bar Object");
+		return;
+	}
+
+	rv = oDomWindow->GetFrames(getter_AddRefs(oDomWindowCol));
+    RvTestResult(rv, "nsIDOMWindow::GetFrames()' rv test", 1);
+	if (!oDomWindowCol)
+	{
+		AfxMessageBox("Cannot create Dom Window Collection Object");
+		return;
+	}
+
+	rv = oDomWindow->GetDocument(getter_AddRefs(oDomDocument));
+    RvTestResult(rv, "nsIDOMWindow::GetDocument()' rv test", 1);
+	if (!oDomDocument)
+	{
+		AfxMessageBox("Cannot create Dom Document Object");
+		return;
+	}
+
+	rv = oDomWindow->GetSelection(getter_AddRefs(oSelection));
+    RvTestResult(rv, "nsIDOMWindow::GetSelection()' rv test", 1);
+	if (!oSelection)
+	{
+		AfxMessageBox("Cannot get the  Selection Object");
+		return;
+	}
+
+	//  nsIDOMBarProp's only attribute
+	//rv = oDomBarProp->GetVisible(&bVisible);
+
+
+	rv = oDomWindow->GetTextZoom(&fTextZoom);
+	    RvTestResult(rv, "nsIDOMWindow::GetTextZoom()' rv test", 1);
+
+	rv = oDomWindow->SetTextZoom(12.0);
+	//fTextZoom = 4.0 ;
+	rv = oDomWindow->SetTextZoom(fTextZoom);
+	    RvTestResult(rv, "nsIDOMWindow::SetTextZoom()' rv test", 1);
+
+	rv = oDomWindow->GetScrollX(&scrollX);
+	   RvTestResult(rv, "nsIDOMWindow::GetScrollX()' rv test", 1);
+
+	rv = oDomWindow->GetScrollY(&scrollY);
+	   RvTestResult(rv, "nsIDOMWindow::GetScrollY()' rv test", 1);
+
+	rv = oDomWindow->ScrollTo(100,100);
+	   RvTestResult(rv, "nsIDOMWindow::ScrollTo()' rv test", 1);
+
+
+	rv = oDomWindow->ScrollBy(5, 5);
+	   RvTestResult(rv, "nsIDOMWindow::ScrollBy()' rv test", 1);
+
+	rv = oDomWindow->ScrollByLines(5);
+	   RvTestResult(rv, "nsIDOMWindow::ScrollByLines()' rv test", 1);
+
+	rv = oDomWindow->ScrollByPages(1);
+	   RvTestResult(rv, "nsIDOMWindow::ScrollByPages()' rv test", 1);
+
+	//rv = oDomWindow->SizeToContent();
+	//   RvTestResult(rv, "nsIDOMWindow::SizeToContent()' rv test", 1);
+
+}
+
+void CDomWindow::GetTop()
+{
+	nsCOMPtr<nsIDOMWindow> oDomWindow;
+	nsCOMPtr<nsIDOMWindow> oDomWindowTop;
+	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
+    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
+	if (!oDomWindow)
+	{
+		AfxMessageBox("Cannot create Dom Window Object");
+		return;
+	}
+
+    rv = oDomWindow->GetTop(getter_AddRefs(oDomWindowTop));
+    RvTestResult(rv, "nsIDOMWindow::GetTop()' rv test", 1);
+	if (!oDomWindowTop)
+	{
+		AfxMessageBox("Cannot create Dom Window Top Object");
+		return;
+	}
+}
+
+void CDomWindow::GetParent()
+{
+	nsCOMPtr<nsIDOMWindow> oDomWindow;
+	nsCOMPtr<nsIDOMWindow> oDomWindowParent;
+
+	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
+    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
+	if (!oDomWindow)
+	{
+		AfxMessageBox("Cannot create Dom Window Object");
+		return;
+	}
+
+	rv = oDomWindow->GetParent(getter_AddRefs(oDomWindow));
+    RvTestResult(rv, "nsIDOMWindow::GetParent()' rv test", 0);
+	if (!oDomWindow)
+	{
+		AfxMessageBox("Cannot create Dom Window Parent Object");
+		return;
+	}
+
+}
+
+
+void CDomWindow::GetScrollbars()
+{
+	nsCOMPtr<nsIDOMWindow> oDomWindow;
+	nsCOMPtr<nsIDOMBarProp> oDomBarProp;
+
+	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
+    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
+	if (!oDomWindow)
+	{
+		AfxMessageBox("Cannot create Dom Window Object");
+		return;
+	}
+
+	rv = oDomWindow->GetScrollbars(getter_AddRefs(oDomBarProp));
+    RvTestResult(rv, "nsIDOMWindow::GetScrollbars()' rv test", 0);
+	if (!oDomBarProp)
+	{
+		AfxMessageBox("Cannot create Dom Window Scroll Bar Object");
+		return;
+	}
+
+}
+
+void CDomWindow::GetFrames()
+{
+	nsCOMPtr<nsIDOMWindow> oDomWindow;
+	nsCOMPtr<nsIDOMWindowCollection> oDomWindowCol;
+
+	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
+    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
+	if (!oDomWindow)
+	{
+		AfxMessageBox("Cannot create Dom Window Object");
+		return;
+	}
+	rv = oDomWindow->GetFrames(getter_AddRefs(oDomWindowCol));
+    RvTestResult(rv, "nsIDOMWindow::GetFrames()' rv test", 0);
+	if (!oDomWindowCol)
+	{
+		AfxMessageBox("Cannot create Dom Window Collection Object");
+		return;
+	}
+}
+
+void CDomWindow::GetDocument()
+{
+	nsCOMPtr<nsIDOMWindow> oDomWindow;
+	nsCOMPtr<nsIDOMDocument> oDomDocument;
+
+	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
+    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
+	if (!oDomWindow)
+	{
+		AfxMessageBox("Cannot create Dom Window Object");
+		return;
+	}
+
+	rv = oDomWindow->GetDocument(getter_AddRefs(oDomDocument));
+    RvTestResult(rv, "nsIDOMWindow::GetDocument()' rv test",0);
+	if (!oDomDocument)
+	{
+		AfxMessageBox("Cannot create Dom Document Object");
+		return;
+	}
+}
+
+void CDomWindow::GetSelection()
+{
+	nsCOMPtr<nsIDOMWindow> oDomWindow;
+	nsCOMPtr<nsISelection> oSelection;
+
+	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
+    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test",0);
+
+	if (!oDomWindow)
+	{
+		AfxMessageBox("Cannot create Dom Window Object");
+		return;
+	}
+
+	rv = oDomWindow->GetSelection(getter_AddRefs(oSelection));
+    RvTestResult(rv, "nsIDOMWindow::GetSelection()' rv test", 0);
+	if (!oSelection)
+	{
+		AfxMessageBox("Cannot get the  Selection Object");
+		return;
+	}
+}
+
+void CDomWindow::GetTextZoom()
+{
+	float fTextZoom = 0.0 ;
+	nsCOMPtr<nsIDOMWindow> oDomWindow;
+	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
+    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
+
+	if (!oDomWindow)
+	{
+		AfxMessageBox("Cannot create Dom Window Object");
+		return;
+	}
+	rv = oDomWindow->GetTextZoom(&fTextZoom);
+	RvTestResult(rv, "nsIDOMWindow::GetTextZoom()' rv test", 0);
+}
+
+void CDomWindow::SetTextZoom()
+{
+	float fTextZoom = 0.0 ;
+
+	fTextZoom = 12.0;
+	rv = GetDOMOWindowObject()->SetTextZoom(fTextZoom);
+	RvTestResult(rv, "nsIDOMWindow::SetTextZoom()' rv test", 0);
+}
+
+void CDomWindow::GetScrollX()
+{
+	PRInt32 scrollX = 0 ;
+	nsCOMPtr<nsIDOMWindow> oDomWindow;
+	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
+    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
+
+	if (!oDomWindow)
+	{
+		AfxMessageBox("Cannot create Dom Window Object");
+		return;
+	}
+	rv = oDomWindow->GetScrollX(&scrollX);
+	RvTestResult(rv, "nsIDOMWindow::GetScrollX()' rv test", 0);
+}
+
+void CDomWindow::GetScrollY()
+{	
+	PRInt32 scrollY = 0 ;
+	nsCOMPtr<nsIDOMWindow> oDomWindow;
+	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
+    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
+
+	if (!oDomWindow)
+	{
+		AfxMessageBox("Cannot create Dom Window Object");
+		return;
+	}
+	rv = oDomWindow->GetScrollY(&scrollY);
+	RvTestResult(rv, "nsIDOMWindow::GetScrollY()' rv test", 0);
+}
+
+void CDomWindow::ScrollTo()
+{
+	nsCOMPtr<nsIDOMWindow> oDomWindow;
+	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
+    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
+
+	if (!oDomWindow)
+	{
+		AfxMessageBox("Cannot create Dom Window Object");
+		return;
+	}
+	rv = oDomWindow->ScrollTo(100,100);
+    RvTestResult(rv, "nsIDOMWindow::ScrollTo()' rv test", 0);
+}
+
+
+void CDomWindow::ScrollBy()
+{
+	nsCOMPtr<nsIDOMWindow> oDomWindow;
+	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
+    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
+
+	if (!oDomWindow)
+	{
+		AfxMessageBox("Cannot create Dom Window Object");
+		return;
+	}
+	rv = oDomWindow->ScrollBy(5, 5);
+	RvTestResult(rv, "nsIDOMWindow::ScrollBy()' rv test", 0);
+}
+
+void CDomWindow::ScrollByLines()
+{
+	nsCOMPtr<nsIDOMWindow> oDomWindow;
+	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
+    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
+
+	if (!oDomWindow)
+	{
+		AfxMessageBox("Cannot create Dom Window Object");
+		return;
+	}
+	rv = oDomWindow->ScrollByLines(5);
+    RvTestResult(rv, "nsIDOMWindow::ScrollByLines()' rv test",0);
+
+}
+
+void CDomWindow::ScrollByPages()
+{
+	nsCOMPtr<nsIDOMWindow> oDomWindow;
+	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
+    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
+
+	if (!oDomWindow)
+	{
+		AfxMessageBox("Cannot create Dom Window Object");
+		return;
+	}
+	rv = oDomWindow->ScrollByPages(1);
+	RvTestResult(rv, "nsIDOMWindow::ScrollByPages()' rv test", 0);
+}
+
+void CDomWindow::SizeToContent()
+{
+	nsCOMPtr<nsIDOMWindow> oDomWindow;
+	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
+    RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
+
+	if (!oDomWindow)
+	{
+		AfxMessageBox("Cannot create Dom Window Object");
+		return;
+	}
+	rv = oDomWindow->SizeToContent();
+	RvTestResult(rv, "nsIDOMWindow::SizeToContent()' rv test", 0);
+}
+
+
+nsIDOMWindow* CDomWindow::GetDOMOWindowObject()
+{
+	nsCOMPtr<nsIDOMWindow> oDomWindow;
+	rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
+	if (!oDomWindow)
+		AfxMessageBox("Cannot create Dom Window Object");
+	return oDomWindow;
+
+}
--- mozilla-firefox-1.0.4.orig/embedding/qa/testembed/Tests.cpp
+++ mozilla-firefox-1.0.4/embedding/qa/testembed/Tests.cpp
@@ -105,7 +105,7 @@
 	ON_COMMAND(ID_TESTS_NSIPROTOCOLHANDLERNEWURI, OnTestsProtocolHandlerNewURI)
 	ON_COMMAND(ID_TOOLS_REMOVEGHPAGE, OnToolsRemoveGHPage)
 	ON_COMMAND(ID_TOOLS_REMOVEALLGH, OnToolsRemoveAllGH)
-	ON_COMMAND(ID_TOOLS_VIEWLOGFILE, OnToolsViewLogfile)
+	ON_COMMAND(ID_TOOLS_VIEWLOGFILE, OnToolsViewLogfile)
 	ON_COMMAND(ID_TOOLS_TESTYOURMETHOD, OnToolsTestYourMethod)
 	ON_COMMAND(ID_TOOLS_TESTYOURMETHOD2, OnToolsTestYourMethod2)
 	ON_COMMAND(ID_VERIFYBUGS_70228, OnVerifybugs70228)
@@ -778,15 +778,15 @@
 
 	QAOutput("End removal of all pages from the GH file.", 2);
 }
-
-void CTests::OnToolsViewLogfile()
-{
-	char theUri[1024];
-
-	strcpy(theUri, "file://C|/temp/TestOutput.txt");
-	rv = qaWebNav->LoadURI(NS_ConvertASCIItoUCS2(theUri).get(),
-		 nsIWebNavigation::LOAD_FLAGS_NONE, nsnull,nsnull, nsnull);
-}
+
+void CTests::OnToolsViewLogfile()
+{
+	char theUri[1024];
+
+	strcpy(theUri, "file://C|/temp/TestOutput.txt");
+	rv = qaWebNav->LoadURI(NS_ConvertASCIItoUCS2(theUri).get(),
+		 nsIWebNavigation::LOAD_FLAGS_NONE, nsnull,nsnull, nsnull);
+}
 
 // ***********************************************************************
 
--- mozilla-firefox-1.0.4.orig/embedding/qa/testembed/Tests.h
+++ mozilla-firefox-1.0.4/embedding/qa/testembed/Tests.h
@@ -120,7 +120,7 @@
 	afx_msg void OnTestsProtocolHandlerNewURI();
 	afx_msg void OnInterfacesNsifile();
 	afx_msg void OnToolsRemoveGHPage();
-	afx_msg void OnToolsRemoveAllGH();
+	afx_msg void OnToolsRemoveAllGH();
 	afx_msg void OnToolsViewLogfile();
 	afx_msg void OnToolsTestYourMethod();
 	afx_msg void OnToolsTestYourMethod2();
--- mozilla-firefox-1.0.4.orig/embedding/qa/testembed/resource.h
+++ mozilla-firefox-1.0.4/embedding/qa/testembed/resource.h
@@ -90,7 +90,7 @@
 #define ID_TOOLS_TESTYOURMETHOD         32801
 #define ID_TOOLS_TESTYOURMETHOD2        32802
 #define ID_INTERFACES_NSIREQUEST        32803
-#define ID_INTERFACES_TEMP              32804
+#define ID_INTERFACES_TEMP              32804
 #define ID_TOOLS_VIEWLOGFILE			32805
 #define ID_INTERFACES_NSIDOMWINDOW_RUNALLTESTS 32808
 #define ID_INTERFACES_NSIDOMWINDOW_GETDOMDOCUMENT 32809
--- mozilla-firefox-1.0.4.orig/js/src/fdlibm/fdlibm.h
+++ mozilla-firefox-1.0.4/js/src/fdlibm/fdlibm.h
@@ -61,7 +61,7 @@
 #define __LITTLE_ENDIAN
 #endif
 
-#if defined(linux) && (defined(__i386__) || defined(__x86_64__))
+#if defined(linux) && (defined(__i386__) || defined(__x86_64__) || defined(__ia64) || defined(__MIPSEL))
 #define __LITTLE_ENDIAN
 #endif
 
--- mozilla-firefox-1.0.4.orig/js/src/jsapi.h
+++ mozilla-firefox-1.0.4/js/src/jsapi.h
@@ -1130,12 +1130,16 @@
  */
 struct JSPrincipals {
     char *codebase;
+
+    /* XXX unspecified and unused by Mozilla code -- can we remove these? */
     void * (* JS_DLL_CALLBACK getPrincipalArray)(JSContext *cx, JSPrincipals *);
     JSBool (* JS_DLL_CALLBACK globalPrivilegesEnabled)(JSContext *cx, JSPrincipals *);
 
     /* Don't call "destroy"; use reference counting macros below. */
     jsrefcount refcount;
-    void (* JS_DLL_CALLBACK destroy)(JSContext *cx, struct JSPrincipals *);
+
+    void   (* JS_DLL_CALLBACK destroy)(JSContext *cx, JSPrincipals *);
+    JSBool (* JS_DLL_CALLBACK subsume)(JSPrincipals *, JSPrincipals *);
 };
 
 #ifdef JS_THREADSAFE
--- mozilla-firefox-1.0.4.orig/js/src/jsarray.c
+++ mozilla-firefox-1.0.4/js/src/jsarray.c
@@ -805,6 +805,7 @@
     CompareArgs ca;
     jsuint len, newlen, i;
     jsval *vec;
+    JSStackFrame *fp;
     jsid id;
     size_t nbytes;
 
@@ -853,6 +854,12 @@
     newlen = len;
 #endif
 
+    /* Root vec, clearing it first in case a GC nests while we're filling it. */
+    memset(vec, 0, len * sizeof(jsval));
+    fp = cx->fp;
+    fp->vars = vec;
+    fp->nvars = len;
+
     for (i = 0; i < len; i++) {
         ca.status = IndexToId(cx, i, &id);
         if (!ca.status)
--- mozilla-firefox-1.0.4.orig/js/src/jsdbgapi.c
+++ mozilla-firefox-1.0.4/js/src/jsdbgapi.c
@@ -668,11 +668,22 @@
 JS_PUBLIC_API(JSPrincipals *)
 JS_EvalFramePrincipals(JSContext *cx, JSStackFrame *fp, JSStackFrame *caller)
 {
-    if (cx->findObjectPrincipals)
-        return cx->findObjectPrincipals(cx, JSVAL_TO_OBJECT(fp->argv[-2]));
+    JSObject *callee;
+    JSPrincipals *principals, *callerPrincipals;
+
+    if (cx->findObjectPrincipals) {
+        callee = JSVAL_TO_OBJECT(fp->argv[-2]);
+        principals = cx->findObjectPrincipals(cx, callee);
+    } else {
+        principals = NULL;
+    }
     if (!caller)
-        return NULL;
-    return JS_StackFramePrincipals(cx, caller);
+        return principals;
+    callerPrincipals = JS_StackFramePrincipals(cx, caller);
+    return (callerPrincipals && principals &&
+            callerPrincipals->subsume(callerPrincipals, principals))
+           ? principals
+           : callerPrincipals;
 }
 
 JS_PUBLIC_API(void *)
--- mozilla-firefox-1.0.4.orig/js/src/jsdbgapi.h
+++ mozilla-firefox-1.0.4/js/src/jsdbgapi.h
@@ -164,10 +164,11 @@
 JS_StackFramePrincipals(JSContext *cx, JSStackFrame *fp);
 
 /*
- * Like JS_StackFramePrincipals(cx, caller), but if cx->findObjectPrincipals
- * is non-null, return the object principals for fp's callee function object
- * (fp->argv[-2]), which is eval, Function, or a similar eval-like method.
- * The caller parameter should be the result of JS_GetScriptedCaller(cx, fp).
+ * This API is like JS_StackFramePrincipals(cx, caller), except that if
+ * cx->runtime->findObjectPrincipals is non-null, it returns the weaker of
+ * the caller's principals and the object principals of fp's callee function
+ * object (fp->argv[-2]), which is eval, Function, or a similar eval-like
+ * method.  The caller parameter should be JS_GetScriptedCaller(cx, fp).
  *
  * All eval-like methods must use JS_EvalFramePrincipals to acquire a weak
  * reference to the correct principals for the eval call to be secure, given
--- mozilla-firefox-1.0.4.orig/js/src/jsemit.c
+++ mozilla-firefox-1.0.4/js/src/jsemit.c
@@ -1549,6 +1549,17 @@
         return JS_TRUE;
 
     /*
+     * A Script object can be used to split an eval into a compile step done
+     * at construction time, and an execute step done separately, possibly in
+     * a different scope altogether.  We therefore cannot do any name-to-slot
+     * optimizations, but must lookup names at runtime.  Note that script_exec
+     * ensures that its caller's frame has a Call object, so arg and var name
+     * lookups will succeed.
+     */
+    if (cx->fp->flags & JSFRAME_SCRIPT_OBJECT)
+        return JS_TRUE;
+
+    /*
      * We can't optimize if var and closure (a local function not in a larger
      * expression and not at top-level within another's body) collide.
      * XXX suboptimal: keep track of colliding names and deoptimize only those
--- mozilla-firefox-1.0.4.orig/js/src/jsexn.c
+++ mozilla-firefox-1.0.4/js/src/jsexn.c
@@ -425,7 +425,8 @@
         if (checkAccess) {
             v = (fp->fun && fp->argv) ? fp->argv[-2] : JSVAL_NULL;
             if (!JSVAL_IS_PRIMITIVE(v)) {
-                ok = checkAccess(cx, fp->fun->object, callerid, JSACC_READ, &v);
+                ok = checkAccess(cx, JSVAL_TO_OBJECT(fp->argv[-2]), callerid,
+                                 JSACC_READ, &v /* ignored */);
                 if (!ok) {
                     ok = JS_TRUE;
                     break;
--- mozilla-firefox-1.0.4.orig/js/src/jsinterp.h
+++ mozilla-firefox-1.0.4/js/src/jsinterp.h
@@ -96,6 +96,7 @@
 #define JSFRAME_COMPILING     0x40  /* frame is being used by compiler */
 #define JSFRAME_COMPILE_N_GO  0x80  /* compiler-and-go mode, can optimize name
                                        references based on scope chain */ 
+#define JSFRAME_SCRIPT_OBJECT 0x100 /* compiling source for a Script object */
 
 #define JSFRAME_OVERRIDE_SHIFT 24   /* override bit-set params; see jsfun.c */
 #define JSFRAME_OVERRIDE_BITS  8
--- mozilla-firefox-1.0.4.orig/js/src/jsobj.c
+++ mozilla-firefox-1.0.4/js/src/jsobj.c
@@ -152,18 +152,19 @@
 obj_getSlot(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
 {
     uint32 slot;
+    jsid propid;
     JSAccessMode mode;
     uintN attrs;
 
     slot = (uint32) JSVAL_TO_INT(id);
     if (id == INT_TO_JSVAL(JSSLOT_PROTO)) {
-        id = (jsid)cx->runtime->atomState.protoAtom;
+        propid = (jsid)cx->runtime->atomState.protoAtom;
         mode = JSACC_PROTO;
     } else {
-        id = (jsid)cx->runtime->atomState.parentAtom;
+        propid = (jsid)cx->runtime->atomState.parentAtom;
         mode = JSACC_PARENT;
     }
-    if (!OBJ_CHECK_ACCESS(cx, obj, id, mode, vp, &attrs))
+    if (!OBJ_CHECK_ACCESS(cx, obj, propid, mode, vp, &attrs))
         return JS_FALSE;
     *vp = OBJ_GET_SLOT(cx, obj, slot);
     return JS_TRUE;
@@ -174,6 +175,7 @@
 {
     JSObject *pobj;
     uint32 slot;
+    jsid propid;
     uintN attrs;
 
     if (!JSVAL_IS_OBJECT(*vp))
@@ -184,7 +186,8 @@
         return JS_FALSE;
 
     /* __parent__ is readonly and permanent, only __proto__ may be set. */
-    if (!OBJ_CHECK_ACCESS(cx, obj, id, JSACC_PROTO | JSACC_WRITE, vp, &attrs))
+    propid = (jsid) cx->runtime->atomState.protoAtom;
+    if (!OBJ_CHECK_ACCESS(cx, obj, propid, JSACC_PROTO|JSACC_WRITE, vp, &attrs))
         return JS_FALSE;
 
     return js_SetProtoOrParent(cx, obj, slot, pobj);
@@ -1078,10 +1081,13 @@
     }
 #endif
 
-    /* Belt-and-braces: check that this eval callee has access to scopeobj. */
-    if (cx->findObjectPrincipals) {
+    /*
+     * Belt-and-braces: check that the lesser of eval's principals and the
+     * caller's principals has access to scopeobj.
+     */
+    if (principals && cx->findObjectPrincipals) {
         scopePrincipals = cx->findObjectPrincipals(cx, scopeobj);
-        if (scopePrincipals != principals) {
+        if (!principals->subsume(principals, scopePrincipals)) {
             JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
                                  JSMSG_BAD_INDIRECT_CALL, js_eval_str);
             return JS_FALSE;
@@ -3363,6 +3369,7 @@
     JSProperty *prop;
     JSScopeProperty *sprop;
     JSClass *clasp;
+    JSCheckAccessOp check;
     JSBool ok;
 
     if (!js_LookupProperty(cx, obj, id, &pobj, &prop))
@@ -3381,12 +3388,32 @@
     sprop = (JSScopeProperty *)prop;
     *vp = (SPROP_HAS_VALID_SLOT(sprop, OBJ_SCOPE(pobj)))
           ? LOCKED_OBJ_GET_SLOT(pobj, sprop->slot)
+          : ((mode & JSACC_WATCH) == JSACC_PROTO)
+          ? LOCKED_OBJ_GET_SLOT(obj, JSSLOT_PROTO)
+          : (mode == JSACC_PARENT)
+          ? LOCKED_OBJ_GET_SLOT(obj, JSSLOT_PARENT)
           : JSVAL_VOID;
     *attrsp = sprop->attrs;
+
+    /*
+     * If obj's class has a stub (null) checkAccess hook, use the per-runtime
+     * checkObjectAccess callback, if configured.
+     *
+     * We don't want to require all classes to supply a checkAccess hook; we
+     * need that hook only for certain classes used when precompiling scripts
+     * and functions ("brutal sharing").  But for general safety of built-in
+     * magic properties such as __proto__ and __parent__, we route all access
+     * checks, even for classes that stub out checkAccess, through the global
+     * checkObjectAccess hook.  This covers precompilation-based sharing and
+     * (possibly unintended) runtime sharing across trust boundaries.
+     */
     clasp = LOCKED_OBJ_GET_CLASS(obj);
-    if (clasp->checkAccess) {
+    check = clasp->checkAccess;
+    if (!check)
+        check = cx->runtime->checkObjectAccess;
+    if (check) {
         JS_UNLOCK_OBJ(cx, pobj);
-        ok = clasp->checkAccess(cx, obj, ID_TO_VALUE(id), mode, vp);
+        ok = check(cx, obj, ID_TO_VALUE(id), mode, vp);
         JS_LOCK_OBJ(cx, pobj);
     } else {
         ok = JS_TRUE;
@@ -3612,6 +3639,44 @@
     return JS_TRUE;
 }
 
+/*
+ * For shared precompilation of function objects, we support cloning on entry
+ * to an execution context in which the function declaration or expression
+ * should be processed as if it were not precompiled, where the precompiled
+ * function's scope chain does not match the execution context's.  The cloned
+ * function object carries its execution-context scope in its parent slot; it
+ * links to the precompiled function (the "clone-parent") via its proto slot.
+ *
+ * Note that this prototype-based delegation leaves an unchecked access path
+ * from the clone to the clone-parent's 'constructor' property.  If the clone
+ * lives in a less privileged or shared scope than the clone-parent, this is
+ * a security hole, a sharing hazard, or both.  Therefore we check all such
+ * accesses with the following getter/setter pair, which we use when defining
+ * 'constructor' in f.prototype for all function objects f.
+ */
+static JSBool
+CheckCtorGetAccess(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+{
+    JSAtom *atom;
+    uintN attrs;
+
+    atom = cx->runtime->atomState.constructorAtom;
+    JS_ASSERT(id == ATOM_KEY(atom));
+    return OBJ_CHECK_ACCESS(cx, obj, (jsid) atom, JSACC_READ, vp, &attrs);
+}
+
+static JSBool
+CheckCtorSetAccess(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+{
+    JSAtom *atom;
+    jsval oldval;
+    uintN attrs;
+
+    atom = cx->runtime->atomState.constructorAtom;
+    JS_ASSERT(id == ATOM_KEY(atom));
+    return OBJ_CHECK_ACCESS(cx, obj, (jsid) atom, JSACC_WRITE, &oldval, &attrs);
+}
+
 JSBool
 js_SetClassPrototype(JSContext *cx, JSObject *ctor, JSObject *proto,
                      uintN attrs)
@@ -3635,7 +3700,8 @@
      */
     return OBJ_DEFINE_PROPERTY(cx, proto,
                                (jsid)cx->runtime->atomState.constructorAtom,
-                               OBJECT_TO_JSVAL(ctor), NULL, NULL,
+                               OBJECT_TO_JSVAL(ctor),
+                               CheckCtorGetAccess, CheckCtorSetAccess,
                                0, NULL);
 }
 
--- mozilla-firefox-1.0.4.orig/js/src/jsparse.c
+++ mozilla-firefox-1.0.4/js/src/jsparse.c
@@ -738,10 +738,12 @@
 #endif
 
     /* Scan the optional function name into funAtom. */
-    if (js_MatchToken(cx, ts, TOK_NAME))
-        funAtom = CURRENT_TOKEN(ts).t_atom;
-    else
-        funAtom = NULL;
+    funAtom = js_MatchToken(cx, ts, TOK_NAME) ? CURRENT_TOKEN(ts).t_atom : NULL;
+    if (!funAtom && !lambda) {
+        js_ReportCompileErrorNumber(cx, ts, NULL, JSREPORT_ERROR,
+                                    JSMSG_SYNTAX_ERROR);
+        return NULL;
+    }
 
     /* Find the nearest variable-declaring scope and use it as our parent. */
     parent = cx->fp->varobj;
@@ -926,13 +928,14 @@
     }
 
 #if JS_HAS_LEXICAL_CLOSURE
-    if (lambda || !funAtom) {
+    JS_ASSERT(lambda || funAtom);
+    if (lambda) {
         /*
          * ECMA ed. 3 standard: function expression, possibly anonymous (even
          * if at top-level, an unnamed function is an expression statement, not
          * a function declaration).
          */
-        op = fun->atom ? JSOP_NAMEDFUNOBJ : JSOP_ANONFUNOBJ;
+        op = funAtom ? JSOP_NAMEDFUNOBJ : JSOP_ANONFUNOBJ;
     } else if (tc->topStmt) {
         /*
          * ECMA ed. 3 extension: a function expression statement not at the
--- mozilla-firefox-1.0.4.orig/js/src/jsregexp.c
+++ mozilla-firefox-1.0.4/js/src/jsregexp.c
@@ -3426,10 +3426,14 @@
 JSClass js_RegExpClass = {
     js_RegExp_str,
     JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(1),
-    JS_PropertyStub,  JS_PropertyStub,  regexp_getProperty, regexp_setProperty,
-    JS_EnumerateStub, JS_ResolveStub,   JS_ConvertStub,     regexp_finalize,
-    NULL,             NULL,             regexp_call,        NULL,
-    regexp_xdrObject, NULL,             regexp_mark,        0
+    JS_PropertyStub,    JS_PropertyStub,
+    regexp_getProperty, regexp_setProperty,
+    JS_EnumerateStub,   JS_ResolveStub,
+    JS_ConvertStub,     regexp_finalize,
+    NULL,               NULL,
+    regexp_call,        NULL,
+    regexp_xdrObject,   NULL,
+    regexp_mark,        NULL
 };
 
 static const jschar empty_regexp_ucstr[] = {'(', '?', ':', ')', 0};
--- mozilla-firefox-1.0.4.orig/js/src/jsscript.c
+++ mozilla-firefox-1.0.4/js/src/jsscript.c
@@ -202,7 +202,7 @@
     }
 
     /* Compile the new script using the caller's scope chain, a la eval(). */
-    fp->flags |= JSFRAME_EVAL;
+    fp->flags |= JSFRAME_EVAL | JSFRAME_SCRIPT_OBJECT;
     script = JS_CompileUCScriptForPrincipals(cx, scopeobj, principals,
                                              JSSTRING_CHARS(str),
                                              JSSTRING_LENGTH(str),
@@ -232,7 +232,7 @@
     JSScript *script;
     JSObject *scopeobj, *parent;
     JSStackFrame *fp, *caller;
-    JSPrincipals *scopePrincipals;
+    JSPrincipals *principals, *scopePrincipals;
 
     if (!JS_InstanceOf(cx, obj, &js_ScriptClass, argv))
         return JS_FALSE;
@@ -293,9 +293,10 @@
     }
 
     /* Belt-and-braces: check that this script object has access to scopeobj. */
-    if (cx->findObjectPrincipals) {
+    principals = script->principals;
+    if (principals && cx->findObjectPrincipals) {
         scopePrincipals = cx->findObjectPrincipals(cx, scopeobj);
-        if (scopePrincipals != script->principals) {
+        if (!principals->subsume(principals, scopePrincipals)) {
             JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
                                  JSMSG_BAD_INDIRECT_CALL,
                                  "Script.prototype.exec");
--- mozilla-firefox-1.0.4.orig/js/src/jsstr.c
+++ mozilla-firefox-1.0.4/js/src/jsstr.c
@@ -1171,20 +1171,29 @@
              * vs. non-null return value, optimize away the array object that
              * would normally be returned in *rval.
              */
-            JS_ASSERT(*cx->fp->down->pc == JSOP_CALL ||
-                      *cx->fp->down->pc == JSOP_NEW);
-            JS_ASSERT(js_CodeSpec[*cx->fp->down->pc].length == 3);
-            switch (cx->fp->down->pc[3]) {
-              case JSOP_POP:
-              case JSOP_IFEQ:
-              case JSOP_IFNE:
-              case JSOP_IFEQX:
-              case JSOP_IFNEX:
-                test = JS_TRUE;
-                break;
-              default:
-                test = JS_FALSE;
-                break;
+            JSStackFrame *fp = cx->fp->down;
+
+            /* Skip Function.prototype.call and .apply frames. */
+            while (fp && !fp->pc) {
+                JS_ASSERT(!fp->script);
+                fp = fp->down;
+            }
+
+            /* Assume a full array result is required, then prove otherwise. */
+            test = JS_FALSE;
+            if (fp) {
+                JS_ASSERT(*fp->pc == JSOP_CALL || *fp->pc == JSOP_NEW);
+                JS_ASSERT(js_CodeSpec[*fp->pc].length == 3);
+                switch (fp->pc[3]) {
+                  case JSOP_POP:
+                  case JSOP_IFEQ:
+                  case JSOP_IFNE:
+                  case JSOP_IFEQX:
+                  case JSOP_IFNEX:
+                    test = JS_TRUE;
+                    break;
+                  default:;
+                }
             }
         }
         ok = js_ExecuteRegExp(cx, re, str, &index, test, rval);
--- mozilla-firefox-1.0.4.orig/js/src/liveconnect/jsj_method.c
+++ mozilla-firefox-1.0.4/js/src/liveconnect/jsj_method.c
@@ -1696,7 +1696,7 @@
 
     /* XXX, workaround for bug 200016, all classes in sun.plugin package should not 
        be accessible in liveconnect.
-       Ideally, this checking should be done in JPI side, but it's not going to happen 
+       Ideally, this checking should be done in JPI side, but it's not going to happen 
        until Sun JRE 1.5.1 */
     if (strstr(class_descriptor->name, "sun.plugin.") == class_descriptor->name)
         return JS_FALSE;
--- mozilla-firefox-1.0.4.orig/js/src/xpconnect/loader/mozJSComponentLoader.cpp
+++ mozilla-firefox-1.0.4/js/src/xpconnect/loader/mozJSComponentLoader.cpp
@@ -404,6 +404,7 @@
 
 mozJSComponentLoader::mozJSComponentLoader()
     : mRuntime(nsnull),
+      mContext(nsnull),
       mModules(nsnull),
       mGlobals(nsnull),
       mInitialized(PR_FALSE)
@@ -478,7 +479,7 @@
 mozJSComponentLoader::Init(nsIComponentManager *aCompMgr, nsISupports *aReg)
 {
     mCompMgr = aCompMgr;
-         
+
     nsresult rv;
     mLoaderManager = do_QueryInterface(mCompMgr, &rv);
     if (NS_FAILED(rv))
@@ -503,6 +504,11 @@
         NS_FAILED(rv = mRuntimeService->GetRuntime(&mRuntime)))
         return rv;
 
+    // Create our compilation context.
+    mContext = JS_NewContext(mRuntime, 256);
+    if (!mContext)
+        return NS_ERROR_OUT_OF_MEMORY;
+
 #ifndef XPCONNECT_STANDALONE
     nsCOMPtr<nsIScriptSecurityManager> secman = 
         do_GetService(kScriptSecurityManagerContractID);
@@ -922,9 +928,7 @@
     if (!xpc)
         return nsnull;
 
-    JSCLAutoContext cx(mRuntime);
-    if(NS_FAILED(cx.GetError()))
-        return nsnull;
+    JSCLContextHelper cx(mContext);
 
     JSObject* cm_jsobj;
     nsCOMPtr<nsIXPConnectJSObjectHolder> cm_holder;
@@ -1014,9 +1018,7 @@
     nsresult rv;
     JSPrincipals* jsPrincipals = nsnull;
 
-    JSCLAutoContext cx(mRuntime);
-    if (NS_FAILED(cx.GetError()))
-        return nsnull;
+    JSCLContextHelper cx(mContext);
 
 #ifndef XPCONNECT_STANDALONE
     nsCOMPtr<nsIScriptObjectPrincipal> backstagePass =
@@ -1037,6 +1039,10 @@
     if (!xpc)
         goto out;
 
+    // Make sure InitClassesWithNewWrappedGlobal() installs the
+    // backstage pass as the global in our compilation context.
+    JS_SetGlobalObject(cx, nsnull);
+
     rv = xpc->InitClassesWithNewWrappedGlobal(cx, backstagePass,
                                               NS_GET_IID(nsISupports),
                                               PR_FALSE,
@@ -1179,11 +1185,9 @@
         PL_HashTableDestroy(mGlobals);
         mGlobals = nsnull;
 
-        JSContext* cx = JS_NewContext(mRuntime, 256);
-        if (cx) {
-            JS_GC(cx);
-            JS_DestroyContext(cx);
-        }
+        // Destroying our context will force a GC.
+        JS_DestroyContext(mContext);
+        mContext = nsnull;
 
         mRuntimeService = nsnull;
     }
@@ -1197,50 +1201,20 @@
 
 //----------------------------------------------------------------------
 
-JSCLAutoContext::JSCLAutoContext(JSRuntime* rt)
-    : mContext(nsnull), mError(NS_OK), mPopNeeded(JS_FALSE), mContextThread(0)
+JSCLContextHelper::JSCLContextHelper(JSContext *cx)
+    : mContext(cx), mContextThread(0)
 {
-    nsCOMPtr<nsIThreadJSContextStack> cxstack = 
-        do_GetService(kJSContextStackContractID, &mError);
-    
-    if (NS_SUCCEEDED(mError)) {
-        mError = cxstack->GetSafeJSContext(&mContext);
-        if (NS_SUCCEEDED(mError) && mContext) {
-            mError = cxstack->Push(mContext);
-            if (NS_SUCCEEDED(mError)) {
-                mPopNeeded = JS_TRUE;   
-            } 
-        } 
-    }
-    
-    if (mContext) {
-        mContextThread = JS_GetContextThread(mContext);
-        if (mContextThread) {
-            JS_BeginRequest(mContext);
-        } 
-    } else {
-        if (NS_SUCCEEDED(mError)) {
-            mError = NS_ERROR_FAILURE;
-        }
-    }
+    mContextThread = JS_GetContextThread(mContext);
+    if (mContextThread) {
+        JS_BeginRequest(mContext);
+    } 
 }
 
-JSCLAutoContext::~JSCLAutoContext()
+JSCLContextHelper::~JSCLContextHelper()
 {
-    if (mContext && mContextThread) {
-        JS_ClearNewbornRoots(mContext);
+    JS_ClearNewbornRoots(mContext);
+    if (mContextThread)
         JS_EndRequest(mContext);
-    }
-
-    if (mPopNeeded) {
-        nsCOMPtr<nsIThreadJSContextStack> cxstack = 
-            do_GetService(kJSContextStackContractID);
-        if (cxstack) {
-            JSContext* cx;
-            nsresult rv = cxstack->Pop(&cx);
-            NS_ASSERTION(NS_SUCCEEDED(rv) && cx == mContext, "push/pop mismatch");
-        }        
-    }        
 }        
 
 //----------------------------------------------------------------------
--- mozilla-firefox-1.0.4.orig/js/src/xpconnect/loader/mozJSComponentLoader.h
+++ mozilla-firefox-1.0.4/js/src/xpconnect/loader/mozJSComponentLoader.h
@@ -87,6 +87,7 @@
     nsCOMPtr<nsIPrincipal> mSystemPrincipal;
 #endif
     JSRuntime *mRuntime;
+    JSContext *mContext;
     PLHashTable *mModules;
     PLHashTable *mGlobals;
 
@@ -94,22 +95,17 @@
     nsSupportsArray mDeferredComponents;
 };
 
-class JSCLAutoContext
+class JSCLContextHelper
 {
 public:
-    JSCLAutoContext(JSRuntime* rt);
-    ~JSCLAutoContext();
+    JSCLContextHelper(JSContext* cx);
+    ~JSCLContextHelper();
 
     operator JSContext*() const {return mContext;}
-    JSContext* GetContext() const {return mContext;}
-    nsresult   GetError()   const {return mError;}
 
-
-    JSCLAutoContext(); // not implemnted
+    JSCLContextHelper(); // not implemnted
 private:
     JSContext* mContext;
-    nsresult   mError;
-    JSBool     mPopNeeded;
     intN       mContextThread; 
 };
 
--- mozilla-firefox-1.0.4.orig/js/src/xpconnect/src/XPCDispObject.cpp
+++ mozilla-firefox-1.0.4/js/src/xpconnect/src/XPCDispObject.cpp
@@ -418,20 +418,13 @@
 static
 JSBool GetMember(XPCCallContext& ccx, JSObject* funobj, XPCNativeInterface*& iface, XPCDispInterface::Member*& member)
 {
-    // We expect funobj to be a clone, we need the real funobj.
-    JSFunction* fun = (JSFunction*) JS_GetPrivate(ccx, funobj);
-    if(!fun)
-        return JS_FALSE;
-    JSObject* realFunObj = JS_GetFunctionObject(fun);
-    if(!realFunObj)
-        return JS_FALSE;
     jsval val;
-    if(!JS_GetReservedSlot(ccx, realFunObj, 1, &val))
+    if(!JS_GetReservedSlot(ccx, funobj, 1, &val))
         return JS_FALSE;
     if(!JSVAL_IS_INT(val))
         return JS_FALSE;
     iface = NS_REINTERPRET_CAST(XPCNativeInterface*,JSVAL_TO_PRIVATE(val));
-    if(!JS_GetReservedSlot(ccx, realFunObj, 0, &val))
+    if(!JS_GetReservedSlot(ccx, funobj, 0, &val))
         return JS_FALSE;
     if(!JSVAL_IS_INT(val))
         return JS_FALSE;
--- mozilla-firefox-1.0.4.orig/js/src/xpconnect/src/XPCIDispatchExtension.cpp
+++ mozilla-firefox-1.0.4/js/src/xpconnect/src/XPCIDispatchExtension.cpp
@@ -266,7 +266,7 @@
     // Protect the jsval 
     AUTO_MARK_JSVAL(ccx, funval);
     // clone a function we can use for this object 
-    JSObject* funobj = JS_CloneFunctionObject(ccx, JSVAL_TO_OBJECT(funval), obj);
+    JSObject* funobj = xpc_CloneJSFunction(ccx, JSVAL_TO_OBJECT(funval), obj);
     if(!funobj)
         return JS_FALSE;
     jsid id;
--- mozilla-firefox-1.0.4.orig/js/src/xpconnect/src/xpccomponents.cpp
+++ mozilla-firefox-1.0.4/js/src/xpconnect/src/xpccomponents.cpp
@@ -2097,8 +2097,8 @@
         return NS_ERROR_XPC_BAD_CONVERT_JS;
 
     // clone a function we can use for this object 
-    JSObject* funobj = JS_CloneFunctionObject(cx, JSVAL_TO_OBJECT(funval), 
-                                              wrapper->GetFlatJSObject());
+    JSObject* funobj = xpc_CloneJSFunction(inner_cc, JSVAL_TO_OBJECT(funval), 
+                                           wrapper->GetFlatJSObject());
     if(!funobj)
         return NS_ERROR_XPC_BAD_CONVERT_JS;
 
--- mozilla-firefox-1.0.4.orig/js/src/xpconnect/src/xpcjsruntime.cpp
+++ mozilla-firefox-1.0.4/js/src/xpconnect/src/xpcjsruntime.cpp
@@ -55,6 +55,7 @@
     "Components",           // IDX_COMPONENTS
     "wrappedJSObject",      // IDX_WRAPPED_JSOBJECT
     "Object",               // IDX_OBJECT
+    "Function",             // IDX_FUNCTION
     "prototype",            // IDX_PROTOTYPE
     "createInstance"        // IDX_CREATE_INSTANCE
 #ifdef XPC_IDISPATCH_SUPPORT
--- mozilla-firefox-1.0.4.orig/js/src/xpconnect/src/xpcprivate.h
+++ mozilla-firefox-1.0.4/js/src/xpconnect/src/xpcprivate.h
@@ -548,6 +548,7 @@
         IDX_COMPONENTS              ,
         IDX_WRAPPED_JSOBJECT        ,
         IDX_OBJECT                  ,
+        IDX_FUNCTION                ,
         IDX_PROTOTYPE               ,
         IDX_CREATE_INSTANCE         ,
 #ifdef XPC_IDISPATCH_SUPPORT
@@ -1002,6 +1003,9 @@
     JSObject*
     GetPrototypeJSObject() const {return mPrototypeJSObject;}
 
+    JSObject*
+    GetPrototypeJSFunction() const {return mPrototypeJSFunction;}
+
     void RemoveWrappedNativeProtos();
 
     static XPCWrappedNativeScope*
@@ -1062,6 +1066,7 @@
     XPCWrappedNativeScope*           mNext;
     JSObject*                        mGlobalJSObject;
     JSObject*                        mPrototypeJSObject;
+    JSObject*                        mPrototypeJSFunction;
 };
 
 /***************************************************************************/
@@ -3222,6 +3227,9 @@
 
 void XPC_WN_JSOps_Shutdown();
 
+JSObject* xpc_CloneJSFunction(XPCCallContext &ccx, JSObject *funobj,
+                              JSObject *parent);
+
 /***************************************************************************/
 // Inlined utilities.
 
--- mozilla-firefox-1.0.4.orig/js/src/xpconnect/src/xpcwrappednativeinfo.cpp
+++ mozilla-firefox-1.0.4/js/src/xpconnect/src/xpcwrappednativeinfo.cpp
@@ -43,6 +43,44 @@
 #include "xpcprivate.h"
 
 /***************************************************************************/
+
+/*
+ * Helper that clones JS Function objects along with both of its
+ * reserved slots.
+ */
+
+JSObject *
+xpc_CloneJSFunction(XPCCallContext &ccx, JSObject *funobj, JSObject *parent)
+{
+    JSObject *clone = JS_CloneFunctionObject(ccx, funobj, parent);
+    if(!clone)
+        return nsnull;
+
+    XPCWrappedNativeScope *scope = 
+        XPCWrappedNativeScope::FindInJSObjectScope(ccx, parent);
+
+    if (!scope) {
+        return nsnull;
+    }
+
+    // Make sure to break the prototype chain to the function object
+    // we cloned to prevent its scope from leaking into the clones
+    // scope.
+    JS_SetPrototype(ccx, clone, scope->GetPrototypeJSFunction());
+
+    // Copy the reserved slots to the clone.
+    jsval ifaceVal, memberVal;
+    if(!JS_GetReservedSlot(ccx, funobj, 0, &ifaceVal) ||
+       !JS_GetReservedSlot(ccx, funobj, 1, &memberVal))
+        return nsnull;
+
+    if(!JS_SetReservedSlot(ccx, clone, 0, ifaceVal) ||
+       !JS_SetReservedSlot(ccx, clone, 1, memberVal))
+        return nsnull;
+
+    return clone;
+}
+
 // XPCNativeMember
 
 // static
@@ -52,19 +90,11 @@
                              XPCNativeInterface** pInterface,
                              XPCNativeMember**    pMember)
 {
-    JSFunction* fun;
-    JSObject* realFunObj;
-
-    // We expect funobj to be a clone, we need the real funobj.
-
-    fun = (JSFunction*) JS_GetPrivate(ccx, funobj);
-    realFunObj = JS_GetFunctionObject(fun);
-
     jsval ifaceVal;
     jsval memberVal;
 
-    if(!JS_GetReservedSlot(ccx, realFunObj, 0, &ifaceVal) ||
-       !JS_GetReservedSlot(ccx, realFunObj, 1, &memberVal) ||
+    if(!JS_GetReservedSlot(ccx, funobj, 0, &ifaceVal) ||
+       !JS_GetReservedSlot(ccx, funobj, 1, &memberVal) ||
        !JSVAL_IS_INT(ifaceVal) || !JSVAL_IS_INT(memberVal))
     {
         return JS_FALSE;
--- mozilla-firefox-1.0.4.orig/js/src/xpconnect/src/xpcwrappednativejsops.cpp
+++ mozilla-firefox-1.0.4/js/src/xpconnect/src/xpcwrappednativejsops.cpp
@@ -454,7 +454,7 @@
 
         AUTO_MARK_JSVAL(ccx, funval);
 
-        funobj = JS_CloneFunctionObject(ccx, JSVAL_TO_OBJECT(funval), obj);
+        funobj = xpc_CloneJSFunction(ccx, JSVAL_TO_OBJECT(funval), obj);
         if(!funobj)
             return JS_FALSE;
     }
@@ -1024,7 +1024,7 @@
 
         // clone a function we can use for this object
         JSObject* funobj =
-            JS_CloneFunctionObject(cx, JSVAL_TO_OBJECT(val), obj);
+            xpc_CloneJSFunction(ccx, JSVAL_TO_OBJECT(val), obj);
         if(!funobj)
             return Throw(NS_ERROR_XPC_BAD_CONVERT_JS, cx);
 
--- mozilla-firefox-1.0.4.orig/js/src/xpconnect/src/xpcwrappednativescope.cpp
+++ mozilla-firefox-1.0.4/js/src/xpconnect/src/xpcwrappednativescope.cpp
@@ -182,6 +182,7 @@
 
         jsval val;
         jsid idObj = mRuntime->GetStringID(XPCJSRuntime::IDX_OBJECT);
+        jsid idFun = mRuntime->GetStringID(XPCJSRuntime::IDX_FUNCTION);
         jsid idProto = mRuntime->GetStringID(XPCJSRuntime::IDX_PROTOTYPE);
 
         if(OBJ_GET_PROPERTY(ccx, aGlobal, idObj, &val) &&
@@ -195,6 +196,18 @@
         {
             NS_ERROR("Can't get globalObject.Object.prototype");
         }
+
+        if(OBJ_GET_PROPERTY(ccx, aGlobal, idFun, &val) &&
+           !JSVAL_IS_PRIMITIVE(val) &&
+           OBJ_GET_PROPERTY(ccx, JSVAL_TO_OBJECT(val), idProto, &val) &&
+           !JSVAL_IS_PRIMITIVE(val))
+        {
+            mPrototypeJSFunction = JSVAL_TO_OBJECT(val);
+        }
+        else
+        {
+            NS_ERROR("Can't get globalObject.Function.prototype");
+        }
     }
 }
 
--- mozilla-firefox-1.0.4.orig/netwerk/base/src/nsStandardURL.cpp
+++ mozilla-firefox-1.0.4/netwerk/base/src/nsStandardURL.cpp
@@ -412,6 +412,7 @@
     nsCAutoString encUsername;
     nsCAutoString encPassword;
     nsCAutoString encHost;
+    PRBool useEncHost;
     nsCAutoString encDirectory;
     nsCAutoString encBasename;
     nsCAutoString encExtension;
@@ -449,6 +450,7 @@
     // However, perform Unicode normalization on it, as IDN does.
     mHostEncoding = eEncoding_ASCII;
     if (mHost.mLen > 0) {
+        useEncHost = PR_FALSE;
         const nsCSubstring& tempHost =
             Substring(spec + mHost.mPos, spec + mHost.mPos + mHost.mLen);
         if (IsASCII(tempHost))
@@ -456,9 +458,10 @@
         else {
             mHostEncoding = eEncoding_UTF8;
             if (gIDNService &&
-                NS_SUCCEEDED(gIDNService->Normalize(tempHost, encHost)))
+                NS_SUCCEEDED(gIDNService->Normalize(tempHost, encHost))) {
                 approxLen += encHost.Length();
-            else {
+                useEncHost = PR_TRUE;
+            } else {
                 encHost.Truncate();
                 approxLen += mHost.mLen;
             }
@@ -492,7 +495,12 @@
         buf[i++] = '@';
     }
     if (mHost.mLen > 0) {
-        i = AppendSegmentToBuf(buf, i, spec, mHost, &encHost);
+        if (useEncHost) {
+            mHost.mPos = i;
+            mHost.mLen = encHost.Length();
+            i = AppendToBuf(buf, i, encHost.get(), mHost.mLen);
+        } else
+            i = AppendSegmentToBuf(buf, i, spec, mHost);
         net_ToLowerCase(buf + mHost.mPos, mHost.mLen);
         if (mPort != -1 && mPort != mDefaultPort) {
             nsCAutoString portbuf;
--- mozilla-firefox-1.0.4.orig/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp
+++ mozilla-firefox-1.0.4/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp
@@ -1051,22 +1051,25 @@
     mResponseMsg = "";
 
     if (mAnonymous) {
-        char* anonPassword = nsnull;
-        PRBool useRealEmail = PR_FALSE;
-        nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
-        if (prefs) {
-            rv = prefs->GetBoolPref("advanced.mailftp", &useRealEmail);
-            if (NS_SUCCEEDED(rv) && useRealEmail)
-                prefs->GetCharPref("network.ftp.anonymous_password", &anonPassword);
-        }
-        if (useRealEmail && anonPassword && *anonPassword != '\0') {
-            passwordStr.Append(anonPassword);
-            nsMemory::Free(anonPassword);
-        }
-        else {
-            // We need to default to a valid email address - bug 101027
-            // example.com is reserved (rfc2606), so use that
-            passwordStr.Append("mozilla@example.com");
+        if (!mPassword.IsEmpty()) {
+            // XXX Is UTF-8 the best choice?
+            AppendUTF16toUTF8(mPassword, passwordStr);
+        } else {
+            nsXPIDLCString anonPassword;
+            PRBool useRealEmail = PR_FALSE;
+            nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
+            if (prefs) {
+                rv = prefs->GetBoolPref("advanced.mailftp", &useRealEmail);
+                if (NS_SUCCEEDED(rv) && useRealEmail)
+                    prefs->GetCharPref("network.ftp.anonymous_password", getter_Copies(anonPassword));
+            }
+            if (!anonPassword.IsEmpty()) {
+                passwordStr.Append(anonPassword);
+            } else {
+                // We need to default to a valid email address - bug 101027
+                // example.com is reserved (rfc2606), so use that
+                passwordStr.Append("mozilla@example.com");
+            }
         }
     } else {
         if (mPassword.IsEmpty() || mRetryPass) {
@@ -1146,6 +1149,12 @@
             }
         }
 
+        // If the login was anonymous, and it failed, try again with a username
+        if (mAnonymous) {
+            mAnonymous = PR_FALSE;
+            return FTP_S_USER;
+        }
+
         mRetryPass = PR_TRUE;
         return FTP_ERROR;
     }
--- mozilla-firefox-1.0.4.orig/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp
+++ mozilla-firefox-1.0.4/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp
@@ -834,8 +834,8 @@
 void
 nsHttpConnectionMgr::OnMsgUpdateParam(nsresult status, void *param)
 {
-    PRUint16 name  = (PRUint32(param) & 0xFFFF0000) >> 16;
-    PRUint16 value =  PRUint32(param) & 0x0000FFFF;
+    PRUint16 name  = (NS_PTR_TO_INT32(param) & 0xFFFF0000) >> 16;
+    PRUint16 value =  NS_PTR_TO_INT32(param) & 0x0000FFFF;
 
     switch (name) {
     case MAX_CONNECTIONS:
--- mozilla-firefox-1.0.4.orig/netwerk/protocol/http/src/nsHttpHandler.cpp
+++ mozilla-firefox-1.0.4/netwerk/protocol/http/src/nsHttpHandler.cpp
@@ -669,8 +669,30 @@
     if (ret >= 0) {
         nsCString buf;  
         buf =  (char*)name.sysname;
+#ifdef AIX
         buf += ' ';
-        buf += (char*)name.machine;
+        // AIX uname returns machine specific info in the uname.machine
+        // field and does not return the cpu type like other platforms.
+        // We use the AIX version and release numbers instead.
+        buf += (char*)name.version;
+        buf += '.';
+        buf += (char*)name.release;
+#else
+        if (strcmp(name.machine, "x86_64") == 0 &&
+            sizeof(long) == sizeof(PRInt32)) {
+            // We're running 32-bit code on x86_64. Make this browser
+            // look like it's running on i686 hardware, but append "
+            // (x86_64)" to the end of the oscpu identifier to be able
+            // to differentiate this from someone running 64-bit code
+            // on x86_64..
+
+            buf += " i686 (x86_64)";
+        } else {
+            buf += ' ';
+
+            buf += (char*)name.machine;
+        }
+#endif
         mOscpu.Assign(buf);
     }
 #endif
--- mozilla-firefox-1.0.4.orig/rdf/chrome/src/nsChromeProtocolHandler.cpp
+++ mozilla-firefox-1.0.4/rdf/chrome/src/nsChromeProtocolHandler.cpp
@@ -733,7 +733,8 @@
         rv = url->GetFileExtension(fileExtension);
         if (PL_strcasecmp(fileExtension.get(), "xul") == 0 ||
             PL_strcasecmp(fileExtension.get(), "html") == 0 ||
-            PL_strcasecmp(fileExtension.get(), "xml") == 0)
+            PL_strcasecmp(fileExtension.get(), "xml") == 0 ||
+            PL_strcasecmp(fileExtension.get(), "xbl") == 0)
         {
             nsCOMPtr<nsIScriptSecurityManager> securityManager =
                      do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
--- mozilla-firefox-1.0.4.orig/xpcom/io/nsAppDirectoryServiceDefs.h
+++ mozilla-firefox-1.0.4/xpcom/io/nsAppDirectoryServiceDefs.h
@@ -75,8 +75,10 @@
 #define NS_APP_CHROME_DIR                       "AChrom"
 #define NS_APP_PLUGINS_DIR                      "APlugns"       // Deprecated - use NS_APP_PLUGINS_DIR_LIST
 #define NS_APP_SEARCH_DIR                       "SrchPlugns"
+#define NS_USER_SEARCH_DIR                      "UsrSrchPlugns"
 
 #define NS_APP_PLUGINS_DIR_LIST                 "APluginsDL"
+#define NS_APP_SEARCH_DIR_LIST                  "ASearchDL"
 
 // --------------------------------------------------------------------------------------
 // Files and directories which exist on a per-profile basis
--- mozilla-firefox-1.0.4.orig/xpcom/io/nsAppFileLocationProvider.cpp
+++ mozilla-firefox-1.0.4/xpcom/io/nsAppFileLocationProvider.cpp
@@ -252,6 +252,12 @@
         if (NS_SUCCEEDED(rv))
             rv = localFile->AppendRelativeNativePath(SEARCH_DIR_NAME);
     }
+    else if (nsCRT::strcmp(prop, NS_USER_SEARCH_DIR) == 0)
+    {
+        rv = GetProductDirectory(getter_AddRefs(localFile));
+        if (NS_SUCCEEDED(rv))
+            rv = localFile->AppendRelativeNativePath(SEARCH_DIR_NAME);
+    }
     else if (nsCRT::strcmp(prop, NS_APP_INSTALL_CLEANUP_DIR) == 0)
     {   
         // This is cloned so that embeddors will have a hook to override
@@ -589,5 +595,16 @@
         NS_IF_ADDREF(*_retval);
         rv = *_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;        
     }
+    if (!nsCRT::strcmp(prop, NS_APP_SEARCH_DIR_LIST))
+    {
+        static const char* keys[] = { nsnull, NS_USER_SEARCH_DIR, NS_APP_SEARCH_DIR, nsnull };
+        if (!keys[0] && !(keys[0] = PR_GetEnv("MOZ_SEARCH_ENGINE_PATH"))) {
+            static const char nullstr = 0;
+            keys[0] = &nullstr;
+        }
+        *_retval = new nsPathsDirectoryEnumerator(this, keys);
+        NS_IF_ADDREF(*_retval);
+        rv = *_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;        
+    }
     return rv;
 }
--- mozilla-firefox-1.0.4.orig/xpcom/reflect/xptcall/public/xptcstubsdecl.inc
+++ mozilla-firefox-1.0.4/xpcom/reflect/xptcall/public/xptcstubsdecl.inc
@@ -258,499 +258,499 @@
 NS_IMETHOD Stub249();
 #else
 NS_IMETHOD Stub3(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub4(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub5(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub6(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub7(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub8(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub9(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub10(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub11(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub12(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub13(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub14(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub15(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub16(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub17(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub18(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub19(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub20(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub21(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub22(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub23(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub24(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub25(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub26(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub27(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub28(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub29(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub30(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub31(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub32(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub33(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub34(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub35(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub36(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub37(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub38(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub39(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub40(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub41(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub42(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub43(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub44(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub45(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub46(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub47(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub48(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub49(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub50(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub51(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub52(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub53(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub54(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub55(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub56(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub57(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub58(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub59(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub60(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub61(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub62(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub63(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub64(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub65(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub66(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub67(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub68(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub69(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub70(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub71(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub72(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub73(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub74(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub75(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub76(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub77(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub78(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub79(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub80(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub81(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub82(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub83(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub84(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub85(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub86(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub87(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub88(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub89(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub90(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub91(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub92(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub93(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub94(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub95(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub96(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub97(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub98(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub99(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub100(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub101(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub102(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub103(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub104(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub105(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub106(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub107(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub108(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub109(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub110(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub111(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub112(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub113(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub114(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub115(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub116(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub117(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub118(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub119(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub120(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub121(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub122(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub123(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub124(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub125(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub126(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub127(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub128(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub129(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub130(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub131(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub132(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub133(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub134(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub135(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub136(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub137(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub138(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub139(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub140(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub141(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub142(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub143(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub144(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub145(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub146(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub147(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub148(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub149(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub150(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub151(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub152(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub153(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub154(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub155(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub156(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub157(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub158(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub159(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub160(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub161(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub162(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub163(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub164(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub165(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub166(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub167(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub168(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub169(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub170(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub171(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub172(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub173(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub174(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub175(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub176(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub177(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub178(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub179(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub180(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub181(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub182(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub183(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub184(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub185(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub186(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub187(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub188(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub189(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub190(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub191(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub192(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub193(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub194(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub195(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub196(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub197(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub198(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub199(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub200(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub201(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub202(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub203(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub204(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub205(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub206(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub207(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub208(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub209(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub210(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub211(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub212(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub213(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub214(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub215(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub216(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub217(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub218(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub219(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub220(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub221(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub222(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub223(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub224(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub225(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub226(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub227(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub228(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub229(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub230(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub231(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub232(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub233(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub234(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub235(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub236(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub237(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub238(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub239(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub240(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub241(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub242(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub243(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub244(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub245(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub246(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub247(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub248(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 NS_IMETHOD Stub249(PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 #endif
 
 /* declarations of sentinel stubs */
--- mozilla-firefox-1.0.4.orig/xpcom/reflect/xptcall/src/md/unix/Makefile.in
+++ mozilla-firefox-1.0.4/xpcom/reflect/xptcall/src/md/unix/Makefile.in
@@ -167,6 +167,20 @@
 endif
 endif
 
+#
+# Linux/HPPA/GCC
+#
+ifeq ($(OS_ARCH),Linux)
+ifneq (,$(filter parisc parisc64,$(OS_TEST)))
+ifeq ($(CC),gcc)
+CPPSRCS		:= xptcinvoke_pa32.cpp xptcstubs_pa32.cpp
+ASFILES		:= xptcstubs_asm_parisc_linux.s xptcinvoke_asm_parisc_linux.s
+CXXFLAGS	+= -O0
+endif
+endif
+endif
+
+
 ######################################################################
 # M68k
 ######################################################################
@@ -210,11 +224,7 @@
 ifneq (,$(findstring mips, $(OS_TEST)))
 CPPSRCS		:= xptcinvoke_mips.cpp xptcstubs_mips.cpp
 ASFILES		:= xptcinvoke_asm_mips.s xptcstubs_asm_mips.s
-#xptcstubs_mips.cpp
-# xptcstubs_asm_mips.s
-ifdef GNU_CC
-ASFLAGS		+= $(INCLUDES) -x assembler-with-cpp -D__GNUC__
-endif
+AS		:= $(CC) $(CFLAGS) $(INCLUDES) -c -x assembler-with-cpp
 endif
 endif
 
@@ -361,10 +371,8 @@
 
 ifeq ($(OS_ARCH),Linux)
 ifneq (,$(findstring mips, $(OS_TEST)))
-xptcstubs_asm_mips.o: xptcstubs_asm_mips.s.m4 $(PUBLIC)/xptcstubsdef.inc
-	m4 $(INCLUDES) $< > ./xptcstubs_asm_mips.s && \
-	$(AS) -o $@ $(ASFLAGS) $(AS_DASH_C_FLAG) ./xptcstubs_asm_mips.s
-	$(RM) -f ./xptcstubs_asm_mips.s
+xptcstubs_asm_mips.o: xptcstubs_asm_mips.s $(PUBLIC)/xptcstubsdef.inc
+	$(AS) -o $@ $<
 endif
 endif
 
--- mozilla-firefox-1.0.4.orig/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips.s
+++ mozilla-firefox-1.0.4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips.s
@@ -21,6 +21,7 @@
  * Contributor(s):
  *   Brendan Eich     <brendan@mozilla.org>
  *   Stuart Parmenter <pavlov@netscape.com>
+ *   Thiemo Seufer    <seufer@csv.ica.uni-stuttgart.de>
  */
 
 /* This code is for MIPS using the O32 ABI. */
@@ -28,139 +29,123 @@
 #include <sys/regdef.h>
 #include <sys/asm.h>
 
-.text
-.globl  invoke_count_words
-.globl	invoke_copy_to_stack 
-
-# We need a variable number of words allocated from the stack for copies of
-# the params, and this space must come between the high frame (where ra, gp,
-# and s0 are saved) and the low frame (where a0-a3 are saved by the callee
-# functions we invoke). 
-
-LOCALSZ=4		# s0, s1, ra, gp
-NARGSAVE=4		# a0, a1, a2, a3
-HIFRAMESZ=(LOCALSZ*SZREG)
-LOFRAMESZ=(NARGSAVE*SZREG)
-FRAMESZ=(HIFRAMESZ+LOFRAMESZ+ALSZ)&ALMASK
-
-# XXX these 2*SZREG, etc. are very magic -- we *know* that ALSZ&ALMASK cause
-# FRAMESZ to be 0 mod 8, in this case to be 16 and not 12.
-RAOFF=FRAMESZ - (2*SZREG)
-GPOFF=FRAMESZ - (3*SZREG)
-S0OFF=FRAMESZ - (4*SZREG)
-S1OFF=FRAMESZ - (5*SZREG)
-
-# These are not magic -- they are just our argsave slots in the caller frame.
-A0OFF=FRAMESZ
-A1OFF=FRAMESZ + (1*SZREG)
-A2OFF=FRAMESZ + (2*SZREG)
-A3OFF=FRAMESZ + (3*SZREG)
-
-	#	
-	# _XPTC_InvokeByIndex(that, methodIndex, paramCount, params)
-	#                      a0       a1          a2         a3
-
-NESTED(_XPTC_InvokeByIndex, FRAMESZ, ra)
-
-	.set	noreorder
-	.cpload	t9
-	.set	reorder
-
+# NARGSAVE is the argument space in the callers frame, including extra
+# 'shadowed' space for the argument registers. The minimum of 4
+# argument slots is sometimes predefined in the header files.
+#ifndef NARGSAVE
+#define NARGSAVE 4
+#endif
+
+#define LOCALSZ 3	/* gp, fp, ra */
+#define FRAMESZ ((((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK)
+
+#define RAOFF (FRAMESZ - (1*SZREG))
+#define FPOFF (FRAMESZ - (2*SZREG))
+#define GPOFF (FRAMESZ - (3*SZREG))
+
+#define A0OFF (FRAMESZ + (0*SZREG))
+#define A1OFF (FRAMESZ + (1*SZREG))
+#define A2OFF (FRAMESZ + (2*SZREG))
+#define A3OFF (FRAMESZ + (3*SZREG))
+
+	.text
+
+#	
+# _XPTC_InvokeByIndex(that, methodIndex, paramCount, params)
+#                      a0       a1          a2         a3
+
+	.globl	_XPTC_InvokeByIndex
+	.align	2
+	.type	_XPTC_InvokeByIndex,@function
+	.ent	_XPTC_InvokeByIndex,0
+	.frame	fp, FRAMESZ, ra
+_XPTC_InvokeByIndex:
+	SETUP_GP
 	subu	sp, FRAMESZ
 
-	# specify the save register mask -- XXX do we want the a0-a3 here, given
-	# our "split" frame where the args are saved below a dynamicly allocated
-	# region under the high frame?
-	#
-	# 10010000000000010000000011110000
-	.mask 0x900100F0, -((NARGSAVE+LOCALSZ)*SZREG)
-
-	# thou shalt not use .cprestore if yer frame has variable size...
-	# .cprestore GPOFF
-
-	REG_S	ra, RAOFF(sp)
-
-	# this happens automatically with .cprestore, but we cannot use that op...
-	REG_S	gp, GPOFF(sp)
-	REG_S	s0, S0OFF(sp)
-	REG_S	s1, S1OFF(sp)
-
-	REG_S	a0, A0OFF(sp)
-	REG_S	a1, A1OFF(sp)
-	REG_S	a2, A2OFF(sp)
-	REG_S	a3, A3OFF(sp)
+	# specify the save register mask for gp, fp, ra, a3 - a0
+	.mask 0xD00000F0, RAOFF-FRAMESZ
 
-	# invoke_count_words(paramCount, params)
-	move	a0, a2
-	move	a1, a3
+	sw	ra, RAOFF(sp)
+	sw	fp, FPOFF(sp)
 
-	jal	invoke_count_words
-	lw	gp, GPOFF(sp)
+	# we can't use .cprestore in a variable stack frame
+	sw	gp, GPOFF(sp)
 
-	# save the old sp so we can pop the param area and any "low frame"
-	# needed as an argsave area below the param block for callees that
-	# we invoke.
-	move	s0, sp
-
-	REG_L	a1, A2OFF(sp)	# a1 = paramCount
-	REG_L	a2, A3OFF(sp)	# a2 = params
-
-	# we define a word as 4 bytes, period end of story!
-	sll	v0, 2		# 4 bytes * result of invoke_copy_words
-	subu	v0, LOFRAMESZ	# but we take back the argsave area built into
-				# our stack frame -- SWEET!
-	subu	sp, sp, v0	# make room
-	move	a0, sp		# a0 = param stack address
-	move	s1, a0		# save it for later -- it should be safe here
-
-	# the old sp is still saved in s0, but we now need another argsave
-	# area ("low frame") for the invoke_copy_to_stack call.
-	subu	sp, sp, LOFRAMESZ
+	sw	a0, A0OFF(sp)
+	sw	a1, A1OFF(sp)
+	sw	a2, A2OFF(sp)
+	sw	a3, A3OFF(sp)
+
+	# save bottom of fixed frame
+	move	fp, sp
+
+	# extern "C" uint32
+	# invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s);
+	la	t9, invoke_count_words
+	move	a0, a2
+	move	a1, a3
+	jalr	t9
+	lw  	gp, GPOFF(fp)
 
-	# copy the param into the stack areas
+	# allocate variable stack, with a size of:
+	# wordsize (of 4 bytes) * result (already aligned to dword)
+	# but a minimum of 16 byte
+	sll	v0, 2
+	slt	t0, v0, 16
+	beqz	t0, 1f
+	li	v0, 16
+1:	subu	sp, v0
+
+	# let a0 point to the bottom of the variable stack, allocate
+	# another fixed stack for:
+	# extern "C" void
 	# invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount,
-	#                      nsXPTCVariant* s)
-	jal     invoke_copy_to_stack
-	lw  	gp, GPOFF(s0)
-
-	move	sp, s0		# get orig sp back, popping params and argsave
-
-	REG_L	a0, A0OFF(sp)	# a0 = set "that" to be "this"
-	REG_L	a1, A1OFF(sp)	# a1 = methodIndex
-
-	# t1 = methodIndex * 4
-	# (use shift instead of mult)
-	sll	t1, a1, 2
-
-	# calculate the function we need to jump to,
-	# which must then be saved in t9
+	#		       nsXPTCVariant* s);
+	la	t9, invoke_copy_to_stack
+	move	a0, sp
+	lw	a1, A2OFF(fp)
+	lw	a2, A3OFF(fp)
+	subu	sp, 16
+	jalr	t9
+	lw  	gp, GPOFF(fp)
+
+	# back to the variable stack frame
+	addu	sp, 16
+
+	# calculate the function we need to jump to, which must then be
+	# stored in t9
+	lw	a0, A0OFF(fp)	# a0 = set "that" to be "this"
+	lw	t0, A1OFF(fp)	# a1 = methodIndex
 	lw	t9, 0(a0)
-	addu	t9, t9, t1
-	lw	t9, 8(t9)
-
-	# a1..a3 and f13..f14 should now be set to what
-	# invoke_copy_to_stack told us. skip a0 and f12
-	# because that is the "this" pointer
-
-	REG_L	a1, 1*SZREG(s1)
-	REG_L	a2, 2*SZREG(s1)
-	REG_L	a3, 3*SZREG(s1)
-
-	l.d	$f13, 8(s1)
-	l.d	$f14, 16(s1)
-
-	# Create the stack pointer for the function, which must have 4 words
-	# of space for callee-saved args.  invoke_count_words allocated space
-        # for a0 starting at s1, so we just move s1 into sp.
-	move	sp, s1
+	# t0 = methodIndex << PTRLOG
+	sll	t0, t0, PTRLOG
+	addu	t9, t0
+#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
+	lw	t9, (t9)
+#else /* not G++ V3 ABI */
+	lw	t9, 2*PTRSIZE(t9)
+#endif /* G++ V3 ABI */
+
+	# Set a1-a3 to what invoke_copy_to_stack told us. a0 is already
+	# the "this" pointer. We don't have to care about floating
+	# point arguments, the non-FP "this" pointer as first argument
+	# means they'll never be used.
+	lw	a1, 1*SZREG(sp)
+	lw	a2, 2*SZREG(sp)
+	lw	a3, 3*SZREG(sp)
+
+	jalr	t9
+	# Micro-optimization: There's no gp usage below this point, so
+	# we don't reload.
+	# lw	gp, GPOFF(fp)
 
-	jalr	ra, t9
-	lw	gp, GPOFF(s0)
+	# leave variable stack frame
+	move	sp, fp
 
-	move	sp, s0
+	lw	ra, RAOFF(sp)
+	lw	fp, FPOFF(sp)
 
-	REG_L	ra, RAOFF(sp)
-	REG_L	s0, S0OFF(sp)
-	addu	sp, FRAMESZ
+	addiu	sp, FRAMESZ
 	j	ra
-.end _XPTC_InvokeByIndex
+END(_XPTC_InvokeByIndex)
--- mozilla-firefox-1.0.4.orig/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_alpha.cpp
+++ mozilla-firefox-1.0.4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_alpha.cpp
@@ -20,6 +20,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
+ *   Glen Nakamura <glen@imodulo.com>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either the GNU General Public License Version 2 or later (the "GPL"), or 
@@ -37,8 +38,6 @@
 
 /* Platform specific code to invoke XPCOM methods on native objects */
 
-/* contributed by Glen Nakamura <glen.nakamura@usa.net> */
-
 #include "xptcprivate.h"
 
 /* Prototype specifies unmangled function name and disables unused warning */
@@ -163,7 +162,11 @@
     "bis $16,$16,$1\n\t"    /* load "this" */
     "ldq $2,16($15)\n\t"    /* load "methodIndex" */
     "ldq $1,0($1)\n\t"      /* load vtable */
+#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
+    "s8addq $2,$31,$2\n\t"  /* vtable index = "methodIndex" * 8 */
+#else /* not G++ V3 ABI */
     "s8addq $2,16,$2\n\t"   /* vtable index = "methodIndex" * 8 + 16 */
+#endif /* G++ V3 ABI */
     "addq $1,$2,$1\n\t"
     "ldq $27,0($1)\n\t"     /* load address of function */
     "jsr $26,($27),0\n\t"   /* call virtual function */
@@ -176,4 +179,3 @@
     "ret $31,($26),1\n\t"
     ".end XPTC_InvokeByIndex"
     );
-
--- mozilla-firefox-1.0.4.orig/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp
+++ mozilla-firefox-1.0.4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp
@@ -21,7 +21,7 @@
  * Contributor(s):
  *   Stuart Parmenter <pavlov@netscape.com>
  *   Brendan Eich     <brendan@mozilla.org>
- * 
+ *   Thiemo Seufer    <seufer@csv.ica.uni-stuttgart.de>
  */
 
 /* This code is for MIPS using the O32 ABI. */
@@ -37,10 +37,8 @@
     // Count a word for a0 even though it's never stored or loaded
     // We do this only for alignment of register pairs.
     PRUint32 result = 1;
-    for (PRUint32 i = 0; i < paramCount; i++, s++)
+    for (PRUint32 i = 0; i < paramCount; i++, result++, s++)
     {
-        result++;
-
         if (s->IsPtrData())
             continue;
 
@@ -53,6 +51,9 @@
 		result++;
 	    result++;
 	    break;
+
+        default:
+            break;
         }
     }
     return (result + 1) & ~(PRUint32)1;
@@ -73,8 +74,6 @@
             continue;
         }
 
-        *((void**)d) = s->val.p;
-
         switch(s->type)
         {
         case nsXPTType::T_I64    :
@@ -89,6 +88,9 @@
             if ((PRWord)d & 4) d++;
             *((double*)   d) = s->val.d;      d++;
             break;
+        default:
+            *((void**)d) = s->val.p;
+            break;
         }
     }
 }
@@ -103,5 +105,4 @@
                    PRUint32 paramCount, nsXPTCVariant* params)
 {
     return _XPTC_InvokeByIndex(that, methodIndex, paramCount, params);
-}    
-
+}
--- mozilla-firefox-1.0.4.orig/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ipf64.s
+++ mozilla-firefox-1.0.4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ipf64.s
@@ -15,15 +15,17 @@
         .type   PrepareAndDispatch,@function
 
 SharedStub::
-// 9 arguments, first 8 are the input arguments of previous
-// function call.  The last one is methodIndex, and is passed in memory
+// 10 arguments, first 8 are the input arguments of previous
+// function call.  The 9th one is methodIndex and the 10th is the
+// pointer to the remaining input arguments.  The last two arguments
+// are passed in memory.
         .prologue
         .save ar.pfs , r41
 // allocate 8 input args, 4 local args, and 5 output args
         alloc           r41 = ar.pfs, 8, 4, 5, 0   // M
         .save rp, r40
         mov             r40 = rp                   // I
-        nop.i           0                       ;; // I
+        add             out4 = 24, sp           ;; // I
 
         .save ar.unat, r42
         mov             r42 = ar.unat              // M
@@ -46,12 +48,9 @@
         .body
         add             out0 = 0, in0        // A  move self ptr
 // 144 bytes = 16 byte stack header + 64 byte int space + 64 byte float space
-// current frame is 144 bytes, previous frame is 112 bytes
-// restarg is at 144 + 112 + 16 bytes away from current sp
-// (current frame + previous frame + previous previous frame header)
 // methodIndex is at 144 + 16 bytes away from current sp
 // (current frame + previous frame header)
-        add             out4 = 192, sp       // A  restarg address
+        ld8             out4 = [out4]        // M  restarg address
         add             r11  = 160, sp    ;; // A  address of methodIndex
 
         ld8             out1 = [r11]         // M  load methodIndex
--- mozilla-firefox-1.0.4.orig/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ipf64.cpp
+++ mozilla-firefox-1.0.4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ipf64.cpp
@@ -147,16 +147,17 @@
 }
 
 extern "C" int SharedStub(PRUint64,PRUint64,PRUint64,PRUint64,
- PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
+ PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64 *);
 
 /* Variable a0-a7 were put there so we can have access to the 8 input
    registers on Stubxyz entry */
 
 #define STUB_ENTRY(n) \
 nsresult nsXPTCStubBase::Stub##n(PRUint64 a1, \
-PRUint64 a2,PRUint64 a3,PRUint64 a4,PRUint64 a5,PRUint64 a6,PRUint64 a7) \
+PRUint64 a2,PRUint64 a3,PRUint64 a4,PRUint64 a5,PRUint64 a6,PRUint64 a7, \
+PRUint64 a8) \
 { uint64_t a0 = (uint64_t) this; \
- return SharedStub(a0,a1,a2,a3,a4,a5,a6,a7,(PRUint64) n); \
+ return SharedStub(a0,a1,a2,a3,a4,a5,a6,a7,(PRUint64) n, &a8); \
 }
 
 #define SENTINEL_ENTRY(n) \
--- mozilla-firefox-1.0.4.orig/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_alpha.cpp
+++ mozilla-firefox-1.0.4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_alpha.cpp
@@ -20,6 +20,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
+ *   Glen Nakamura <glen@imodulo.com>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either the GNU General Public License Version 2 or later (the "GPL"), or 
@@ -37,8 +38,6 @@
 
 /* Implement shared vtbl methods. */
 
-/* contributed by Glen Nakamura <glen.nakamura@usa.net> */
-
 #include "xptcprivate.h"
 
 /* Prototype specifies unmangled function name and disables unused warning */
@@ -188,23 +187,45 @@
  * nsresult nsXPTCStubBase::Stub##n()
  *  Sets register $1 to "methodIndex" and jumps to SharedStub.
  */
+#define STUB_MANGLED_ENTRY(n, symbol) \
+    "#### Stub"#n" ####"      "\n\t" \
+    ".text"                   "\n\t" \
+    ".align 5"                "\n\t" \
+    ".globl " symbol          "\n\t" \
+    ".ent " symbol            "\n"   \
+symbol ":"                    "\n\t" \
+    ".frame $30,0,$26,0"      "\n\t" \
+    "ldgp $29,0($27)"         "\n"   \
+"$" symbol "..ng:"            "\n\t" \
+    ".prologue 1"             "\n\t" \
+    "lda $1,"#n               "\n\t" \
+    "br $31,$SharedStub..ng"  "\n\t" \
+    ".end " symbol
+
+#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
+
+#define STUB_ENTRY(n) \
+__asm__( \
+    ".if "#n" < 10"                                              "\n\t" \
+        STUB_MANGLED_ENTRY(n, "_ZN14nsXPTCStubBase5Stub"#n"Ev")  "\n\t" \
+    ".elseif "#n" < 100"                                         "\n\t" \
+        STUB_MANGLED_ENTRY(n, "_ZN14nsXPTCStubBase6Stub"#n"Ev")  "\n\t" \
+    ".elseif "#n" < 1000"                                        "\n\t" \
+        STUB_MANGLED_ENTRY(n, "_ZN14nsXPTCStubBase7Stub"#n"Ev")  "\n\t" \
+    ".else"                                                      "\n\t" \
+    ".err \"Stub"#n" >= 1000 not yet supported.\""               "\n\t" \
+    ".endif" \
+    );
+
+#else /* not G++ V3 ABI */
+
 #define STUB_ENTRY(n) \
 __asm__( \
-    "#### Stub"#n" ####\n" \
-".text\n\t" \
-    ".align 5\n\t" \
-    ".globl Stub"#n"__14nsXPTCStubBase\n\t" \
-    ".ent Stub"#n"__14nsXPTCStubBase\n" \
-"Stub"#n"__14nsXPTCStubBase:\n\t" \
-    ".frame $30,0,$26,0\n\t" \
-    "ldgp $29,0($27)\n" \
-"$Stub"#n"__14nsXPTCStubBase..ng:\n\t" \
-    ".prologue 1\n\t" \
-    "lda $1,"#n"\n\t" \
-    "br $31,$SharedStub..ng\n\t" \
-    ".end Stub"#n"__14nsXPTCStubBase" \
+    STUB_MANGLED_ENTRY(n, "Stub"#n"__14nsXPTCStubBase") \
     );
 
+#endif /* G++ V3 ABI */
+
 #define SENTINEL_ENTRY(n) \
 nsresult nsXPTCStubBase::Sentinel##n() \
 { \
@@ -213,4 +234,3 @@
 }
 
 #include "xptcstubsdef.inc"
-
--- mozilla-firefox-1.0.4.orig/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_parisc_linux.s
+++ mozilla-firefox-1.0.4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_parisc_linux.s
@@ -0,0 +1,128 @@
+
+	.LEVEL 1.1
+	.text
+	.align 4
+
+framesz:
+	.equ 128
+
+; XPTC_InvokeByIndex(nsISuppots* that, PRUint32 methodIndex,
+;   PRUint32 paramCount, nsXPTCVariant* params);
+
+.globl XPTC_InvokeByIndex
+	.type XPTC_InvokeByIndex, @function
+
+
+XPTC_InvokeByIndex:
+  	.PROC
+	.CALLINFO FRAME=72, CALLER,SAVE_RP, SAVE_SP, ENTRY_GR=3
+	.ENTRY
+
+ ; frame marker takes 48 bytes,
+ ; register spill area takes 8 bytes,
+ ; local stack area takes 72 bytes result in 128 bytes total
+
+        STW          %rp,-20(%sp)
+        STW,MA       %r3,128(%sp)
+
+        LDO     -framesz(%r30),%r28
+        STW     %r28,-4(%r30)       ; save previous sp
+        STW     %r19,-32(%r30)
+
+        STW     %r26,-36-framesz(%r30)  ; save argument registers in
+        STW     %r25,-40-framesz(%r30)  ; in PREVIOUS frame
+        STW     %r24,-44-framesz(%r30)  ;
+        STW     %r23,-48-framesz(%r30)  ;
+
+;	B,L     .+8,%r2
+;	ADDIL   L'invoke_count_bytes-$PIC_pcrel$1+4,%r2,%r1
+;    ;    LDO     R'invoke_count_bytes-$PIC_pcrel$2+8(%r1),%r1
+;$PIC_pcrel$1
+;        LDSID   (%r1),%r31
+;$PIC_pcrel$2
+;        MTSP    %r31,%sr0
+
+	.CALL   ARGW0=GR,ARGW1=GR,ARGW2=GR ;in=24,25,26;out=28
+        BL    invoke_count_bytes,%r31
+        COPY    %r31,%r2
+
+        CMPIB,>=        0,%r28, .+76
+        COPY    %r30,%r3            ; copy stack ptr to saved stack ptr
+        ADD     %r30,%r28,%r30      ; extend stack frame
+        LDW     -4(%r3),%r28        ; move frame
+        STW     %r28,-4(%r30)
+        LDW     -8(%r3),%r28
+        STW     %r28,-8(%r30)
+        LDW     -12(%r3),%r28
+        STW     %r28,-12(%r30)
+        LDW     -16(%r3),%r28
+        STW     %r28,-16(%r30)
+        LDW     -20(%r3),%r28
+        STW     %r28,-20(%r30)
+        LDW     -24(%r3),%r28
+        STW     %r28,-24(%r30)
+        LDW     -28(%r3),%r28
+        STW     %r28,-28(%r30)
+        LDW     -32(%r3),%r28
+        STW     %r28,-32(%r30)
+
+        LDO     -40(%r30),%r26         ; load copy address
+        LDW     -44-framesz(%r3),%r25  ; load rest of 2 arguments
+        LDW     -48-framesz(%r3),%r24  ;
+
+        LDW     -32(%r30),%r19 ; shared lib call destroys r19; reload
+;        B,L     .+8,%r2
+;        ADDIL   L'invoke_copy_to_stack-$PIC_pcrel$3+4,%r2,%r1
+;        LDO     R'invoke_copy_to_stack-$PIC_pcrel$4+8(%r1),%r1
+;$PIC_pcrel$3
+;        LDSID   (%r1),%r31
+;$PIC_pcrel$4
+;        MTSP    %r31,%sr0
+        .CALL   ARGW0=GR,ARGW1=GR,ARGW2=GR ;in=24,25,26
+        BL    invoke_copy_to_stack,%r31
+        COPY    %r31,%r2
+
+        LDO     -48(%r30),%r20
+        EXTRW,U,= %r28,31,1,%r22
+        FLDD    0(%r20),%fr7  ; load double arg 1
+        EXTRW,U,= %r28,30,1,%r22
+        FLDW    8(%r20),%fr5L ; load float arg 1
+        EXTRW,U,= %r28,29,1,%r22
+        FLDW    4(%r20),%fr6L ; load float arg 2
+        EXTRW,U,= %r28,28,1,%r22
+        FLDW    0(%r20),%fr7L ; load float arg 3
+
+        LDW     -36-framesz(%r3),%r26  ; load ptr to 'that'
+        LDW     -40(%r30),%r25  ; load the rest of dispatch argument registers
+        LDW     -44(%r30),%r24
+        LDW     -48(%r30),%r23
+
+        LDW     -36-framesz(%r3),%r20  ; load vtable addr
+        LDW     -40-framesz(%r3),%r28  ; load index
+        LDW     0(%r20),%r20    ; follow vtable
+;        LDO     0(%r20),%r20   ; offset vtable by 16 bytes (g++: 8, aCC: 16)
+        SH2ADDL %r28,%r20,%r28  ; add 4*index to vtable entry
+        LDW     0(%r28),%r22    ; load vtable entry
+
+;        B,L     .+8,%r2
+;        ADDIL   L'$$dyncall_external-$PIC_pcrel$5+4,%r2,%r1
+;        LDO     R'$$dyncall_external-$PIC_pcrel$6+8(%r1),%r1
+;$PIC_pcrel$5
+;        LDSID   (%r1),%r31
+;$PIC_pcrel$6
+;        MTSP    %r31,%sr0
+        .CALL ARGW0=GR,ARGW1=GR,ARGW2=GR,ARGW3=GR,RTNVAL=GR ;in=22-26;out=28;
+        BL    $$dyncall,%r31
+        COPY    %r31,%r2
+
+        LDW     -32(%r30),%r19
+        COPY    %r3,%r30              ; restore saved stack ptr
+
+        LDW          -148(%sp),%rp
+        LDWM       -128(%sp),%r3
+	BV,N             (%rp)
+	NOP
+   .EXIT
+  .PROCEND  ;in=23,24,25,26;
+  .SIZE XPTC_InvokeByIndex, .-XPTC_InvokeByIndex
+
--- mozilla-firefox-1.0.4.orig/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_parisc_linux.s
+++ mozilla-firefox-1.0.4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_parisc_linux.s
@@ -0,0 +1,73 @@
+        .LEVEL  1.1
+	.TEXT
+	.ALIGN 4
+
+curframesz:
+	.EQU 128
+
+
+; SharedStub has stack size of 128 bytes
+
+lastframesz:
+	.EQU 64
+
+; the StubN C++ function has a small stack size of 64 bytes
+
+
+.globl SharedStub
+	.type SharedStub, @function
+
+SharedStub:
+        .PROC
+        .CALLINFO CALLER,FRAME=80,SAVE_RP
+
+  .ENTRY
+        STW     %rp,-20(%sp)
+        LDO     128(%sp),%sp
+
+        STW     %r19,-32(%r30)
+        STW     %r26,-36-curframesz(%r30) ; save arg0 in previous frame
+
+        LDO     -80(%r30),%r28
+        FSTD,MA %fr5,8(%r28)   ; save darg0
+        FSTD,MA %fr7,8(%r28)   ; save darg1
+        FSTW,MA %fr4L,4(%r28)  ; save farg0
+        FSTW,MA %fr5L,4(%r28)  ; save farg1
+        FSTW,MA %fr6L,4(%r28)  ; save farg2
+        FSTW,MA %fr7L,4(%r28)  ; save farg3
+
+        ; Former value of register 26 is already properly saved by StubN,
+        ; but register 25-23 are not because of the arguments mismatch
+        STW     %r25,-40-curframesz-lastframesz(%r30) ; save r25
+        STW     %r24,-44-curframesz-lastframesz(%r30) ; save r24
+        STW     %r23,-48-curframesz-lastframesz(%r30) ; save r23
+        COPY    %r26,%r25                             ; method index is arg1
+        LDW     -36-curframesz-lastframesz(%r30),%r26 ; self is arg0
+        LDO     -40-curframesz-lastframesz(%r30),%r24 ; normal args is arg2
+        LDO     -80(%r30),%r23                        ; floating args is arg3
+
+;       BL      .+8,%r2
+;       ADDIL   L'PrepareAndDispatch-$PIC_pcrel$0+4,%r2
+;        LDO     R'PrepareAndDispatch-$PIC_pcrel$1+8(%r1),%r1
+;$PIC_pcrel$0
+;        LDSID   (%r1),%r31
+;$PIC_pcrel$1
+;        MTSP    %r31,%sr0
+        .CALL   ARGW0=GR,ARGW1=GR,ARGW2=GR,ARGW3=GR,RTNVAL=GR ;in=23-26;out=28;
+        BL     PrepareAndDispatch, %r31
+        COPY    %r31,%r2
+
+        LDW     -32(%r30),%r19
+
+        LDW     -148(%sp),%rp
+        LDO     -128(%sp),%sp
+
+
+	BV,N     (%rp)
+	NOP
+	NOP
+
+	.EXIT
+        .PROCEND        ;in=26;out=28;
+
+	.SIZE SharedStub, .-SharedStub
--- mozilla-firefox-1.0.4.orig/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.s
+++ mozilla-firefox-1.0.4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.s
@@ -0,0 +1,142 @@
+/* -*- Mode: asm; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp, Inc.
+ * Portions created by the Initial Developer are Copyright (C) 2001
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Stuart Parmenter <pavlov@netscape.com>
+ *   Chris Waterson   <waterson@netscape.com>
+ *   Thiemo Seufer    <seufer@csv.ica.uni-stuttgart.de>
+ */
+
+/* This code is for MIPS using the O32 ABI. */
+
+#include <sys/regdef.h>
+#include <sys/asm.h>
+
+# NARGSAVE is the argument space in the callers frame, including extra
+# 'shadowed' space for the argument registers. The minimum of 4
+# argument slots is sometimes predefined in the header files.
+#ifndef NARGSAVE
+#define NARGSAVE 4
+#endif
+
+#define LOCALSZ 2	/* gp, ra */
+#define FRAMESZ ((((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK)
+
+#define RAOFF (FRAMESZ - (1*SZREG))
+#define GPOFF (FRAMESZ - (2*SZREG))
+
+#define A0OFF (FRAMESZ + (0*SZREG))
+#define A1OFF (FRAMESZ + (1*SZREG))
+#define A2OFF (FRAMESZ + (2*SZREG))
+#define A3OFF (FRAMESZ + (3*SZREG))
+
+	.text
+
+#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
+#define STUB_ENTRY(x)						\
+	.if x < 10;						\
+	.globl	_ZN14nsXPTCStubBase5Stub ##x ##Ev;		\
+	.type	_ZN14nsXPTCStubBase5Stub ##x ##Ev,@function;	\
+	.aent	_ZN14nsXPTCStubBase5Stub ##x ##Ev,0;		\
+_ZN14nsXPTCStubBase5Stub ##x ##Ev:;				\
+	SETUP_GP;						\
+	li	t0,x;						\
+	b	sharedstub;					\
+	.elseif x < 100;					\
+	.globl	_ZN14nsXPTCStubBase6Stub ##x ##Ev;		\
+	.type	_ZN14nsXPTCStubBase6Stub ##x ##Ev,@function;	\
+	.aent	_ZN14nsXPTCStubBase6Stub ##x ##Ev,0;		\
+_ZN14nsXPTCStubBase6Stub ##x ##Ev:;				\
+	SETUP_GP;						\
+	li	t0,x;						\
+	b	sharedstub;					\
+	.elseif x < 1000;					\
+	.globl	_ZN14nsXPTCStubBase7Stub ##x ##Ev;		\
+	.type	_ZN14nsXPTCStubBase7Stub ##x ##Ev,@function;	\
+	.aent	_ZN14nsXPTCStubBase7Stub ##x ##Ev,0;		\
+_ZN14nsXPTCStubBase7Stub ##x ##Ev:;				\
+	SETUP_GP;						\
+	li	t0,x;						\
+	b	sharedstub;					\
+	.else;							\
+	.err;							\
+	.endif
+#else /* not G++ V3 ABI */
+#define STUB_ENTRY(x)						\
+	.globl	Stub ##x ##__14nsXPTCStubBase;			\
+	.type	Stub ##x ##__14nsXPTCStubBase,@function;	\
+	.aent	Stub ##x ##__14nsXPTCStubBase,0;		\
+Stub ##x ##__14nsXPTCStubBase:;					\
+	SETUP_GP;						\
+	li	t0,x;						\
+	b	sharedstub
+#endif /* G++ V3 ABI */
+
+# SENTINEL_ENTRY is handled in the cpp file.
+#define SENTINEL_ENTRY(x)
+
+#
+# open a dummy frame for the function entries
+#
+	.align	2
+	.type	dummy,@function
+	.ent	dummy, 0
+	.frame	sp, FRAMESZ, ra 
+dummy:
+	SETUP_GP
+
+#include "xptcstubsdef.inc"
+
+sharedstub:
+	subu	sp, FRAMESZ
+
+	# specify the save register mask for gp, ra, a0-a3
+	.mask 0x900000F0, RAOFF-FRAMESZ
+
+	sw	ra, RAOFF(sp)
+	SAVE_GP(GPOFF)
+
+	# Micro-optimization: a0 is already loaded, and its slot gets
+	# ignored by PrepareAndDispatch, so no need to save it here.
+	# sw	a0, A0OFF(sp)
+	sw	a1, A1OFF(sp)
+	sw	a2, A2OFF(sp)
+	sw	a3, A3OFF(sp)
+
+	la	t9, PrepareAndDispatch
+
+	# t0 is methodIndex
+	move	a1, t0
+	# have a2 point to the begin of the argument space on stack
+	addiu	a2, sp, FRAMESZ
+
+	# PrepareAndDispatch(that, methodIndex, args)
+	jalr	t9
+
+	# Micro-optimization: Using jalr explicitly has the side-effect
+	# of not triggering .cprestore. This is ok because we have no
+	# gp reference below this point. It also allows better
+	# instruction sscheduling.
+	# lw	gp, GPOFF(fp)
+ 
+ 	lw	ra, RAOFF(sp)
+	addiu	sp, FRAMESZ
+	j	ra
+	END(dummy)
--- mozilla-firefox-1.0.4.orig/xpinstall/packager/packages-os2
+++ mozilla-firefox-1.0.4/xpinstall/packager/packages-os2
@@ -359,7 +359,6 @@
 bin/res/throbber/*
 ;debug menus reference samples dir - remove for actual releases:
 bin/res/samples/*
-bin/res/builtin/platformHTMLBindings.xml
 
 [mail]
 bin/msgbsutl.dll
--- mozilla-firefox-1.0.4.orig/xpinstall/packager/packages-static-unix
+++ mozilla-firefox-1.0.4/xpinstall/packager/packages-static-unix
@@ -264,8 +264,6 @@
 bin/res/dtd/*
 ;debug menus reference samples dir - remove for actual releases:
 bin/res/samples/*
-bin/res/builtin/htmlBindings.xml
-bin/res/builtin/platformHTMLBindings.xml
 
 ; p3p
 bin/components/p3p.xpt
--- mozilla-firefox-1.0.4.orig/xpinstall/packager/packages-unix
+++ mozilla-firefox-1.0.4/xpinstall/packager/packages-unix
@@ -347,7 +347,6 @@
 bin/res/dtd/*
 ;debug menus reference samples dir - remove for actual releases:
 bin/res/samples/*
-bin/res/builtin/platformHTMLBindings.xml
 
 
 [mail]
--- mozilla-firefox-1.0.4.orig/xpinstall/packager/unix/browser.jst
+++ mozilla-firefox-1.0.4/xpinstall/packager/unix/browser.jst
@@ -77,35 +77,18 @@
     logComment("dirCreate() returned: " + ignoreErr);
 
     var cf = getFolder("Chrome");
-    registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"toolkit.jar"),"content/global-platform/");
-    registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/communicator-platform/");
-    registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/navigator-platform/");
-
-    registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"toolkit.jar"),"content/global-region/");
-    registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/communicator-region/");
-    registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/editor-region/");
-    registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/navigator-region/");
-
     registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"toolkit.jar"),"content/global/");
     registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/autoconfig/");
     registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/cookie/");
     registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/wallet/");
     registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"content-packs.jar"),"content/content-packs/");
     registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/communicator/");
-    registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/editor/");
     registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/navigator/");
     registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/necko/");
     registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/mozldap/");
     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"classic.jar"),"skin/classic/communicator/");
-    registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"classic.jar"),"skin/classic/editor/");
     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"classic.jar"),"skin/classic/global/");
-    registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"classic.jar"),"skin/classic/messenger/");
     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"classic.jar"),"skin/classic/navigator/");
-    registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"modern.jar"),"skin/modern/communicator/");
-    registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"modern.jar"),"skin/modern/editor/");
-    registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"modern.jar"),"skin/modern/global/");
-    registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"modern.jar"),"skin/modern/messenger/");
-    registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"modern.jar"),"skin/modern/navigator/");
     registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"help.jar"),"content/help/");
     registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/xbl-marquee/");
     registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/p3p/");
--- mozilla-firefox-1.0.4.orig/xpinstall/src/nsJSFile.cpp
+++ mozilla-firefox-1.0.4/xpinstall/src/nsJSFile.cpp
@@ -71,12 +71,6 @@
                                 JSContext* aContext,
                                 jsval aValue);
 
-extern PRBool ConvertJSValToObj(nsISupports** aSupports,
-                               REFNSIID aIID,
-                               const nsString& aTypeName,
-                               JSContext* aContext,
-                               jsval aValue);
-
 extern JSObject *gFileSpecProto;
 extern JSClass InstallClass;
 
--- mozilla-firefox-1.0.4.orig/xpinstall/src/nsJSFileSpecObj.cpp
+++ mozilla-firefox-1.0.4/xpinstall/src/nsJSFileSpecObj.cpp
@@ -36,12 +36,6 @@
                                 JSContext* aContext,
                                 jsval aValue);
 
-extern PRBool ConvertJSValToObj(nsISupports** aSupports,
-                               REFNSIID aIID,
-                               const nsString& aTypeName,
-                               JSContext* aContext,
-                               jsval aValue);
-
 
 
 static void PR_CALLBACK
--- mozilla-firefox-1.0.4.orig/xpinstall/src/nsJSInstall.cpp
+++ mozilla-firefox-1.0.4/xpinstall/src/nsJSInstall.cpp
@@ -291,36 +291,50 @@
 
 PRBool ConvertJSValToObj(nsISupports** aSupports,
                         REFNSIID aIID,
-                        const nsString& aTypeName,
+                        JSClass* aClass,
                         JSContext* aContext,
                         jsval aValue)
 {
   if (JSVAL_IS_NULL(aValue)) {
     *aSupports = nsnull;
+    return JS_TRUE;
   }
-  else if (JSVAL_IS_OBJECT(aValue)) {
-    JSObject* jsobj = JSVAL_TO_OBJECT(aValue);
-    JSClass* jsclass = JS_GetClass(aContext, jsobj);
-    if ((nsnull != jsclass) && (jsclass->flags & JSCLASS_HAS_PRIVATE)) {
-      nsISupports *supports = (nsISupports *)JS_GetPrivate(aContext, jsobj);
-      if (NS_OK != supports->QueryInterface(aIID, (void **)aSupports)) {
-        char buf[128];
-        char typeName[128];
-        aTypeName.ToCString(typeName, sizeof(typeName));
-        sprintf(buf, "Parameter must of type %s", typeName);
-        JS_ReportError(aContext, buf);
-        return JS_FALSE;
-      }
-    }
-    else {
-      JS_ReportError(aContext, "Parameter isn't an object");
-      return JS_FALSE;
-    }
-  }
-  else {
+  if (!JSVAL_IS_OBJECT(aValue)) {
     JS_ReportError(aContext, "Parameter must be an object");
     return JS_FALSE;
   }
+  JSObject* jsobj = JSVAL_TO_OBJECT(aValue);
+  JSClass* jsclass = JS_GetClass(aContext, jsobj);
+  if (!jsclass ||
+      !(jsclass->flags & JSCLASS_HAS_PRIVATE) ||
+      !(jsclass->flags & JSCLASS_PRIVATE_IS_NSISUPPORTS)) {
+    JS_ReportError(aContext,
+                   "Parameter isn't an object that implements nsISupports");
+    return JS_FALSE;
+  }
+  if (!JS_InstanceOf(aContext,
+                     jsobj,
+                     aClass,
+                     nsnull))
+  {
+    char buf[128];
+    sprintf(buf, "Parameter isn't an instance of type %s", aClass->name);
+    JS_ReportError(aContext, buf);
+    return JS_FALSE;
+  }
+  nsISupports *supports = (nsISupports *)JS_GetPrivate(aContext, jsobj);
+  if (!supports) {
+    NS_ERROR("This should not happen.");
+    JS_ReportError(aContext,
+                   "JSObject has JSCLASS_PRIVATE_IS_NSISUPPORTS flag but has a null private slot, please file a bug.");
+    return JS_FALSE;
+  }
+  if (NS_FAILED(supports->QueryInterface(aIID, (void **)aSupports))) {
+    char buf[128];
+    sprintf(buf, "Parameter must be of type %s", aClass->name);
+    JS_ReportError(aContext, buf);
+    return JS_FALSE;
+  }
 
   return JS_TRUE;
 }
@@ -360,8 +374,6 @@
 {
   nsInstall *nativeThis =
     (nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
-  if (!nativeThis)
-    return JS_FALSE;
 
   int32   b0;
 
@@ -402,8 +414,6 @@
 {
   nsInstall *nativeThis =
     (nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
-  if (!nativeThis)
-    return JS_FALSE;
 
   PRInt32 nativeRet;
   nsAutoString b0;
@@ -558,8 +568,6 @@
 {
   nsInstall *nativeThis =
     (nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
-  if (!nativeThis)
-    return JS_FALSE;
 
   PRInt32 nativeRet;
   nsAutoString b0;
@@ -735,8 +743,6 @@
 {
   nsInstall *nativeThis =
     (nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
-  if (!nativeThis)
-    return JS_FALSE;
 
   PRInt32 nativeRet;
   nsAutoString b0;
@@ -804,8 +810,6 @@
 {
   nsInstall *nativeThis =
     (nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
-  if (!nativeThis)
-    return JS_FALSE;
 
   PRInt32 nativeRet;
 
@@ -837,8 +841,6 @@
 {
   nsInstall *nativeThis =
     (nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
-  if (!nativeThis)
-    return JS_FALSE;
 
   PRInt32 nativeRet;
   nsAutoString b0;
@@ -882,8 +884,6 @@
 {
   nsInstall *nativeThis =
     (nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
-  if (!nativeThis)
-    return JS_FALSE;
 
   nsInstallFolder* folder;
   nsAutoString b0;
@@ -958,8 +958,6 @@
 {
   nsInstall *nativeThis =
     (nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
-  if (!nativeThis)
-    return JS_FALSE;
 
   JSObject *jsObj;
   nsAutoString b0;
@@ -1063,8 +1061,6 @@
 {
   nsInstall *nativeThis =
     (nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
-  if (!nativeThis)
-    return JS_FALSE;
 
   PRInt32 nativeRet;
 
@@ -1162,8 +1158,6 @@
 {
   nsInstall *nativeThis =
     (nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
-  if (!nativeThis)
-    return JS_FALSE;
 
   nsAutoString b0;
 
@@ -1200,8 +1194,6 @@
 {
   nsInstall *nativeThis =
     (nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
-  if (!nativeThis)
-    return JS_FALSE;
 
   PRInt32 nativeRet;
   nsAutoString b0;
@@ -1316,8 +1308,6 @@
   // If there's no private data, this must be the prototype, so ignore
   nsInstall *nativeThis =
     (nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
-  if (!nativeThis)
-    return JS_FALSE;
 
   if (nsnull == nativeThis) {
     *rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
@@ -1363,8 +1353,6 @@
 {
   nsInstall *nativeThis =
     (nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
-  if (!nativeThis)
-    return JS_FALSE;
 
   // If there's no private data, this must be the prototype, so ignore
   if (!nativeThis)
@@ -1391,8 +1379,6 @@
 {
   nsInstall *nativeThis =
     (nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
-  if (!nativeThis)
-    return JS_FALSE;
 
   *rval = JSVAL_VOID;
 
@@ -1420,8 +1406,6 @@
 {
   nsInstall *nativeThis =
     (nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
-  if (!nativeThis)
-    return JS_FALSE;
 
   nsAutoString b0;
   JSObject *jsObj;
@@ -1482,8 +1466,6 @@
 {
   nsInstall *nativeThis =
     (nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
-  if (!nativeThis)
-    return JS_FALSE;
 
   PRInt32 nativeRet;
   nsAutoString b0;
@@ -1538,8 +1520,6 @@
 {
   nsInstall *nativeThis =
     (nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);
-  if (!nativeThis)
-    return JS_FALSE;
 
   PRInt32 nativeRet;
   nsAutoString b0;
--- mozilla-firefox-1.0.4.orig/xpinstall/src/nsJSInstallTriggerGlobal.cpp
+++ mozilla-firefox-1.0.4/xpinstall/src/nsJSInstallTriggerGlobal.cpp
@@ -70,12 +70,6 @@
                                 JSContext* aContext,
                                 jsval aValue);
 
-extern PRBool ConvertJSValToObj(nsISupports** aSupports,
-                               REFNSIID aIID,
-                               const nsString& aTypeName,
-                               JSContext* aContext,
-                               jsval aValue);
-
 PR_STATIC_CALLBACK(void)
 FinalizeInstallTriggerGlobal(JSContext *cx, JSObject *obj);
 
@@ -270,6 +264,21 @@
   }
 
 
+  nsCOMPtr<nsIScriptSecurityManager> secman(do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID));
+  if (!secman)
+  {
+    JS_ReportError(cx, "Could not the script security manager service.");
+    return JS_FALSE;
+  }
+  // get the principal.  if it doesn't exist, die.
+  nsCOMPtr<nsIPrincipal> principal;
+  secman->GetSubjectPrincipal(getter_AddRefs(principal));
+  if (!principal)
+  {
+    JS_ReportError(cx, "Could not get the Subject Principal during InstallTrigger.Install()");
+    return JS_FALSE;
+  }
+  
   // get window.location to construct relative URLs
   nsCOMPtr<nsIURI> baseURL;
   JSObject* global = JS_GetGlobalObject(cx);
@@ -293,6 +302,8 @@
     if (!trigger)
       return JS_FALSE;
 
+    trigger->SetPrincipal(principal);
+
     JSIdArray *ida = JS_Enumerate( cx, JSVAL_TO_OBJECT(argv[0]) );
     if ( ida )
     {
--- mozilla-firefox-1.0.4.orig/xpinstall/src/nsJSInstallVersion.cpp
+++ mozilla-firefox-1.0.4/xpinstall/src/nsJSInstallVersion.cpp
@@ -71,7 +71,7 @@
 //
 JSClass InstallVersionClass = {
   "InstallVersion",
-  JSCLASS_HAS_PRIVATE,
+  JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS,
   JS_PropertyStub,
   JS_PropertyStub,
   GetInstallVersionProperty,
@@ -97,7 +97,7 @@
 
 extern PRBool ConvertJSValToObj(nsISupports** aSupports,
                                REFNSIID aIID,
-                               const nsString& aTypeName,
+                               JSClass* aClass,
                                JSContext* aContext,
                                jsval aValue);
 
@@ -465,13 +465,19 @@
 
         if(JS_FALSE == ConvertJSValToObj(getter_AddRefs(versionObj),
                                          NS_GET_IID(nsIDOMInstallVersion),
-                                         NS_ConvertASCIItoUCS2("InstallVersion"),
+                                         &InstallVersionClass,
                                          cx,
                                          argv[0]))
         {
           return JS_FALSE;
         }
 
+        if (!versionObj)
+        {
+          JS_ReportError(cx, "Function compareTo expects a non null object.");
+          return JS_FALSE;
+        }
+
         if(NS_OK != nativeThis->CompareTo(versionObj, &nativeRet))
         {
           return JS_FALSE;
--- mozilla-firefox-1.0.4.orig/xpinstall/src/nsJSWinProfile.cpp
+++ mozilla-firefox-1.0.4/xpinstall/src/nsJSWinProfile.cpp
@@ -56,12 +56,6 @@
                                 JSContext* aContext,
                                 jsval aValue);
 
-extern PRBool ConvertJSValToObj(nsISupports** aSupports,
-                               REFNSIID aIID,
-                               const nsString& aTypeName,
-                               JSContext* aContext,
-                               jsval aValue);
-
 
 static void PR_CALLBACK
 WinProfileCleanup(JSContext *cx, JSObject *obj);
--- mozilla-firefox-1.0.4.orig/xpinstall/src/nsJSWinReg.cpp
+++ mozilla-firefox-1.0.4/xpinstall/src/nsJSWinReg.cpp
@@ -58,12 +58,6 @@
                                 JSContext* aContext,
                                 jsval aValue);
 
-extern PRBool ConvertJSValToObj(nsISupports** aSupports,
-                               REFNSIID aIID,
-                               const nsString& aTypeName,
-                               JSContext* aContext,
-                               jsval aValue);
-
 
 static void PR_CALLBACK WinRegCleanup(JSContext *cx, JSObject *obj)
 {
--- mozilla-firefox-1.0.4.orig/xpinstall/src/nsXPITriggerInfo.cpp
+++ mozilla-firefox-1.0.4/xpinstall/src/nsXPITriggerInfo.cpp
@@ -29,6 +29,7 @@
 #include "nsIServiceManager.h"
 #include "nsIEventQueueService.h"
 #include "nsIJSContextStack.h"
+#include "nsIScriptSecurityManager.h"
 
 static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
 
@@ -211,6 +212,32 @@
             do_GetService("@mozilla.org/js/xpc/ContextStack;1");
         if (stack)
             stack->Push(event->cx);
+        
+        nsCOMPtr<nsIScriptSecurityManager> secman = 
+            do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID);
+        
+        if (!secman)
+        {
+            JS_ReportError(event->cx, "Could not get script security manager service");
+            return 0;
+        }
+
+        nsCOMPtr<nsIPrincipal> principal;
+        secman->GetSubjectPrincipal(getter_AddRefs(principal));
+        if (!principal)
+        {
+            JS_ReportError(event->cx, "Could not get principal from script security manager");
+            return 0;
+        }
+
+        PRBool equals = PR_FALSE;
+        principal->Equals(event->princ, &equals);
+
+        if (!equals)
+        {
+            JS_ReportError(event->cx, "Principal of callback context is different then InstallTriggers");
+            return 0;
+        }
 
         JS_CallFunctionValue( event->cx,
                               JSVAL_TO_OBJECT(event->global),
@@ -254,6 +281,7 @@
                     event->URL      = URL;
                     event->status   = status;
                     event->cx       = mCx;
+                    event->princ    = mPrincipal;
 
                     JSObject *obj = nsnull;
 
--- mozilla-firefox-1.0.4.orig/xpinstall/src/nsXPITriggerInfo.h
+++ mozilla-firefox-1.0.4/xpinstall/src/nsXPITriggerInfo.h
@@ -47,6 +47,7 @@
     jsval       global;
     jsval       cbval;
     nsCOMPtr<nsISupports> ref;
+    nsCOMPtr<nsIPrincipal> princ;
 } XPITriggerEvent;
 
 
@@ -68,13 +69,13 @@
     nsCOMPtr<nsIOutputStream>   mOutStream;
     nsCOMPtr<nsIPrincipal>      mPrincipal;
 
+    void    SetPrincipal(nsIPrincipal* aPrincipal);
 
     PRBool  IsFileURL() { return StringBeginsWith(mURL, NS_LITERAL_STRING("file:/")); }
     PRBool  IsRelativeURL();
 
     const PRUnichar* GetSafeURLString();
 
-    void    SetPrincipal(nsIPrincipal* aPrincipal);
   private:
     //-- prevent inadvertent copies and assignments
     nsXPITriggerItem& operator=(const nsXPITriggerItem& rhs);
@@ -103,6 +104,9 @@
 
     void                SendStatus(const PRUnichar* URL, PRInt32 status);
 
+    void                SetPrincipal(nsIPrincipal* aPrinc) { mPrincipal = aPrinc; }
+
+
   private:
     nsVoidArray mItems;
     JSContext   *mCx;
@@ -110,6 +114,8 @@
     jsval       mCbval;
     PRThread*   mThread;
 
+    nsCOMPtr<nsIPrincipal>      mPrincipal;
+
     //-- prevent inadvertent copies and assignments
     nsXPITriggerInfo& operator=(const nsXPITriggerInfo& rhs);
     nsXPITriggerInfo(const nsXPITriggerInfo& rhs);
--- mozilla-firefox-1.0.4.orig/content/base/public/nsContentUtils.h
+++ mozilla-firefox-1.0.4/content/base/public/nsContentUtils.h
@@ -75,6 +75,8 @@
 
   static PRBool   IsCallerChrome();
 
+  static PRBool   IsChromeDoc(nsIDocument *aDocument);
+
   /*
    * Returns true if the nodes are both in the same document or
    * if neither is in a document.
--- mozilla-firefox-1.0.4.orig/content/base/src/nsContentUtils.cpp
+++ mozilla-firefox-1.0.4/content/base/src/nsContentUtils.cpp
@@ -927,6 +927,21 @@
 
 // static
 PRBool
+nsContentUtils::IsChromeDoc(nsIDocument *aDocument)
+{
+  nsIPrincipal *principal;
+  if (!aDocument || !(principal = aDocument->GetPrincipal())) {
+    return PR_FALSE;
+  }
+
+  nsCOMPtr<nsIPrincipal> systemPrincipal;
+  sSecurityManager->GetSystemPrincipal(getter_AddRefs(systemPrincipal));
+
+  return principal == systemPrincipal;
+}
+
+// static
+PRBool
 nsContentUtils::InSameDoc(nsIDOMNode* aNode, nsIDOMNode* aOther)
 {
   if (!aNode || !aOther) {
--- mozilla-firefox-1.0.4.orig/content/base/src/nsDocument.cpp
+++ mozilla-firefox-1.0.4/content/base/src/nsDocument.cpp
@@ -628,6 +628,7 @@
   NS_INTERFACE_MAP_ENTRY(nsIDOMEventReceiver)
   NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
   NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget)
+  NS_INTERFACE_MAP_ENTRY(nsIDOMNSEventTarget)
   NS_INTERFACE_MAP_ENTRY(nsIDOMNode)
   NS_INTERFACE_MAP_ENTRY(nsIDOM3Node)
   NS_INTERFACE_MAP_ENTRY(nsIDOM3Document)
@@ -1810,8 +1811,12 @@
   nsCOMPtr<nsIDOMEvent> event;
   CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));
 
-  if (event) {
+  nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));
+
+  if (privateEvent) {
     event->InitEvent(NS_LITERAL_STRING("DOMContentLoaded"), PR_TRUE, PR_TRUE);
+    privateEvent->SetTrusted(PR_TRUE);
+
     PRBool noDefault;
     DispatchEvent(event, &noDefault);
   }
@@ -1857,8 +1862,6 @@
         break;
       }
 
-      nsCOMPtr<nsIPrivateDOMEvent> private_event;
-
       nsCOMPtr<nsIDOMDocumentEvent> document_event =
         do_QueryInterface(ancestor_doc);
 
@@ -1866,14 +1869,15 @@
         document_event->CreateEvent(NS_LITERAL_STRING("Events"),
                                     getter_AddRefs(event));
 
-        private_event = do_QueryInterface(event);
+        privateEvent = do_QueryInterface(event);
       }
 
-      if (event && private_event) {
+      if (event && privateEvent) {
         event->InitEvent(NS_LITERAL_STRING("DOMFrameContentLoaded"), PR_TRUE,
                          PR_TRUE);
 
-        private_event->SetTarget(target_frame);
+        privateEvent->SetTarget(target_frame);
+        privateEvent->SetTrusted(PR_TRUE);
 
         // To dispatch this event we must manually call
         // HandleDOMEvent() on the ancestor document since the target
@@ -1882,7 +1886,7 @@
         // dispatching code.
 
         nsEvent* innerEvent;
-        private_event->GetInternalNSEvent(&innerEvent);
+        privateEvent->GetInternalNSEvent(&innerEvent);
         if (innerEvent) {
           nsEventStatus status = nsEventStatus_eIgnore;
 
@@ -2768,6 +2772,10 @@
   CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));
   if (event) {
     event->InitEvent(NS_LITERAL_STRING("DOMTitleChanged"), PR_TRUE, PR_TRUE);
+    // There might be script running, so the event might have ended up
+    // untrusted.  Make it trusted.
+    nsCOMPtr<nsIPrivateDOMEvent> privEvt(do_QueryInterface(event));
+    privEvt->SetTrusted(PR_TRUE);
     PRBool noDefault;
     DispatchEvent(event, &noDefault);
   }
@@ -3706,6 +3714,9 @@
                            nsIDOMEvent** aDOMEvent, PRUint32 aFlags,
                            nsEventStatus* aEventStatus)
 {
+  // Make sure to tell the event that dispatch has started.
+  NS_MARK_EVENT_DISPATCH_STARTED(aEvent);
+
   nsresult mRet = NS_OK;
   PRBool externalDOMEvent = PR_FALSE;
 
@@ -3772,6 +3783,10 @@
       }
       aDOMEvent = nsnull;
     }
+
+    // Now that we're done with this event, remove the flag that says
+    // we're in the process of dispatching this event.
+    NS_MARK_EVENT_DISPATCH_DONE(aEvent);
   }
 
   return mRet;
@@ -3810,7 +3825,8 @@
                              nsIDOMEventListener* aListener,
                              PRBool aUseCapture)
 {
-  return AddGroupedEventListener(aType, aListener, aUseCapture, nsnull);
+  return AddEventListener(aType, aListener, aUseCapture,
+                          !nsContentUtils::IsChromeDoc(this));
 }
 
 nsresult
@@ -3890,6 +3906,24 @@
 }
 
 NS_IMETHODIMP
+nsDocument::AddEventListener(const nsAString& aType,
+                             nsIDOMEventListener *aListener,
+                             PRBool aUseCapture, PRBool aWantsUntrusted)
+{
+  nsCOMPtr<nsIEventListenerManager> manager;
+  nsresult rv = GetListenerManager(getter_AddRefs(manager));
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE;
+
+  if (aWantsUntrusted) {
+    flags |= NS_PRIV_EVENT_UNTRUSTED_PERMITTED;
+  }
+
+  return manager->AddEventListenerByType(aListener, aType, flags, nsnull);
+}
+
+NS_IMETHODIMP
 nsDocument::CreateEvent(const nsAString& aEventType, nsIDOMEvent** aReturn)
 {
   NS_ENSURE_ARG_POINTER(aReturn);
--- mozilla-firefox-1.0.4.orig/content/base/src/nsDocument.h
+++ mozilla-firefox-1.0.4/content/base/src/nsDocument.h
@@ -56,6 +56,7 @@
 #include "nsStubDocumentObserver.h"
 #include "nsIDOMEventReceiver.h"
 #include "nsIDOM3EventTarget.h"
+#include "nsIDOMNSEventTarget.h"
 #include "nsIDOMStyleSheetList.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsIDOMEventTarget.h"
@@ -191,6 +192,7 @@
                    public nsSupportsWeakReference,
                    public nsIDOMEventReceiver,
                    public nsIDOM3EventTarget,
+                   public nsIDOMNSEventTarget,
                    public nsIScriptObjectPrincipal,
                    public nsIRadioGroupContainer
 {
@@ -492,6 +494,9 @@
   // nsIDOM3EventTarget
   NS_DECL_NSIDOM3EVENTTARGET
 
+  // nsIDOMNSEventTarget
+  NS_DECL_NSIDOMNSEVENTTARGET
+
   // nsIScriptObjectPrincipal
   NS_IMETHOD GetPrincipalObsolete(nsIPrincipalObsolete **aPrincipal);
   NS_IMETHOD GetPrincipal(nsIPrincipal **aPrincipal);
--- mozilla-firefox-1.0.4.orig/content/base/src/nsDocumentViewer.cpp
+++ mozilla-firefox-1.0.4/content/base/src/nsDocumentViewer.cpp
@@ -911,7 +911,7 @@
   // Now, fire either an OnLoad or OnError event to the document...
   if(NS_SUCCEEDED(aStatus)) {
     nsEventStatus status = nsEventStatus_eIgnore;
-    nsEvent event(NS_PAGE_LOAD);
+    nsEvent event(PR_TRUE, NS_PAGE_LOAD);
 
     rv = global->HandleDOMEvent(mPresContext, &event, nsnull,
                                 NS_EVENT_FLAG_INIT, &status);
@@ -994,7 +994,7 @@
   // Now, fire an BeforeUnload event to the document and see if it's ok
   // to unload...
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsBeforePageUnloadEvent event(NS_BEFORE_PAGE_UNLOAD);
+  nsBeforePageUnloadEvent event(PR_TRUE, NS_BEFORE_PAGE_UNLOAD);
   nsresult rv = NS_OK;
 
   {
@@ -1098,7 +1098,7 @@
 
   // Now, fire an Unload event to the document...
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsEvent event(NS_PAGE_UNLOAD);
+  nsEvent event(PR_TRUE, NS_PAGE_UNLOAD);
 
   // Never permit popups from the unload handler, no matter how we get
   // here.
--- mozilla-firefox-1.0.4.orig/content/base/src/nsGenericDOMDataNode.cpp
+++ mozilla-firefox-1.0.4/content/base/src/nsGenericDOMDataNode.cpp
@@ -88,6 +88,8 @@
                                  nsDOMEventRTTearoff::Create(this))
   NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3EventTarget,
                                  nsDOMEventRTTearoff::Create(this))
+  NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMNSEventTarget,
+                                 nsDOMEventRTTearoff::Create(this))
   NS_INTERFACE_MAP_ENTRY(nsIContent)
   // No nsITextContent since all subclasses might not want that.
   NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3Node, new nsNode3Tearoff(this))
@@ -704,6 +706,9 @@
                                      PRUint32 aFlags,
                                      nsEventStatus* aEventStatus)
 {
+  // Make sure to tell the event that dispatch has started.
+  NS_MARK_EVENT_DISPATCH_STARTED(aEvent);
+
   nsresult ret = NS_OK;
   nsIDOMEvent* domEvent = nsnull;
 
@@ -778,6 +783,10 @@
     }
 
     aDOMEvent = nsnull;
+
+    // Now that we're done with this event, remove the flag that says
+    // we're in the process of dispatching this event.
+    NS_MARK_EVENT_DISPATCH_DONE(aEvent);
   }
 
   return ret;
@@ -1095,7 +1104,7 @@
 
   if (haveMutationListeners) {
     nsCOMPtr<nsIDOMEventTarget> node(do_QueryInterface(this));
-    nsMutationEvent mutation(NS_MUTATION_CHARACTERDATAMODIFIED, node);
+    nsMutationEvent mutation(PR_TRUE, NS_MUTATION_CHARACTERDATAMODIFIED, node);
 
     mutation.mPrevAttrValue = oldValue;
     nsDependentString newVal(aBuffer);
@@ -1139,7 +1148,7 @@
 
   if (haveMutationListeners) {
     nsCOMPtr<nsIDOMEventTarget> node(do_QueryInterface(this));
-    nsMutationEvent mutation(NS_MUTATION_CHARACTERDATAMODIFIED, node);
+    nsMutationEvent mutation(PR_TRUE, NS_MUTATION_CHARACTERDATAMODIFIED, node);
 
     mutation.mPrevAttrValue = oldValue;
     if (*aBuffer)
@@ -1170,14 +1179,14 @@
   if (haveMutationListeners) {
     oldValue = GetCurrentValueAtom();
   }
-    
+
   mText = aStr;
 
   SetBidiStatus();
 
   if (haveMutationListeners) {
     nsCOMPtr<nsIDOMEventTarget> node(do_QueryInterface(this));
-    nsMutationEvent mutation(NS_MUTATION_CHARACTERDATAMODIFIED, node);
+    nsMutationEvent mutation(PR_TRUE, NS_MUTATION_CHARACTERDATAMODIFIED, node);
 
     mutation.mPrevAttrValue = oldValue;
     if (!aStr.IsEmpty())
--- mozilla-firefox-1.0.4.orig/content/base/src/nsGenericElement.cpp
+++ mozilla-firefox-1.0.4/content/base/src/nsGenericElement.cpp
@@ -509,6 +509,7 @@
   NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
   NS_INTERFACE_MAP_ENTRY(nsIDOMEventReceiver)
   NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget)
+  NS_INTERFACE_MAP_ENTRY(nsIDOMNSEventTarget)
 NS_INTERFACE_MAP_END_AGGREGATED(mContent)
 
 NS_IMPL_ADDREF(nsDOMEventRTTearoff)
@@ -641,11 +642,15 @@
                                       nsIDOMEventListener *listener,
                                       PRBool useCapture)
 {
-  nsCOMPtr<nsIDOMEventReceiver> event_receiver;
-  nsresult rv = GetEventReceiver(getter_AddRefs(event_receiver));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return event_receiver->AddEventListener(type, listener, useCapture);
+  nsIDocument* doc = mContent->GetDocument();
+  if (!doc) {
+    nsIContent* parent = mContent->GetParent();
+    if (parent)
+        doc = parent->GetDocument();
+  }
+  return
+    AddEventListener(type, listener, useCapture,
+                     !nsContentUtils::IsChromeDoc(doc));
 }
 
 NS_IMETHODIMP
@@ -711,6 +716,27 @@
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
+// nsIDOMNSEventTarget
+NS_IMETHODIMP
+nsDOMEventRTTearoff::AddEventListener(const nsAString& aType,
+                                      nsIDOMEventListener *aListener,
+                                      PRBool aUseCapture,
+                                      PRBool aWantsUntrusted)
+{
+  nsCOMPtr<nsIEventListenerManager> listener_manager;
+  nsresult rv = mContent->GetListenerManager(getter_AddRefs(listener_manager));
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE;
+
+  if (aWantsUntrusted) {
+    flags |= NS_PRIV_EVENT_UNTRUSTED_PERMITTED;
+  }
+
+  return listener_manager->AddEventListenerByType(aListener, aType, flags,
+                                                  nsnull);
+}
+
 //----------------------------------------------------------------------
 
 nsDOMSlots::nsDOMSlots(PtrBits aFlags)
@@ -1814,6 +1840,9 @@
                                  PRUint32 aFlags,
                                  nsEventStatus* aEventStatus)
 {
+  // Make sure to tell the event that dispatch has started.
+  NS_MARK_EVENT_DISPATCH_STARTED(aEvent);
+
   nsresult ret = NS_OK;
   PRBool retarget = PR_FALSE;
   PRBool externalDOMEvent = PR_FALSE;
@@ -2034,6 +2063,10 @@
 
       aDOMEvent = nsnull;
     }
+
+    // Now that we're done with this event, remove the flag that says
+    // we're in the process of dispatching this event.
+    NS_MARK_EVENT_DISPATCH_DONE(aEvent);
   }
 
   return ret;
@@ -2525,7 +2558,7 @@
     }
 
     if (HasMutationListeners(this, NS_EVENT_BITS_MUTATION_NODEINSERTED)) {
-      nsMutationEvent mutation(NS_MUTATION_NODEINSERTED, aKid);
+      nsMutationEvent mutation(PR_TRUE, NS_MUTATION_NODEINSERTED, aKid);
       mutation.mRelatedNode = do_QueryInterface(this);
 
       nsEventStatus status = nsEventStatus_eIgnore;
@@ -2557,7 +2590,7 @@
       mDocument->ContentReplaced(this, oldKid, aKid, aIndex);
     }
     if (HasMutationListeners(this, NS_EVENT_BITS_MUTATION_SUBTREEMODIFIED)) {
-      nsMutationEvent mutation(NS_MUTATION_SUBTREEMODIFIED, this);
+      nsMutationEvent mutation(PR_TRUE, NS_MUTATION_SUBTREEMODIFIED, this);
       mutation.mRelatedNode = do_QueryInterface(oldKid);
     
       nsEventStatus status = nsEventStatus_eIgnore;
@@ -2594,7 +2627,7 @@
     }
 
     if (HasMutationListeners(this, NS_EVENT_BITS_MUTATION_NODEINSERTED)) {
-      nsMutationEvent mutation(NS_MUTATION_NODEINSERTED, aKid);
+      nsMutationEvent mutation(PR_TRUE, NS_MUTATION_NODEINSERTED, aKid);
       mutation.mRelatedNode = do_QueryInterface(this);
 
       nsEventStatus status = nsEventStatus_eIgnore;
@@ -2613,7 +2646,7 @@
     mozAutoDocUpdate updateBatch(mDocument, UPDATE_CONTENT_MODEL, aNotify);
 
     if (HasMutationListeners(this, NS_EVENT_BITS_MUTATION_NODEREMOVED)) {
-      nsMutationEvent mutation(NS_MUTATION_NODEREMOVED, oldKid);
+      nsMutationEvent mutation(PR_TRUE, NS_MUTATION_NODEREMOVED, oldKid);
       mutation.mRelatedNode = do_QueryInterface(this);
 
       nsEventStatus status = nsEventStatus_eIgnore;
@@ -3141,6 +3174,8 @@
                                  nsDOMEventRTTearoff::Create(this))
   NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3EventTarget,
                                  nsDOMEventRTTearoff::Create(this))
+  NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMNSEventTarget,
+                                 nsDOMEventRTTearoff::Create(this))
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent)
 NS_INTERFACE_MAP_END
 
@@ -3239,7 +3274,10 @@
   }
 
   if (manager) {
-    rv = manager->AddScriptEventListener(target, aAttribute, aValue, defer);
+    nsIDocument *ownerDoc = mNodeInfo->NodeInfoManager()->GetDocument();
+
+    rv = manager->AddScriptEventListener(target, aAttribute, aValue, defer,
+                                         !nsContentUtils::IsChromeDoc(ownerDoc));
   }
 
   return rv;
@@ -3401,8 +3439,9 @@
       binding->AttributeChanged(aName, aNamespaceID, PR_FALSE, aNotify);
 
     if (HasMutationListeners(this, NS_EVENT_BITS_MUTATION_ATTRMODIFIED)) {
-      nsCOMPtr<nsIDOMEventTarget> node(do_QueryInterface(NS_STATIC_CAST(nsIContent *, this)));
-      nsMutationEvent mutation(NS_MUTATION_ATTRMODIFIED, node);
+      nsCOMPtr<nsIDOMEventTarget> node =
+        do_QueryInterface(NS_STATIC_CAST(nsIContent *, this));
+      nsMutationEvent mutation(PR_TRUE, NS_MUTATION_ATTRMODIFIED, node);
 
       nsAutoString attrName;
       aName->ToString(attrName);
@@ -3492,8 +3531,9 @@
     }
 
     if (HasMutationListeners(this, NS_EVENT_BITS_MUTATION_ATTRMODIFIED)) {
-      nsCOMPtr<nsIDOMEventTarget> node(do_QueryInterface(NS_STATIC_CAST(nsIContent *, this)));
-      nsMutationEvent mutation(NS_MUTATION_ATTRMODIFIED, node);
+      nsCOMPtr<nsIDOMEventTarget> node =
+        do_QueryInterface(NS_STATIC_CAST(nsIContent *, this));
+      nsMutationEvent mutation(PR_TRUE, NS_MUTATION_ATTRMODIFIED, node);
 
       nsAutoString attrName;
       aName->ToString(attrName);
--- mozilla-firefox-1.0.4.orig/content/base/src/nsGenericElement.h
+++ mozilla-firefox-1.0.4/content/base/src/nsGenericElement.h
@@ -50,11 +50,7 @@
 #include "nsIDOMEventReceiver.h"
 #include "nsIDOM3EventTarget.h"
 #include "nsIDOM3Node.h"
-#include "nsIStyleSheetLinkingElement.h"
-#include "nsICSSStyleSheet.h"
-#include "nsICSSLoaderObserver.h"
-#include "nsIDocument.h"
-#include "nsVoidArray.h"
+#include "nsIDOMNSEventTarget.h"
 #include "nsILinkHandler.h"
 #include "nsGenericDOMNodeList.h"
 #include "nsIEventListenerManager.h"
@@ -270,7 +266,8 @@
  */
 
 class nsDOMEventRTTearoff : public nsIDOMEventReceiver,
-                            public nsIDOM3EventTarget
+                            public nsIDOM3EventTarget,
+                            public nsIDOMNSEventTarget
 {
 private:
   // This class uses a caching scheme so we don't let users of this
@@ -326,6 +323,9 @@
   NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent);
   NS_IMETHOD GetSystemEventGroup(nsIDOMEventGroup** aGroup);
 
+  // nsIDOMNSEventTarget
+  NS_DECL_NSIDOMNSEVENTTARGET
+
 private:
   /**
    * Strong reference back to the content object from where an instance of this
--- mozilla-firefox-1.0.4.orig/content/base/src/nsImageLoadingContent.cpp
+++ mozilla-firefox-1.0.4/content/base/src/nsImageLoadingContent.cpp
@@ -575,7 +575,7 @@
     eventMsg = NS_IMAGE_ERROR;
   }
 
-  nsEvent event(eventMsg);
+  nsEvent event(PR_TRUE, eventMsg);
   evt->mContent->HandleDOMEvent(evt->mPresContext, &event, nsnull,
                                 NS_EVENT_FLAG_INIT, &estatus);
 
--- mozilla-firefox-1.0.4.orig/content/base/src/nsSelection.cpp
+++ mozilla-firefox-1.0.4/content/base/src/nsSelection.cpp
@@ -906,6 +906,7 @@
 ////////////BEGIN nsSelection methods
 
 nsSelection::nsSelection()
+  : mDelayedMouseEvent(PR_FALSE, 0, nsnull)
 {
   PRInt32 i;
   for (i = 0;i<nsISelectionController::NUM_SELECTIONTYPES;i++){
@@ -2741,7 +2742,7 @@
 #endif
         nsCOMPtr<nsIDOMNode> parent;
         nsCOMPtr<nsIContent> parentContent;
-        nsMouseEvent event;
+        nsMouseEvent event(PR_FALSE, 0, nsnull);
         nsresult result;
 
         // Start selecting in the cell we were in before
--- mozilla-firefox-1.0.4.orig/content/html/content/src/nsGenericHTMLElement.cpp
+++ mozilla-firefox-1.0.4/content/html/content/src/nsGenericHTMLElement.cpp
@@ -1477,7 +1477,8 @@
 
             //fire click
             nsGUIEvent* guiEvent = NS_STATIC_CAST(nsGUIEvent*, aEvent);
-            nsMouseEvent event(NS_MOUSE_LEFT_CLICK, guiEvent->widget);
+            nsMouseEvent event(NS_IS_TRUSTED_EVENT(aEvent),
+                               NS_MOUSE_LEFT_CLICK, guiEvent->widget);
             event.point = aEvent->point;
             event.refPoint = aEvent->refPoint;
             event.clickCount = 1;
@@ -1485,8 +1486,6 @@
             event.isControl = keyEvent->isControl;
             event.isAlt = keyEvent->isAlt;
             event.isMeta = keyEvent->isMeta;
-            event.internalAppFlags |=
-              aEvent->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED;
 
             nsIPresShell *presShell = aPresContext->GetPresShell();
             if (presShell) {
@@ -1679,7 +1678,7 @@
     if (aFireMutation) {
       nsCOMPtr<nsIDOMEventTarget> node =
         do_QueryInterface(NS_STATIC_CAST(nsIContent *, this));
-      nsMutationEvent mutation(NS_MUTATION_ATTRMODIFIED, node);
+      nsMutationEvent mutation(PR_TRUE, NS_MUTATION_ATTRMODIFIED, node);
 
       nsAutoString attrName;
       aAttribute->ToString(attrName);
--- mozilla-firefox-1.0.4.orig/content/html/content/src/nsHTMLButtonElement.cpp
+++ mozilla-firefox-1.0.4/content/html/content/src/nsHTMLButtonElement.cpp
@@ -256,8 +256,12 @@
       nsCOMPtr<nsIPresContext> context;
       shell->GetPresContext(getter_AddRefs(context));
       if (context) {
+        // Click() is never called from native code, but it may be
+        // called from chrome JS. Mark this event trusted if Click()
+        // is called from chrome code.
+        nsMouseEvent event(nsContentUtils::IsCallerChrome(),
+                           NS_MOUSE_LEFT_CLICK, nsnull);
         nsEventStatus status = nsEventStatus_eIgnore;
-        nsMouseEvent event(NS_MOUSE_LEFT_CLICK);
         HandleDOMEvent(context, &event, nsnull,
                        NS_EVENT_FLAG_INIT, &status);
       }
@@ -429,7 +433,9 @@
           if ((keyEvent->keyCode == NS_VK_RETURN && NS_KEY_PRESS == aEvent->message) ||
               keyEvent->keyCode == NS_VK_SPACE  && NS_KEY_UP == aEvent->message) {
             nsEventStatus status = nsEventStatus_eIgnore;
-            nsMouseEvent event(NS_MOUSE_LEFT_CLICK);
+
+            nsMouseEvent event(NS_IS_TRUSTED_EVENT(aEvent),
+                               NS_MOUSE_LEFT_CLICK, nsnull);
             rv = HandleDOMEvent(aPresContext, &event, nsnull,
                                 NS_EVENT_FLAG_INIT, &status);
           }
@@ -438,22 +444,22 @@
 
       case NS_MOUSE_LEFT_CLICK:
         {
-          if (mForm) {
-            if (mType == NS_FORM_BUTTON_SUBMIT || mType == NS_FORM_BUTTON_RESET) {
-              nsFormEvent event((mType == NS_FORM_BUTTON_RESET)
-                                ? NS_FORM_RESET : NS_FORM_SUBMIT);
-              event.originator      = this;
-              nsEventStatus status  = nsEventStatus_eIgnore;
-
-              nsIPresShell *presShell = aPresContext->GetPresShell();
-              // If |nsIPresShell::Destroy| has been called due to
-              // handling the event (base class HandleDOMEvent, above),
-              // the pres context will return a null pres shell.  See
-              // bug 125624.
-              if (presShell) {
-                nsCOMPtr<nsIContent> form(do_QueryInterface(mForm));
-                presShell->HandleDOMEventWithTarget(form, &event, &status);
-              }
+          if (mForm && (mType == NS_FORM_BUTTON_SUBMIT ||
+                        mType == NS_FORM_BUTTON_RESET)) {
+            nsFormEvent event(PR_TRUE,
+                              (mType == NS_FORM_BUTTON_RESET)
+                              ? NS_FORM_RESET : NS_FORM_SUBMIT);
+            event.originator      = this;
+            nsEventStatus status  = nsEventStatus_eIgnore;
+
+            nsIPresShell *presShell = aPresContext->GetPresShell();
+            // If |nsIPresShell::Destroy| has been called due to
+            // handling the event (base class HandleDOMEvent, above),
+            // the pres context will return a null pres shell.  See
+            // bug 125624.
+            if (presShell) {
+              nsCOMPtr<nsIContent> form(do_QueryInterface(mForm));
+              presShell->HandleDOMEventWithTarget(form, &event, &status);
             }
           }
         }
--- mozilla-firefox-1.0.4.orig/content/html/content/src/nsHTMLFormElement.cpp
+++ mozilla-firefox-1.0.4/content/html/content/src/nsHTMLFormElement.cpp
@@ -611,7 +611,7 @@
     // the frame does not exist.  This does not have an effect right now, but
     // If PresShell::HandleEventWithTarget() ever starts to work for elements
     // without frames, that should be called instead.
-    nsFormEvent event(NS_FORM_RESET);
+    nsFormEvent event(PR_TRUE, NS_FORM_RESET);
     nsEventStatus status  = nsEventStatus_eIgnore;
     HandleDOMEvent(presContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
   }
--- mozilla-firefox-1.0.4.orig/content/html/content/src/nsHTMLInputElement.cpp
+++ mozilla-firefox-1.0.4/content/html/content/src/nsHTMLInputElement.cpp
@@ -985,13 +985,13 @@
     if (submitControl) {
       // Fire the button's onclick handler and let the button handle
       // submitting the form.
-      nsMouseEvent event(NS_MOUSE_LEFT_CLICK);
+      nsMouseEvent event(PR_TRUE, NS_MOUSE_LEFT_CLICK, nsnull);
       nsEventStatus status = nsEventStatus_eIgnore;
       shell->HandleDOMEventWithTarget(submitControl, &event, &status);
     } else if (numTextControlsFound == 1) {
       // If there's only one text control, just submit the form
       nsCOMPtr<nsIContent> form = do_QueryInterface(mForm);
-      nsFormEvent event(NS_FORM_SUBMIT);
+      nsFormEvent event(PR_TRUE, NS_FORM_SUBMIT);
       nsEventStatus status  = nsEventStatus_eIgnore;
       shell->HandleDOMEventWithTarget(form, &event, &status);
     }
@@ -1051,7 +1051,7 @@
   nsCOMPtr<nsIPresContext> presContext;
   GetPresContext(this, getter_AddRefs(presContext));
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsEvent event(NS_FORM_CHANGE);
+  nsEvent event(PR_TRUE, NS_FORM_CHANGE);
   HandleDOMEvent(presContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
 }
 
@@ -1182,8 +1182,8 @@
     
     //If already handling select event, don't dispatch a second.
     if (!GET_BOOLBIT(mBitField, BF_HANDLING_SELECT_EVENT)) {
-      nsEvent event(NS_FORM_SELECTED);
-  
+      nsEvent event(nsContentUtils::IsCallerChrome(), NS_FORM_SELECTED);
+
       SET_BOOLBIT(mBitField, BF_HANDLING_SELECT_EVENT, PR_TRUE);
       rv = HandleDOMEvent(presContext, &event, nsnull, NS_EVENT_FLAG_INIT,
                           &status);
@@ -1269,8 +1269,12 @@
       shell->GetPresContext(getter_AddRefs(context));
 
       if (context) {
+        // Click() is never called from native code, but it may be
+        // called from chrome JS. Mark this event trusted if Click()
+        // is called from chrome code.
+        nsMouseEvent event(nsContentUtils::IsCallerChrome(),
+                           NS_MOUSE_LEFT_CLICK, nsnull);
         nsEventStatus status = nsEventStatus_eIgnore;
-        nsMouseEvent event(NS_MOUSE_LEFT_CLICK);
 
         SET_BOOLBIT(mBitField, BF_HANDLING_CLICK, PR_TRUE);
 
@@ -1497,8 +1501,10 @@
               case NS_FORM_INPUT_SUBMIT:
               case NS_FORM_INPUT_IMAGE: // Bug 34418
               {
+                nsMouseEvent event(NS_IS_TRUSTED_EVENT(aEvent),
+                                   NS_MOUSE_LEFT_CLICK, nsnull);
                 nsEventStatus status = nsEventStatus_eIgnore;
-                nsMouseEvent event(NS_MOUSE_LEFT_CLICK);
+
                 rv = HandleDOMEvent(aPresContext, &event, nsnull,
                                     NS_EVENT_FLAG_INIT, &status);
               } // case
@@ -1585,7 +1591,7 @@
             case NS_FORM_INPUT_IMAGE:
               {
                 if (mForm) {
-                  nsFormEvent event((mType == NS_FORM_INPUT_RESET) ?
+                  nsFormEvent event(PR_TRUE, (mType == NS_FORM_INPUT_RESET) ?
                                     NS_FORM_RESET : NS_FORM_SUBMIT);
                   event.originator      = this;
                   nsEventStatus status  = nsEventStatus_eIgnore;
@@ -2042,9 +2048,16 @@
   nsCOMPtr<nsIEventListenerManager> manager;
   GetListenerManager(getter_AddRefs(manager));
   if (manager &&
-      NS_SUCCEEDED(manager->CreateEvent(aPresContext, nsnull, NS_LITERAL_STRING("Events"), getter_AddRefs(event)))) {
+      NS_SUCCEEDED(manager->CreateEvent(aPresContext, nsnull,
+                                        NS_LITERAL_STRING("Events"),
+                                        getter_AddRefs(event)))) {
     event->InitEvent(aEventType, PR_TRUE, PR_TRUE);
 
+    nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));
+    if (privateEvent) {
+      privateEvent->SetTrusted(PR_TRUE);
+    }
+
     PRBool noDefault;
     nsISupports *target = NS_STATIC_CAST(nsIDOMHTMLInputElement*, this);
     aPresContext->EventStateManager()->DispatchNewEvent(target, event,
--- mozilla-firefox-1.0.4.orig/content/html/content/src/nsHTMLScriptElement.cpp
+++ mozilla-firefox-1.0.4/content/html/content/src/nsHTMLScriptElement.cpp
@@ -577,7 +577,7 @@
     GetPresContext(this, getter_AddRefs(presContext));
 
     nsEventStatus status = nsEventStatus_eIgnore;
-    nsScriptErrorEvent event(NS_SCRIPT_ERROR);
+    nsScriptErrorEvent event(PR_TRUE, NS_SCRIPT_ERROR);
 
     event.lineNr = aLineNo;
 
@@ -610,7 +610,8 @@
     GetPresContext(this, getter_AddRefs(presContext));
 
     nsEventStatus status = nsEventStatus_eIgnore;
-    nsEvent event(NS_SUCCEEDED(aResult) ? NS_SCRIPT_LOAD : NS_SCRIPT_ERROR);
+    nsEvent event(PR_TRUE,
+                  NS_SUCCEEDED(aResult) ? NS_SCRIPT_LOAD : NS_SCRIPT_ERROR);
     rv = HandleDOMEvent(presContext, &event, nsnull, NS_EVENT_FLAG_INIT,
                         &status);
   }
--- mozilla-firefox-1.0.4.orig/content/html/content/src/nsHTMLSelectElement.cpp
+++ mozilla-firefox-1.0.4/content/html/content/src/nsHTMLSelectElement.cpp
@@ -63,6 +63,7 @@
 #include "nsIDOMHTMLOptionsCollection.h"
 #include "nsIDOMNSHTMLOptionCollectn.h"
 #include "nsGUIEvent.h"
+#include "nsIPrivateDOMEvent.h"
 #include "nsIBoxObject.h"
 #include "nsIDOMNSDocument.h"
 #include "nsIDOMDocumentEvent.h"
@@ -2129,10 +2130,18 @@
   nsCOMPtr<nsIDOMDocumentEvent> domDoc = do_QueryInterface(mDocument);
   if (domDoc) {
     nsCOMPtr<nsIDOMEvent> selectEvent;
-    domDoc->CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(selectEvent));
-    if (selectEvent) {
+    domDoc->CreateEvent(NS_LITERAL_STRING("Events"),
+                        getter_AddRefs(selectEvent));
+
+    nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(selectEvent));
+
+    if (privateEvent) {
       selectEvent->InitEvent(aName, PR_TRUE, PR_TRUE);
-      nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(NS_STATIC_CAST(nsIDOMNode*, this)));
+
+      privateEvent->SetTrusted(PR_TRUE);
+
+      nsCOMPtr<nsIDOMEventTarget> target =
+        do_QueryInterface(NS_STATIC_CAST(nsIDOMNode*, this));
       PRBool noDefault;
       target->DispatchEvent(selectEvent, &noDefault);
     }
--- mozilla-firefox-1.0.4.orig/content/html/content/src/nsHTMLTableCellElement.cpp
+++ mozilla-firefox-1.0.4/content/html/content/src/nsHTMLTableCellElement.cpp
@@ -334,7 +334,8 @@
   { 0 }
 };
 
-#define MAX_COLROWSPAN 8190 // celldata.h can not handle more
+#define MAX_ROWSPAN 8190 // celldata.h can not handle more
+#define MAX_COLSPAN 1000 // limit as IE and opera do
 
 PRBool
 nsHTMLTableCellElement::ParseAttribute(nsIAtom* aAttribute,
@@ -348,9 +349,20 @@
     /* attributes that resolve to integers with a min of 0 */
     return aResult.ParseIntWithBounds(aValue, 0);
   }
-  else if ((aAttribute == nsHTMLAtoms::colspan) ||
-           (aAttribute == nsHTMLAtoms::rowspan)) {
-    PRBool res = aResult.ParseIntWithBounds(aValue, -1, MAX_COLROWSPAN);
+  if (aAttribute == nsHTMLAtoms::colspan) {
+    PRBool res = aResult.ParseIntWithBounds(aValue, -1);
+    if (res) {
+      PRInt32 val = aResult.GetIntegerValue();
+      // reset large colspan values as IE and opera do
+      // quirks mode does not honor the special html 4 value of 0
+      if (val > MAX_COLSPAN || val < 0 || (0 == val && InNavQuirksMode(mDocument))) {
+        aResult.SetTo(1, nsAttrValue::eInteger);
+      }
+    }
+    return res;
+  }
+  if (aAttribute == nsHTMLAtoms::rowspan) {
+    PRBool res = aResult.ParseIntWithBounds(aValue, -1, MAX_ROWSPAN);
     if (res) {
       PRInt32 val = aResult.GetIntegerValue();
       // quirks mode does not honor the special html 4 value of 0
--- mozilla-firefox-1.0.4.orig/content/html/content/src/nsHTMLTextAreaElement.cpp
+++ mozilla-firefox-1.0.4/content/html/content/src/nsHTMLTextAreaElement.cpp
@@ -352,8 +352,9 @@
   GetPresContext(this, getter_AddRefs(presContext)); 
 
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsGUIEvent event(NS_FORM_SELECTED);
-  rv = HandleDOMEvent(presContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
+  nsGUIEvent event(PR_TRUE, NS_FORM_SELECTED, nsnull);
+  rv = HandleDOMEvent(presContext, &event, nsnull, NS_EVENT_FLAG_INIT,
+                      &status);
 
   // If the DOM event was not canceled (e.g. by a JS event handler
   // returning false)
--- mozilla-firefox-1.0.4.orig/content/html/document/src/nsHTMLDocument.cpp
+++ mozilla-firefox-1.0.4/content/html/document/src/nsHTMLDocument.cpp
@@ -1985,15 +1985,10 @@
 {
   *sourceURI = nsnull;
 
-  // XXX This will fail on non-DOM contexts :(
-  nsIDOMDocument *domDoc = nsContentUtils::GetDocumentFromCaller();
-
-  nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
-  if (!doc) {
-    return NS_OK; // No document in the window
-  }
+  nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager();
 
-  nsIPrincipal *principal = doc->GetPrincipal();
+  nsCOMPtr<nsIPrincipal> principal;
+  secMan->GetSubjectPrincipal(getter_AddRefs(principal));
 
   if (!principal) {
     return NS_OK; // No principal available
--- mozilla-firefox-1.0.4.orig/content/events/public/nsIEventListenerManager.h
+++ mozilla-firefox-1.0.4/content/events/public/nsIEventListenerManager.h
@@ -102,15 +102,18 @@
   NS_IMETHOD AddScriptEventListener(nsISupports *aObject,
                                     nsIAtom *aName,
                                     const nsAString& aFunc,
-                                    PRBool aDeferCompilation) = 0;
+                                    PRBool aDeferCompilation,
+                                    PRBool aPermitUntrustedEvents) = 0;
 
 
   NS_IMETHOD RemoveScriptEventListener(nsIAtom *aName) = 0;
 
   /**
   * Registers an event listener that already exists on the given
-  * script object with the event listener manager.
-  * @param an event listener
+  * script object with the event listener manager. If the event
+  * listener is registerd from chrome code, the event listener will
+  * only ever receive trusted events.
+  * @param the name of an event listener
   */
   NS_IMETHOD RegisterScriptEventListener(nsIScriptContext *aContext,
                                          nsISupports *aObject,
--- mozilla-firefox-1.0.4.orig/content/events/public/nsIPrivateDOMEvent.h
+++ mozilla-firefox-1.0.4/content/events/public/nsIPrivateDOMEvent.h
@@ -54,9 +54,10 @@
 
 class nsIDOMEventTarget;
 class nsIDOMEvent;
+class nsEvent;
 
-class nsIPrivateDOMEvent : public nsISupports {
-
+class nsIPrivateDOMEvent : public nsISupports
+{
 public:
   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPRIVATEDOMEVENT_IID)
 
--- mozilla-firefox-1.0.4.orig/content/events/public/nsMutationEvent.h
+++ mozilla-firefox-1.0.4/content/events/public/nsMutationEvent.h
@@ -43,27 +43,24 @@
 
 #define NS_MUTATION_EVENT     20
 
-struct nsMutationEvent : public nsEvent
-{             
-  nsMutationEvent(PRUint32 msg = 0, PRUint8 structType = NS_MUTATION_EVENT)
-    : nsEvent(msg, structType),
+class nsMutationEvent : public nsEvent
+{
+public:
+  nsMutationEvent(PRBool isTrusted, PRUint32 msg)
+    : nsEvent(isTrusted, msg, NS_MUTATION_EVENT),
       mAttrChange(0)
   {
   }
 
-  nsMutationEvent(PRUint32 msg,
-                  nsIDOMEventTarget *target,
-                  PRUint8 structType = NS_MUTATION_EVENT)
-    : nsEvent(msg, structType),
+  nsMutationEvent(PRBool isTrusted, PRUint32 msg, nsIDOMEventTarget *target)
+    : nsEvent(isTrusted, msg, NS_MUTATION_EVENT),
       mTarget(target),
       mAttrChange(0)
   {
   }
 
-  nsMutationEvent(PRUint32 msg,
-                  nsIContent *target,
-                  PRUint8 structType = NS_MUTATION_EVENT)
-    : nsEvent(msg, structType),
+  nsMutationEvent(PRBool isTrusted, PRUint32 msg, nsIContent *target)
+    : nsEvent(isTrusted, msg, NS_MUTATION_EVENT),
       mTarget(do_QueryInterface(target)),
       mAttrChange(0)
   {
--- mozilla-firefox-1.0.4.orig/content/events/src/nsDOMEvent.cpp
+++ mozilla-firefox-1.0.4/content/events/src/nsDOMEvent.cpp
@@ -65,6 +65,7 @@
 #include "nsIURI.h"
 #include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
+#include "nsIScriptSecurityManager.h"
 
 static const char* const sEventNames[] = {
   "mousedown", "mouseup", "click", "dblclick", "mouseover",
@@ -492,7 +493,7 @@
 NS_IMETHODIMP
 nsDOMEvent::GetIsTrusted(PRBool *aIsTrusted)
 {
-  *aIsTrusted = (mEvent->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED) != 0;
+  *aIsTrusted = NS_IS_TRUSTED_EVENT(mEvent);
 
   return NS_OK;
 }
@@ -1190,7 +1191,7 @@
 nsresult
 nsDOMEvent::SetEventType(const nsAString& aEventTypeArg)
 {
-  nsCOMPtr<nsIAtom> atom= do_GetAtom(NS_LITERAL_STRING("on") + aEventTypeArg);
+  nsCOMPtr<nsIAtom> atom = do_GetAtom(NS_LITERAL_STRING("on") + aEventTypeArg);
   mEvent->message = NS_USER_DEFINED_EVENT;
 
   if (mEvent->eventStructType == NS_MOUSE_EVENT) {
@@ -1264,9 +1265,32 @@
 NS_IMETHODIMP
 nsDOMEvent::InitEvent(const nsAString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg)
 {
+  // Make sure this event isn't already being dispatched.
+  NS_ENSURE_TRUE(!NS_IS_EVENT_IN_DISPATCH(mEvent), NS_ERROR_INVALID_ARG);
+
+  if (NS_IS_TRUSTED_EVENT(mEvent)) {
+    // Ensure the caller is permitted to dispatch trusted DOM events.
+
+    PRBool enabled = PR_FALSE;
+    nsContentUtils::GetSecurityManager()->
+      IsCapabilityEnabled("UniversalBrowserWrite", &enabled);
+
+    if (!enabled) {
+      SetTrusted(PR_FALSE);
+    }
+  }
+
   NS_ENSURE_SUCCESS(SetEventType(aEventTypeArg), NS_ERROR_FAILURE);
-  mEvent->flags |= aCanBubbleArg ? NS_EVENT_FLAG_NONE : NS_EVENT_FLAG_CANT_BUBBLE;
-  mEvent->flags |= aCancelableArg ? NS_EVENT_FLAG_NONE : NS_EVENT_FLAG_CANT_CANCEL;
+
+  mEvent->flags |=
+    aCanBubbleArg ? NS_EVENT_FLAG_NONE : NS_EVENT_FLAG_CANT_BUBBLE;
+  mEvent->flags |=
+    aCancelableArg ? NS_EVENT_FLAG_NONE : NS_EVENT_FLAG_CANT_CANCEL;
+
+  // Unset the NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY bit (which is
+  // set at the end of event dispatch) so that this event can be
+  // dispatched.
+  mEvent->flags &= ~NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY;
 
   return NS_OK;
 }
@@ -1275,6 +1299,26 @@
 nsDOMEvent::InitUIEvent(const nsAString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, 
                         nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg)
 {
+  // Make sure this event isn't already being dispatched.
+  NS_ENSURE_TRUE(!NS_IS_EVENT_IN_DISPATCH(mEvent), NS_ERROR_INVALID_ARG);
+
+  if (NS_IS_TRUSTED_EVENT(mEvent)) {
+    // Ensure the caller is permitted to dispatch trusted DOM events.
+
+    PRBool enabled = PR_FALSE;
+    nsContentUtils::GetSecurityManager()->
+      IsCapabilityEnabled("UniversalBrowserWrite", &enabled);
+
+    if (!enabled) {
+      SetTrusted(PR_FALSE);
+    }
+  }
+
+  // Unset the NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY bit (which is
+  // set at the end of event dispatch) so that this event can be
+  // dispatched.
+  mEvent->flags &= ~NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY;
+
   return NS_ERROR_FAILURE;
 }
 
@@ -1285,6 +1329,26 @@
                            PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, 
                            PRBool aMetaKeyArg, PRUint16 aButtonArg, nsIDOMEventTarget *aRelatedTargetArg)
 {
+  // Make sure this event isn't already being dispatched.
+  NS_ENSURE_TRUE(!NS_IS_EVENT_IN_DISPATCH(mEvent), NS_ERROR_INVALID_ARG);
+
+  if (NS_IS_TRUSTED_EVENT(mEvent)) {
+    // Ensure the caller is permitted to dispatch trusted DOM events.
+
+    PRBool enabled = PR_FALSE;
+    nsContentUtils::GetSecurityManager()->
+      IsCapabilityEnabled("UniversalBrowserWrite", &enabled);
+
+    if (!enabled) {
+      SetTrusted(PR_FALSE);
+    }
+  }
+
+  // Unset the NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY bit (which is
+  // set at the end of event dispatch) so that this event can be
+  // dispatched.
+  mEvent->flags &= ~NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY;
+
   NS_ENSURE_SUCCESS(SetEventType(aTypeArg), NS_ERROR_FAILURE);
   mEvent->flags |= aCanBubbleArg ? NS_EVENT_FLAG_NONE : NS_EVENT_FLAG_CANT_BUBBLE;
   mEvent->flags |= aCancelableArg ? NS_EVENT_FLAG_NONE : NS_EVENT_FLAG_CANT_CANCEL;
@@ -1325,6 +1389,26 @@
                          PRBool aShiftKeyArg, PRBool aMetaKeyArg, 
                          PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg)
 {
+  // Make sure this event isn't already being dispatched.
+  NS_ENSURE_TRUE(!NS_IS_EVENT_IN_DISPATCH(mEvent), NS_ERROR_INVALID_ARG);
+
+  if (NS_IS_TRUSTED_EVENT(mEvent)) {
+    // Ensure the caller is permitted to dispatch trusted DOM events.
+
+    PRBool enabled = PR_FALSE;
+    nsContentUtils::GetSecurityManager()->
+      IsCapabilityEnabled("UniversalBrowserWrite", &enabled);
+
+    if (!enabled) {
+      SetTrusted(PR_FALSE);
+    }
+  }
+
+  // Unset the NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY bit (which is
+  // set at the end of event dispatch) so that this event can be
+  // dispatched.
+  mEvent->flags &= ~NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY;
+
   NS_ENSURE_SUCCESS(SetEventType(aTypeArg), NS_ERROR_FAILURE);
   mEvent->flags |= aCanBubbleArg ? NS_EVENT_FLAG_NONE : NS_EVENT_FLAG_CANT_BUBBLE;
   mEvent->flags |= aCancelableArg ? NS_EVENT_FLAG_NONE : NS_EVENT_FLAG_CANT_CANCEL;
@@ -1352,6 +1436,26 @@
                             nsIURI *aPopupWindowURI,
                             const nsAString & aPopupWindowFeatures)
 {
+  // Make sure this event isn't already being dispatched.
+  NS_ENSURE_TRUE(!NS_IS_EVENT_IN_DISPATCH(mEvent), NS_ERROR_INVALID_ARG);
+
+  if (NS_IS_TRUSTED_EVENT(mEvent)) {
+    // Ensure the caller is permitted to dispatch trusted DOM events.
+
+    PRBool enabled = PR_FALSE;
+    nsContentUtils::GetSecurityManager()->
+      IsCapabilityEnabled("UniversalBrowserWrite", &enabled);
+
+    if (!enabled) {
+      SetTrusted(PR_FALSE);
+    }
+  }
+
+  // Unset the NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY bit (which is
+  // set at the end of event dispatch) so that this event can be
+  // dispatched.
+  mEvent->flags &= ~NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY;
+
   NS_ENSURE_SUCCESS(SetEventType(aTypeArg), NS_ERROR_FAILURE);
   mEvent->flags |= aCanBubbleArg ? NS_EVENT_FLAG_NONE : NS_EVENT_FLAG_CANT_BUBBLE;
   mEvent->flags |= aCancelableArg ? NS_EVENT_FLAG_NONE : NS_EVENT_FLAG_CANT_CANCEL;
@@ -1570,7 +1674,7 @@
     }
     break;
   case NS_KEY_EVENT :
-    if (aEvent->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED) {
+    if (NS_IS_TRUSTED_EVENT(aEvent)) {
       PRUint32 key = NS_STATIC_CAST(nsKeyEvent *, aEvent)->keyCode;
       switch(aEvent->message) {
       case NS_KEY_PRESS :
@@ -1595,7 +1699,7 @@
     }
     break;
   case NS_MOUSE_EVENT :
-    if (aEvent->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED) {
+    if (NS_IS_TRUSTED_EVENT(aEvent)) {
       switch(aEvent->message) {
       case NS_MOUSE_LEFT_BUTTON_UP :
         if (::PopupAllowedForEvent("mouseup"))
@@ -1818,25 +1922,25 @@
   //Allocate internal event
   nsAutoString eventType(aEventType);
   if (eventType.EqualsIgnoreCase("MouseEvents")) {
-    mEvent = new nsMouseEvent();
+    mEvent = new nsMouseEvent(PR_FALSE, 0, nsnull);
   }
   else if (eventType.EqualsIgnoreCase("MouseScrollEvents")) {
-    mEvent = new nsMouseScrollEvent();
+    mEvent = new nsMouseScrollEvent(PR_FALSE, 0, nsnull);
   }
   else if (eventType.EqualsIgnoreCase("KeyEvents")) {
-    mEvent = new nsKeyEvent();
+    mEvent = new nsKeyEvent(PR_FALSE, 0, nsnull);
   }
   else if (eventType.EqualsIgnoreCase("MutationEvents")) {
-    mEvent = new nsMutationEvent();
+    mEvent = new nsMutationEvent(PR_FALSE, 0);
   }
   else if (eventType.EqualsIgnoreCase("PopupEvents")) {
-    mEvent = new nsGUIEvent();
+    mEvent = new nsGUIEvent(PR_FALSE, 0, nsnull);
   }
   else if (eventType.EqualsIgnoreCase("PopupBlockedEvents")) {
-    mEvent = new nsPopupBlockedEvent();
+    mEvent = new nsPopupBlockedEvent(PR_FALSE, 0);
   }
   else {
-    mEvent = new nsEvent();
+    mEvent = new nsEvent(PR_FALSE, 0);
   }
   mEvent->time = PR_Now();
 }
--- mozilla-firefox-1.0.4.orig/content/events/src/nsDOMMutationEvent.cpp
+++ mozilla-firefox-1.0.4/content/events/src/nsDOMMutationEvent.cpp
@@ -41,6 +41,7 @@
 #include "nsDOMEvent.h"
 #include "nsMutationEvent.h"
 #include "nsContentUtils.h"
+#include "nsIScriptSecurityManager.h"
 
 class nsIPresContext;
 
@@ -150,6 +151,26 @@
                                       const nsAString& aAttrNameArg,
                                       PRUint16 aAttrChangeArg)
 {
+  // Make sure this event isn't already being dispatched.
+  NS_ENSURE_TRUE(!NS_IS_EVENT_IN_DISPATCH(mEvent), NS_ERROR_INVALID_ARG);
+
+  if (NS_IS_TRUSTED_EVENT(mEvent)) {
+    // Ensure the caller is permitted to dispatch trusted DOM events.
+
+    PRBool enabled = PR_FALSE;
+    nsContentUtils::GetSecurityManager()->
+      IsCapabilityEnabled("UniversalBrowserWrite", &enabled);
+
+    if (!enabled) {
+      SetTrusted(PR_FALSE);
+    }
+  }
+
+  // Unset the NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY bit (which is
+  // set at the end of event dispatch) so that this event can be
+  // dispatched.
+  mEvent->flags &= ~NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY;
+
   NS_ENSURE_SUCCESS(SetEventType(aTypeArg), NS_ERROR_FAILURE);
   mEvent->flags |= aCanBubbleArg ? NS_EVENT_FLAG_NONE : NS_EVENT_FLAG_CANT_BUBBLE;
   mEvent->flags |= aCancelableArg ? NS_EVENT_FLAG_NONE : NS_EVENT_FLAG_CANT_CANCEL;
--- mozilla-firefox-1.0.4.orig/content/events/src/nsEventListenerManager.cpp
+++ mozilla-firefox-1.0.4/content/events/src/nsEventListenerManager.cpp
@@ -386,7 +386,8 @@
   }
 }
 
-nsresult nsEventListenerManager::RemoveAllListeners(PRBool aScriptOnly)
+nsresult
+nsEventListenerManager::RemoveAllListeners(PRBool aScriptOnly)
 {
   if (!aScriptOnly) {
     mListenersRemoved = PR_TRUE;
@@ -400,7 +401,7 @@
 
   if (mMultiListeners) {
     // XXX probably should just be i < Count()
-    for (int i=0; i<EVENT_ARRAY_TYPE_LENGTH && i < mMultiListeners->Count(); i++) {
+    for (PRInt32 i=0; i<EVENT_ARRAY_TYPE_LENGTH && i < mMultiListeners->Count(); i++) {
       nsVoidArray* listeners;
       listeners = NS_STATIC_CAST(nsVoidArray*, mMultiListeners->ElementAt(i));
       ReleaseListeners(&listeners, aScriptOnly);
@@ -426,7 +427,8 @@
   return NS_OK;
 }
 
-void nsEventListenerManager::Shutdown()
+void
+nsEventListenerManager::Shutdown()
 {
     sAddListenerID = JSVAL_VOID;
 
@@ -446,9 +448,9 @@
 NS_INTERFACE_MAP_END
 
 
-nsVoidArray* nsEventListenerManager::GetListenersByType(EventArrayType aType, 
-                                                        nsHashKey* aKey,
-                                                        PRBool aCreate)
+nsVoidArray*
+nsEventListenerManager::GetListenersByType(EventArrayType aType, 
+                                           nsHashKey* aKey, PRBool aCreate)
 {
   NS_ASSERTION(aType >= 0,"Negative EventListenerType?");
   //Look for existing listeners
@@ -550,7 +552,8 @@
   return nsnull;
 }
 
-EventArrayType nsEventListenerManager::GetTypeForIID(const nsIID& aIID)
+EventArrayType
+nsEventListenerManager::GetTypeForIID(const nsIID& aIID)
 { 
   if (aIID.Equals(NS_GET_IID(nsIDOMMouseListener)))
       return eEventArrayType_Mouse;
@@ -597,7 +600,9 @@
   return eEventArrayType_None;
 }
 
-void nsEventListenerManager::ReleaseListeners(nsVoidArray** aListeners, PRBool aScriptOnly)
+void
+nsEventListenerManager::ReleaseListeners(nsVoidArray** aListeners,
+                                         PRBool aScriptOnly)
 {
   if (nsnull != *aListeners) {
     PRInt32 i, count = (*aListeners)->Count();
@@ -683,7 +688,7 @@
   PRBool found = PR_FALSE;
   nsListenerStruct* ls;
 
-  for (int i=0; i<listeners->Count(); i++) {
+  for (PRInt32 i=0; i<listeners->Count(); i++) {
     ls = (nsListenerStruct*)listeners->ElementAt(i);
     if (ls->mListener == aListener && ls->mFlags == aFlags &&
         ls->mGroupFlags == group) {
@@ -727,9 +732,10 @@
   nsListenerStruct* ls;
   PRBool listenerRemoved = PR_FALSE;
 
-  for (int i=0; i<listeners->Count(); i++) {
+  for (PRInt32 i=0; i<listeners->Count(); i++) {
     ls = (nsListenerStruct*)listeners->ElementAt(i);
-    if (ls->mListener == aListener && ls->mFlags == aFlags) {
+    if (ls->mListener == aListener &&
+        ((ls->mFlags & ~NS_PRIV_EVENT_UNTRUSTED_PERMITTED) == aFlags)) {
       ls->mSubType &= ~aSubType;
       if (ls->mSubType == NS_EVENT_BITS_NONE) {
         NS_RELEASE(ls->mListener);
@@ -1020,9 +1026,10 @@
 {
   nsVoidArray *listeners = GetListenersByType(aType, nsnull, PR_FALSE);
   if (listeners) {
-    //Run through the listeners for this IID and see if a script listener is registered
+    // Run through the listeners for this type and see if a script
+    // listener is registered
     nsListenerStruct *ls;
-    for (int i=0; i<listeners->Count(); i++) {
+    for (PRInt32 i=0; i < listeners->Count(); i++) {
       ls = (nsListenerStruct*)listeners->ElementAt(i);
       if (ls->mFlags & NS_PRIV_EVENT_FLAG_SCRIPT) {
         return ls;
@@ -1037,7 +1044,8 @@
 nsEventListenerManager::SetJSEventListener(nsIScriptContext *aContext, 
                                            nsISupports *aObject,
                                            nsIAtom* aName,
-                                           PRBool aIsString)
+                                           PRBool aIsString,
+                                           PRBool aPermitUntrustedEvents)
 {
   nsresult rv = NS_OK;
   nsListenerStruct *ls;
@@ -1050,8 +1058,8 @@
   ls = FindJSEventListener(arrayType);
 
   if (nsnull == ls) {
-    //If we didn't find a script listener or no listeners existed
-    //create and add a new one.
+    // If we didn't find a script listener or no listeners existed
+    // create and add a new one.
     nsCOMPtr<nsIDOMScriptObjectFactory> factory =
       do_GetService(kDOMScriptObjectFactoryCID);
     NS_ENSURE_TRUE(factory, NS_ERROR_FAILURE);
@@ -1076,8 +1084,12 @@
       ls->mHandlerIsString &= ~flags;
     }
 
-    //Set subtype flags based on event
+    // Set subtype flags based on event
     ls->mSubType |= flags;
+
+    if (aPermitUntrustedEvents) {
+      ls->mFlags |= NS_PRIV_EVENT_UNTRUSTED_PERMITTED;
+    }
   }
 
   return rv;
@@ -1087,7 +1099,8 @@
 nsEventListenerManager::AddScriptEventListener(nsISupports *aObject,
                                                nsIAtom *aName,
                                                const nsAString& aBody,
-                                               PRBool aDeferCompilation)
+                                               PRBool aDeferCompilation,
+                                               PRBool aPermitUntrustedEvents)
 {
   nsIScriptContext *context = nsnull;
   JSContext* cx = nsnull;
@@ -1185,7 +1198,8 @@
     }
   }
 
-  return SetJSEventListener(context, aObject, aName, aDeferCompilation);
+  return SetJSEventListener(context, aObject, aName, aDeferCompilation,
+                            aPermitUntrustedEvents);
 }
 
 nsresult
@@ -1257,7 +1271,8 @@
   nsCOMPtr<nsIClassInfo> classInfo = do_QueryInterface(aObject);
 
   if (sAddListenerID == JSVAL_VOID && cx) {
-    sAddListenerID = STRING_TO_JSVAL(::JS_InternString(cx, "addEventListener"));
+    sAddListenerID =
+      STRING_TO_JSVAL(::JS_InternString(cx, "addEventListener"));
 
     rv = nsContentUtils::GetSecurityManager()->
       CheckPropertyAccess(cx, jsobj,
@@ -1270,7 +1285,10 @@
     }
   }
 
-  return SetJSEventListener(aContext, aObject, aName, PR_FALSE);
+  // Untrusted events are always permitted for non-chrome script
+  // handlers.
+  return SetJSEventListener(aContext, aObject, aName, PR_FALSE,
+                            !nsContentUtils::IsCallerChrome());
 }
 
 nsresult
@@ -1445,12 +1463,13 @@
 * @param an event listener
 */
 
-nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext,
-                                             nsEvent* aEvent,
-                                             nsIDOMEvent** aDOMEvent,
-                                             nsIDOMEventTarget* aCurrentTarget,
-                                             PRUint32 aFlags,
-                                             nsEventStatus* aEventStatus)
+nsresult
+nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext,
+                                    nsEvent* aEvent,
+                                    nsIDOMEvent** aDOMEvent,
+                                    nsIDOMEventTarget* aCurrentTarget,
+                                    PRUint32 aFlags,
+                                    nsEventStatus* aEventStatus)
 {
   NS_ENSURE_ARG_POINTER(aEventStatus);
   nsresult ret = NS_OK;
@@ -1489,9 +1508,9 @@
   if (aEvent->message == NS_USER_DEFINED_EVENT) {
     listeners = GetListenersByType(eEventArrayType_Hash, aEvent->userType, PR_FALSE);
   } else {
-    for (int i = 0; i < eEventArrayType_Hash; ++i) {
+    for (PRInt32 i = 0; i < eEventArrayType_Hash; ++i) {
       typeData = &sEventTypes[i];
-      for (int j = 0; j < typeData->numEvents; ++j) {
+      for (PRInt32 j = 0; j < typeData->numEvents; ++j) {
         dispData = &(typeData->events[j]);
         if (aEvent->message == dispData->message) {
           listeners = GetListenersByType((EventArrayType)i, nsnull, PR_FALSE);
@@ -1513,9 +1532,11 @@
     if (NS_SUCCEEDED(ret)) {
       nsAutoPopupStatePusher popupStatePusher(nsDOMEvent::GetEventPopupControlState(aEvent));
 
-      for (int k = 0; !mListenersRemoved && listeners && k < listeners->Count(); ++k) {
+      for (PRInt32 k = 0; !mListenersRemoved && listeners && k < listeners->Count(); ++k) {
         nsListenerStruct* ls = NS_STATIC_CAST(nsListenerStruct*, listeners->ElementAt(k));
-        if (ls->mFlags & aFlags && ls->mGroupFlags == currentGroup) {
+        if (ls->mFlags & aFlags && ls->mGroupFlags == currentGroup &&
+            (NS_IS_TRUSTED_EVENT(aEvent) ||
+             ls->mFlags & NS_PRIV_EVENT_UNTRUSTED_PERMITTED)) {
           // Try the type-specific listener interface
           PRBool hasInterface = PR_FALSE;
           if (typeData)
@@ -1525,10 +1546,11 @@
 
           // If it doesn't implement that, call the generic HandleEvent()
           if (!hasInterface && (ls->mSubType == NS_EVENT_BITS_NONE ||
-                                ls->mSubType & dispData->bits))
+                                ls->mSubType & dispData->bits)) {
             HandleEventSubType(ls, *aDOMEvent, aCurrentTarget,
                                dispData ? dispData->bits : NS_EVENT_BITS_NONE,
                                aFlags);
+          }
         }
       }
     }
@@ -1946,10 +1968,13 @@
   return ret;
 }
 
-void nsEventListenerManager::GetCoordinatesFor(nsIDOMElement *aCurrentEl, 
-                                               nsIPresContext *aPresContext,
-                                               nsIPresShell *aPresShell, 
-                                               nsPoint& aTargetPt)
+// Get coordinates relative to root view for element, 
+// first ensuring the element is onscreen
+void
+nsEventListenerManager::GetCoordinatesFor(nsIDOMElement *aCurrentEl, 
+                                          nsIPresContext *aPresContext,
+                                          nsIPresShell *aPresShell, 
+                                          nsPoint& aTargetPt)
 {
   nsCOMPtr<nsIContent> focusedContent(do_QueryInterface(aCurrentEl));
   nsIFrame *frame = nsnull;
--- mozilla-firefox-1.0.4.orig/content/events/src/nsEventListenerManager.h
+++ mozilla-firefox-1.0.4/content/events/src/nsEventListenerManager.h
@@ -52,10 +52,10 @@
 
 typedef struct {
   nsIDOMEventListener* mListener;
-  PRUint8 mFlags;
   PRUint8 mSubType;
   PRUint8 mHandlerIsString;
   PRUint8 mSubTypeCapture;
+  PRUint16 mFlags;
   PRUint16 mGroupFlags;
 } nsListenerStruct;
 
@@ -126,7 +126,8 @@
   NS_IMETHOD AddScriptEventListener(nsISupports *aObject,
                                     nsIAtom *aName,
                                     const nsAString& aFunc,
-                                    PRBool aDeferCompilation); 
+                                    PRBool aDeferCompilation,
+                                    PRBool aPermitUntrustedEvents);
   NS_IMETHOD RegisterScriptEventListener(nsIScriptContext *aContext,
                                          nsISupports *aObject,
                                          nsIAtom* aName);
@@ -198,7 +199,7 @@
   nsListenerStruct* FindJSEventListener(EventArrayType aType);
   nsresult SetJSEventListener(nsIScriptContext *aContext,
                               nsISupports *aObject, nsIAtom* aName,
-                              PRBool aIsString);
+                              PRBool aIsString, PRBool aPermitUntrustedEvents);
   nsresult AddEventListener(nsIDOMEventListener *aListener, 
                             EventArrayType aType, 
                             PRInt32 aSubType,
--- mozilla-firefox-1.0.4.orig/content/events/src/nsEventStateManager.cpp
+++ mozilla-firefox-1.0.4/content/events/src/nsEventStateManager.cpp
@@ -22,6 +22,9 @@
  * Contributor(s):
  *   Makoto Kato  <m_kato@ga2.so-net.ne.jp>
  *   Dean Tessman <dean_tessman@hotmail.com>
+ *   Andrew Wellington <proton@wiretapped.net>
+ *   Graham Dennis <u3952328@anu.edu.au>
+ *   Thomas Kleffel <thomas.kleffel@maintech.de>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -504,7 +507,7 @@
             // Fire the blur event on the previously focused document.
 
             nsEventStatus blurstatus = nsEventStatus_eIgnore;
-            nsEvent blurevent(NS_BLUR_CONTENT);
+            nsEvent blurevent(PR_TRUE, NS_BLUR_CONTENT);
 
             gLastFocusedDocument->HandleDOMEvent(gLastFocusedPresContext,
                                                  &blurevent,
@@ -556,10 +559,9 @@
         // Now we should fire the focus event.  We fire it on the document,
         // then the content node, then the window.
 
-        nsEventStatus status = nsEventStatus_eIgnore;
-        nsEvent focusevent(NS_FOCUS_CONTENT);
+        nsCOMPtr<nsIScriptGlobalObject> globalObject =
+          mDocument->GetScriptGlobalObject();
 
-        nsCOMPtr<nsIScriptGlobalObject> globalObject = mDocument->GetScriptGlobalObject();
         if (globalObject) {
           // We don't want there to be a focused content node while we're
           // dispatching the focus event.
@@ -568,6 +570,9 @@
           // "leak" this reference, but we take it back later
           SetFocusedContent(nsnull);
 
+          nsEventStatus status = nsEventStatus_eIgnore;
+          nsEvent focusevent(PR_TRUE, NS_FOCUS_CONTENT);
+
           if (gLastFocusedDocument != mDocument) {
             mDocument->HandleDOMEvent(aPresContext, &focusevent, nsnull,
                                       NS_EVENT_FLAG_INIT, &status);
@@ -655,7 +660,7 @@
         // and window.
 
         nsEventStatus status = nsEventStatus_eIgnore;
-        nsEvent event(NS_BLUR_CONTENT);
+        nsEvent event(PR_TRUE, NS_BLUR_CONTENT);
 
         if (gLastFocusedDocument && gLastFocusedPresContext) {
           if (gLastFocusedContent) {
@@ -814,7 +819,7 @@
       if (gLastFocusedDocument && gLastFocusedDocument == mDocument) {
 
         nsEventStatus status = nsEventStatus_eIgnore;
-        nsEvent event(NS_BLUR_CONTENT);
+        nsEvent event(PR_TRUE, NS_BLUR_CONTENT);
 
         if (gLastFocusedContent) {
           nsIPresShell *shell = gLastFocusedDocument->GetShellAt(0);
@@ -984,12 +989,10 @@
 
         if (activate) {
           // B) Click on it if the users prefs indicate to do so.
-          nsEventStatus status = nsEventStatus_eIgnore;
-          nsMouseEvent event(NS_MOUSE_LEFT_CLICK);
 
           // Propagate trusted state to the new event.
-          event.internalAppFlags |=
-            aEvent->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED;
+          nsEventStatus status = nsEventStatus_eIgnore;
+          nsMouseEvent event(NS_IS_TRUSTED_EVENT(aEvent), NS_MOUSE_LEFT_CLICK, nsnull);
 
           content->HandleDOMEvent(mPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
         }
@@ -1095,7 +1098,7 @@
 nsEventStateManager::CreateClickHoldTimer(nsIPresContext* inPresContext,
                                           nsGUIEvent* inMouseDownEvent)
 {
-  if (!(inMouseDownEvent->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED))
+  if (!NS_IS_TRUSTED_EVENT(inMouseDownEvent))
     return;
 
   // just to be anal (er, safe)
@@ -1201,7 +1204,7 @@
 #endif
 
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(NS_CONTEXTMENU, mEventDownWidget);
+  nsMouseEvent event(PR_TRUE, NS_CONTEXTMENU, mEventDownWidget);
   event.clickCount = 1;
   event.point = mEventPoint;
   event.refPoint = mEventRefPoint;
@@ -1444,7 +1447,8 @@
 
       // get the widget from the target frame
       nsEventStatus status = nsEventStatus_eIgnore;
-      nsMouseEvent event(NS_DRAGDROP_GESTURE, mGestureDownFrame->GetWindow());
+      nsMouseEvent event(NS_IS_TRUSTED_EVENT(aEvent), NS_DRAGDROP_GESTURE,
+                         mGestureDownFrame->GetWindow());
       event.point = mGestureDownPoint;
       event.refPoint = mGestureDownRefPoint;
       // ideally, we should get the modifiers from the original event too, 
@@ -1622,6 +1626,13 @@
                                aEvent->isShift,    aEvent->isMeta,
                                0, nsnull);
     PRBool allowDefault;
+
+    nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(mouseEvent));
+
+    if (privateEvent && NS_IS_TRUSTED_EVENT(aEvent)) {
+      privateEvent->SetTrusted(PR_TRUE);
+    }
+
     nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(targetContent));
     if (target) {
       target->DispatchEvent(event, &allowDefault);
@@ -1637,7 +1648,8 @@
   // Create a mouseout event that we fire to the content before
   // scrolling, to allow tooltips to disappear, etc.
 
-  nsMouseEvent mouseOutEvent(NS_MOUSE_EXIT, aEvent->widget);
+  nsMouseEvent mouseOutEvent(NS_IS_TRUSTED_EVENT(aEvent),
+                             NS_MOUSE_EXIT, aEvent->widget);
   mouseOutEvent.internalAppFlags |=
     aEvent->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED;
 
@@ -1981,6 +1993,109 @@
       }
     }
     break;
+  case NS_USER_DEFINED_EVENT: // In reality an extended mouse event
+    {
+      nsExtendedMouseEventStatus *eMEStatus;
+      nsMouseEvent *mEvent = (nsMouseEvent* )aEvent;
+      eMEStatus = (nsExtendedMouseEventStatus *)&mEvent->clickCount;
+      nsresult rv;
+      char ourbutton=0;
+      char *string, *suffix, *straction, *strnumlines;
+      PRInt32 action;
+      PRInt32 numLines;
+
+      rv = getPrefBranch();
+      if (NS_FAILED(rv)) return rv;
+      
+      // adding 2 below so the maximum number of mouse buttons we can
+      // support is 99 but to represent the buttons in buttonlist
+      // we're going to map 10->35 onto 'a'->'z'
+      // the storage actually supports 256
+      if(eMEStatus->button > 35) break;
+      if(eMEStatus->button > 9)
+        ourbutton = 'a' + eMEStatus->button -9;
+      else
+        ourbutton = '0' + eMEStatus->button;
+      mPrefBranch->GetCharPref("mousebuttonsextended.buttonlist", &string);
+      if(!string) break;
+      if(!strchr(string, ourbutton)) {
+          free(string);
+          break;
+      }
+      free(string);
+      switch(eMEStatus->event)
+        {
+        case nsExtendedMouseEventStatus_up:
+          suffix=strdup(".up");
+          break;
+
+        case nsExtendedMouseEventStatus_down:
+          suffix=strdup(".down");
+          break;
+        default:
+          return NS_OK;
+        }
+      straction= (char *)memset(malloc(100), 0, 100);
+      strnumlines=(char *)memset(malloc(100), 0, 100);
+
+      strcpy(straction, "mousebuttonsextended.buttons.X.action");
+      strcpy(strnumlines, "mousebuttonsextended.buttons.X.numlines");
+      strcpy(straction+strlen(straction), suffix);
+      strcpy(strnumlines+strlen(strnumlines), suffix); 
+
+      string = strchr(straction, 'X');  *string = ourbutton;
+      string = strchr(strnumlines, 'X'); *string = ourbutton;
+
+      mPrefBranch->GetIntPref(straction, &action);
+      mPrefBranch->GetIntPref(strnumlines, &numLines);
+
+      switch (action) {
+
+#if 0   // Because we would have to create a msEvent
+      case MOUSE_SCROLL_N_LINES:
+      case MOUSE_SCROLL_PAGE:
+        {
+          DoWheelScroll(aPresContext, aTargetFrame, msEvent, numLines,
+                        (msEvent->scrollFlags & nsMouseScrollEvent::kIsHorizontal),
+                        (action == MOUSE_SCROLL_PAGE), PR_FALSE);
+
+        }
+        break;
+#endif 
+      case MOUSE_SCROLL_HISTORY:
+        {
+          nsCOMPtr<nsISupports> pcContainer;
+          pcContainer = mPresContext->GetContainer();
+          if (pcContainer) {
+            nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(pcContainer));
+            if (webNav) {
+              if (numLines < 0)
+                 webNav->GoBack();
+              else
+                 webNav->GoForward();
+            }
+          }
+        }
+        break;
+
+      case MOUSE_SCROLL_TEXTSIZE:
+        {
+          // Exclude form controls and XUL content.
+          nsIContent* content = aTargetFrame->GetContent();
+          if (content &&
+              !content->IsContentOfType(nsIContent::eHTML_FORM_CONTROL) &&
+              !content->IsContentOfType(nsIContent::eXUL))
+            {
+              ChangeTextSize((numLines > 0) ? 1 : -1);
+            }
+        }
+        break;
+
+      default:  // Including -1 (do nothing)
+        break;
+      }          
+    }
+    break;
   case NS_MOUSE_SCROLL:
     if (nsEventStatus_eConsumeNoDefault != *aStatus) {
       nsresult rv;
@@ -2547,7 +2662,7 @@
                                         nsIContent* aRelatedContent)
 {
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(aMessage, aEvent->widget);
+  nsMouseEvent event(NS_IS_TRUSTED_EVENT(aEvent), aMessage, aEvent->widget);
   event.point = aEvent->point;
   event.refPoint = aEvent->refPoint;
   event.isShift = ((nsMouseEvent*)aEvent)->isShift;
@@ -2555,8 +2670,6 @@
   event.isAlt = ((nsMouseEvent*)aEvent)->isAlt;
   event.isMeta = ((nsMouseEvent*)aEvent)->isMeta;
   event.nativeMsg = ((nsMouseEvent*)aEvent)->nativeMsg;
-  event.internalAppFlags |=
-    aEvent->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED;
 
   mCurrentTargetContent = aTargetContent;
   mCurrentRelatedContent = aRelatedContent;
@@ -2608,7 +2721,7 @@
         nsIPresShell *parentShell = parentDoc->GetShellAt(0);
         if (parentShell) {
           nsEventStatus status = nsEventStatus_eIgnore;
-          nsMouseEvent event(aMessage, aEvent->widget);
+          nsMouseEvent event(NS_IS_TRUSTED_EVENT(aEvent), aMessage, aEvent->widget);
           event.point = aEvent->point;
           event.refPoint = aEvent->refPoint;
           event.isShift = ((nsMouseEvent*)aEvent)->isShift;
@@ -2764,15 +2877,14 @@
         if ( mLastDragOverFrame ) {
           //fire drag exit
           nsEventStatus status = nsEventStatus_eIgnore;
-          nsMouseEvent event(NS_DRAGDROP_EXIT_SYNTH, aEvent->widget);
+          nsMouseEvent event(NS_IS_TRUSTED_EVENT(aEvent),
+                             NS_DRAGDROP_EXIT_SYNTH, aEvent->widget);
           event.point = aEvent->point;
           event.refPoint = aEvent->refPoint;
           event.isShift = ((nsMouseEvent*)aEvent)->isShift;
           event.isControl = ((nsMouseEvent*)aEvent)->isControl;
           event.isAlt = ((nsMouseEvent*)aEvent)->isAlt;
           event.isMeta = ((nsMouseEvent*)aEvent)->isMeta;
-          event.internalAppFlags |=
-            aEvent->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED;
 
           //The frame has change but the content may not have.  Check before dispatching to content
           mLastDragOverFrame->GetContentForEvent(aPresContext, aEvent, getter_AddRefs(lastContent));
@@ -2799,15 +2911,13 @@
 
         //fire drag enter
         nsEventStatus status = nsEventStatus_eIgnore;
-        nsMouseEvent event(NS_DRAGDROP_ENTER, aEvent->widget);
+        nsMouseEvent event(NS_IS_TRUSTED_EVENT(aEvent), NS_DRAGDROP_ENTER, aEvent->widget);
         event.point = aEvent->point;
         event.refPoint = aEvent->refPoint;
         event.isShift = ((nsMouseEvent*)aEvent)->isShift;
         event.isControl = ((nsMouseEvent*)aEvent)->isControl;
         event.isAlt = ((nsMouseEvent*)aEvent)->isAlt;
         event.isMeta = ((nsMouseEvent*)aEvent)->isMeta;
-        event.internalAppFlags |=
-          aEvent->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED;
 
         mCurrentTargetContent = targetContent;
         mCurrentRelatedContent = lastContent;
@@ -2842,15 +2952,13 @@
 
         // fire mouseout
         nsEventStatus status = nsEventStatus_eIgnore;
-        nsMouseEvent event(NS_DRAGDROP_EXIT_SYNTH, aEvent->widget);
+        nsMouseEvent event(NS_IS_TRUSTED_EVENT(aEvent), NS_DRAGDROP_EXIT_SYNTH, aEvent->widget);
         event.point = aEvent->point;
         event.refPoint = aEvent->refPoint;
         event.isShift = ((nsMouseEvent*)aEvent)->isShift;
         event.isControl = ((nsMouseEvent*)aEvent)->isControl;
         event.isAlt = ((nsMouseEvent*)aEvent)->isAlt;
         event.isMeta = ((nsMouseEvent*)aEvent)->isMeta;
-        event.internalAppFlags |=
-          aEvent->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED;
 
         // dispatch to content via DOM
         nsCOMPtr<nsIContent> lastContent;
@@ -2968,7 +3076,7 @@
       break;
     }
 
-    nsMouseEvent event(eventMsg, aEvent->widget);
+    nsMouseEvent event(NS_IS_TRUSTED_EVENT(aEvent), eventMsg, aEvent->widget);
     event.point = aEvent->point;
     event.refPoint = aEvent->refPoint;
     event.clickCount = aEvent->clickCount;
@@ -2976,8 +3084,6 @@
     event.isControl = aEvent->isControl;
     event.isAlt = aEvent->isAlt;
     event.isMeta = aEvent->isMeta;
-    event.internalAppFlags |=
-      aEvent->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED;
 
     nsCOMPtr<nsIPresShell> presShell = mPresContext->GetPresShell();
     if (presShell) {
@@ -2999,8 +3105,8 @@
           eventMsg = NS_MOUSE_RIGHT_DOUBLECLICK;
           break;
         }
-        
-        nsMouseEvent event2(eventMsg, aEvent->widget);
+
+        nsMouseEvent event2(NS_IS_TRUSTED_EVENT(aEvent), eventMsg, aEvent->widget);
         event2.point = aEvent->point;
         event2.refPoint = aEvent->refPoint;
         event2.clickCount = aEvent->clickCount;
@@ -3008,10 +3114,9 @@
         event2.isControl = aEvent->isControl;
         event2.isAlt = aEvent->isAlt;
         event2.isMeta = aEvent->isMeta;
-        event2.internalAppFlags |=
-          aEvent->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED;
 
-        ret = presShell->HandleEventWithTarget(&event2, mCurrentTarget, mouseContent, flags, aStatus);
+        ret = presShell->HandleEventWithTarget(&event2, mCurrentTarget,
+                                               mouseContent, flags, aStatus);
       }
     }
   }
@@ -4229,12 +4334,13 @@
 
           //fire blur
           nsEventStatus status = nsEventStatus_eIgnore;
-          nsEvent event(NS_BLUR_CONTENT);
+          nsEvent event(PR_TRUE, NS_BLUR_CONTENT);
           shepherd.SetCurrentEvent(&event);
 
           EnsureDocument(presShell);
-          
-          // Make sure we're not switching command dispatchers, if so, surpress the blurred one
+
+          // Make sure we're not switching command dispatchers, if so,
+          // surpress the blurred one
           if(gLastFocusedDocument && mDocument) {
             nsCOMPtr<nsIFocusController> newFocusController;
             nsCOMPtr<nsIFocusController> oldFocusController;
@@ -4285,10 +4391,11 @@
 
     if (gLastFocusedDocument && (gLastFocusedDocument != mDocument) && globalObject) {  
       nsEventStatus status = nsEventStatus_eIgnore;
-      nsEvent event(NS_BLUR_CONTENT);
+      nsEvent event(PR_TRUE, NS_BLUR_CONTENT);
       shepherd.SetCurrentEvent(&event);
 
-      // Make sure we're not switching command dispatchers, if so, surpress the blurred one
+      // Make sure we're not switching command dispatchers, if so,
+      // surpress the blurred one
       if (mDocument) {
         nsCOMPtr<nsIFocusController> newFocusController;
         nsCOMPtr<nsIFocusController> oldFocusController;
@@ -4370,7 +4477,7 @@
 
     //fire focus
     nsEventStatus status = nsEventStatus_eIgnore;
-    nsEvent event(NS_FOCUS_CONTENT);
+    nsEvent event(PR_TRUE, NS_FOCUS_CONTENT);
     shepherd.SetCurrentEvent(&event);
 
     if (nsnull != mPresContext) {
@@ -4392,7 +4499,7 @@
     //fire focus on document even if the content isn't focusable (ie. text)
     //see bugzilla bug 93521
     nsEventStatus status = nsEventStatus_eIgnore;
-    nsEvent event(NS_FOCUS_CONTENT);
+    nsEvent event(PR_TRUE, NS_FOCUS_CONTENT);
     shepherd.SetCurrentEvent(&event);
 
     if (nsnull != mPresContext && mDocument) {
@@ -4555,17 +4662,34 @@
 
   nsCOMPtr<nsIPrivateDOMEvent> privEvt(do_QueryInterface(aEvent));
   if (privEvt) {
+    nsEvent * innerEvent;
+    privEvt->GetInternalNSEvent(&innerEvent);
+
+    NS_ENSURE_TRUE(innerEvent, NS_ERROR_ILLEGAL_VALUE);
+
+    // Make sure this event isn't currently in dispatch.
+    NS_ENSURE_TRUE(!NS_IS_EVENT_IN_DISPATCH(innerEvent),
+                   NS_ERROR_ILLEGAL_VALUE);
+
+    // And make sure this event wasn't already dispatched w/o being
+    // re-initialized in between.
+    NS_ENSURE_TRUE(!(innerEvent->flags & NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY),
+                   NS_ERROR_ILLEGAL_VALUE);
+
+    // Mark this event as dispatched now that we're this far along.
+    NS_MARK_EVENT_DISPATCH_STARTED(innerEvent);
+
     nsCOMPtr<nsIDOMEventTarget> eventTarget(do_QueryInterface(aTarget));
     privEvt->SetTarget(eventTarget);
 
-    //Check security state to determine if dispatcher is trusted
-    nsIScriptSecurityManager *securityManager =
-      nsContentUtils::GetSecurityManager();
-
     PRBool trusted;
     privEvt->IsTrustedEvent(&trusted);
 
     if (!trusted) {
+      //Check security state to determine if dispatcher is trusted
+      nsIScriptSecurityManager *securityManager =
+        nsContentUtils::GetSecurityManager();
+
       PRBool enabled;
       nsresult res =
         securityManager->IsCapabilityEnabled("UniversalBrowserWrite",
@@ -4573,45 +4697,40 @@
       privEvt->SetTrusted(NS_SUCCEEDED(res) && enabled);
     }
 
-    nsEvent * innerEvent;
-    privEvt->GetInternalNSEvent(&innerEvent);
-
-    if (innerEvent) {
-      nsEventStatus status = nsEventStatus_eIgnore;
-      nsCOMPtr<nsIScriptGlobalObject> target(do_QueryInterface(aTarget));
+    nsEventStatus status = nsEventStatus_eIgnore;
+    nsCOMPtr<nsIScriptGlobalObject> target(do_QueryInterface(aTarget));
+    if (target) {
+      ret = target->HandleDOMEvent(mPresContext, innerEvent, &aEvent, NS_EVENT_FLAG_INIT, &status);
+    }
+    else {
+      nsCOMPtr<nsIDocument> target(do_QueryInterface(aTarget));
       if (target) {
         ret = target->HandleDOMEvent(mPresContext, innerEvent, &aEvent, NS_EVENT_FLAG_INIT, &status);
       }
       else {
-        nsCOMPtr<nsIDocument> target(do_QueryInterface(aTarget));
+        nsCOMPtr<nsIContent> target(do_QueryInterface(aTarget));
         if (target) {
           ret = target->HandleDOMEvent(mPresContext, innerEvent, &aEvent, NS_EVENT_FLAG_INIT, &status);
+
+          // Dispatch to the system event group.  Make sure to clear the
+          // STOP_DISPATCH flag since this resets for each event group
+          // per DOM3 Events.
+
+          innerEvent->flags &= ~NS_EVENT_FLAG_STOP_DISPATCH;
+          ret = target->HandleDOMEvent(mPresContext, innerEvent, &aEvent,
+                                       NS_EVENT_FLAG_INIT | NS_EVENT_FLAG_SYSTEM_EVENT,
+                                       &status);
         }
         else {
-          nsCOMPtr<nsIContent> target(do_QueryInterface(aTarget));
+          nsCOMPtr<nsIChromeEventHandler> target(do_QueryInterface(aTarget));
           if (target) {
-            ret = target->HandleDOMEvent(mPresContext, innerEvent, &aEvent, NS_EVENT_FLAG_INIT, &status);
-
-            // Dispatch to the system event group.  Make sure to clear the
-            // STOP_DISPATCH flag since this resets for each event group
-            // per DOM3 Events.
-
-            innerEvent->flags &= ~NS_EVENT_FLAG_STOP_DISPATCH;
-            ret = target->HandleDOMEvent(mPresContext, innerEvent, &aEvent,
-                                         NS_EVENT_FLAG_INIT | NS_EVENT_FLAG_SYSTEM_EVENT,
-                                         &status);
-          }
-          else {
-            nsCOMPtr<nsIChromeEventHandler> target(do_QueryInterface(aTarget));
-            if (target) {
-              ret = target->HandleChromeEvent(mPresContext, innerEvent, &aEvent, NS_EVENT_FLAG_INIT, &status);
-            }
+            ret = target->HandleChromeEvent(mPresContext, innerEvent, &aEvent, NS_EVENT_FLAG_INIT, &status);
           }
         }
       }
-
-      *aPreventDefault = status != nsEventStatus_eConsumeNoDefault;
     }
+
+    *aPreventDefault = status != nsEventStatus_eConsumeNoDefault;
   }
 
   return ret;
--- mozilla-firefox-1.0.4.orig/content/svg/content/src/nsSVGElement.cpp
+++ mozilla-firefox-1.0.4/content/svg/content/src/nsSVGElement.cpp
@@ -208,7 +208,7 @@
     // We don't have an nsISVGValue attribute.
     attrValue.SetTo(aValue);
   }
-  
+
   return SetAttrAndNotify(aNamespaceID, aName, aPrefix, oldValue, attrValue,
                           modification, hasListeners, aNotify);
 }
@@ -550,7 +550,7 @@
 
     if (aFireMutation) {
       nsCOMPtr<nsIDOMEventTarget> node = do_QueryInterface(NS_STATIC_CAST(nsIContent *, this));
-      nsMutationEvent mutation(NS_MUTATION_ATTRMODIFIED, node);
+      nsMutationEvent mutation(PR_TRUE, NS_MUTATION_ATTRMODIFIED, node);
 
       nsAutoString attrName;
       aAttribute->ToString(attrName);
--- mozilla-firefox-1.0.4.orig/content/xbl/builtin/gtk2/Makefile.in
+++ mozilla-firefox-1.0.4/content/xbl/builtin/gtk2/Makefile.in
@@ -0,0 +1,45 @@
+# 
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is
+# Jonas Sicking.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either of the GNU General Public License Version 2 or later (the "GPL"),
+# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH		= ../../../..
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
--- mozilla-firefox-1.0.4.orig/content/xbl/builtin/gtk2/jar.mn
+++ mozilla-firefox-1.0.4/content/xbl/builtin/gtk2/jar.mn
@@ -0,0 +1,2 @@
+toolkit.jar:
+* content/global/platformHTMLBindings.xml   (platformHTMLBindings.xml)
--- mozilla-firefox-1.0.4.orig/content/xbl/builtin/mac/Makefile.in
+++ mozilla-firefox-1.0.4/content/xbl/builtin/mac/Makefile.in
@@ -0,0 +1,45 @@
+# 
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is
+# Jonas Sicking.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either of the GNU General Public License Version 2 or later (the "GPL"),
+# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH		= ../../../..
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
--- mozilla-firefox-1.0.4.orig/content/xbl/builtin/mac/jar.mn
+++ mozilla-firefox-1.0.4/content/xbl/builtin/mac/jar.mn
@@ -0,0 +1,2 @@
+toolkit.jar:
+* content/global/platformHTMLBindings.xml   (platformHTMLBindings.xml)
--- mozilla-firefox-1.0.4.orig/content/xbl/builtin/Makefile.in
+++ mozilla-firefox-1.0.4/content/xbl/builtin/Makefile.in
@@ -27,29 +27,17 @@
 include $(DEPTH)/config/autoconf.mk
 
 ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
-PLATFORM_DIR	= win
+DIRS	= win
 else
 ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
-PLATFORM_DIR	= mac
+DIRS	= mac
 else
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
-PLATFORM_DIR	= gtk2
+DIRS	= gtk2
 else
-PLATFORM_DIR	= unix
+DIRS	= unix
 endif
 endif
 endif
 
 include $(topsrcdir)/config/rules.mk
-
-PLATFORM_BINDINGS = $(srcdir)/$(PLATFORM_DIR)/platformHTMLBindings.xml
-PREPROCESS_BINDINGS = $(PERL) $(MOZILLA_DIR)/config/preprocessor.pl $(DEFINES) $(ACDEFINES) $(PLATFORM_BINDINGS)
-
-$(DIST)/bin/res/builtin/platformHTMLBindings.xml $(DESTDIR)$(mozappdir)/res/builtin/platformHTMLBindings.xml: $(PLATFORM_BINDINGS) $(wildcard $(srcdir)/*.inc) Makefile
-	@mkdir -p $(dir $@)
-	@rm -f $@
-	@$(PREPROCESS_BINDINGS) > $@
-
-libs:: $(DIST)/bin/res/builtin/platformHTMLBindings.xml
-
-install:: $(DESTDIR)$(mozappdir)/res/builtin/platformHTMLBindings.xml
--- mozilla-firefox-1.0.4.orig/content/xbl/builtin/unix/Makefile.in
+++ mozilla-firefox-1.0.4/content/xbl/builtin/unix/Makefile.in
@@ -0,0 +1,45 @@
+# 
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is
+# Jonas Sicking.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either of the GNU General Public License Version 2 or later (the "GPL"),
+# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH		= ../../../..
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
--- mozilla-firefox-1.0.4.orig/content/xbl/builtin/unix/jar.mn
+++ mozilla-firefox-1.0.4/content/xbl/builtin/unix/jar.mn
@@ -0,0 +1,2 @@
+toolkit.jar:
+* content/global/platformHTMLBindings.xml   (platformHTMLBindings.xml)
--- mozilla-firefox-1.0.4.orig/content/xbl/builtin/win/Makefile.in
+++ mozilla-firefox-1.0.4/content/xbl/builtin/win/Makefile.in
@@ -0,0 +1,45 @@
+# 
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is
+# Jonas Sicking.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either of the GNU General Public License Version 2 or later (the "GPL"),
+# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH		= ../../../..
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
--- mozilla-firefox-1.0.4.orig/content/xbl/builtin/win/jar.mn
+++ mozilla-firefox-1.0.4/content/xbl/builtin/win/jar.mn
@@ -0,0 +1,2 @@
+toolkit.jar:
+* content/global/platformHTMLBindings.xml   (platformHTMLBindings.xml)
--- mozilla-firefox-1.0.4.orig/content/xbl/src/nsXBLBinding.cpp
+++ mozilla-firefox-1.0.4/content/xbl/src/nsXBLBinding.cpp
@@ -102,6 +102,9 @@
 
 #include "nsXBLPrototypeBinding.h"
 #include "nsXBLBinding.h"
+#include "nsContentUtils.h"
+#include "nsIPrincipal.h"
+#include "nsIScriptSecurityManager.h"
 
 #include "prprf.h"
 
@@ -1301,33 +1304,6 @@
   return PR_TRUE;
 }
 
-NS_IMETHODIMP
-nsXBLBinding::AddScriptEventListener(nsIContent* aElement, nsIAtom* aName,
-                                     const nsString& aValue)
-{
-  nsAutoString val;
-  aName->ToString(val);
-  
-  nsAutoString eventStr(NS_LITERAL_STRING("on"));
-  eventStr += val;
-
-  nsCOMPtr<nsIAtom> eventName = do_GetAtom(eventStr);
-
-  nsresult rv;
-
-  nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(aElement));
-  if (!receiver)
-    return NS_OK;
-
-  nsCOMPtr<nsIEventListenerManager> manager;
-  rv = receiver->GetListenerManager(getter_AddRefs(manager));
-  if (NS_FAILED(rv)) return rv;
-
-  rv = manager->AddScriptEventListener(receiver, eventName, aValue, PR_FALSE);
-
-  return rv;
-}
-
 nsresult
 nsXBLBinding::GetTextData(nsIContent *aParent, nsString& aResult)
 {
@@ -1352,7 +1328,45 @@
 {
   PRBool result;
   mPrototypeBinding->GetAllowScripts(&result);
-  return result;
+  if (!result) {
+    return result;
+  }
+
+  // Nasty hack.  Use the JSContext of the bound node, since the
+  // security manager API expects to get the docshell type from
+  // that.  But use the nsIPrincipal of our document.
+  nsIScriptSecurityManager* mgr = nsContentUtils::GetSecurityManager();
+  if (!mgr) {
+    return PR_FALSE;
+  }
+  
+  nsIDocument* doc = mBoundElement->GetDocument();
+  if (!doc) {
+    return PR_FALSE;
+  }
+
+  nsIScriptGlobalObject* global = doc->GetScriptGlobalObject();
+  if (!global) {
+    return PR_FALSE;
+  }
+
+  nsCOMPtr<nsIScriptContext> context = global->GetContext();
+  if (!context) {
+    return PR_FALSE;
+  }
+  
+  JSContext* cx = (JSContext*) context->GetNativeContext();
+
+  nsCOMPtr<nsIDocument> ourDocument;
+  mPrototypeBinding->XBLDocumentInfo()->GetDocument(getter_AddRefs(ourDocument));
+  nsIPrincipal* principal = ourDocument->GetPrincipal();
+  if (!principal) {
+    return PR_FALSE;
+  }
+
+  PRBool canExecute;
+  nsresult rv = mgr->CanExecuteScripts(cx, principal, &canExecute);
+  return NS_SUCCEEDED(rv) && canExecute;
 }
 
 PR_STATIC_CALLBACK(PRBool)
--- mozilla-firefox-1.0.4.orig/content/xbl/src/nsXBLBinding.h
+++ mozilla-firefox-1.0.4/content/xbl/src/nsXBLBinding.h
@@ -127,8 +127,6 @@
   nsXBLBinding(nsXBLPrototypeBinding* aProtoBinding);
   virtual ~nsXBLBinding();
 
-  NS_IMETHOD AddScriptEventListener(nsIContent* aElement, nsIAtom* aName, const nsString& aValue);
-
   PRBool AllowScripts();
   void InstallAnonymousContent(nsIContent* aAnonParent, nsIContent* aElement);
 
--- mozilla-firefox-1.0.4.orig/content/xbl/src/nsXBLPrototypeHandler.cpp
+++ mozilla-firefox-1.0.4/content/xbl/src/nsXBLPrototypeHandler.cpp
@@ -475,7 +475,7 @@
 nsXBLPrototypeHandler::BindingAttached(nsIDOMEventReceiver* aReceiver)
 {
   nsresult ret;
-  nsMouseEvent event(NS_XUL_COMMAND);
+  nsMouseEvent event(PR_TRUE, NS_XUL_COMMAND, nsnull);
 
   nsCOMPtr<nsIEventListenerManager> listenerManager;
   if (NS_FAILED(ret = aReceiver->GetListenerManager(getter_AddRefs(listenerManager)))) {
@@ -496,6 +496,7 @@
   nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(domEvent);
   if (privateEvent) {
     privateEvent->SetTarget(aReceiver);
+    privateEvent->SetTrusted(PR_TRUE);
   }
 
   ExecuteHandler(aReceiver, domEvent);
@@ -507,7 +508,7 @@
 nsXBLPrototypeHandler::BindingDetached(nsIDOMEventReceiver* aReceiver)
 {
   nsresult ret;
-  nsMouseEvent event(NS_XUL_COMMAND);
+  nsMouseEvent event(PR_TRUE, NS_XUL_COMMAND, nsnull);
 
   nsCOMPtr<nsIEventListenerManager> listenerManager;
   if (NS_FAILED(ret = aReceiver->GetListenerManager(getter_AddRefs(listenerManager)))) {
@@ -528,6 +529,7 @@
   nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(domEvent);
   if (privateEvent) {
     privateEvent->SetTarget(aReceiver);
+    privateEvent->SetTrusted(PR_TRUE);
   }
 
   ExecuteHandler(aReceiver, domEvent);
--- mozilla-firefox-1.0.4.orig/content/xbl/src/nsXBLService.cpp
+++ mozilla-firefox-1.0.4/content/xbl/src/nsXBLService.cpp
@@ -79,6 +79,7 @@
 #include "nsContentUtils.h"
 #include "nsISyncLoadDOMService.h"
 #include "nsIDOM3Node.h"
+#include "nsContentPolicyUtils.h"
 
 #include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
@@ -576,6 +577,29 @@
     if (NS_FAILED(rv))
       return rv;
   }
+
+  // Content policy check.  We have to be careful to not pass aContent as the
+  // context here.  Otherwise, if there is a JS-implemented content policy, we
+  // will attempt to wrap the content node, which will try to load XBL bindings
+  // for it, if any.  Since we're not done loading this binding yet, that will
+  // reenter this method and we'll end up creating a binding and then
+  // immediately clobbering it in our table.  That makes things very confused,
+  // leading to misbehavior and crashes.
+  PRInt16 decision = nsIContentPolicy::ACCEPT;
+  rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_OTHER,
+                                 aURL,
+                                 docURI,
+                                 document,        // context
+                                 EmptyCString(),  // mime guess
+                                 nsnull,          // extra
+                                 &decision);
+
+  if (NS_SUCCEEDED(rv) && !NS_CP_ACCEPTED(decision))
+    rv = NS_ERROR_NOT_AVAILABLE;
+
+  if (NS_FAILED(rv))
+    return rv;
+
   nsCOMPtr<nsIXBLBinding> newBinding;
   if (NS_FAILED(rv = GetBinding(aContent, aURL, getter_AddRefs(newBinding)))) {
     return rv;
--- mozilla-firefox-1.0.4.orig/content/xbl/src/nsXBLWindowHandler.cpp
+++ mozilla-firefox-1.0.4/content/xbl/src/nsXBLWindowHandler.cpp
@@ -68,6 +68,8 @@
 #include "nsXULAtoms.h"
 #include "nsIURI.h"
 #include "nsNetUtil.h"
+#include "nsIPrefBranch.h"
+#include "nsIPrefService.h"
 
 class nsXBLSpecialDocInfo
 {
@@ -92,10 +94,7 @@
   nsXBLSpecialDocInfo() : mInitialized(PR_FALSE) {};
 };
 
-const char nsXBLSpecialDocInfo::sHTMLBindingStr[] = "resource://gre/res/builtin/platformHTMLBindings.xml";
-// Allow for a userHTMLBindings.xml.
-// XXXbsmedberg Should be in the profile chrome directory, when we have a resource mapping for that
-const char nsXBLSpecialDocInfo::sUserHTMLBindingStr[] = "resource://gre/res/builtin/userHTMLBindings.xml";
+const char nsXBLSpecialDocInfo::sHTMLBindingStr[] = "chrome://global/content/platformHTMLBindings.xml";
 
 void nsXBLSpecialDocInfo::LoadDocInfo()
 {
@@ -120,16 +119,23 @@
                                       PR_TRUE, 
                                       getter_AddRefs(mHTMLBindings));
 
-  rv = bindingURI->SetSpec(NS_LITERAL_CSTRING(sUserHTMLBindingStr));
-  if (NS_FAILED(rv)) {
-    NS_ERROR("Shouldn't fail to set spec here");
-    return;
+  nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
+  if (prefBranch) {
+    nsAdoptingCString userHTMLBindingStr;
+    prefBranch->GetCharPref("dom.userHTMLBindings.uri", getter_Copies(userHTMLBindingStr));
+    if (!userHTMLBindingStr.IsEmpty()) {
+      NS_NewURI(getter_AddRefs(bindingURI), userHTMLBindingStr);
+      if (!bindingURI) {
+        return;
+      }
+
+      xblService->LoadBindingDocumentInfo(nsnull, nsnull,
+                                          bindingURI,
+                                          PR_TRUE, 
+                                          getter_AddRefs(mUserHTMLBindings));
+    }
+
   }
-  
-  xblService->LoadBindingDocumentInfo(nsnull, nsnull,
-                                      bindingURI,
-                                      PR_TRUE, 
-                                      getter_AddRefs(mUserHTMLBindings));
 }
 
 //
--- mozilla-firefox-1.0.4.orig/content/xml/content/src/nsXMLElement.cpp
+++ mozilla-firefox-1.0.4/content/xml/content/src/nsXMLElement.cpp
@@ -395,7 +395,8 @@
 
           //fire click
           nsGUIEvent* guiEvent = NS_STATIC_CAST(nsGUIEvent*, aEvent);
-          nsMouseEvent event(NS_MOUSE_LEFT_CLICK, guiEvent->widget);
+          nsMouseEvent event(NS_IS_TRUSTED_EVENT(aEvent), NS_MOUSE_LEFT_CLICK,
+                             guiEvent->widget);
           event.point = aEvent->point;
           event.refPoint = aEvent->refPoint;
           event.clickCount = 1;
--- mozilla-firefox-1.0.4.orig/content/xml/document/src/nsXMLDocument.cpp
+++ mozilla-firefox-1.0.4/content/xml/document/src/nsXMLDocument.cpp
@@ -624,10 +624,11 @@
   mLoopingForSyncLoad = PR_FALSE;
 
   if (mLoadedAsData) {
-    // Generate a document load event for the case when an XML document was loaded
-    // as pure data without any presentation attached to it.
+    // Generate a document load event for the case when an XML
+    // document was loaded as pure data without any presentation
+    // attached to it.
+    nsEvent event(PR_TRUE, NS_PAGE_LOAD);
     nsEventStatus status = nsEventStatus_eIgnore;
-    nsEvent event(NS_PAGE_LOAD);
 
     nsCOMPtr<nsIScriptGlobalObject> sgo;
     nsCOMPtr<nsIScriptGlobalObjectOwner> container =
--- mozilla-firefox-1.0.4.orig/content/xul/content/src/nsXULElement.cpp
+++ mozilla-firefox-1.0.4/content/xul/content/src/nsXULElement.cpp
@@ -159,7 +159,6 @@
 
 //----------------------------------------------------------------------
 
-static NS_DEFINE_CID(kEventListenerManagerCID,    NS_EVENTLISTENERMANAGER_CID);
 static NS_DEFINE_CID(kRDFServiceCID,              NS_RDFSERVICE_CID);
 
 static NS_DEFINE_CID(kXULPopupListenerCID,        NS_XULPOPUPLISTENER_CID);
@@ -566,6 +565,8 @@
                                    nsDOMEventRTTearoff::Create(this))
     NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3EventTarget,
                                    nsDOMEventRTTearoff::Create(this))
+    NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMNSEventTarget,
+                                   nsDOMEventRTTearoff::Create(this))
     NS_INTERFACE_MAP_ENTRY(nsIChromeEventHandler)
     NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3Node,
                                    new nsNode3Tearoff(this))
@@ -1402,7 +1403,8 @@
 
     if (NS_FAILED(rv)) return rv;
 
-    return manager->AddScriptEventListener(target, aName, aValue, defer);
+    return manager->AddScriptEventListener(target, aName, aValue, defer,
+                                           !nsContentUtils::IsChromeDoc(mDocument));
 }
 
 nsresult
@@ -1747,7 +1749,7 @@
 
         if (HasMutationListeners(this,
                                  NS_EVENT_BITS_MUTATION_NODEINSERTED)) {
-            nsMutationEvent mutation(NS_MUTATION_NODEINSERTED, aKid);
+            nsMutationEvent mutation(PR_TRUE, NS_MUTATION_NODEINSERTED, aKid);
             mutation.mRelatedNode =
                 do_QueryInterface(NS_STATIC_CAST(nsIStyledContent*, this));
 
@@ -1796,7 +1798,7 @@
         }
         if (HasMutationListeners(this,
                                  NS_EVENT_BITS_MUTATION_SUBTREEMODIFIED)) {
-            nsMutationEvent mutation(NS_MUTATION_SUBTREEMODIFIED, this);
+            nsMutationEvent mutation(PR_TRUE, NS_MUTATION_SUBTREEMODIFIED, this);
             mutation.mRelatedNode = do_QueryInterface(oldKid);
 
             nsEventStatus status = nsEventStatus_eIgnore;
@@ -1842,7 +1844,7 @@
 
         if (HasMutationListeners(this,
                                  NS_EVENT_BITS_MUTATION_NODEINSERTED)) {
-            nsMutationEvent mutation(NS_MUTATION_NODEINSERTED, aKid);
+            nsMutationEvent mutation(PR_TRUE, NS_MUTATION_NODEINSERTED, aKid);
             mutation.mRelatedNode =
                 do_QueryInterface(NS_STATIC_CAST(nsIStyledContent*, this));
 
@@ -1866,7 +1868,7 @@
     mozAutoDocUpdate updateBatch(mDocument, UPDATE_CONTENT_MODEL, aNotify);
 
     if (HasMutationListeners(this, NS_EVENT_BITS_MUTATION_NODEREMOVED)) {
-      nsMutationEvent mutation(NS_MUTATION_NODEREMOVED, oldKid);
+      nsMutationEvent mutation(PR_TRUE, NS_MUTATION_NODEREMOVED, oldKid);
       mutation.mRelatedNode =
           do_QueryInterface(NS_STATIC_CAST(nsIStyledContent*, this));
 
@@ -1962,8 +1964,12 @@
       nsCOMPtr<nsIDOMDocumentEvent> doc(do_QueryInterface(mDocument));
       nsCOMPtr<nsIDOMEvent> event;
       doc->CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));
-      if (event) {
+      nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));
+
+      if (privateEvent) {
         event->InitEvent(NS_LITERAL_STRING("select"), PR_FALSE, PR_TRUE);
+        privateEvent->SetTrusted(PR_TRUE);
+
         PRBool noDefault;
         nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(NS_STATIC_CAST(nsIContent *, this)));
         NS_ENSURE_TRUE(target, NS_ERROR_FAILURE);
@@ -2193,7 +2199,7 @@
         if (aFireMutation) {
             nsCOMPtr<nsIDOMEventTarget> node =
                 do_QueryInterface(NS_STATIC_CAST(nsIContent *, this));
-            nsMutationEvent mutation(NS_MUTATION_ATTRMODIFIED, node);
+            nsMutationEvent mutation(PR_TRUE, NS_MUTATION_ATTRMODIFIED, node);
 
             nsAutoString attrName;
             aAttribute->ToString(attrName);
@@ -2380,7 +2386,7 @@
     if (mDocument) {
         if (hasMutationListeners) {
             nsCOMPtr<nsIDOMEventTarget> node(do_QueryInterface(NS_STATIC_CAST(nsIContent *, this)));
-            nsMutationEvent mutation(NS_MUTATION_ATTRMODIFIED, node);
+            nsMutationEvent mutation(PR_TRUE, NS_MUTATION_ATTRMODIFIED, node);
 
             mutation.mRelatedNode = attrNode;
             mutation.mAttrName = aName;
@@ -2651,6 +2657,9 @@
                              nsIDOMEvent** aDOMEvent, PRUint32 aFlags,
                              nsEventStatus* aEventStatus)
 {
+    // Make sure to tell the event that dispatch has started.
+    NS_MARK_EVENT_DISPATCH_STARTED(aEvent);
+
     nsresult ret = NS_OK;
 
     PRBool retarget = PR_FALSE;
@@ -2680,10 +2689,10 @@
         }
         if (aDOMEvent) {
             if (*aDOMEvent)
-              externalDOMEvent = PR_TRUE;
+                externalDOMEvent = PR_TRUE;
         }
         else
-          aDOMEvent = &domEvent;
+            aDOMEvent = &domEvent;
 
         aEvent->flags |= aFlags;
         aFlags &= ~(NS_EVENT_FLAG_CANT_BUBBLE | NS_EVENT_FLAG_CANT_CANCEL);
@@ -2728,22 +2737,22 @@
                 // menu), then that breaks.
                 nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(domEvent);
                 if (privateEvent) {
-                  nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(NS_STATIC_CAST(nsIContent *, this)));
-                  privateEvent->SetTarget(target);
+                    nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(NS_STATIC_CAST(nsIContent *, this)));
+                    privateEvent->SetTarget(target);
                 }
                 else
-                  return NS_ERROR_FAILURE;
+                    return NS_ERROR_FAILURE;
 
                 // if we are a XUL click, we have the private event set.
                 // now switch to a left mouse click for the duration of the event
                 if (aEvent->message == NS_XUL_CLICK)
-                  aEvent->message = NS_MOUSE_LEFT_CLICK;
+                    aEvent->message = NS_MOUSE_LEFT_CLICK;
             }
         }
     }
     else if (aEvent->message == NS_IMAGE_LOAD)
-      return NS_OK; // Don't let these events bubble or be captured.  Just allow them
-                    // on the target image.
+        return NS_OK; // Don't let these events bubble or be captured.  Just allow them
+                      // on the target image.
 
     // Find out whether we're anonymous.
     if (IsNativeAnonymous()) {
@@ -2779,58 +2788,61 @@
     }
 
     if (retarget || (parent != GetParent())) {
-      if (!*aDOMEvent) {
-        // We haven't made a DOMEvent yet.  Force making one now.
-        nsCOMPtr<nsIEventListenerManager> listenerManager;
-        if (NS_FAILED(ret = GetListenerManager(getter_AddRefs(listenerManager)))) {
-          return ret;
-        }
-        nsAutoString empty;
-        if (NS_FAILED(ret = listenerManager->CreateEvent(aPresContext, aEvent, empty, aDOMEvent)))
-          return ret;
-      }
+        if (!*aDOMEvent) {
+            // We haven't made a DOMEvent yet.  Force making one now.
+            nsCOMPtr<nsIEventListenerManager> listenerManager;
+            if (NS_FAILED(ret = GetListenerManager(getter_AddRefs(listenerManager)))) {
+                return ret;
+            }
+            nsAutoString empty;
+            if (NS_FAILED(ret = listenerManager->CreateEvent(aPresContext, aEvent, empty, aDOMEvent)))
+                return ret;
 
-      if (!*aDOMEvent) {
-        return NS_ERROR_FAILURE;
-      }
-      nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(*aDOMEvent);
-      if (!privateEvent) {
-        return NS_ERROR_FAILURE;
-      }
+            if (!*aDOMEvent) {
+                return NS_ERROR_FAILURE;
+            }
+        }
+
+        nsCOMPtr<nsIPrivateDOMEvent> privateEvent =
+            do_QueryInterface(*aDOMEvent);
+        if (!privateEvent) {
+            return NS_ERROR_FAILURE;
+        }
 
-      (*aDOMEvent)->GetTarget(getter_AddRefs(oldTarget));
+        (*aDOMEvent)->GetTarget(getter_AddRefs(oldTarget));
 
-      PRBool hasOriginal;
-      privateEvent->HasOriginalTarget(&hasOriginal);
+        PRBool hasOriginal;
+        privateEvent->HasOriginalTarget(&hasOriginal);
 
-      if (!hasOriginal)
-        privateEvent->SetOriginalTarget(oldTarget);
+        if (!hasOriginal)
+            privateEvent->SetOriginalTarget(oldTarget);
 
-      if (retarget) {
-          nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(GetParent());
-          privateEvent->SetTarget(target);
-      }
+        if (retarget) {
+            nsCOMPtr<nsIDOMEventTarget> target =
+                do_QueryInterface(GetParent());
+            privateEvent->SetTarget(target);
+        }
     }
 
     //Capturing stage evaluation
     if (NS_EVENT_FLAG_CAPTURE & aFlags) {
-      //Initiate capturing phase.  Special case first call to document
-      if (parent) {
-        parent->HandleDOMEvent(aPresContext, aEvent, aDOMEvent, aFlags & NS_EVENT_CAPTURE_MASK, aEventStatus);
-      }
-      else if (mDocument != nsnull) {
-          ret = mDocument->HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
-                                          aFlags & NS_EVENT_CAPTURE_MASK, aEventStatus);
-      }
+        //Initiate capturing phase.  Special case first call to document
+        if (parent) {
+            parent->HandleDOMEvent(aPresContext, aEvent, aDOMEvent, aFlags & NS_EVENT_CAPTURE_MASK, aEventStatus);
+        }
+        else if (mDocument != nsnull) {
+            ret = mDocument->HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
+                                            aFlags & NS_EVENT_CAPTURE_MASK, aEventStatus);
+        }
     }
 
-
     if (retarget) {
-      // The event originated beneath us, and we performed a retargeting.
-      // We need to restore the original target of the event.
-      nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(*aDOMEvent);
-      if (privateEvent)
-        privateEvent->SetTarget(oldTarget);
+        // The event originated beneath us, and we performed a retargeting.
+        // We need to restore the original target of the event.
+        nsCOMPtr<nsIPrivateDOMEvent> privateEvent =
+            do_QueryInterface(*aDOMEvent);
+        if (privateEvent)
+            privateEvent->SetTarget(oldTarget);
     }
 
     //Local handling stage
@@ -2842,12 +2854,12 @@
     }
 
     if (retarget) {
-      // The event originated beneath us, and we need to perform a retargeting.
-      nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(*aDOMEvent);
-      if (privateEvent) {
-        nsCOMPtr<nsIDOMEventTarget> parentTarget(do_QueryInterface(GetParent()));
-        privateEvent->SetTarget(parentTarget);
-      }
+        // The event originated beneath us, and we need to perform a retargeting.
+        nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(*aDOMEvent);
+        if (privateEvent) {
+            nsCOMPtr<nsIDOMEventTarget> parentTarget(do_QueryInterface(GetParent()));
+            privateEvent->SetTarget(parentTarget);
+        }
     }
 
     //Bubbling stage
@@ -2855,44 +2867,48 @@
         if (parent != nsnull) {
             // We have a parent. Let them field the event.
             ret = parent->HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
-                                          aFlags & NS_EVENT_BUBBLE_MASK, aEventStatus);
-      }
+                                         aFlags & NS_EVENT_BUBBLE_MASK, aEventStatus);
+        }
         else if (mDocument != nsnull) {
-        // We must be the document root. The event should bubble to the
-        // document.
-        ret = mDocument->HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
-                                        aFlags & NS_EVENT_BUBBLE_MASK, aEventStatus);
+            // We must be the document root. The event should bubble to the
+            // document.
+            ret = mDocument->HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
+                                            aFlags & NS_EVENT_BUBBLE_MASK, aEventStatus);
         }
     }
 
     if (retarget) {
-      // The event originated beneath us, and we performed a retargeting.
-      // We need to restore the original target of the event.
-      nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(*aDOMEvent);
-      if (privateEvent)
-        privateEvent->SetTarget(oldTarget);
+        // The event originated beneath us, and we performed a retargeting.
+        // We need to restore the original target of the event.
+        nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(*aDOMEvent);
+        if (privateEvent)
+            privateEvent->SetTarget(oldTarget);
     }
 
     if (NS_EVENT_FLAG_INIT & aFlags) {
-      // We're leaving the DOM event loop so if we created a DOM event,
-      // release here.  If externalDOMEvent is set the event was passed in
-      // and we don't own it
-      if (*aDOMEvent && !externalDOMEvent) {
-        nsrefcnt rc;
-        NS_RELEASE2(*aDOMEvent, rc);
-        if (0 != rc) {
-          // Okay, so someone in the DOM loop (a listener, JS object)
-          // still has a ref to the DOM Event but the internal data
-          // hasn't been malloc'd.  Force a copy of the data here so the
-          // DOM Event is still valid.
-          nsCOMPtr<nsIPrivateDOMEvent> privateEvent =
-            do_QueryInterface(*aDOMEvent);
-          if (privateEvent) {
-            privateEvent->DuplicatePrivateData();
-          }
+        // We're leaving the DOM event loop so if we created a DOM event,
+        // release here.  If externalDOMEvent is set the event was passed in
+        // and we don't own it
+        if (*aDOMEvent && !externalDOMEvent) {
+            nsrefcnt rc;
+            NS_RELEASE2(*aDOMEvent, rc);
+            if (0 != rc) {
+                // Okay, so someone in the DOM loop (a listener, JS object)
+                // still has a ref to the DOM Event but the internal data
+                // hasn't been malloc'd.  Force a copy of the data here so the
+                // DOM Event is still valid.
+                nsCOMPtr<nsIPrivateDOMEvent> privateEvent =
+                    do_QueryInterface(*aDOMEvent);
+                if (privateEvent) {
+                    privateEvent->DuplicatePrivateData();
+                }
+            }
+            aDOMEvent = nsnull;
         }
-        aDOMEvent = nsnull;
-      }
+
+        // Now that we're done with this event, remove the flag that says
+        // we're in the process of dispatching this event.
+        NS_MARK_EVENT_DISPATCH_DONE(aEvent);
     }
 
     return ret;
@@ -3847,9 +3863,13 @@
             nsIPresShell *shell = doc->GetShellAt(i);
             shell->GetPresContext(getter_AddRefs(context));
 
-            nsMouseEvent eventDown(NS_MOUSE_LEFT_BUTTON_DOWN),
-                eventUp(NS_MOUSE_LEFT_BUTTON_UP),
-                eventClick(NS_XUL_CLICK);
+            PRBool isCallerChrome = nsContentUtils::IsCallerChrome();
+
+            nsMouseEvent eventDown(isCallerChrome, NS_MOUSE_LEFT_BUTTON_DOWN,
+                                   nsnull);
+            nsMouseEvent eventUp(isCallerChrome, NS_MOUSE_LEFT_BUTTON_UP,
+                                 nsnull);
+            nsMouseEvent eventClick(isCallerChrome, NS_XUL_CLICK, nsnull);
 
             // send mouse down
             nsEventStatus status = nsEventStatus_eIgnore;
@@ -3885,7 +3905,7 @@
             shell->GetPresContext(getter_AddRefs(context));
 
             nsEventStatus status = nsEventStatus_eIgnore;
-            nsMouseEvent event(NS_XUL_COMMAND);
+            nsMouseEvent event(PR_TRUE, NS_XUL_COMMAND, nsnull);
             HandleDOMEvent(context, &event, nsnull, NS_EVENT_FLAG_INIT,
                            &status);
         }
--- mozilla-firefox-1.0.4.orig/content/xul/document/src/nsXULCommandDispatcher.cpp
+++ mozilla-firefox-1.0.4/content/xul/document/src/nsXULCommandDispatcher.cpp
@@ -379,7 +379,9 @@
 
       // Handle the DOM event
       nsEventStatus status = nsEventStatus_eIgnore;
-      nsEvent event(NS_XUL_COMMAND_UPDATE);
+
+      nsEvent event(PR_TRUE, NS_XUL_COMMAND_UPDATE);
+
       content->HandleDOMEvent(context, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
     }
   }
--- mozilla-firefox-1.0.4.orig/content/xul/document/src/nsXULDocument.cpp
+++ mozilla-firefox-1.0.4/content/xul/document/src/nsXULDocument.cpp
@@ -1056,7 +1056,7 @@
 
         // This is the right <observes> element. Execute the
         // |onbroadcast| event handler
-        nsEvent event(NS_XUL_BROADCAST);
+        nsEvent event(PR_TRUE, NS_XUL_BROADCAST);
 
         PRInt32 j = mPresShells.Count();
         while (--j >= 0) {
@@ -1223,11 +1223,14 @@
 
 nsresult
 nsXULDocument::HandleDOMEvent(nsIPresContext* aPresContext,
-                            nsEvent* aEvent,
-                            nsIDOMEvent** aDOMEvent,
-                            PRUint32 aFlags,
-                            nsEventStatus* aEventStatus)
+                              nsEvent* aEvent,
+                              nsIDOMEvent** aDOMEvent,
+                              PRUint32 aFlags,
+                              nsEventStatus* aEventStatus)
 {
+    // Make sure to tell the event that dispatch has started.
+    NS_MARK_EVENT_DISPATCH_STARTED(aEvent);
+
     nsresult ret = NS_OK;
     nsIDOMEvent* domEvent = nsnull;
     PRBool externalDOMEvent = PR_FALSE;
@@ -1288,6 +1291,10 @@
             }
         }
         aDOMEvent = nsnull;
+
+        // Now that we're done with this event, remove the flag that says
+        // we're in the process of dispatching this event.
+        NS_MARK_EVENT_DISPATCH_DONE(aEvent);
     }
 
     return ret;
--- mozilla-firefox-1.0.4.orig/dom/public/idl/events/Makefile.in
+++ mozilla-firefox-1.0.4/dom/public/idl/events/Makefile.in
@@ -49,6 +49,7 @@
 	nsIDOMMutationEvent.idl			\
 	nsIDOMNSUIEvent.idl			\
 	nsIDOMPopupBlockedEvent.idl		\
+	nsIDOMNSEventTarget.idl			\
 	$(NULL)
 
 include $(topsrcdir)/config/rules.mk
--- mozilla-firefox-1.0.4.orig/dom/public/idl/events/nsIDOMNSEventTarget.idl
+++ mozilla-firefox-1.0.4/dom/public/idl/events/nsIDOMNSEventTarget.idl
@@ -0,0 +1,71 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * The Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Johnny Stenback <jst@mozilla.org> (original author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "domstubs.idl"
+
+/**
+ * The nsIDOMNSEventTarget interface is an extension to the standard
+ * nsIDOMEventTarget interface, implemented by all event targets in
+ * the Document Object Model.
+ */
+
+[scriptable, uuid(6cbbbf64-212f-4ef8-9ad4-7240dbb8d6ac)]
+interface nsIDOMNSEventTarget : nsISupports
+{
+  /**
+   * This method is the same as the addEventListener() method defined
+   * in nsIDOMEventTarget, but it takes one additional argument which
+   * lets callers control whether or not they want to receive
+   * untrusted events (synthetic events generated by untrusted code)
+   *
+   * @param   type See the type argument to the same method in
+   *               nsIDOMEventTarget.
+   * @param   listener See the listener argument to the same method in
+   *                   nsIDOMEventTarget.
+   * @param   useCapture See the listener argument to the same method in
+   *                     nsIDOMEventTarget.
+   * @param   wantsUntrusted If false, the listener will not receive any
+   *                         untrusted events (see above), if true, the
+   *                         listener will receive events whether or not
+   *                         they're trusted
+   */
+  void                     addEventListener(in DOMString type,
+                                            in nsIDOMEventListener listener,
+                                            in boolean useCapture,
+                                            in boolean wantsUntrusted);
+};
--- mozilla-firefox-1.0.4.orig/dom/src/base/nsDOMClassInfo.cpp
+++ mozilla-firefox-1.0.4/dom/src/base/nsDOMClassInfo.cpp
@@ -157,6 +157,7 @@
 // Event related includes
 #include "nsIEventListenerManager.h"
 #include "nsIDOMEventReceiver.h"
+#include "nsIDOMNSEventTarget.h"
 
 // CSS related includes
 #include "nsIDOMStyleSheet.h"
@@ -954,6 +955,7 @@
 jsval nsDOMClassInfo::sAdd_id             = JSVAL_VOID;
 jsval nsDOMClassInfo::sAll_id             = JSVAL_VOID;
 jsval nsDOMClassInfo::sTags_id            = JSVAL_VOID;
+jsval nsDOMClassInfo::sAddEventListener_id= JSVAL_VOID;
 
 const JSClass *nsDOMClassInfo::sObjectClass = nsnull;
 
@@ -1049,7 +1051,6 @@
   return STRING_TO_JSVAL(s);
 }
 
-
 // static
 nsresult
 nsDOMClassInfo::DefineStaticJSVals(JSContext *cx)
@@ -1127,6 +1128,7 @@
   SET_JSVAL_TO_STRING(sAdd_id,             cx, "add");
   SET_JSVAL_TO_STRING(sAll_id,             cx, "all");
   SET_JSVAL_TO_STRING(sTags_id,            cx, "tags");
+  SET_JSVAL_TO_STRING(sAddEventListener_id,cx, "addEventListener");
 
   return NS_OK;
 }
@@ -1377,6 +1379,19 @@
     d.mInterfaces = interface_list;                                           \
   }
 
+#define DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES                                    \
+    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocument)                                 \
+    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentEvent)                              \
+    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentStyle)                              \
+    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocumentStyle)                            \
+    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentView)                               \
+    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentRange)                              \
+    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentTraversal)                          \
+    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentXBL)                                \
+    DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)                                \
+    DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Document)                                  \
+    DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Node)
+
 #define DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES                                \
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLElement)                              \
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMElementCSSInlineStyle)                      \
@@ -1494,17 +1509,7 @@
   DOM_CLASSINFO_MAP_BEGIN(XMLDocument, nsIDOMXMLDocument)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocument)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMXMLDocument)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocument)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentEvent)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentStyle)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocumentStyle)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentView)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentRange)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentTraversal)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentXBL)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Document)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Node)
+    DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END_WITH_XPATH
 
   DOM_CLASSINFO_MAP_BEGIN(DocumentType, nsIDOMDocumentType)
@@ -1601,17 +1606,7 @@
   DOM_CLASSINFO_MAP_BEGIN(HTMLDocument, nsIDOMHTMLDocument)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLDocument)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLDocument)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocument)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentEvent)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentStyle)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocumentStyle)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentView)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentRange)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentTraversal)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentXBL)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Document)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Node)
+    DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END_WITH_XPATH
 
   DOM_CLASSINFO_MAP_BEGIN(HTMLCollection, nsIDOMHTMLCollection)
@@ -2043,17 +2038,7 @@
   DOM_CLASSINFO_MAP_BEGIN(XULDocument, nsIDOMXULDocument)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocument)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULDocument)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocument)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentEvent)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentView)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentXBL)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentStyle)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocumentStyle)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentRange)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentTraversal)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Document)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Node)
+    DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END_WITH_XPATH
 
   DOM_CLASSINFO_MAP_BEGIN(XULElement, nsIDOMXULElement)
@@ -2142,16 +2127,7 @@
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLDocument)
     DOM_CLASSINFO_MAP_ENTRY(nsIImageDocument)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLDocument)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocument)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentEvent)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentStyle)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocumentStyle)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentView)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentRange)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentTraversal)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentXBL)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Node)
+    DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END_WITH_XPATH
 
 #ifdef MOZ_XUL
@@ -2187,17 +2163,7 @@
   DOM_CLASSINFO_MAP_BEGIN(SVGDocument, nsIDOMSVGDocument)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGDocument)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocument)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocument)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNode)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Node)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Document)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentEvent)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentView)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentXBL)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentStyle)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocumentStyle)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentRange)
+    DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END_WITH_XPATH
 
   DOM_CLASSINFO_MAP_BEGIN(SVGSVGElement, nsIDOMSVGSVGElement)
@@ -3676,7 +3642,7 @@
     return rv;
   }
 
-  rv = nsDOMGenericSH::WrapNative(cx, ::JS_GetGlobalObject(cx), native,
+  rv = nsDOMGenericSH::WrapNative(cx, GetGlobalJSObject(cx, obj), native,
                                   NS_GET_IID(nsISupports), rval);
 
   return NS_SUCCEEDED(rv) ? JS_TRUE : JS_FALSE;
@@ -4961,13 +4927,116 @@
   return PR_FALSE;
 }
 
+// static
+JSBool JS_DLL_CALLBACK
+nsEventReceiverSH::AddEventListenerHelper(JSContext *cx, JSObject *obj,
+                                          uintN argc, jsval *argv, jsval *rval)
+{
+  if (argc < 3 || argc > 4) {
+    ThrowJSException(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS);
+
+    return JS_FALSE;
+  }
+
+  nsCOMPtr<nsIXPConnectWrappedNative> wrapper;
+  nsresult rv =
+    sXPConnect->GetWrappedNativeOfJSObject(cx, obj, getter_AddRefs(wrapper));
+  if (NS_FAILED(rv)) {
+    nsDOMClassInfo::ThrowJSException(cx, rv);
+
+    return JS_FALSE;
+  }
+
+  if (JSVAL_IS_PRIMITIVE(argv[1])) {
+    // The second argument must be a function, or a
+    // nsIDOMEventListener. Throw an error.
+    ThrowJSException(cx, NS_ERROR_XPC_BAD_CONVERT_JS);
+
+    return JS_FALSE;
+  }
+
+  JSString* jsstr = JS_ValueToString(cx, argv[0]);
+  if (!jsstr) {
+    nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_OUT_OF_MEMORY);
+
+    return JS_FALSE;
+  }
+
+  nsDependentJSString type(jsstr);
+
+  nsCOMPtr<nsIDOMEventListener> listener;
+
+  {
+    nsCOMPtr<nsISupports> tmp;
+    sXPConnect->WrapJS(cx, JSVAL_TO_OBJECT(argv[1]),
+                       NS_GET_IID(nsIDOMEventListener), getter_AddRefs(tmp));
+
+    listener = do_QueryInterface(tmp, &rv);
+    if (NS_FAILED(rv)) {
+      ThrowJSException(cx, rv);
+
+      return JS_FALSE;
+    }
+  }
+
+  JSBool useCapture;
+  if (!JS_ValueToBoolean(cx, argv[2], &useCapture)) {
+    return JS_FALSE;
+  }
+
+  nsCOMPtr<nsISupports> wrappedNative;
+  wrapper->GetNative(getter_AddRefs(wrappedNative));
+
+  if (argc == 4) {
+    JSBool wantsUntrusted;
+    if (!JS_ValueToBoolean(cx, argv[3], &wantsUntrusted)) {
+      return JS_FALSE;
+    }
+
+    nsresult rv;
+    nsCOMPtr<nsIDOMNSEventTarget> eventTarget(
+                     do_QueryInterface(wrappedNative, &rv));
+    if (NS_FAILED(rv)) {
+      ThrowJSException(cx, rv);
+
+      return JS_FALSE;
+    }
+
+    rv = eventTarget->AddEventListener(type, listener, useCapture,
+                                       wantsUntrusted);
+    if (NS_FAILED(rv)) {
+      ThrowJSException(cx, rv);
+
+      return JS_FALSE;
+    }
+  } else {
+    nsresult rv;
+    nsCOMPtr<nsIDOMEventTarget> eventTarget(
+                   do_QueryInterface(wrappedNative, &rv));
+    if (NS_FAILED(rv)) {
+      ThrowJSException(cx, rv);
+
+      return JS_FALSE;
+    }
+
+    rv = eventTarget->AddEventListener(type, listener, useCapture);
+    if (NS_FAILED(rv)) {
+      ThrowJSException(cx, rv);
+
+      return JS_FALSE;
+    }
+  }
+  
+  return JS_TRUE;
+}
+
 nsresult
 nsEventReceiverSH::RegisterCompileHandler(nsIXPConnectWrappedNative *wrapper,
                                           JSContext *cx, JSObject *obj,
                                           jsval id, PRBool compile,
-                                          PRBool *did_compile)
+                                          PRBool *did_define)
 {
-  *did_compile = PR_FALSE;
+  *did_define = PR_FALSE;
 
   if (!IsEventName(id)) {
     return NS_OK;
@@ -4984,7 +5053,6 @@
   NS_ENSURE_TRUE(receiver, NS_ERROR_UNEXPECTED);
 
   nsCOMPtr<nsIEventListenerManager> manager;
-
   receiver->GetListenerManager(getter_AddRefs(manager));
   NS_ENSURE_TRUE(manager, NS_ERROR_UNEXPECTED);
 
@@ -4995,7 +5063,7 @@
 
   if (compile) {
     rv = manager->CompileScriptEventListener(script_cx, native, atom,
-                                             did_compile);
+                                             did_define);
   } else {
     rv = manager->RegisterScriptEventListener(script_cx, native, atom);
   }
@@ -5014,13 +5082,23 @@
     return NS_OK;
   }
 
-  PRBool did_compile = PR_FALSE;
+  if (id == sAddEventListener_id && !(flags & JSRESOLVE_ASSIGNING)) {
+    JSString *str = JSVAL_TO_STRING(id);
+    JSFunction *fnc =
+      ::JS_DefineFunction(cx, obj, ::JS_GetStringBytes(str),
+                          AddEventListenerHelper, 0, JSPROP_ENUMERATE);
+
+    *objp = obj;
+
+    return fnc ? NS_OK : NS_ERROR_UNEXPECTED;
+  }
 
+  PRBool did_define = PR_FALSE;
   nsresult rv = RegisterCompileHandler(wrapper, cx, obj, id, PR_TRUE,
-                                       &did_compile);
+                                       &did_define);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  if (did_compile) {
+  if (did_define) {
     *objp = obj;
   }
 
@@ -5033,7 +5111,8 @@
                                JSContext *cx, JSObject *obj, jsval id,
                                jsval *vp, PRBool *_retval)
 {
-  if (::JS_TypeOfValue(cx, *vp) != JSTYPE_FUNCTION || !JSVAL_IS_STRING(id)) {
+  if (::JS_TypeOfValue(cx, *vp) != JSTYPE_FUNCTION ||
+      !JSVAL_IS_STRING(id) || id == sAddEventListener_id) {
     return NS_OK;
   }
 
--- mozilla-firefox-1.0.4.orig/dom/src/base/nsDOMClassInfo.h
+++ mozilla-firefox-1.0.4/dom/src/base/nsDOMClassInfo.h
@@ -270,6 +270,7 @@
   static jsval sAdd_id;
   static jsval sAll_id;
   static jsval sTags_id;
+  static jsval sAddEventListener_id;
 
   static const JSClass *sObjectClass;
 
@@ -309,9 +310,14 @@
     return PR_FALSE;
   }
 
+  static JSBool JS_DLL_CALLBACK AddEventListenerHelper(JSContext *cx,
+                                                       JSObject *obj,
+                                                       uintN argc, jsval *argv,
+                                                       jsval *rval);
+
   nsresult RegisterCompileHandler(nsIXPConnectWrappedNative *wrapper,
                                   JSContext *cx, JSObject *obj, jsval id,
-                                  PRBool compile, PRBool *did_compile);
+                                  PRBool compile, PRBool *did_define);
 
 public:
   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
--- mozilla-firefox-1.0.4.orig/dom/src/base/nsGlobalWindow.cpp
+++ mozilla-firefox-1.0.4/dom/src/base/nsGlobalWindow.cpp
@@ -55,6 +55,7 @@
 #include "jsdbgapi.h"           // for JS_ClearWatchPointsForObject
 #include "nsReadableUtils.h"
 #include "nsDOMClassInfo.h"
+#include "nsContentUtils.h"
 
 // Other Classes
 #include "nsIEventListenerManager.h"
@@ -140,6 +141,8 @@
 #include "nsGlobalWindowCommands.h"
 #include "nsAutoPtr.h"
 #include "nsIPrincipalObsolete.h"
+#include "nsIURIFixup.h"
+#include "nsCDefaultURIFixup.h"
 
 #include "plbase64.h"
 
@@ -343,6 +346,7 @@
   NS_INTERFACE_MAP_ENTRY(nsIDOMEventReceiver)
   NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
   NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget)
+  NS_INTERFACE_MAP_ENTRY(nsIDOMNSEventTarget)
   NS_INTERFACE_MAP_ENTRY(nsPIDOMWindow)
   NS_INTERFACE_MAP_ENTRY(nsIDOMViewCSS)
   NS_INTERFACE_MAP_ENTRY(nsIDOMAbstractView)
@@ -819,6 +823,9 @@
                                  PRUint32 aFlags,
                                  nsEventStatus* aEventStatus)
 {
+  // Make sure to tell the event that dispatch has started.
+  NS_MARK_EVENT_DISPATCH_STARTED(aEvent);
+
   nsresult ret = NS_OK;
   PRBool externalDOMEvent = PR_FALSE;
   nsIDOMEvent *domEvent = nsnull;
@@ -968,7 +975,7 @@
       // onload event for the frame element.
 
       nsEventStatus status = nsEventStatus_eIgnore;
-      nsEvent event(NS_PAGE_LOAD);
+      nsEvent event(NS_IS_TRUSTED_EVENT(aEvent), NS_PAGE_LOAD);
 
       // Most of the time we could get a pres context to pass in here,
       // but not always (i.e. if this window is not shown there won't
@@ -998,6 +1005,10 @@
       }
       aDOMEvent = nsnull;
     }
+
+    // Now that we're done with this event, remove the flag that says
+    // we're in the process of dispatching this event.
+    NS_MARK_EVENT_DISPATCH_DONE(aEvent);
   }
 
   mCurrentEvent = oldEvent;
@@ -2409,28 +2420,76 @@
 {
   aOutTitle.Truncate(0);
 
-  // Load the string to be prepended to titles for script
-  // confirm/alert/prompt boxes.
+  // Try to get a host from the running principal -- this will do the right
+  // thing for javascript: and data: documents.
 
-  nsresult rv;
-  nsCOMPtr<nsIStringBundleService> stringBundleService =
-     do_GetService(kCStringBundleServiceCID, &rv);
+  nsresult rv = NS_OK;
+  nsCOMPtr<nsIPrincipal> principal;
+  NS_WARN_IF_FALSE(sSecMan, "Global Window has no security manager!");
+  if (sSecMan) {
+    rv = sSecMan->GetSubjectPrincipal(getter_AddRefs(principal));
+
+    if (NS_SUCCEEDED(rv) && principal) {
+      nsCOMPtr<nsIURI> uri;
+      rv = principal->GetURI(getter_AddRefs(uri));
+      if (NS_SUCCEEDED(rv) && uri) {
+
+        // remove user:pass for privacy and spoof prevention
+
+        nsCOMPtr<nsIURIFixup> fixup(do_GetService(NS_URIFIXUP_CONTRACTID));
+        if (fixup) {
+          nsCOMPtr<nsIURI> fixedURI;
+          nsresult rv = fixup->CreateExposableURI(uri, getter_AddRefs(fixedURI));
+          if (NS_SUCCEEDED(rv) && fixedURI) {
+            nsCAutoString host;
+            fixedURI->GetHost(host);
+
+            if (!host.IsEmpty()) {
+
+              // if this URI has a host we'll show it. For other schemes
+              // (e.g. file:) we fall back to the localized generic string
+
+              nsCAutoString prepath;
+              fixedURI->GetPrePath(prepath);
+
+              aOutTitle = NS_ConvertUTF8toUTF16(prepath);
+              if (!aInTitle.IsEmpty())
+                aOutTitle.Append(NS_LITERAL_STRING(" - ") + aInTitle);
+            }
+          }
+        }
+      }
+    }
+    else { // failed to get subject principal
+      NS_WARNING("No script principal? Who is calling alert/confirm/prompt?!");
+    }
+  }
+
+  if (aOutTitle.IsEmpty()) {
 
-  if (NS_SUCCEEDED(rv) && stringBundleService) {
-    nsCOMPtr<nsIStringBundle> stringBundle;
-    rv = stringBundleService->CreateBundle(kDOMBundleURL,
-       getter_AddRefs(stringBundle));
-
-    if (stringBundle) {
-      nsAutoString inTitle(aInTitle);
-      nsXPIDLString tempString;
-      const PRUnichar *formatStrings[1];
-      formatStrings[0] = inTitle.get();
-      rv = stringBundle->FormatStringFromName(
-        NS_LITERAL_STRING("ScriptDlgTitle").get(),
-        formatStrings, 1, getter_Copies(tempString));
-      if (tempString)
-        aOutTitle = tempString.get();
+    // We didn't find a host so use the generic title modifier.
+    // Load the string to be prepended to titles for script
+    // confirm/alert/prompt boxes.
+
+    nsCOMPtr<nsIStringBundleService> stringBundleService =
+       do_GetService(kCStringBundleServiceCID, &rv);
+
+    if (NS_SUCCEEDED(rv) && stringBundleService) {
+      nsCOMPtr<nsIStringBundle> stringBundle;
+      rv = stringBundleService->CreateBundle(kDOMBundleURL,
+         getter_AddRefs(stringBundle));
+
+      if (stringBundle) {
+        nsAutoString inTitle(aInTitle);
+        nsXPIDLString tempString;
+        const PRUnichar *formatStrings[1];
+        formatStrings[0] = inTitle.get();
+        rv = stringBundle->FormatStringFromName(
+          NS_LITERAL_STRING("ScriptDlgTitle").get(),
+          formatStrings, 1, getter_Copies(tempString));
+        if (tempString)
+          aOutTitle = tempString.get();
+      }
     }
   }
 
@@ -4233,7 +4292,10 @@
                                    nsIDOMEventListener* aListener,
                                    PRBool aUseCapture)
 {
-  return AddGroupedEventListener(aType, aListener, aUseCapture, nsnull);
+  nsCOMPtr<nsIDocument> doc(do_QueryInterface(mDocument));
+
+  return AddEventListener(aType, aListener, aUseCapture,
+                          !nsContentUtils::IsChromeDoc(doc));
 }
 
 NS_IMETHODIMP
@@ -4315,6 +4377,25 @@
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
+NS_IMETHODIMP
+GlobalWindowImpl::AddEventListener(const nsAString& aType,
+                                 nsIDOMEventListener *aListener,
+                                 PRBool aUseCapture, PRBool aWantsUntrusted)
+{
+  nsCOMPtr<nsIEventListenerManager> manager;
+  nsresult rv = GetListenerManager(getter_AddRefs(manager));
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE;
+
+  if (aWantsUntrusted) {
+    flags |= NS_PRIV_EVENT_UNTRUSTED_PERMITTED;
+  }
+
+  return manager->AddEventListenerByType(aListener, aType, flags, nsnull);
+}
+
+
 //*****************************************************************************
 // GlobalWindowImpl::nsIDOMEventReceiver
 //*****************************************************************************
@@ -4561,7 +4642,7 @@
 
   nsEventStatus status;
 
-  nsGUIEvent guiEvent(NS_ACTIVATE, widget);
+  nsGUIEvent guiEvent(PR_TRUE, NS_ACTIVATE, widget);
   guiEvent.time = PR_IntervalNow();
 
   vm->DispatchEvent(&guiEvent, &status);
@@ -4589,7 +4670,7 @@
 
   nsEventStatus status;
 
-  nsGUIEvent guiEvent(NS_DEACTIVATE, widget);
+  nsGUIEvent guiEvent(PR_TRUE, NS_DEACTIVATE, widget);
   guiEvent.time = PR_IntervalNow();
 
   vm->DispatchEvent(&guiEvent, &status);
@@ -4979,26 +5060,6 @@
         // dialog is open.
         nsAutoPopupStatePusher popupStatePusher(openAbused, PR_TRUE);
 
-        nsCOMPtr<nsIDOMChromeWindow> chrome_win =
-          do_QueryInterface(NS_STATIC_CAST(nsIDOMWindow *, this));
-
-        nsCOMPtr<nsIJSContextStack> stack;
-        JSContext *cx = nsnull;
-
-        if (IsCallerChrome() && !chrome_win) {
-          // open() is called from chrome on a non-chrome window, push
-          // the context of the callee onto the context stack to
-          // prevent the caller's priveleges from leaking into code
-          // that runs while opening the new window.
-
-          cx = (JSContext *)mContext->GetNativeContext();
-
-          stack = do_GetService(sJSStackContractID);
-          if (stack && cx) {
-            stack->Push(cx);
-          }
-        }
-
         if (argc) {
           nsCOMPtr<nsPIWindowWatcher> pwwatch(do_QueryInterface(wwatch));
           if (pwwatch) {
@@ -5015,10 +5076,6 @@
           rv = wwatch->OpenWindow(this, url.get(), name_ptr, options_ptr,
                                   aExtraArgument, getter_AddRefs(domReturn));
         }
-
-        if (stack && cx) {
-          stack->Pop(nsnull);
-        }
       }
     }
   }
--- mozilla-firefox-1.0.4.orig/dom/src/base/nsGlobalWindow.h
+++ mozilla-firefox-1.0.4/dom/src/base/nsGlobalWindow.h
@@ -62,6 +62,7 @@
 #include "nsIDOMViewCSS.h"
 #include "nsIDOMEventReceiver.h"
 #include "nsIDOM3EventTarget.h"
+#include "nsIDOMNSEventTarget.h"
 #include "nsIDOMNavigator.h"
 #include "nsIDOMNSLocation.h"
 #include "nsIDOMWindowInternal.h"
@@ -121,6 +122,7 @@
                          public nsIScriptObjectPrincipal,
                          public nsIDOMEventReceiver,
                          public nsIDOM3EventTarget,
+                         public nsIDOMNSEventTarget,
                          public nsPIDOMWindow,
                          public nsIDOMViewCSS,
                          public nsSupportsWeakReference,
@@ -171,6 +173,9 @@
   // nsIDOM3EventTarget
   NS_DECL_NSIDOM3EVENTTARGET
 
+  // nsIDOMNSEventTarget
+  NS_DECL_NSIDOMNSEVENTTARGET
+
   // nsIDOMEventReceiver
   NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener,
                                    const nsIID& aIID);
--- mozilla-firefox-1.0.4.orig/dom/src/base/nsJSEnvironment.cpp
+++ mozilla-firefox-1.0.4/dom/src/base/nsJSEnvironment.cpp
@@ -181,7 +181,7 @@
         docShell->GetPresContext(getter_AddRefs(presContext));
 
         if (presContext && errorDepth < 2) {
-          nsScriptErrorEvent errorevent(NS_SCRIPT_ERROR);
+          nsScriptErrorEvent errorevent(PR_TRUE, NS_SCRIPT_ERROR);
 
           errorevent.fileName = fileName.get();
           errorevent.errorMsg = msg.get();
--- mozilla-firefox-1.0.4.orig/dom/src/base/nsWindowRoot.cpp
+++ mozilla-firefox-1.0.4/dom/src/base/nsWindowRoot.cpp
@@ -54,7 +54,13 @@
 {
 }
 
-NS_IMPL_ISUPPORTS5(nsWindowRoot, nsIDOMEventReceiver, nsIChromeEventHandler, nsPIWindowRoot, nsIDOMEventTarget, nsIDOM3EventTarget)
+NS_IMPL_ISUPPORTS6(nsWindowRoot,
+                   nsIDOMEventReceiver,
+                   nsIChromeEventHandler,
+                   nsPIWindowRoot,
+                   nsIDOMEventTarget,
+                   nsIDOM3EventTarget,
+                   nsIDOMNSEventTarget)
 
 NS_IMETHODIMP
 nsWindowRoot::AddEventListener(const nsAString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture)
@@ -132,6 +138,24 @@
 }
 
 NS_IMETHODIMP
+nsWindowRoot::AddEventListener(const nsAString& aType,
+                               nsIDOMEventListener *aListener,
+                               PRBool aUseCapture, PRBool aWantsUntrusted)
+{
+  nsCOMPtr<nsIEventListenerManager> manager;
+  nsresult rv = GetListenerManager(getter_AddRefs(manager));
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE;
+
+  if (aWantsUntrusted) {
+    flags |= NS_PRIV_EVENT_UNTRUSTED_PERMITTED;
+  }
+
+  return manager->AddEventListenerByType(aListener, aType, flags, nsnull);
+}
+
+NS_IMETHODIMP
 nsWindowRoot::AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID)
 {
   nsCOMPtr<nsIEventListenerManager> manager;
@@ -186,10 +210,14 @@
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP nsWindowRoot::HandleChromeEvent(nsIPresContext* aPresContext,
-   nsEvent* aEvent, nsIDOMEvent** aDOMEvent, PRUint32 aFlags, 
-   nsEventStatus* aEventStatus)
+NS_IMETHODIMP
+nsWindowRoot::HandleChromeEvent(nsIPresContext* aPresContext, nsEvent* aEvent,
+                                nsIDOMEvent** aDOMEvent, PRUint32 aFlags, 
+                                nsEventStatus* aEventStatus)
 {
+  // Make sure to tell the event that dispatch has started.
+  NS_MARK_EVENT_DISPATCH_STARTED(aEvent);
+
   // Prevent the world from going
   // away until after we've finished handling the event.
   nsCOMPtr<nsIDOMWindow> kungFuDeathGrip(mWindow);
@@ -212,13 +240,16 @@
   }
 
   if (NS_EVENT_FLAG_INIT & aFlags) {
-    // We're leaving the DOM event loop so if we created a DOM event, release here.
+    // We're leaving the DOM event loop so if we created a DOM event,
+    // release here.
     if (nsnull != *aDOMEvent) {
       nsrefcnt rc;
       NS_RELEASE2(*aDOMEvent, rc);
       if (0 != rc) {
-      //Okay, so someone in the DOM loop (a listener, JS object) still has a ref to the DOM Event but
-      //the internal data hasn't been malloc'd.  Force a copy of the data here so the DOM Event is still valid.
+        // Okay, so someone in the DOM loop (a listener, JS object)
+        // still has a ref to the DOM Event but the internal data
+        // hasn't been malloc'd.  Force a copy of the data here so the
+        // DOM Event is still valid.
         nsIPrivateDOMEvent *privateEvent;
         if (NS_OK == (*aDOMEvent)->QueryInterface(NS_GET_IID(nsIPrivateDOMEvent), (void**)&privateEvent)) {
           privateEvent->DuplicatePrivateData();
@@ -227,6 +258,10 @@
       }
     }
     aDOMEvent = nsnull;
+
+    // Now that we're done with this event, remove the flag that says
+    // we're in the process of dispatching this event.
+    NS_MARK_EVENT_DISPATCH_DONE(aEvent);
   }
 
   return ret;
--- mozilla-firefox-1.0.4.orig/dom/src/base/nsWindowRoot.h
+++ mozilla-firefox-1.0.4/dom/src/base/nsWindowRoot.h
@@ -31,13 +31,18 @@
 #include "nsGUIEvent.h"
 #include "nsIDOMEventReceiver.h"
 #include "nsIDOM3EventTarget.h"
+#include "nsIDOMNSEventTarget.h"
 #include "nsIChromeEventHandler.h"
 #include "nsIEventListenerManager.h"
 #include "nsPIWindowRoot.h"
 #include "nsIFocusController.h"
 #include "nsIDOMEventTarget.h"
 
-class nsWindowRoot : public nsIDOMEventReceiver, public nsIDOM3EventTarget, public nsIChromeEventHandler, public nsPIWindowRoot
+class nsWindowRoot : public nsIDOMEventReceiver,
+                     public nsIDOM3EventTarget,
+                     public nsIDOMNSEventTarget,
+                     public nsIChromeEventHandler,
+                     public nsPIWindowRoot
 {
 public:
   nsWindowRoot(nsIDOMWindow* aWindow);
@@ -46,6 +51,7 @@
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMEVENTTARGET
   NS_DECL_NSIDOM3EVENTTARGET
+  NS_DECL_NSIDOMNSEVENTTARGET
 
   NS_IMETHOD HandleChromeEvent(nsIPresContext* aPresContext,
                                nsEvent* aEvent, nsIDOMEvent** aDOMEvent,
--- mozilla-firefox-1.0.4.orig/dom/src/Makefile.in
+++ mozilla-firefox-1.0.4/dom/src/Makefile.in
@@ -30,3 +30,12 @@
 
 include $(topsrcdir)/config/rules.mk
 
+_FILES = \
+	$(srcdir)/res/hiddenWindow.html \
+	$(NULL)
+
+libs::
+	$(INSTALL) $(_FILES) $(DIST)/bin/res
+
+install::
+	$(SYSINSTALL) $(IFLAGS1) $(_FILES) $(DESTDIR)$(mozappdir)/res
--- mozilla-firefox-1.0.4.orig/dom/src/res/hiddenWindow.html
+++ mozilla-firefox-1.0.4/dom/src/res/hiddenWindow.html
@@ -0,0 +1 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title></title></head><body></body></html>
\ No newline at end of file
--- mozilla-firefox-1.0.4.orig/gfx/src/gtk/fontEncoding.properties
+++ mozilla-firefox-1.0.4/gfx/src/gtk/fontEncoding.properties
@@ -54,8 +54,8 @@
 # font,  you do need them. 
 
 # Symbol font
-#encoding.symbol.ttf = Adobe-Symbol-Encoding
-#encoding.symbol.ftcmap = mac_roman
+encoding.symbol.ttf = Adobe-Symbol-Encoding
+encoding.symbol.ftcmap = mac_roman
 
 # TeX's Computer Modern fonts (Roman, Math Italic, Symbol and Extension)
 
--- mozilla-firefox-1.0.4.orig/gfx/src/gtk/nsImageGTK.cpp
+++ mozilla-firefox-1.0.4/gfx/src/gtk/nsImageGTK.cpp
@@ -91,17 +91,17 @@
 nsImageGTK::~nsImageGTK()
 {
   if(nsnull != mImageBits) {
-    delete[] mImageBits;
+    free(mImageBits);
     mImageBits = nsnull;
   }
 
   if (nsnull != mAlphaBits) {
-    delete[] mAlphaBits;
+    free(mAlphaBits);
     mAlphaBits = nsnull;
   }
 
   if (nsnull != mTrueAlphaBits) {
-    delete[] mTrueAlphaBits;
+    free(mTrueAlphaBits);
     mTrueAlphaBits = nsnull;
   }
 
@@ -173,7 +173,9 @@
   // create the memory for the image
   ComputeMetrics();
 
-  mImageBits = (PRUint8*) new PRUint8[mSizeImage];
+  mImageBits = (PRUint8*)malloc(mSizeImage);
+  if (!mImageBits)
+    return NS_ERROR_OUT_OF_MEMORY;
 
   switch(aMaskRequirements)
   {
@@ -183,8 +185,9 @@
 
       // 32-bit align each row
       mTrueAlphaRowBytes = (mTrueAlphaRowBytes + 3) & ~0x3;
-      mTrueAlphaBits = new PRUint8[mTrueAlphaRowBytes * aHeight];
-      memset(mTrueAlphaBits, 0, mTrueAlphaRowBytes*aHeight);
+      mTrueAlphaBits = (PRUint8*)calloc(mTrueAlphaRowBytes * aHeight, 1);
+      if (!mTrueAlphaBits)
+        return NS_ERROR_OUT_OF_MEMORY;
 
       // FALL THROUGH
 
@@ -195,8 +198,9 @@
       // 32-bit align each row
       mAlphaRowBytes = (mAlphaRowBytes + 3) & ~0x3;
 
-      mAlphaBits = new PRUint8[mAlphaRowBytes * aHeight];
-      memset(mAlphaBits, 0, mAlphaRowBytes*aHeight);
+      mAlphaBits = (PRUint8*)calloc(mAlphaRowBytes * aHeight, 1);
+      if (!mAlphaBits)
+        return NS_ERROR_OUT_OF_MEMORY;
       break;
 
     default:
@@ -340,7 +344,7 @@
           mAlphaPixmap = 0;
         }
         if (mAlphaBits) {
-          delete [] mAlphaBits;
+          free(mAlphaBits);
           mAlphaBits = mTrueAlphaBits;
           mAlphaRowBytes = mTrueAlphaRowBytes;
           mTrueAlphaBits = 0;
@@ -1825,18 +1829,18 @@
 
   if ((gdk_rgb_get_visual()->depth > 8) && (mAlphaDepth != 8)) {
     if(nsnull != mImageBits) {
-      delete[] mImageBits;
+      free(mImageBits);
       mImageBits = nsnull;
     }
 
     if (nsnull != mAlphaBits) {
-      delete[] mAlphaBits;
+      free(mAlphaBits);
       mAlphaBits = nsnull;
     }
   }
     
   if (mTrueAlphaBits) {
-    delete[] mTrueAlphaBits;
+    free(mTrueAlphaBits);
     mTrueAlphaBits = nsnull;
   }
 
@@ -1867,8 +1871,9 @@
                               0, 0, mWidth, mHeight,
                               AllPlanes, XYPixmap);
 
-    mAlphaBits = new PRUint8[mAlphaRowBytes * mHeight];
-    memset(mAlphaBits, 0, mAlphaRowBytes * mHeight);
+    mAlphaBits = (PRUint8*)calloc(mAlphaRowBytes * mHeight, 1);
+    if (!mAlphaBits)
+      return NS_ERROR_OUT_OF_MEMORY;
 
     for (PRInt32 y = 0; y < mHeight; ++y) {
       PRUint8 *alphaTarget = mAlphaBits + y*mAlphaRowBytes;
@@ -1904,7 +1909,10 @@
                       0, 0, mWidth, mHeight,
                       AllPlanes, XYPixmap);
 
-  mImageBits = (PRUint8*) new PRUint8[mSizeImage];
+   mImageBits = (PRUint8*)malloc(mSizeImage);
+   if (!mImageBits)
+     return NS_ERROR_OUT_OF_MEMORY;
+
   GdkVisual *visual = gdk_rgb_get_visual();
   GdkColormap *colormap = gdk_rgb_get_cmap();
 
--- mozilla-firefox-1.0.4.orig/gfx/src/freetype/nsFreeType.cpp
+++ mozilla-firefox-1.0.4/gfx/src/freetype/nsFreeType.cpp
@@ -96,7 +96,7 @@
 // Define the FreeType2 functions we resolve at run time.
 // see the comment near nsFreeType2::DoneFace() for more info
 //
-#define NS_FT2_OFFSET(f) (int)&((nsFreeType2*)0)->f
+#define NS_FT2_OFFSET(f) (NS_PTR_TO_INT32(&((nsFreeType2*)0)->f))
 FtFuncList nsFreeType2::FtFuncs [] = {
   {"FT_Done_Face",            NS_FT2_OFFSET(nsFT_Done_Face),            PR_TRUE},
   {"FT_Done_FreeType",        NS_FT2_OFFSET(nsFT_Done_FreeType),        PR_TRUE},
--- mozilla-firefox-1.0.4.orig/gfx/src/windows/nsDrawingSurfaceWin.cpp
+++ mozilla-firefox-1.0.4/gfx/src/windows/nsDrawingSurfaceWin.cpp
@@ -262,6 +262,8 @@
       }
       else
       {
+        if (!(aFlags & NS_LOCK_SURFACE_WRITE_ONLY))
+          ::GdiFlush();
         mLockedBitmap = mSelectedBitmap;
         mBitmap.bmBits = mDIBits + mBitmap.bmWidthBytes * aY;
       }
@@ -426,11 +428,15 @@
   if (nsnull == mSurface)
 #endif
   {
-    HBITMAP tbits;
+    HBITMAP tbits = nsnull;
 
     if ((aWidth > 0) && (aHeight > 0))
     {
-      if (aFlags & NS_CREATEDRAWINGSURFACE_FOR_PIXEL_ACCESS)
+      if ((aFlags & NS_CREATEDRAWINGSURFACE_FOR_PIXEL_ACCESS) == 0)
+        tbits = ::CreateCompatibleBitmap(aDC, aWidth, aHeight);
+
+      // Create a DIB if we need Pixel Access, or it DDB creation failed
+      if (nsnull == tbits)
       {
         void        *bits;
         BITMAPINFO  *binfo;
@@ -440,21 +446,19 @@
 
         binfo = CreateBitmapInfo(aWidth, aHeight, depth);
 
-        if (nsnull != binfo)
-          mSelectedBitmap = tbits = ::CreateDIBSection(aDC, binfo, DIB_RGB_COLORS, &bits, NULL, 0);
+        if (nsnull == binfo)
+          return NS_ERROR_FAILURE;
+
+        mSelectedBitmap = tbits = ::CreateDIBSection(aDC, binfo, DIB_RGB_COLORS, &bits, NULL, 0);
 
         if (NULL == mSelectedBitmap)
-          tbits = ::CreateCompatibleBitmap(aDC, aWidth, aHeight);
-        else
-        {
-          mBitmapInfo = binfo;
-          mDIBits = (PRUint8 *)bits;
-          mBitmap.bmWidthBytes = RASWIDTH(aWidth, depth);
-          mBitmap.bmBitsPixel = depth;
-        }
+          return NS_ERROR_FAILURE;
+
+        mBitmapInfo = binfo;
+        mDIBits = (PRUint8 *)bits;
+        mBitmap.bmWidthBytes = RASWIDTH(aWidth, depth);
+        mBitmap.bmBitsPixel = depth;
       }
-      else
-        tbits = ::CreateCompatibleBitmap(aDC, aWidth, aHeight);
     }
     else
     {
--- mozilla-firefox-1.0.4.orig/gfx/src/windows/nsImageWin.cpp
+++ mozilla-firefox-1.0.4/gfx/src/windows/nsImageWin.cpp
@@ -42,9 +42,7 @@
 #include "nsRenderingContextWin.h"
 #include "nsDeviceContextWin.h"
 #include "imgScaler.h"
-
-static nsresult BuildDIB(LPBITMAPINFOHEADER *aBHead, PRInt32 aWidth,
-                         PRInt32 aHeight, PRInt32 aDepth, PRInt8 *aNumBitPix);
+#include "nsComponentManagerUtils.h"
 
 static PRInt32 GetPlatform()
 {
@@ -56,8 +54,18 @@
   return versionInfo.dwPlatformId;
 }
 
+static PRInt32 GetOsMajorVersion()
+{
+  OSVERSIONINFO versionInfo;
+
+  versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
+  ::GetVersionEx(&versionInfo);
+  return versionInfo.dwMajorVersion;
+}
+
 
 PRInt32 nsImageWin::gPlatform = GetPlatform();
+PRInt32 nsImageWin::gOsMajorVersion = GetOsMajorVersion();
 
 
 /** ----------------------------------------------------------------
@@ -85,6 +93,9 @@
   , mARowBytes(0)
   , mImageCache(0)
   , mInitialized(PR_FALSE)
+  , mWantsOptimization(PR_FALSE)
+  , mTimer(nsnull)
+  , mImagePreMultiplied(PR_FALSE)
 {
 }
 
@@ -95,6 +106,9 @@
   */
 nsImageWin :: ~nsImageWin()
 {
+  if (mTimer)
+    mTimer->Cancel();
+
   CleanUpDDB();
   CleanUpDIB();
 
@@ -136,17 +150,18 @@
   if (aWidth > k64KLimit || aHeight > k64KLimit)
       return NS_ERROR_FAILURE;
 
-  if (mNumPaletteColors >= 0){
-    // If we have a palette
-    if (0 == mNumPaletteColors) {
-      // space for the header only (no color table)
-      mBHead = (LPBITMAPINFOHEADER)new char[sizeof(BITMAPINFO)];
-    } else {
-      // Space for the header and the palette. Since we'll be using DIB_PAL_COLORS
-      // the color table is an array of 16-bit unsigned integers that specify an
-      // index into the currently realized logical palette
-      mBHead = (LPBITMAPINFOHEADER)new char[sizeof(BITMAPINFOHEADER) + (256 * sizeof(WORD))];
-    }
+  if (0 == mNumPaletteColors) {
+    // space for the header only (no color table)
+    mBHead = (LPBITMAPINFOHEADER)new char[sizeof(BITMAPINFO)];
+  } else {
+    // Space for the header and the palette. Since we'll be using DIB_PAL_COLORS
+    // the color table is an array of 16-bit unsigned integers that specify an
+    // index into the currently realized logical palette
+    mBHead = (LPBITMAPINFOHEADER)new char[sizeof(BITMAPINFOHEADER) + (256 * sizeof(WORD))];
+  }
+  if (!mBHead)
+    return NS_ERROR_OUT_OF_MEMORY;
+
     mBHead->biSize = sizeof(BITMAPINFOHEADER);
     mBHead->biWidth = aWidth;
     mBHead->biHeight = aHeight;
@@ -167,6 +182,11 @@
 
     // Allocate the image bits
     mImageBits = new unsigned char[mSizeImage];
+    if (!mImageBits) {
+      delete[] mBHead;
+      mBHead = nsnull;
+      return NS_ERROR_OUT_OF_MEMORY;
+    }
  
     // Need to clear the entire buffer so an incrementally loaded image
     // will not have garbage rendered for the unloaded bits.
@@ -207,6 +227,13 @@
 
 
       mAlphaBits = new unsigned char[mARowBytes * aHeight];
+      if (!mAlphaBits) {
+        delete[] mBHead;
+        mBHead = nsnull;
+        delete[] mImageBits;
+        mImageBits = nsnull;
+        return NS_ERROR_OUT_OF_MEMORY;
+      }
     }
 
 
@@ -227,7 +254,6 @@
         memset(mColorMap->Index, 0, sizeof(PRUint8) * (3 * mColorMap->NumColors));
       }
     }
-  }
 
   mInitialized = PR_TRUE;
   return NS_OK;
@@ -393,6 +419,18 @@
         imageWithAlphaRow[3] = *alphaRow;
       }
     }
+  } else if (mImagePreMultiplied) {
+    for (int y = 0; y < mBHead->biHeight; y++) {
+      unsigned char *imageWithAlphaRow = imageWithAlphaBits + y * mBHead->biWidth * 4;
+      unsigned char *imageRow = mImageBits + y * mRowBytes;
+      unsigned char *alphaRow = mAlphaBits + y * mARowBytes;
+
+      for (int x = 0; x < mBHead->biWidth;
+          x++, imageWithAlphaRow += 4, imageRow += 3, alphaRow++) {
+        memcpy(imageWithAlphaRow, imageRow, 3);
+        imageWithAlphaRow[3] = *alphaRow;
+      }
+    }
   } else {
     for (int y = 0; y < mBHead->biHeight; y++) {
       unsigned char *imageWithAlphaRow = imageWithAlphaBits + y * mBHead->biWidth * 4;
@@ -417,45 +455,6 @@
  *  See documentation in nsIImageWin.h  
  *  @update 3/27/00 dwc
  */
-void 
-nsImageWin :: CreateDDB(nsDrawingSurface aSurface)
-{
-  HDC TheHDC;
-
-
-  ((nsDrawingSurfaceWin *)aSurface)->GetDC(&TheHDC);
-
-
-  if (TheHDC != NULL){
-    // Temporary fix for bug 135226 until we do better decode-time
-    // dithering and paletized storage of images. Bail on the 
-    // optimization to DDB if we're on a paletted device.
-    int rasterCaps = ::GetDeviceCaps(TheHDC, RASTERCAPS);
-    if (RC_PALETTE == (rasterCaps & RC_PALETTE)) {
-      ((nsDrawingSurfaceWin *)aSurface)->ReleaseDC();
-      return;
-    }
-    
-    if (mSizeImage > 0){
-       if (mAlphaDepth == 8) {
-         CreateImageWithAlphaBits(TheHDC);
-       } else {
-         mHBitmap = ::CreateDIBitmap(TheHDC, mBHead, CBM_INIT, mImageBits,
-                                     (LPBITMAPINFO)mBHead,
-                                     256 == mNumPaletteColors ? DIB_PAL_COLORS : DIB_RGB_COLORS);
-         mIsOptimized = (mHBitmap != 0);
-       }
-      if (mIsOptimized)
-        CleanUpDIB();
-    }
-    ((nsDrawingSurfaceWin *)aSurface)->ReleaseDC();
-  }
-}
-
-/** ---------------------------------------------------
- *  See documentation in nsIImageWin.h  
- *  @update 3/27/00 dwc
- */
 NS_IMETHODIMP 
 nsImageWin::Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface,
                  PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight,
@@ -508,6 +507,8 @@
   PRInt32 canRaster;
   ((nsDrawingSurfaceWin *)aSurface)->GetTECHNOLOGY(&canRaster);
 
+  CreateDDB();
+
   PRBool didComposite = PR_FALSE;
   if (!mIsOptimized || !mHBitmap) {
     DWORD rop = SRCCOPY;
@@ -707,7 +708,7 @@
   /* Copy from the HDC */
   BOOL retval = ::BitBlt(memDC, 0, 0, aDWidth, aDHeight,
                          TheHDC, aDX, aDY, SRCCOPY);
-  if (!retval) {
+  if (!retval || !::GdiFlush()) {
     /* select the old object again... */
     ::SelectObject(memDC, oldBitmap);
     ::DeleteObject(tmpBitmap);
@@ -916,7 +917,8 @@
       // Copy from the HDC to the memory DC
       // this will be the image on the screen into a buffer for the blend.
       ::StretchBlt(memDC, 0, 0, width, height,theHDC, aDestRect.x, aDestRect.y, width, height, SRCCOPY);
-  
+      ::GdiFlush();
+
       imageBytesPerPixel = mBHead->biBitCount/8;
 
       // windows bitmaps start at the bottom.. and go up.  This messes up the offsets for the
@@ -1016,7 +1018,9 @@
     ((nsDrawingSurfaceWin *)aSurface)->ReleaseDC();
     return PR_FALSE;
   }
-  
+
+  CreateDDB();
+
   nsPaletteInfo palInfo;
   aContext->GetPaletteInfo(palInfo);
   if (palInfo.isPaletteDevice && palInfo.palette) {
@@ -1422,9 +1426,25 @@
  * @update dc - 11/20/98
  * @param aContext - The device context to use for the optimization
  */
-nsresult 
-nsImageWin :: Optimize(nsIDeviceContext* aContext)
+nsresult nsImageWin::Optimize(nsIDeviceContext* aContext)
 {
+  // Do the actual optimizing when we first use the image (draw it)
+  // This saves on GDI resources.
+  mWantsOptimization = PR_TRUE;
+  return NS_OK;
+}
+
+// CreateDDB only if DDB is wanted
+NS_IMETHODIMP nsImageWin::CreateDDB()
+{
+  if (!mWantsOptimization || mIsOptimized) {
+    // Timer only exists when mIsOptimized.  Push timer forwards.
+    if (mTimer)
+      mTimer->SetDelay(GFX_MS_REMOVE_DBB);
+
+    return NS_OK;
+  }
+
   // we used to set a flag because a valid HDC may not be ready, 
   // like at startup, but now we just roll our own HDC for the given screen.
 
@@ -1435,7 +1455,9 @@
   // We also can not optimize empty images, or 8-bit alpha depth images on
   // Win98 due to a Windows API bug.
   //
-  // Create DDBs only for large (> 128k) images to minimize GDI handle usage.
+  // On Windows 95/98/Me, GDI resources are very limited.  Windows NT has more,
+  // but is still rather limited. Create DDBs on these platforms only for 
+  // large (> 128k) images to minimize GDI handle usage.
   // See bug 205893, bug 204374, and bug 216430 for more info on the situation.
   // Bottom-line: we need a better accounting mechanism to avoid exceeding the
   // system's GDI object limit.  The rather arbitrary size limitation imposed
@@ -1443,9 +1465,9 @@
   // most certainly the wrong place to impose this policy, but we do it for
   // now as a stop-gap measure.
   //
-  if ((gPlatform == VER_PLATFORM_WIN32_WINDOWS && mSizeImage >= 0xFF0000) ||
-      (mAlphaDepth == 8 && !CanAlphaBlend()) ||
-      (mSizeImage < 0x20000)) {
+  if ((gOsMajorVersion <= VER_OSMAJOR_WIN9598MENT && 
+       (mSizeImage >= 0xFF0000 || mSizeImage < 0x20000)) ||
+      (mAlphaDepth == 8 && !CanAlphaBlend())) {
     return NS_OK;
   }
 
@@ -1471,20 +1493,45 @@
     if (mAlphaDepth == 8) {
       CreateImageWithAlphaBits(TheHDC);
     } else {
-      LPVOID bits;
-      mHBitmap = ::CreateDIBSection(TheHDC, (LPBITMAPINFO)mBHead,
-        256 == mNumPaletteColors ? DIB_PAL_COLORS : DIB_RGB_COLORS,
-        &bits, NULL, 0);
-
-      if (mHBitmap) {
-        memcpy(bits, mImageBits, mSizeImage);
-        mIsOptimized = PR_TRUE;
+      // Apparently, DIBs use less resources than DDBs.
+      // On Windows 95/98/Me/NT, use DIBs to save resources.  On remaining
+      // platforms, use DDBs.  DDBs draw at the same speed or faster when
+      // drawn to a DDB surface.  This is another temporary solution until
+      // we manage our resources better.
+      if (gOsMajorVersion <= VER_OSMAJOR_WIN9598MENT) {
+        LPVOID bits;
+        mHBitmap = ::CreateDIBSection(TheHDC, (LPBITMAPINFO)mBHead,
+          256 == mNumPaletteColors ? DIB_PAL_COLORS : DIB_RGB_COLORS,
+          &bits, NULL, 0);
+
+        if (mHBitmap) {
+          memcpy(bits, mImageBits, mSizeImage);
+          mIsOptimized = PR_TRUE;
+        } else {
+          mIsOptimized = PR_FALSE;
+        }
       } else {
-        mIsOptimized = PR_FALSE;
+        mHBitmap = ::CreateDIBitmap(TheHDC, mBHead, CBM_INIT, mImageBits,
+                                    (LPBITMAPINFO)mBHead,
+                                    256 == mNumPaletteColors ? DIB_PAL_COLORS
+                                                             : DIB_RGB_COLORS);
+        mIsOptimized = (mHBitmap != 0);
       }
     }
-    if (mIsOptimized)
+    if (mIsOptimized) {
+      ::GdiFlush();
       CleanUpDIB();
+
+      if (mTimer) {
+        mTimer->SetDelay(GFX_MS_REMOVE_DBB);
+      } else {
+        mTimer = do_CreateInstance("@mozilla.org/timer;1");
+        if (mTimer)
+          mTimer->InitWithFuncCallback(nsImageWin::TimerCallBack, this,
+                                       GFX_MS_REMOVE_DBB,
+                                       nsITimer::TYPE_ONE_SHOT);
+      }
+    }
     ::SelectObject(TheHDC,oldbits);
     ::DeleteObject(tBitmap);
     ::DeleteDC(TheHDC);
@@ -1493,6 +1540,22 @@
   return NS_OK;
 }
 
+// Removes the DBB, restoring the imagebits if necessary
+NS_IMETHODIMP nsImageWin::RemoveDDB()
+{
+  if (!mIsOptimized && mHBitmap == nsnull)
+    return NS_OK;
+
+  if (!mImageBits) {
+    nsresult rv = ConvertDDBtoDIB();
+    if (NS_FAILED(rv))
+      return rv;
+  }
+
+  CleanUpDDB();
+  return NS_OK;
+}
+
 
 /** ----------------------------------------------------------------
  * Calculate the number of bytes in a span for this image
@@ -1539,13 +1602,6 @@
     delete mColorMap;
     mColorMap = nsnull;
   }
-
-
-  //mNumPaletteColors = -1;
-  //mNumBytesPixel = 0;
-  mSizeImage = 0;
-
-
 }
 
 /** ---------------------------------------------------
@@ -1556,6 +1612,11 @@
 nsImageWin :: CleanUpDDB()
 {
   if (mHBitmap != nsnull) {
+    if (mTimer) {
+      mTimer->Cancel();
+      mTimer = nsnull;
+    }
+
     ::DeleteObject(mHBitmap);
     mHBitmap = nsnull;
   }
@@ -1610,112 +1671,49 @@
 
 
 /** ----------------------------------------------------------------
- * See documentation in nsIImage.h
- * @update - dwc 5/20/99
+ * recreate a device independent image from a device dependent image (DDB)
+ * Does not remove the DDB
+ *
  * @return the result of the operation, if NS_OK a DIB was created.
  */
-nsresult 
-nsImageWin::ConvertDDBtoDIB()
+nsresult nsImageWin::ConvertDDBtoDIB()
 {
-  PRInt32             numbytes,tWidth,tHeight;
-  BITMAP              srcinfo;
-  HBITMAP             oldbits;
   HDC                 memPrDC;
-  UINT                palType;
-
-
-  if (mIsOptimized == PR_TRUE) {
-
-    if (mHBitmap != nsnull){
-      memPrDC = ::CreateDC("DISPLAY",NULL,NULL,NULL);
-      oldbits = (HBITMAP)::SelectObject(memPrDC,mHBitmap);
-
-      numbytes = ::GetObject(mHBitmap,sizeof(BITMAP),&srcinfo);
-      
-      tWidth = mBHead->biWidth;
-      tHeight = mBHead->biHeight;
 
-      if (nsnull != mBHead){
-        delete[] mBHead;
-      }
-      BuildDIB(&mBHead,tWidth,tHeight,srcinfo.bmBitsPixel,&mNumBytesPixel);
-      mRowBytes = CalcBytesSpan(mBHead->biWidth);
-      mSizeImage = mRowBytes * mBHead->biHeight; // no compression
-
-
-      // Allocate the image bits
-      mImageBits = new unsigned char[mSizeImage];
+  if (mImageBits)
+    return NS_OK;
 
+  if (!mInitialized || mHBitmap == nsnull)
+    return NS_ERROR_FAILURE;
 
-      if (mBHead->biBitCount == 8) {
-        palType = DIB_PAL_COLORS;
-      } else {
-        palType = DIB_RGB_COLORS;
-      }
+  memPrDC = ::CreateDC("DISPLAY", NULL, NULL, NULL);
+  if (!memPrDC)
+    return NS_ERROR_FAILURE;
 
-      numbytes = ::GetDIBits(memPrDC, mHBitmap, 0, srcinfo.bmHeight, mImageBits,
-                             (LPBITMAPINFO)mBHead, palType);
-      ::SelectObject(memPrDC,oldbits);
-      DeleteDC(memPrDC);
-    }
+  // Allocate the image bits
+  mImageBits = new unsigned char[mSizeImage];
+  if (!mImageBits) {
+    ::DeleteDC(memPrDC);
+    return NS_ERROR_OUT_OF_MEMORY;
   }
 
-  return NS_OK;
-}
-
-
-/** ----------------------------------------------------------------
- * Build A DIB header and allocate memory 
- * @update dc - 11/20/98
- * @return void
- */
-nsresult
-BuildDIB(LPBITMAPINFOHEADER  *aBHead,PRInt32 aWidth,PRInt32 aHeight,PRInt32 aDepth,PRInt8 *aNumBytesPix)
-{
-  PRInt16 numPaletteColors;
+  PRInt32 retVal = 
+    ::GetDIBits(memPrDC, mHBitmap, 0, mBHead->biHeight,
+                mImageBits, (LPBITMAPINFO)mBHead,
+                256 == mNumPaletteColors ? DIB_PAL_COLORS : DIB_RGB_COLORS);
 
+  ::GdiFlush();
+  ::DeleteDC(memPrDC);
 
-  if (8 == aDepth) {
-    numPaletteColors = 256;
-    *aNumBytesPix = 1;
-  } else if (16 == aDepth) {
-    numPaletteColors = 0;
-    *aNumBytesPix = 2; 
-  } else if (24 == aDepth) {
-    numPaletteColors = 0;
-    *aNumBytesPix = 3;
-  } else if (32 == aDepth) {
-    numPaletteColors = 0;  
-    *aNumBytesPix = 4;
-  } else {
-    NS_ASSERTION(PR_FALSE, "unexpected image depth");
-    return NS_ERROR_UNEXPECTED;
-  }
-
-
-  if (0 == numPaletteColors) {
-    // space for the header only (no color table)
-    (*aBHead) = (LPBITMAPINFOHEADER)new char[sizeof(BITMAPINFO)];
-  } else {
-    // Space for the header and the palette. Since we'll be using DIB_PAL_COLORS
-    // the color table is an array of 16-bit unsigned integers that specify an
-    // index into the currently realized logical palette
-    (*aBHead) = (LPBITMAPINFOHEADER)new char[sizeof(BITMAPINFOHEADER) + (256 * sizeof(WORD))];
+  if (retVal == 0) {
+    delete [] mImageBits;
+    mImageBits = nsnull;
+    return NS_ERROR_FAILURE;
   }
 
-
-  (*aBHead)->biSize = sizeof(BITMAPINFOHEADER);
-  (*aBHead)->biWidth = aWidth;
-  (*aBHead)->biHeight = aHeight;
-  (*aBHead)->biPlanes = 1;
-  (*aBHead)->biBitCount = (WORD)aDepth;
-  (*aBHead)->biCompression = BI_RGB;
-  (*aBHead)->biSizeImage = 0;            // not compressed, so we dont need this to be set
-  (*aBHead)->biXPelsPerMeter = 0;
-  (*aBHead)->biYPelsPerMeter = 0;
-  (*aBHead)->biClrUsed = numPaletteColors;
-  (*aBHead)->biClrImportant = numPaletteColors;
-
+  // If we converted a 8 bit alpha back to bits, those bits are pre-multiplied
+  if (mAlphaDepth == 8)
+    mImagePreMultiplied = PR_TRUE;
 
   return NS_OK;
 }
@@ -2034,6 +2032,8 @@
                         256 == aNumPaletteColors ? DIB_PAL_COLORS : DIB_RGB_COLORS,
                         SRCPAINT);
 
+        ::GdiFlush();
+
         // output the composed image
         ::StretchDIBits(aTheHDC, aDX, aDY, aDWidth, aDHeight,
                         aSX, aSrcy, aSWidth, aSHeight,
@@ -2048,3 +2048,20 @@
     ::DeleteDC(memDC);
   }
 }
+
+void nsImageWin::TimerCallBack(nsITimer *aTimer, void *aClosure)
+{
+  nsImageWin *entry = NS_STATIC_CAST(nsImageWin*, aClosure);
+  if (!entry)
+    return;
+
+  if (NS_FAILED(entry->RemoveDDB())) {
+    // Try again later.  Can't SetDelay while timer is being called, so
+    // create a new timer instead
+    entry->mTimer = do_CreateInstance("@mozilla.org/timer;1");
+    if (entry->mTimer)
+      entry->mTimer->InitWithFuncCallback(nsImageWin::TimerCallBack, entry,
+                                          GFX_MS_REMOVE_DBB,
+                                          nsITimer::TYPE_ONE_SHOT);
+  }
+}
--- mozilla-firefox-1.0.4.orig/gfx/src/windows/nsImageWin.h
+++ mozilla-firefox-1.0.4/gfx/src/windows/nsImageWin.h
@@ -41,6 +41,11 @@
 
 #include <windows.h>
 #include "nsIImage.h"
+#include "nsCOMPtr.h"
+#include "nsITimer.h"
+
+// Remove DDB after 60s of non-use
+#define GFX_MS_REMOVE_DBB          60000
 
 /* for compatibility with VC++ 5 */
 #if !defined(AC_SRC_OVER)
@@ -69,6 +74,11 @@
   int nHeightSrc,
   BLENDFUNCTION blendFunction);
 
+/* For gOsMajorVersion */
+#define VER_OSMAJOR_WINNT31        3
+#define VER_OSMAJOR_WIN9598MENT    4
+#define VER_OSMAJOR_WIN2KXP        5
+
 class nsImageWin : public nsIImage{
 public:
   nsImageWin();
@@ -149,6 +159,14 @@
   // VER_PLATFORM_WIN32_WINDOWS == Win 95/98/ME
   // VER_PLATFORM_WIN32_NT == Win NT/2K/XP/.NET Server
   static PRInt32 gPlatform;
+  static PRInt32 gOsMajorVersion;
+
+  /** Create a DDB out of the imagebits, and destroy the imagebits
+   */
+  NS_IMETHOD CreateDDB();
+  /** Removes the DBB, restoring the imagebits if necessary
+   */
+  NS_IMETHOD RemoveDDB();
 
 private:
   /** 
@@ -165,13 +183,6 @@
 
   void CreateImageWithAlphaBits(HDC TheHDC);
 
-  /** 
-   * Create a Device Dependent bitmap from a drawing surface
-   * @update dc - 10/29/98
-   * @param aSurface - The drawingsurface to create the DDB from.
-   */
-  void CreateDDB(nsDrawingSurface aSurface);
-
   void DrawComposited24(unsigned char *aBits,
                         PRUint8 *aImageRGB, PRUint32 aStrideRGB,
                         PRUint8 *aImageAlpha, PRUint32 aStrideAlpha,
@@ -182,9 +193,8 @@
   static PRBool CanAlphaBlend(void);
 
   /** 
-   * Create a Device Dependent bitmap from a drawing surface
-   * @update dc - 05/20/99
-   * @param aSurface - The drawingsurface to create the DIB from.
+   * Recreate a device independent image from a device dependent image (DDB)
+   * Does not remove the DDB
    */
   nsresult ConvertDDBtoDIB();
 
@@ -253,9 +263,11 @@
   PRUint8 PaletteMatch(PRUint8 r, PRUint8 g, PRUint8 b);
 
   PRPackedBool        mInitialized;
+  PRPackedBool        mWantsOptimization;
   PRPackedBool        mIsOptimized;       // Did we convert our DIB to a HBITMAP
   PRPackedBool        mIsLocked;          // variable to keep track of the locking
   PRPackedBool        mDIBTemp;           // boolean to let us know if DIB was created as temp
+  PRPackedBool        mImagePreMultiplied;// Are the image bits pre-multiplied with alpha?
   PRInt8              mNumBytesPixel;     // number of bytes per pixel
   PRInt16             mNumPaletteColors;  // Number of colors in the pallete 256 
   PRInt32             mSizeImage;         // number of bytes
@@ -278,6 +290,8 @@
 
   static ALPHABLENDPROC gAlphaBlend;      // AlphaBlend function pointer
 
+  nsCOMPtr<nsITimer>  mTimer;             // Timer for releasing DDB
+  static void TimerCallBack(nsITimer *aTimer, void *aClosure);
 };
 
 #endif
--- mozilla-firefox-1.0.4.orig/htmlparser/src/nsParser.cpp
+++ mozilla-firefox-1.0.4/htmlparser/src/nsParser.cpp
@@ -2565,21 +2565,7 @@
   nsresult rv = NS_OK;
   
   if(eOnStart==mParserContext->mStreamListenerState) {
-    nsAutoString temp;
-
-    //If you're here, then OnDataAvailable() never got called. 
-    //Prior to necko, we never dealt with this case, but the problem may have existed.
-    //What we'll do (for now at least) is construct a blank HTML document.
-    if (!mParserContext->mMimeType.Equals(NS_LITERAL_CSTRING(kPlainTextContentType)))
-    {
-      temp.Assign(NS_LITERAL_STRING("<html><body></body></html>"));
-    }
-    // XXX: until bug #108067 has been fixed we must ensure that *something*
-    //      is in the scanner!  so, for now just put in a single space.
-    else {
-      temp.Assign(NS_LITERAL_STRING(" "));
-    }
-    mParserContext->mScanner->Append(temp);
+    //Everybody can live with an empty input stream, so just resume parsing.
     rv = ResumeParse(PR_TRUE,PR_TRUE);    
   }
 
--- mozilla-firefox-1.0.4.orig/htmlparser/tests/html/24184.html
+++ mozilla-firefox-1.0.4/htmlparser/tests/html/24184.html
@@ -1,4 +1,4 @@
-<HTML><HEAD>
+<HTML><HEAD>
 <style type="text/css">
 
 span:before { content: "<" attr(class) ">" }
@@ -35,4 +35,4 @@
 <P><SPAN CLASS="a">[span class a]</SPAN></P> 
 
 </font></body></html>
-
+
--- mozilla-firefox-1.0.4.orig/htmlparser/tests/html/40809_CR.html
+++ mozilla-firefox-1.0.4/htmlparser/tests/html/40809_CR.html
@@ -1 +1,259 @@
-<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>Rob Kaper's Capsi | Beyond Paradise</title>
<meta name="author" content="Rob Kaper">
<meta name="copyright" content="&copy; Copyright 1995-2000 Rob Kaper.">
<meta name="capsi_layout" content="HTML4/CSS2 incompatible: Netscape, Explorer (Mozilla/4.72 (Macintosh; U; PPC))">
<meta name="keywords" content="capsi,rob,kaper,cap,pepsi,capricorn,rjkap,beyond,paradise,home,page,homepage,home-page,web,site,website,web-site,personal,code,chat,fun,entertainment">
<meta name="description" content="Rob Kaper's Capsi: a splarkling website including personal items (a bio, poetry and a resume), fun stuff (a postcard server, the Capsi chat) and serious stuff (Linux code).">
<style type="text/css">
<!--
a
{
	text-decoration: none
}
a:hover
{
	text-decoration: underline
} 
h4
{
	font-family: Verdana, Helvetica, Arial, sans-serif;
	font-size: 12pt;
	font-style: normal;
	font-weight: bold;
	list-style-type: square;
	list-style-image: none
}
b
{
	font-weight: bold
}
td
{ 
	font-family: Verdana, Helvetica, Arial, sans-serif;
	font-size: 10pt;
	font-style: normal;
	font-weight: normal;
	list-style-type: square;
	list-style-image: none
}
small
{ 
	font-family: Helvetica, Arial, sans-serif;
	font-size: 10pt;
	font-style: normal;
	font-weight: normal;
	list-style-type: square;
	list-style-image: none
}
pre
{
	font-family: Verdana, Fixed, Courier, sans-serif;
	font-size: 10pt;
	font-style: normal;
	font-weight: normal;
	list-style-type: square;
	list-style-image: none
}
tt
{
	font-family: Fixed, Courier, monospace;
	font-size: 12pt;
	font-style: normal;
	font-weight: normal;
	list-style-type: square;
	list-style-image: none
}
#title
{
	position: absolute;
	
	width: auto;
	height: 20px;
	left: 170px;
	right: 10px;
	top: 87px;
	bottom: auto;

	border: solid 1px #ffffff;
	background-color: #e1e0ff;
	background-image: url("/img/bg-layer.jpg");
	font-family: Verdana, Helvetica, Arial, sans-serif;
	font-weight: bold;
	font-size: 12pt;
}
#header
{
	position: absolute;
	
	width: auto;
	height: 68px;
	left: 170px;
	right: 10px;
	top: 10px;
	bottom: auto;

	text-align: center;
	margin-top: auto;
	border: solid 1px white;
	background-color: #e1e0ff;
	background-image: url("/img/bg-layer.jpg");
	font-family: Helvetica, Arial, sans-serif;
	font-size: 10pt;
	padding: 2px;
}
#footer
{
	position: fixed;

	width: auto;
	height: 15px;
	left: 10px;
	right: 10px;
	top: auto;
	bottom: 0;

	text-align: right;
	margin-top: auto;
	background-color: #e1e0ff;
	background-image: url("/img/bg-blue.jpg");
	font-family: Helvetica, Arial, sans-serif;
	font-size: 10pt;
	padding: 0px;
}
#ad
{
	position: absolute;
	
	width: auto;
	height: 60px;
	left: 170px;
	right: 10px;
	top: auto;
	bottom: 15px;

	text-align: center;
	margin-top: auto;
	border: solid 1px white;
	background-color: #e1e0ff;
	background-image: url("/img/bg-layer.jpg");
	font-family: Helvetica, Arial, sans-serif;
	font-size: 10pt;
}
#sidebar
{
	position: fixed;

	width: 150px;
	height: auto;
	left: 10px;
	right: 160px;
	top: 10px;
	bottom: 15px;

	background-color: #e1e0ff;
	background-image: url("/img/bg-horizontal.jpg");
	border: solid 1px white;

	font-family: Verdana, Helvetica, Arial, sans-serif;
	font-size: 10pt;
}
#main
{
	position: absolute;
	
	width: auto;
	height: auto;

	left: 170px;
	right: 10px;
	top: 112px;
	bottom: 80px;

	background-color: #ffffff;

	border: solid 1px #ccccff;

	font-family: Verdana, Helvetica, Arial, sans-serif;
	font-size: 10pt;

	list-style-image: url("/img/box-tiny.jpg");

	padding: 5px;
}
-->
</style>
</head>
<body bgcolor="#ffffff" background="/img/bg-blue.jpg" text="#000000" link="#0000aa" alink="#000000" vlink="#3333ff">
<div id="header">
<a href="/personal.html"><img src="/img/menu/personal.jpg" width=69 height=68 alt="[Personal]" border=0></a>
<a href="/code.html"><img src="/img/menu/code.jpg" width=69 height=68 alt="[Code]" border=0></a>
<a href="/chat.html"><img src="/img/menu/chat.jpg" width=69 height=68 alt="[Chat]" border=0></a>
<a href="/starcrush.html"><img src="/img/menu/starcrush.jpg" width=145 height=68 alt="[Starcrush]" border=0></a>
</div>
<div id="title">&nbsp; <a href="./">Capsi</a> | Beyond Paradise &nbsp;</div>
<div id="sidebar" style="position: absolute">
<a href="./"><img src="/img/capsi-blue.jpg" width=150 height=60 alt="[Capsi]" border=0></a>
<center><small>
<a href="/">Home</a>
<br><a href="/faq.html">FAQ</a>
+ <a href="/gbook-read.html">Guestbook</a>
+ <a href="/mail.html">Mail</a>
<br><a href="/postcards.html">Postcards</a>
+ <a href="/vortex.html">Vortex</a>
<br><a href="/user-login.html?r=/index.html">Login</a>
</small>
<p><b>Sections</b>
<br><a href="/personal.html">Personal</a>
<br><a href="/code.html">Code</a>
<br><a href="/chat.html">CapsiChat</a>
<br><a href="/starcrush.html">Starcrush</a>
</center>
</div>
<div id="main">
Welcome to Capsi! This website is divided into the following sections:
<br><br>
<center><table border=0 cellpadding=1 cellspacing=0 bgcolor="#ccccff"><tr><td>
<table border=0 cellpadding=1 cellspacing=0 bgcolor="#ffffff"><tr><td>
<table border=0 cellpadding=2 cellspacing=1 bgcolor="#e1e0ff"><tr>
<td><b>Section</b></td>
<td><b>Description</b></td>
</tr><tr>
<td><img src="img/box-tiny.jpg" width=12 height=12 alt=""> <a href="personal.html">Personal</a></td>
<td><small>Aptly named because it's all about me</small></td>
</tr><tr>
<td><img src="img/box-tiny.jpg" width=12 height=12 alt=""> <a href="code.html">Code</a></td>
<td><small>Various programs and utilities I have written</small></td>
</tr><tr>
<td><img src="img/box-tiny.jpg" width=12 height=12 alt=""> <a href="chat.html">CapsiChat</a></td>
<td><small>My haven, or chat-box</small></td>
</tr><tr>
<td><img src="img/box-tiny.jpg" width=12 height=12 alt=""> <a href="starcrush.html">Starcrush</a></td>
<td><small>Chicks and babes, lads and dudes.</small></td>
</tr>
</table>
</td></tr></table>
</td></tr></table></center>
<br><br>
<center><table border=0 cellpadding=1 cellspacing=0 bgcolor="#ccccff"><tr><td>
<table border=0 cellpadding=1 cellspacing=0 bgcolor="#ffffff"><tr><td>
<table border=0 cellpadding=2 cellspacing=1 bgcolor="#e1e0ff"><tr>
<td valign=top><small>2000.05.19</small></td>
<td>
<b>Mission Back to Dot-Com</b>
<p>
I have made up my mind: I will drop the capsi.cx domain! Everything will
move back to capsi.com and the Capsi services in Maryland will be hosted
under the usa.capsi.com subdomain. Until the capsi.cx domain expires in
February 2001 all requests will be forwarded to the proper capsi.com
locations. I expect to make the big move in June or July.
</td>
</table>
</td></tr></table>
</td></tr></table></center>
<p><hr><center><a target="_top" href="http://ads.capsi.cx/redirect?host=hs0002586&amp;b=98&amp;v=0"><small>Please visit Capsi's sponsor</small><br><img src="http://ads.capsi.cx/cycle?host=hs0002586&amp;b=98&amp;noscript=1" width=468 height=60 alt="[Please visit Capsi's sponsor]" border=0></a></center>
</div>
</body>
</html>
\ No newline at end of file
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<html lang="en">
+<head>
+<title>Rob Kaper's Capsi | Beyond Paradise</title>
+<meta name="author" content="Rob Kaper">
+<meta name="copyright" content="&copy; Copyright 1995-2000 Rob Kaper.">
+<meta name="capsi_layout" content="HTML4/CSS2 incompatible: Netscape, Explorer (Mozilla/4.72 (Macintosh; U; PPC))">
+<meta name="keywords" content="capsi,rob,kaper,cap,pepsi,capricorn,rjkap,beyond,paradise,home,page,homepage,home-page,web,site,website,web-site,personal,code,chat,fun,entertainment">
+<meta name="description" content="Rob Kaper's Capsi: a splarkling website including personal items (a bio, poetry and a resume), fun stuff (a postcard server, the Capsi chat) and serious stuff (Linux code).">
+<style type="text/css">
+<!--
+a
+{
+	text-decoration: none
+}
+a:hover
+{
+	text-decoration: underline
+} 
+h4
+{
+	font-family: Verdana, Helvetica, Arial, sans-serif;
+	font-size: 12pt;
+	font-style: normal;
+	font-weight: bold;
+	list-style-type: square;
+	list-style-image: none
+}
+b
+{
+	font-weight: bold
+}
+td
+{ 
+	font-family: Verdana, Helvetica, Arial, sans-serif;
+	font-size: 10pt;
+	font-style: normal;
+	font-weight: normal;
+	list-style-type: square;
+	list-style-image: none
+}
+small
+{ 
+	font-family: Helvetica, Arial, sans-serif;
+	font-size: 10pt;
+	font-style: normal;
+	font-weight: normal;
+	list-style-type: square;
+	list-style-image: none
+}
+pre
+{
+	font-family: Verdana, Fixed, Courier, sans-serif;
+	font-size: 10pt;
+	font-style: normal;
+	font-weight: normal;
+	list-style-type: square;
+	list-style-image: none
+}
+tt
+{
+	font-family: Fixed, Courier, monospace;
+	font-size: 12pt;
+	font-style: normal;
+	font-weight: normal;
+	list-style-type: square;
+	list-style-image: none
+}
+#title
+{
+	position: absolute;
+	
+	width: auto;
+	height: 20px;
+	left: 170px;
+	right: 10px;
+	top: 87px;
+	bottom: auto;
+
+	border: solid 1px #ffffff;
+	background-color: #e1e0ff;
+	background-image: url("/img/bg-layer.jpg");
+	font-family: Verdana, Helvetica, Arial, sans-serif;
+	font-weight: bold;
+	font-size: 12pt;
+}
+#header
+{
+	position: absolute;
+	
+	width: auto;
+	height: 68px;
+	left: 170px;
+	right: 10px;
+	top: 10px;
+	bottom: auto;
+
+	text-align: center;
+	margin-top: auto;
+	border: solid 1px white;
+	background-color: #e1e0ff;
+	background-image: url("/img/bg-layer.jpg");
+	font-family: Helvetica, Arial, sans-serif;
+	font-size: 10pt;
+	padding: 2px;
+}
+#footer
+{
+	position: fixed;
+
+	width: auto;
+	height: 15px;
+	left: 10px;
+	right: 10px;
+	top: auto;
+	bottom: 0;
+
+	text-align: right;
+	margin-top: auto;
+	background-color: #e1e0ff;
+	background-image: url("/img/bg-blue.jpg");
+	font-family: Helvetica, Arial, sans-serif;
+	font-size: 10pt;
+	padding: 0px;
+}
+#ad
+{
+	position: absolute;
+	
+	width: auto;
+	height: 60px;
+	left: 170px;
+	right: 10px;
+	top: auto;
+	bottom: 15px;
+
+	text-align: center;
+	margin-top: auto;
+	border: solid 1px white;
+	background-color: #e1e0ff;
+	background-image: url("/img/bg-layer.jpg");
+	font-family: Helvetica, Arial, sans-serif;
+	font-size: 10pt;
+}
+#sidebar
+{
+	position: fixed;
+
+	width: 150px;
+	height: auto;
+	left: 10px;
+	right: 160px;
+	top: 10px;
+	bottom: 15px;
+
+	background-color: #e1e0ff;
+	background-image: url("/img/bg-horizontal.jpg");
+	border: solid 1px white;
+
+	font-family: Verdana, Helvetica, Arial, sans-serif;
+	font-size: 10pt;
+}
+#main
+{
+	position: absolute;
+	
+	width: auto;
+	height: auto;
+
+	left: 170px;
+	right: 10px;
+	top: 112px;
+	bottom: 80px;
+
+	background-color: #ffffff;
+
+	border: solid 1px #ccccff;
+
+	font-family: Verdana, Helvetica, Arial, sans-serif;
+	font-size: 10pt;
+
+	list-style-image: url("/img/box-tiny.jpg");
+
+	padding: 5px;
+}
+-->
+</style>
+</head>
+<body bgcolor="#ffffff" background="/img/bg-blue.jpg" text="#000000" link="#0000aa" alink="#000000" vlink="#3333ff">
+<div id="header">
+<a href="/personal.html"><img src="/img/menu/personal.jpg" width=69 height=68 alt="[Personal]" border=0></a>
+<a href="/code.html"><img src="/img/menu/code.jpg" width=69 height=68 alt="[Code]" border=0></a>
+<a href="/chat.html"><img src="/img/menu/chat.jpg" width=69 height=68 alt="[Chat]" border=0></a>
+<a href="/starcrush.html"><img src="/img/menu/starcrush.jpg" width=145 height=68 alt="[Starcrush]" border=0></a>
+</div>
+<div id="title">&nbsp; <a href="./">Capsi</a> | Beyond Paradise &nbsp;</div>
+<div id="sidebar" style="position: absolute">
+<a href="./"><img src="/img/capsi-blue.jpg" width=150 height=60 alt="[Capsi]" border=0></a>
+<center><small>
+<a href="/">Home</a>
+<br><a href="/faq.html">FAQ</a>
++ <a href="/gbook-read.html">Guestbook</a>
++ <a href="/mail.html">Mail</a>
+<br><a href="/postcards.html">Postcards</a>
++ <a href="/vortex.html">Vortex</a>
+<br><a href="/user-login.html?r=/index.html">Login</a>
+</small>
+<p><b>Sections</b>
+<br><a href="/personal.html">Personal</a>
+<br><a href="/code.html">Code</a>
+<br><a href="/chat.html">CapsiChat</a>
+<br><a href="/starcrush.html">Starcrush</a>
+</center>
+</div>
+<div id="main">
+Welcome to Capsi! This website is divided into the following sections:
+<br><br>
+<center><table border=0 cellpadding=1 cellspacing=0 bgcolor="#ccccff"><tr><td>
+<table border=0 cellpadding=1 cellspacing=0 bgcolor="#ffffff"><tr><td>
+<table border=0 cellpadding=2 cellspacing=1 bgcolor="#e1e0ff"><tr>
+<td><b>Section</b></td>
+<td><b>Description</b></td>
+</tr><tr>
+<td><img src="img/box-tiny.jpg" width=12 height=12 alt=""> <a href="personal.html">Personal</a></td>
+<td><small>Aptly named because it's all about me</small></td>
+</tr><tr>
+<td><img src="img/box-tiny.jpg" width=12 height=12 alt=""> <a href="code.html">Code</a></td>
+<td><small>Various programs and utilities I have written</small></td>
+</tr><tr>
+<td><img src="img/box-tiny.jpg" width=12 height=12 alt=""> <a href="chat.html">CapsiChat</a></td>
+<td><small>My haven, or chat-box</small></td>
+</tr><tr>
+<td><img src="img/box-tiny.jpg" width=12 height=12 alt=""> <a href="starcrush.html">Starcrush</a></td>
+<td><small>Chicks and babes, lads and dudes.</small></td>
+</tr>
+</table>
+</td></tr></table>
+</td></tr></table></center>
+<br><br>
+<center><table border=0 cellpadding=1 cellspacing=0 bgcolor="#ccccff"><tr><td>
+<table border=0 cellpadding=1 cellspacing=0 bgcolor="#ffffff"><tr><td>
+<table border=0 cellpadding=2 cellspacing=1 bgcolor="#e1e0ff"><tr>
+<td valign=top><small>2000.05.19</small></td>
+<td>
+<b>Mission Back to Dot-Com</b>
+<p>
+I have made up my mind: I will drop the capsi.cx domain! Everything will
+move back to capsi.com and the Capsi services in Maryland will be hosted
+under the usa.capsi.com subdomain. Until the capsi.cx domain expires in
+February 2001 all requests will be forwarded to the proper capsi.com
+locations. I expect to make the big move in June or July.
+</td>
+</table>
+</td></tr></table>
+</td></tr></table></center>
+<p><hr><center><a target="_top" href="http://ads.capsi.cx/redirect?host=hs0002586&amp;b=98&amp;v=0"><small>Please visit Capsi's sponsor</small><br><img src="http://ads.capsi.cx/cycle?host=hs0002586&amp;b=98&amp;noscript=1" width=468 height=60 alt="[Please visit Capsi's sponsor]" border=0></a></center>
+</div>
+</body>
+</html>
--- mozilla-firefox-1.0.4.orig/htmlparser/tests/html/48351.html
+++ mozilla-firefox-1.0.4/htmlparser/tests/html/48351.html
@@ -1,8 +1,8 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><title>Mozilla Tests: An XHTML Document</title>
     
-    <style type="text/css">
-       .xhtml { display: none; }
-       strong { color: red; }
+    <style type="text/css">
+       .xhtml { display: none; }
+       strong { color: red; }
     </style></head>
 
   <body>
--- mozilla-firefox-1.0.4.orig/htmlparser/tests/html/51161.html
+++ mozilla-firefox-1.0.4/htmlparser/tests/html/51161.html
@@ -1,6 +1,6 @@
 <html><head>
-<style>
-p { font-size: 24px}
+<style>
+p { font-size: 24px}
 </style></head>
 <body>
   <p>text text text text</p>
--- mozilla-firefox-1.0.4.orig/htmlparser/tests/html/6148.html
+++ mozilla-firefox-1.0.4/htmlparser/tests/html/6148.html
@@ -1,29 +1,29 @@
-<html>
-<head>
-<title>Bug</title>
-</head>
-<body>
-
-BUG:<BR>
-
-<SPAN style="color:blue">&lt;SPAN>
-<DIV style="color:red">&lt;DIV>
-<SPAN style="color:green">&lt;SPAN>
-&lt;/SPAN></SPAN>
-&lt;/DIV></DIV>
-&lt;/SPAN></SPAN>
-
-<HR>
-
-NO BUG:<BR>
-
-<SPAN style="color:blue">&lt;SPAN>
-<DIV style="color:red">&lt;DIV>
-<B style="color:green">&lt;B>
-&lt;/B></B>
-&lt;/DIV></DIV>
-&lt;/SPAN></SPAN>
-
-
-</body>
-</html>
+<html>
+<head>
+<title>Bug</title>
+</head>
+<body>
+
+BUG:<BR>
+
+<SPAN style="color:blue">&lt;SPAN>
+<DIV style="color:red">&lt;DIV>
+<SPAN style="color:green">&lt;SPAN>
+&lt;/SPAN></SPAN>
+&lt;/DIV></DIV>
+&lt;/SPAN></SPAN>
+
+<HR>
+
+NO BUG:<BR>
+
+<SPAN style="color:blue">&lt;SPAN>
+<DIV style="color:red">&lt;DIV>
+<B style="color:green">&lt;B>
+&lt;/B></B>
+&lt;/DIV></DIV>
+&lt;/SPAN></SPAN>
+
+
+</body>
+</html>
--- mozilla-firefox-1.0.4.orig/htmlparser/tests/html/endswithcr.html
+++ mozilla-firefox-1.0.4/htmlparser/tests/html/endswithcr.html
@@ -1 +1 @@
-This file ends with a CR
\ No newline at end of file
+This file ends with a CR
--- mozilla-firefox-1.0.4.orig/htmlparser/tests/html/newlines.html
+++ mozilla-firefox-1.0.4/htmlparser/tests/html/newlines.html
@@ -1,3 +1,4 @@
 #1: This is a line of input terminated by a \n
 #2: This is another line of input terminated by a \r\n
-#3: This is a line of input terminated by a \r
#4: This is the last line
+#3: This is a line of input terminated by a \r
+#4: This is the last line
--- mozilla-firefox-1.0.4.orig/layout/build/layout.pkg
+++ mozilla-firefox-1.0.4/layout/build/layout.pkg
@@ -40,8 +40,6 @@
 dist/bin/res/ua.css
 dist/bin/res/broken-image.gif
 dist/bin/res/loading-image.gif
-dist/bin/res/builtin/htmlBindings.xml
-dist/bin/res/builtin/platformHTMLBindings.xml
 dist/bin/res/html/gopher-audio.gif
 dist/bin/res/html/gopher-binary.gif
 dist/bin/res/html/gopher-find.gif
--- mozilla-firefox-1.0.4.orig/layout/doc/regression_tests.html
+++ mozilla-firefox-1.0.4/layout/doc/regression_tests.html
@@ -35,30 +35,30 @@
    -
    - ***** END LICENSE BLOCK ***** -->
 
-<html>
-<head>
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<html>
+<head>
+   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
      <title>Layout Regression tests</title>
 <style type="text/css">
   body {font-family:arial}
 .screen {background-color:silver; color:blue}
 pre.screen {display:table-cell}
  </style>
-
-</head>
-<body>
-
+
+</head>
+<body>
+
 <h1>Table Regression Tests</h1>
 <h6>Bernd Mielke</h6>
-<h2>About This Document</h2>
+<h2>About This Document</h2>
 <p>
-This document describes my guerilla approach to successfully  running the table layout regression tests. It should encourage more people to run those tests.
-
-<h2>Subject Overview</h2>
+This document describes my guerilla approach to successfully  running the table layout regression tests. It should encourage more people to run those tests.
+
+<h2>Subject Overview</h2>
 <p>
 The table element and its children are one of the major layout components that can create some structure on the screen. They are widely (ab)used  by page authors. Every small change in the table code can generate a bunch of bugzilla entries and a lot of seemingly unrelated dupes. With the high frequency of checkins in to the source tree  it is difficult and time consuming to track the regression down to a single checkin. The risk of becoming very infamous can be reduced by running the layout regression tests.
 
-<h2>Prerequisites</h2>
+<h2>Prerequisites</h2>
 <p>
 In order to run these tests, you will need to have:
 <ol>
@@ -68,7 +68,7 @@
 <li>patience and time.
 </ol>
 
-<h2>Test Runs</h2>
+<h2>Test Runs</h2>
 
 <ul>
 <li>Go to the <code>%MOZ_SRC%/layout/html/tests/block</code>  directory.
@@ -225,8 +225,8 @@
 <p>
 The first regression test has failed and it is marked so. 
 
-
-<h2>Adding new regression tests</h2>
+
+<h2>Adding new regression tests</h2>
 <p>
 Once you have checked in the code:
 <ul>
@@ -237,8 +237,8 @@
 <li>Update the <code>file_list<b>x</b>.txt</code> in order to include your file.
 </ul>
 <p>I would like to thank Chris Karnaze for his guidance and fantasai for his language support.
-<div style="text-align:right"><i>&lt;regression.html&gt;&nbsp; &lt;Last updated:
-2002-06-16 <a href="mailto:bernd.mielke@snafu.de">Bernd Mielke</a></i></div>
-
-</body>
-</html>
+<div style="text-align:right"><i>&lt;regression.html&gt;&nbsp; &lt;Last updated:
+2002-06-16 <a href="mailto:bernd.mielke@snafu.de">Bernd Mielke</a></i></div>
+
+</body>
+</html>
--- mozilla-firefox-1.0.4.orig/layout/html/base/src/nsGfxScrollFrame.cpp
+++ mozilla-firefox-1.0.4/layout/html/base/src/nsGfxScrollFrame.cpp
@@ -1087,7 +1087,7 @@
           // Fire the onScroll event now that we have scrolled
           nsIPresShell *presShell = mOuter->mPresContext->GetPresShell();
           if (presShell) {
-            nsScrollbarEvent event(NS_SCROLL_EVENT);
+            nsScrollbarEvent event(PR_TRUE, NS_SCROLL_EVENT, nsnull);
             nsEventStatus status = nsEventStatus_eIgnore;
             // note if hcontent is non-null then hframe must be non-null.
             // likewise for vcontent and vframe. Thus targetFrame will always
--- mozilla-firefox-1.0.4.orig/layout/html/base/src/nsObjectFrame.cpp
+++ mozilla-firefox-1.0.4/layout/html/base/src/nsObjectFrame.cpp
@@ -644,6 +644,8 @@
       rv = event->InitEvent(NS_LITERAL_STRING("PluginNotFound"), PR_TRUE,
                             PR_TRUE);
       if (NS_SUCCEEDED(rv)) {
+        nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));
+        privateEvent->SetTrusted(PR_TRUE);
         PRBool unused;
         target->DispatchEvent(event, &unused);
       }
@@ -3546,7 +3548,9 @@
     nsEvent * theEvent;
     privateEvent->GetInternalNSEvent(&theEvent);
     if (theEvent) {
-      nsGUIEvent focusEvent(theEvent->message); // we only care about the message in ProcessEvent
+      // we only care about the message in ProcessEvent
+      nsGUIEvent focusEvent(NS_IS_TRUSTED_EVENT(theEvent), theEvent->message,
+                            nsnull);
       nsEventStatus rv = ProcessEvent(focusEvent);
       if (nsEventStatus_eConsumeNoDefault == rv) {
         aFocusEvent->PreventDefault();
--- mozilla-firefox-1.0.4.orig/layout/html/base/src/nsPresShell.cpp
+++ mozilla-firefox-1.0.4/layout/html/base/src/nsPresShell.cpp
@@ -3023,7 +3023,7 @@
     return;
 
   //Send resize event from here.
-  nsEvent event(NS_RESIZE_EVENT);
+  nsEvent event(PR_TRUE, NS_RESIZE_EVENT);
   nsEventStatus status = nsEventStatus_eIgnore;
 
   nsCOMPtr<nsIScriptGlobalObject> globalObj = mDocument->GetScriptGlobalObject();
--- mozilla-firefox-1.0.4.orig/layout/html/document/src/forms.css
+++ mozilla-firefox-1.0.4/layout/html/document/src/forms.css
@@ -94,7 +94,7 @@
   letter-spacing: normal;
   cursor: text;
   -moz-user-focus: normal;
-  -moz-binding: url("resource://gre/res/builtin/platformHTMLBindings.xml#inputFields");
+  -moz-binding: url("chrome://global/content/platformHTMLBindings.xml#inputFields");
   text-indent: 0;
 }
 
@@ -112,7 +112,7 @@
   vertical-align: text-bottom;
   cursor: text;
   -moz-user-focus: normal;
-  -moz-binding: url("resource://gre/res/builtin/platformHTMLBindings.xml#textAreas");
+  -moz-binding: url("chrome://global/content/platformHTMLBindings.xml#textAreas");
   -moz-appearance: textfield;
   text-indent: 0;
 }
--- mozilla-firefox-1.0.4.orig/layout/html/document/src/html.css
+++ mozilla-firefox-1.0.4/layout/html/document/src/html.css
@@ -441,6 +441,13 @@
 /* PRINT ONLY rules follow */
 @media print {
 
+  body {
+    font-family: times, serif;
+  }
+  tt, pre {
+    font-family: courier, monospace;
+  }
+
   marquee { -moz-binding: none; }
  
   *|*:-moz-any-link img, img[usemap], object[usemap],
--- mozilla-firefox-1.0.4.orig/layout/html/forms/public/nsIFormControlFrame.h
+++ mozilla-firefox-1.0.4/layout/html/forms/public/nsIFormControlFrame.h
@@ -69,8 +69,6 @@
 
   virtual void ScrollIntoView(nsIPresContext* aPresContext) = 0;  
 
-  virtual void MouseClicked(nsIPresContext* aPresContext) = 0;
-
   /**
    * Set the suggested size for the form element. 
    * This is used to control the size of the element during reflow if it hasn't had it's size
--- mozilla-firefox-1.0.4.orig/layout/html/forms/resources/content/xbl-forms.css
+++ mozilla-firefox-1.0.4/layout/html/forms/resources/content/xbl-forms.css
@@ -203,7 +203,7 @@
   vertical-align: text-bottom;
   -moz-box-sizing: border-box;
   -moz-user-focus: normal;
-  -moz-binding: url("resource://gre/res/builtin/platformHTMLBindings.xml#inputFields");
+  -moz-binding: url("chrome://global/content/platformHTMLBindings.xml#inputFields");
   padding: 1px 0 1px 0;
 }
 
@@ -218,7 +218,7 @@
   vertical-align: text-bottom;
   -moz-box-sizing: border-box;
   -moz-user-focus: normal;
-  -moz-binding: url("resource://gre/res/builtin/platformHTMLBindings.xml#textAreas");
+  -moz-binding: url("chrome://global/content/platformHTMLBindings.xml#textAreas");
 }
 
 textarea > scrollbar {
--- mozilla-firefox-1.0.4.orig/layout/html/forms/src/nsComboboxControlFrame.cpp
+++ mozilla-firefox-1.0.4/layout/html/forms/src/nsComboboxControlFrame.cpp
@@ -578,7 +578,8 @@
 
   // fire a popup dom event
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(aShowPopup ? NS_XUL_POPUP_SHOWING : NS_XUL_POPUP_HIDING);
+  nsMouseEvent event(PR_TRUE, aShowPopup ?
+                     NS_XUL_POPUP_SHOWING : NS_XUL_POPUP_HIDING, nsnull);
 
   nsIPresShell *shell = mPresContext->GetPresShell();
   if (shell) 
@@ -624,15 +625,6 @@
 }
 
 
-//-------------------------------------------------------------
-// this is in response to the MouseClick from the containing browse button
-// XXX: TODO still need to get filters from accept attribute
-void 
-nsComboboxControlFrame::MouseClicked(nsIPresContext* aPresContext)
-{
-   //ToggleList(aPresContext);
-}
-
 nsresult
 nsComboboxControlFrame::ReflowComboChildFrame(nsIFrame* aFrame, 
                                              nsIPresContext*  aPresContext, 
--- mozilla-firefox-1.0.4.orig/layout/html/forms/src/nsComboboxControlFrame.h
+++ mozilla-firefox-1.0.4/layout/html/forms/src/nsComboboxControlFrame.h
@@ -163,9 +163,6 @@
                                              nscoord aCharWidth) const;
   virtual nsresult RequiresWidget(PRBool &aRequiresWidget);
 
-  // nsIFormMouseListener
-  virtual void MouseClicked(nsIPresContext* aPresContext);
-
   //nsIComboboxControlFrame
   NS_IMETHOD IsDroppedDown(PRBool * aDoDropDown) { *aDoDropDown = mDroppedDown; return NS_OK; }
   NS_IMETHOD ShowDropDown(PRBool aDoDropDown);
--- mozilla-firefox-1.0.4.orig/layout/html/forms/src/nsFileControlFrame.h
+++ mozilla-firefox-1.0.4/layout/html/forms/src/nsFileControlFrame.h
@@ -70,8 +70,6 @@
     return nsAreaFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
   }
 
-  virtual void MouseClicked(nsIPresContext* aPresContext) {}
-
   NS_IMETHOD Paint(nsIPresContext*      aPresContext,
                    nsIRenderingContext& aRenderingContext,
                    const nsRect&        aDirtyRect,
--- mozilla-firefox-1.0.4.orig/layout/html/forms/src/nsFormControlFrame.cpp
+++ mozilla-firefox-1.0.4/layout/html/forms/src/nsFormControlFrame.cpp
@@ -731,19 +731,12 @@
   // unfortunately native widgets don't seem to handle this right. 
   // so use the old code for native stuff. -EDV
   switch (aEvent->message) {
-     case NS_MOUSE_LEFT_CLICK:
-        MouseClicked(aPresContext);
-     break;
-
 	   case NS_KEY_DOWN:
 	    if (NS_KEY_EVENT == aEvent->eventStructType) {
 	      nsKeyEvent* keyEvent = (nsKeyEvent*)aEvent;
 	      if (NS_VK_RETURN == keyEvent->keyCode) {
 	        EnterPressed(aPresContext);
 	      }
-	      //else if (NS_VK_SPACE == keyEvent->keyCode) {
-	      //  MouseClicked(aPresContext);
-	      //}
 	    }
 	    break;
   }
--- mozilla-firefox-1.0.4.orig/layout/html/forms/src/nsFormControlFrame.h
+++ mozilla-firefox-1.0.4/layout/html/forms/src/nsFormControlFrame.h
@@ -162,11 +162,6 @@
   virtual void EnterPressed(nsIPresContext* aPresContext) {} 
 
   /**
-    * Respond to a mouse click (e.g. mouse enter, mouse down, mouse up)
-    */
-  virtual void MouseClicked(nsIPresContext* aPresContext) {}
-
-  /**
     * Respond to a control change (e.g. combo box close-up)
     */
   virtual void ControlChanged(nsIPresContext* aPresContext) {}
--- mozilla-firefox-1.0.4.orig/layout/html/forms/src/nsGfxButtonControlFrame.cpp
+++ mozilla-firefox-1.0.4/layout/html/forms/src/nsGfxButtonControlFrame.cpp
@@ -393,14 +393,11 @@
   // Override the HandleEvent to prevent the nsFrame::HandleEvent
   // from being called. The nsFrame::HandleEvent causes the button label
   // to be selected (Drawn with an XOR rectangle over the label)
- 
-  // Do nothing here, nsHTMLInputElement::HandleDOMEvent
-  // takes cares of calling MouseClicked for us.
 
   // do we have user-input style?
   const nsStyleUserInterface* uiStyle = GetStyleUserInterface();
   if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE || uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED)
     return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
-  
+
   return NS_OK;
 }
--- mozilla-firefox-1.0.4.orig/layout/html/forms/src/nsHTMLButtonControlFrame.cpp
+++ mozilla-firefox-1.0.4/layout/html/forms/src/nsHTMLButtonControlFrame.cpp
@@ -243,13 +243,6 @@
 }
 
 
-void
-nsHTMLButtonControlFrame::MouseClicked(nsIPresContext* aPresContext) 
-{
-// This is no longer called; click events are handled in
-// nsHTMLInputElement::HandleDOMEvent().
-}
-
 void 
 nsHTMLButtonControlFrame::SetFocus(PRBool aOn, PRBool aRepaint)
 {
--- mozilla-firefox-1.0.4.orig/layout/html/forms/src/nsHTMLButtonControlFrame.h
+++ mozilla-firefox-1.0.4/layout/html/forms/src/nsHTMLButtonControlFrame.h
@@ -147,7 +147,6 @@
   NS_IMETHOD_(PRInt32) GetFormControlType() const;
   NS_IMETHOD GetName(nsAString* aName);
   NS_IMETHOD GetValue(nsAString* aName);
-  virtual void MouseClicked(nsIPresContext* aPresContext);
   NS_IMETHOD OnContentReset();
 
   void SetFocus(PRBool aOn, PRBool aRepaint);
--- mozilla-firefox-1.0.4.orig/layout/html/forms/src/nsImageControlFrame.cpp
+++ mozilla-firefox-1.0.4/layout/html/forms/src/nsImageControlFrame.cpp
@@ -99,8 +99,6 @@
                        nsPoint&        aPoint,
                        PRInt32&        aCursor);
 
-  virtual void MouseClicked(nsIPresContext* aPresContext);
-
   NS_IMETHOD_(PRInt32) GetFormControlType() const;
 
   NS_IMETHOD GetName(nsAString* aName);
@@ -316,13 +314,6 @@
   return NS_OK;
 }
 
-void
-nsImageControlFrame::MouseClicked(nsIPresContext* aPresContext) 
-{
-// This is no longer called; click events are handled in
-// nsHTMLInputElement::HandleDOMEvent().
-}
-
 NS_IMETHODIMP
 nsImageControlFrame::GetFont(nsIPresContext* aPresContext, 
                              const nsFont*&  aFont)
--- mozilla-firefox-1.0.4.orig/layout/html/forms/src/nsListControlFrame.cpp
+++ mozilla-firefox-1.0.4/layout/html/forms/src/nsListControlFrame.cpp
@@ -2063,13 +2063,6 @@
 }
 
 
-//---------------------------------------------------------
-void
-nsListControlFrame::MouseClicked(nsIPresContext* aPresContext)
-{
-}
-
-
 NS_IMETHODIMP
 nsListControlFrame::OnContentReset()
 {
@@ -2472,7 +2465,7 @@
 
   // Dispatch the NS_FORM_CHANGE event
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsEvent event(NS_FORM_CHANGE);
+  nsEvent event(PR_TRUE, NS_FORM_CHANGE);
 
   nsIPresShell *presShell = mPresContext->GetPresShell();
   if (presShell) {
@@ -2863,6 +2856,10 @@
   if (manager &&
       NS_SUCCEEDED(manager->CreateEvent(mPresContext, nsnull, NS_LITERAL_STRING("Events"), getter_AddRefs(event)))) {
     event->InitEvent(NS_LITERAL_STRING("DOMMenuItemActive"), PR_TRUE, PR_TRUE);
+
+    nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));
+    privateEvent->SetTrusted(PR_TRUE);
+
     PRBool noDefault;
     mPresContext->EventStateManager()->DispatchNewEvent(mContent, event,
                                                         &noDefault);
--- mozilla-firefox-1.0.4.orig/layout/html/forms/src/nsListControlFrame.h
+++ mozilla-firefox-1.0.4/layout/html/forms/src/nsListControlFrame.h
@@ -144,7 +144,6 @@
 
   virtual void SetFocus(PRBool aOn = PR_TRUE, PRBool aRepaint = PR_FALSE);
   virtual void ScrollIntoView(nsIPresContext* aPresContext);
-  virtual void MouseClicked(nsIPresContext* aPresContext);
   virtual nscoord GetVerticalInsidePadding(nsIPresContext* aPresContext,
                                            float aPixToTwip,
                                            nscoord aInnerHeight) const;
--- mozilla-firefox-1.0.4.orig/layout/html/forms/src/nsTextControlFrame.cpp
+++ mozilla-firefox-1.0.4/layout/html/forms/src/nsTextControlFrame.cpp
@@ -294,7 +294,7 @@
         if (presShell) 
         {
           nsEventStatus status = nsEventStatus_eIgnore;
-          nsEvent event(NS_FORM_SELECTED);
+          nsEvent event(PR_TRUE, NS_FORM_SELECTED);
 
           presShell->HandleEventWithTarget(&event,mFrame,content,NS_EVENT_FLAG_INIT,&status);
         }
@@ -2310,8 +2310,6 @@
   }
 }
 
-void    nsTextControlFrame::MouseClicked(nsIPresContext* aPresContext){}
-
 nscoord 
 nsTextControlFrame::GetVerticalInsidePadding(nsIPresContext* aPresContext,
                                              float aPixToTwip, 
@@ -3015,7 +3013,7 @@
   
   // Dispatch the "input" event
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsGUIEvent event(NS_FORM_INPUT);
+  nsGUIEvent event(PR_TRUE, NS_FORM_INPUT, nsnull);
 
   // Have the content handle the event, propagating it according to normal
   // DOM rules.
@@ -3064,7 +3062,7 @@
   if (NS_SUCCEEDED(GetFormContent(*getter_AddRefs(content))))
   {
     nsEventStatus status = nsEventStatus_eIgnore;
-    nsInputEvent event(NS_FORM_CHANGE);
+    nsInputEvent event(PR_TRUE, NS_FORM_CHANGE, nsnull);
 
     // Have the content handle the event.
     nsWeakPtr &shell = mTextSelImpl->GetPresShell();
--- mozilla-firefox-1.0.4.orig/layout/html/forms/src/nsTextControlFrame.h
+++ mozilla-firefox-1.0.4/layout/html/forms/src/nsTextControlFrame.h
@@ -138,7 +138,6 @@
   NS_IMETHOD GetName(nsAString* aName);//*
   virtual void SetFocus(PRBool aOn , PRBool aRepaint); 
   virtual void ScrollIntoView(nsIPresContext* aPresContext);
-  virtual void MouseClicked(nsIPresContext* aPresContext);
   virtual nscoord GetVerticalInsidePadding(nsIPresContext* aPresContext,
                                            float aPixToTwip,
                                            nscoord aInnerHeight) const;
--- mozilla-firefox-1.0.4.orig/layout/html/tests/block/base/jlbtest1.html
+++ mozilla-firefox-1.0.4/layout/html/tests/block/base/jlbtest1.html
@@ -1,34 +1,34 @@
-<HTML>
-<HEAD>
-   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=Shift_JIS">
-   <META NAME="Author" CONTENT="Frank Tang">
-   <META NAME="GENERATOR" CONTENT="Mozilla/4.03 [en] (WinNT; I) [Netscape]">
-   <TITLE>Japanese Line Break Test 1</TITLE>
-</HEAD>
-<BODY>
-Japanese Line Breaking Test:
-<BR>&nbsp;
-
-<P>ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
-<BR>-ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
-<BR>--ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
-<BR>---ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
-<BR>----ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
-<BR>-----ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
-<BR>------ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
-<BR>-------ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
-<BR>--------ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
-<BR>---------ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
-<BR>----------ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
-<BR>-----------ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
-<BR>------------ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
-<BR>-------------ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
-<BR>--------------ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
-<BR>---------------ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
-<BR>----------------ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
-
-<P>The valide break point should be : [Need to spec out]
-
-<P>ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B&nbsp;
-</BODY>
-</HTML>
+<HTML>
+<HEAD>
+   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=Shift_JIS">
+   <META NAME="Author" CONTENT="Frank Tang">
+   <META NAME="GENERATOR" CONTENT="Mozilla/4.03 [en] (WinNT; I) [Netscape]">
+   <TITLE>Japanese Line Break Test 1</TITLE>
+</HEAD>
+<BODY>
+Japanese Line Breaking Test:
+<BR>&nbsp;
+
+<P>ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
+<BR>-ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
+<BR>--ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
+<BR>---ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
+<BR>----ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
+<BR>-----ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
+<BR>------ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
+<BR>-------ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
+<BR>--------ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
+<BR>---------ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
+<BR>----------ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
+<BR>-----------ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
+<BR>------------ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
+<BR>-------------ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
+<BR>--------------ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
+<BR>---------------ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
+<BR>----------------ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B
+
+<P>The valide break point should be : [Need to spec out]
+
+<P>ƒtƒWƒeƒŒƒr‚Ì‰¹Šy”Ô‘g�uHEY! HEY! HEY!�v‚Ìƒz�[ƒ€ƒy�[ƒW�B&nbsp;
+</BODY>
+</HTML>
--- mozilla-firefox-1.0.4.orig/layout/html/tests/block/bugs/13599.html
+++ mozilla-firefox-1.0.4/layout/html/tests/block/bugs/13599.html
@@ -1,13 +1,13 @@
-<html><head><title>Testcase for bug 13599</title></head>
-<body bgcolor="#FFFFFF">
-<H3>Using apprunner 1999-09-10-10-M11 on Windows 98, the first and third
-items have no number displayed.</H2>
-
-<OL>
-<LI><P>first list item</P></LI>
-<LI>second list item</LI>
-<LI><P>third list</P> item</LI>
-<LI>fourth list<P>item</P></LI>
-</OL>
-
-</body></html>
+<html><head><title>Testcase for bug 13599</title></head>
+<body bgcolor="#FFFFFF">
+<H3>Using apprunner 1999-09-10-10-M11 on Windows 98, the first and third
+items have no number displayed.</H2>
+
+<OL>
+<LI><P>first list item</P></LI>
+<LI>second list item</LI>
+<LI><P>third list</P> item</LI>
+<LI>fourth list<P>item</P></LI>
+</OL>
+
+</body></html>
--- mozilla-firefox-1.0.4.orig/layout/html/tests/block/bugs/155333-1.html
+++ mozilla-firefox-1.0.4/layout/html/tests/block/bugs/155333-1.html
@@ -1,3 +1,3 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html><head><title>Testcase bug 155333</title></head>
-<body><small>Foo<br>Bar<br>Baz</small> </body></html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><title>Testcase bug 155333</title></head>
+<body><small>Foo<br>Bar<br>Baz</small> </body></html>
--- mozilla-firefox-1.0.4.orig/layout/html/tests/block/bugs/155333-2.html
+++ mozilla-firefox-1.0.4/layout/html/tests/block/bugs/155333-2.html
@@ -1,2 +1,2 @@
-<html><head><title>Testcase bug 155333</title></head>
-<body><span style="font-size: 50%">foo<br>bar<br>baz </span> </body></html>
+<html><head><title>Testcase bug 155333</title></head>
+<body><span style="font-size: 50%">foo<br>bar<br>baz </span> </body></html>
--- mozilla-firefox-1.0.4.orig/layout/html/tests/block/bugs/185411-2.html
+++ mozilla-firefox-1.0.4/layout/html/tests/block/bugs/185411-2.html
@@ -1,25 +1,25 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-            "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
-  <title>Inconsistency testcase</title>
-  <style type="text/css">
-div { margin-left: auto; margin-right: auto; margin-top: 1em; }
-  </style>
-</head>
-<body>
-<p>All divs have margin-left and margin-right set to auto.<p>
-<div style="width: 400px; border: 4px dashed green;">
- <p style="text-align: center; font-weight: bold;">Containing block (400px)</p>
-
- <div style="width: 500px; border-top: solid thin red; border-bottom: solid thin red;">
-  500px-wide div without left or right border
- </div>
-
- <div style="width: 500px; border: solid thin red;">
-  500px-wide div with left and right border
- </div>
-</div>
-</body>
-</html>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+            "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+  <title>Inconsistency testcase</title>
+  <style type="text/css">
+div { margin-left: auto; margin-right: auto; margin-top: 1em; }
+  </style>
+</head>
+<body>
+<p>All divs have margin-left and margin-right set to auto.<p>
+<div style="width: 400px; border: 4px dashed green;">
+ <p style="text-align: center; font-weight: bold;">Containing block (400px)</p>
+
+ <div style="width: 500px; border-top: solid thin red; border-bottom: solid thin red;">
+  500px-wide div without left or right border
+ </div>
+
+ <div style="width: 500px; border: solid thin red;">
+  500px-wide div with left and right border
+ </div>
+</div>
+</body>
+</html>
--- mozilla-firefox-1.0.4.orig/layout/html/tests/block/bugs/38157-a.html
+++ mozilla-firefox-1.0.4/layout/html/tests/block/bugs/38157-a.html
@@ -1,23 +1,46 @@
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

-

-<HTML>

-<HEAD>

-<TITLE>Coppied from Jigsaw</TITLE>

-<style>

-DIV.body {

-	  FLOAT: left; }

-.left {

-	FLOAT: left; }

-

-</style>

-</HEAD>

-<BODY>

-<DIV class=left>

-<P class=link>Local&nbsp;Links</P></DIV>

-<DIV class=body>

-    <P>Winie is a network utility to put files on the web using HTTP/1.1. The main 

-  feature of Winie is to solve the lost update problem  by storing 

-  ETags. Winie use the client side api of Jigsaw.</P>

-    </DIV>

-</BODY>

-</HTML>

+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+
+
+
+<HTML>
+
+<HEAD>
+
+<TITLE>Coppied from Jigsaw</TITLE>
+
+<style>
+
+DIV.body {
+
+	  FLOAT: left; }
+
+.left {
+
+	FLOAT: left; }
+
+
+
+</style>
+
+</HEAD>
+
+<BODY>
+
+<DIV class=left>
+
+<P class=link>Local&nbsp;Links</P></DIV>
+
+<DIV class=body>
+
+    <P>Winie is a network utility to put files on the web using HTTP/1.1. The main 
+
+  feature of Winie is to solve the lost update problem  by storing 
+
+  ETags. Winie use the client side api of Jigsaw.</P>
+
+    </DIV>
+
+</BODY>
+
+</HTML>
+
--- mozilla-firefox-1.0.4.orig/layout/html/tests/block/bugs/38157-b.html
+++ mozilla-firefox-1.0.4/layout/html/tests/block/bugs/38157-b.html
@@ -1,37 +1,74 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"

-                      "http://www.w3.org/TR/REC-html40/loose.dtd">

-<html>

-<head>

-<STYLE>

-

-DL {

-	margin-left: 20%;

-}

-

-DIV.body {

-  background-color: #F0F0E0;

-  float: left; 

-}

-

-.left {

-  text-align: left;

-  width: 100px;

-  float: left; 

-  background-color: yellow;

-}

-</STYLE>

-</head>

-

-<body bgcolor="#FFFFFF" class="smallmargin">

-

-

-<div class="left">abc</div>

-

-<div class="body">

-    <dl>

-      <dd>The design has been done in such way to minimize file system accesses. By 

-      </dd>

-    </dl>

-</div>

-

-</body></html>

+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
+
+                      "http://www.w3.org/TR/REC-html40/loose.dtd">
+
+<html>
+
+<head>
+
+<STYLE>
+
+
+
+DL {
+
+	margin-left: 20%;
+
+}
+
+
+
+DIV.body {
+
+  background-color: #F0F0E0;
+
+  float: left; 
+
+}
+
+
+
+.left {
+
+  text-align: left;
+
+  width: 100px;
+
+  float: left; 
+
+  background-color: yellow;
+
+}
+
+</STYLE>
+
+</head>
+
+
+
+<body bgcolor="#FFFFFF" class="smallmargin">
+
+
+
+
+
+<div class="left">abc</div>
+
+
+
+<div class="body">
+
+    <dl>
+
+      <dd>The design has been done in such way to minimize file system accesses. By 
+
+      </dd>
+
+    </dl>
+
+</div>
+
+
+
+</body></html>
+
--- mozilla-firefox-1.0.4.orig/layout/html/tests/block/bugs/46918.html
+++ mozilla-firefox-1.0.4/layout/html/tests/block/bugs/46918.html
@@ -1,9 +1,9 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN"><html lang="en"><head><title>Mozilla Tests: Inline margins</title>
     
-    <style type="text/css">
-       span.left { margin-left: 10em; }
-       span.right { margin-right: 10em; }
-       div { width: 30em; border: thin solid; }
+    <style type="text/css">
+       span.left { margin-left: 10em; }
+       span.right { margin-right: 10em; }
+       div { width: 30em; border: thin solid; }
     </style></head>
 
   <body>
--- mozilla-firefox-1.0.4.orig/layout/html/tests/block/bugs/53960.html
+++ mozilla-firefox-1.0.4/layout/html/tests/block/bugs/53960.html
@@ -1,3 +1,3 @@
-<HTML><BODY><TABLE><TR><TD>
- <TABLE border=1><TR><TD><SCRIPT language=JavaScript>document.write('<form method=post name = "DominoForm1" action="' + document.forms[1].action + '">');</SCRIPT>
-</TD></TR></TABLE></TD><TD>X</TD></TR></TABLE>
+<HTML><BODY><TABLE><TR><TD>
+ <TABLE border=1><TR><TD><SCRIPT language=JavaScript>document.write('<form method=post name = "DominoForm1" action="' + document.forms[1].action + '">');</SCRIPT>
+</TD></TR></TABLE></TD><TD>X</TD></TR></TABLE>
--- mozilla-firefox-1.0.4.orig/layout/html/tests/block/printing/127145-1.html
+++ mozilla-firefox-1.0.4/layout/html/tests/block/printing/127145-1.html
@@ -1,8 +1,8 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"><html><head>
-<style>
-table  {border:green  2px  solid;}
-td     {border:red    1px  dotted;}
-div    {border:blue    1px  dashed;}
+<style>
+table  {border:green  2px  solid;}
+td     {border:red    1px  dotted;}
+div    {border:blue    1px  dashed;}
 </style></head>
 
  
--- mozilla-firefox-1.0.4.orig/layout/html/tests/block/printing/145305-11.html
+++ mozilla-firefox-1.0.4/layout/html/tests/block/printing/145305-11.html
@@ -1,15 +1,15 @@
-<div style="width:100px; height:870px; border:1px solid black">test 11 - float right table, text on page 2</div>
-<table border style="float:right">
- <tr>
-  <td>one<br>two<br></td>
- </tr>
-</table>
-START some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text END
+<div style="width:100px; height:870px; border:1px solid black">test 11 - float right table, text on page 2</div>
+<table border style="float:right">
+ <tr>
+  <td>one<br>two<br></td>
+ </tr>
+</table>
+START some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text END
--- mozilla-firefox-1.0.4.orig/layout/html/tests/block/printing/145305-13.html
+++ mozilla-firefox-1.0.4/layout/html/tests/block/printing/145305-13.html
@@ -1,19 +1,19 @@
-<div style="width:100px; height:870px; border:1px solid black">test 13 - float left table, float right table, text on page 2</div>
-<table border style="float:left">
- <tr>
-  <td>one<br>two</td>
- </tr>
-</table><table border style="float:right">
- <tr>
-  <td>1<br>2<br>3</td>
- </tr>
-</table>
-START some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text END
+<div style="width:100px; height:870px; border:1px solid black">test 13 - float left table, float right table, text on page 2</div>
+<table border style="float:left">
+ <tr>
+  <td>one<br>two</td>
+ </tr>
+</table><table border style="float:right">
+ <tr>
+  <td>1<br>2<br>3</td>
+ </tr>
+</table>
+START some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text END
--- mozilla-firefox-1.0.4.orig/layout/html/tests/block/printing/145305-17.html
+++ mozilla-firefox-1.0.4/layout/html/tests/block/printing/145305-17.html
@@ -1,27 +1,27 @@
-<div style="width:100px; height:870px; border:1px solid black">test 17 - float right button, float right table, put floaters on next page</div>
-<button style="float:right; font-size:xx-large">foo<BR>foo<BR>foo</button>
-<table border style="float:right">
- <tr>
-  <td>one<br>two<br>three</td>
- </tr>
-</table>
-START some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text END
+<div style="width:100px; height:870px; border:1px solid black">test 17 - float right button, float right table, put floaters on next page</div>
+<button style="float:right; font-size:xx-large">foo<BR>foo<BR>foo</button>
+<table border style="float:right">
+ <tr>
+  <td>one<br>two<br>three</td>
+ </tr>
+</table>
+START some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text END
--- mozilla-firefox-1.0.4.orig/layout/html/tests/block/printing/145305-19.html
+++ mozilla-firefox-1.0.4/layout/html/tests/block/printing/145305-19.html
@@ -1,15 +1,15 @@
-<div style="width:100px; height:850px; border:1px solid black">test 19 - Text to have floaters below current line, float right table, text on page 2</div>
-Text to have floaters below current line<table border style="float:right">
- <tr>
-  <td>one<br>two<br></td>
- </tr>
-</table>
-START some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text END
+<div style="width:100px; height:850px; border:1px solid black">test 19 - Text to have floaters below current line, float right table, text on page 2</div>
+Text to have floaters below current line<table border style="float:right">
+ <tr>
+  <td>one<br>two<br></td>
+ </tr>
+</table>
+START some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text END
--- mozilla-firefox-1.0.4.orig/layout/html/tests/block/printing/145305-21.html
+++ mozilla-firefox-1.0.4/layout/html/tests/block/printing/145305-21.html
@@ -1,27 +1,27 @@
-<div style="width:100px; height:850px; border:1px solid black">test 21 - Text to have floaters below current line, float right button, float right table, put floaters on next page</div>
-Text to have floaters below current line<button style="float:right; font-size:xx-large">foo<BR>foo<BR>foo</button>
-<table border style="float:right">
- <tr>
-  <td>one<br>two<br>three</td>
- </tr>
-</table>
-START some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text END
+<div style="width:100px; height:850px; border:1px solid black">test 21 - Text to have floaters below current line, float right button, float right table, put floaters on next page</div>
+Text to have floaters below current line<button style="float:right; font-size:xx-large">foo<BR>foo<BR>foo</button>
+<table border style="float:right">
+ <tr>
+  <td>one<br>two<br>three</td>
+ </tr>
+</table>
+START some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text END
--- mozilla-firefox-1.0.4.orig/layout/html/tests/block/printing/145305-3.html
+++ mozilla-firefox-1.0.4/layout/html/tests/block/printing/145305-3.html
@@ -1,7 +1,7 @@
-<div style="width:100px; height:870px; border:1px solid black">test 3 - float left table, no text on page 2</div>
-<table border style="float:left">
- <tr>
-  <td>one<br>two<br>three</td>
- </tr>
-</table>
-some text
+<div style="width:100px; height:870px; border:1px solid black">test 3 - float left table, no text on page 2</div>
+<table border style="float:left">
+ <tr>
+  <td>one<br>two<br>three</td>
+ </tr>
+</table>
+some text
--- mozilla-firefox-1.0.4.orig/layout/html/tests/block/printing/145305-4.html
+++ mozilla-firefox-1.0.4/layout/html/tests/block/printing/145305-4.html
@@ -1,7 +1,7 @@
-<div style="width:100px; height:870px; border:1px solid black">test 4 - float right table, no text on page 2</div>
-<table border style="float:right">
- <tr>
-  <td>one<br>two<br>three</td>
- </tr>
-</table>
-some text
+<div style="width:100px; height:870px; border:1px solid black">test 4 - float right table, no text on page 2</div>
+<table border style="float:right">
+ <tr>
+  <td>one<br>two<br>three</td>
+ </tr>
+</table>
+some text
--- mozilla-firefox-1.0.4.orig/layout/html/tests/block/printing/145305-7.html
+++ mozilla-firefox-1.0.4/layout/html/tests/block/printing/145305-7.html
@@ -1,11 +1,11 @@
-<div style="width:100px; height:870px; border:1px solid black">test 7 - 2 float right tables, no text on page 2</div>
-<table border style="float:right">
- <tr>
-  <td>one<br>two</td>
- </tr>
-</table><table border style="float:right">
- <tr>
-  <td>1<br>2<br>3</td>
- </tr>
-</table>
-some text
+<div style="width:100px; height:870px; border:1px solid black">test 7 - 2 float right tables, no text on page 2</div>
+<table border style="float:right">
+ <tr>
+  <td>one<br>two</td>
+ </tr>
+</table><table border style="float:right">
+ <tr>
+  <td>1<br>2<br>3</td>
+ </tr>
+</table>
+some text
--- mozilla-firefox-1.0.4.orig/layout/html/tests/block/printing/145305-9.html
+++ mozilla-firefox-1.0.4/layout/html/tests/block/printing/145305-9.html
@@ -1,15 +1,15 @@
-<div style="width:100px; height:870px; border:1px solid black">test 9 - float left table, text on page 2</div>
-<table border style="float:left">
- <tr>
-  <td>one<br>two<br></td>
- </tr>
-</table>
-START some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text
-some text some text some text some text some text some text END
+<div style="width:100px; height:870px; border:1px solid black">test 9 - float left table, text on page 2</div>
+<table border style="float:left">
+ <tr>
+  <td>one<br>two<br></td>
+ </tr>
+</table>
+START some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text
+some text some text some text some text some text some text END
--- mozilla-firefox-1.0.4.orig/layout/html/tests/formctls/bugs/bug8665.html
+++ mozilla-firefox-1.0.4/layout/html/tests/formctls/bugs/bug8665.html
@@ -1 +1,10 @@
-<HTML>
<p>First instance - SkyMiles¨ - does not use character entity<br>
Second instance - SkyMiles&reg; - uses character entity<br>
<FORM METHOD="POST" ACTION="/cgi-bin/quiknav.pl" TARGET="_top" ONSUBMIT="foo">
<SELECT NAME="section" SIZE="1">
<OPTION VALUE="/skymile/index.html">SkyMiles¨
<OPTION VALUE="/skymile/index.html">SkyMiles&reg;
</SELECT>
</FORM>
</HTML>
\ No newline at end of file
+<HTML>
+<p>First instance - SkyMiles¨ - does not use character entity<br>
+Second instance - SkyMiles&reg; - uses character entity<br>
+<FORM METHOD="POST" ACTION="/cgi-bin/quiknav.pl" TARGET="_top" ONSUBMIT="foo">
+<SELECT NAME="section" SIZE="1">
+<OPTION VALUE="/skymile/index.html">SkyMiles¨
+<OPTION VALUE="/skymile/index.html">SkyMiles&reg;
+</SELECT>
+</FORM>
+</HTML>
--- mozilla-firefox-1.0.4.orig/layout/html/tests/frameset/core/blank2.html
+++ mozilla-firefox-1.0.4/layout/html/tests/frameset/core/blank2.html
@@ -1,4 +1,4 @@
-<!--Revision="C     @(#)index.html      1.2 latest revision 3/25/00 15:23:23 " -->
+<!--Revision="C     @(#)index.html      1.2 latest revision 3/25/00 15:23:23 " -->
 <html>
 <frameset rows="*" frameborder="0" border=0 framespacing="0">
  <frame name="global" src="blankin.html" marginwidth="0" marginheight="0" scrolling="auto">
--- mozilla-firefox-1.0.4.orig/layout/html/tests/frameset/core/r3.html
+++ mozilla-firefox-1.0.4/layout/html/tests/frameset/core/r3.html
@@ -1,11 +1,11 @@
-<HTML>
-<HEAD>
-<TITLE></TITLE>
-</HEAD>
-
-<BODY BGCOLOR="#FFFFCC">
-
-Some text
-
-</BODY>
+<HTML>
+<HEAD>
+<TITLE></TITLE>
+</HEAD>
+
+<BODY BGCOLOR="#FFFFCC">
+
+Some text
+
+</BODY>
 </HTML>
\ No newline at end of file
--- mozilla-firefox-1.0.4.orig/layout/html/tests/frameset/core/r4.html
+++ mozilla-firefox-1.0.4/layout/html/tests/frameset/core/r4.html
@@ -1,9 +1,9 @@
-<HTML>
-<HEAD>
-<TITLE></TITLE>
-</HEAD>
-
-<BODY BGCOLOR="#CCCCFF">
-
-</BODY>
+<HTML>
+<HEAD>
+<TITLE></TITLE>
+</HEAD>
+
+<BODY BGCOLOR="#CCCCFF">
+
+</BODY>
 </HTML>
\ No newline at end of file
--- mozilla-firefox-1.0.4.orig/layout/html/tests/table/bugs/bug101759.html
+++ mozilla-firefox-1.0.4/layout/html/tests/table/bugs/bug101759.html
@@ -1,67 +1,67 @@
-<table cellspacing="0" cellpadding="0">
- <tr>
-  <td width="1%" bgcolor=blue>
-   XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX
-  </td>
-  <td bgcolor=green>
-   <table border="0" cellspacing="0" cellpadding="0" bgcolor="yellow">
-   </table>
-  </td>
- </tr>
-</table>
-
-<BR>
-
-<table border cellspacing="0" cellpadding="0">
- <tr>
-  <td width="1%" bgcolor=blue>
-   XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX
-  </td>
-  <td bgcolor=green>
-   <table border="0" cellspacing="0" cellpadding="0" bgcolor="yellow">
-   </table>
-  </td>
- </tr>
-</table>
-
-<BR>
-<table border cellspacing="0" cellpadding="1">
- <tr>
-  <td width="1%" bgcolor=blue>
-   XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX
-  </td>
-  <td bgcolor=green>
-   <table border="0" cellspacing="0" cellpadding="0" bgcolor="yellow">
-   </table>
-  </td>
- </tr>
-</table>
-
-<BR>
-<table border="0" cellspacing="0" cellpadding="0">
- <tr>
-  <td width="1%" bgcolor=blue>
-   XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX
-  </td>
-  <td width="1%" bgcolor=orange>
-   XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX
-  </td>
-  <td bgcolor=green>
-   <table border="0" cellspacing="0" cellpadding="0" bgcolor="yellow">
-   </table>
-  </td>
- </tr>
-</table>
-
-<BR>
-<table borderx="1" cellspacing="0" cellpadding="0">
- <tr>
-  <td width="1%" bgcolor=blue>
-   XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX
-  </td>
-  <td bgcolor=green>
-   x
-  </td>
- </tr>
-</table>
+<table cellspacing="0" cellpadding="0">
+ <tr>
+  <td width="1%" bgcolor=blue>
+   XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX
+  </td>
+  <td bgcolor=green>
+   <table border="0" cellspacing="0" cellpadding="0" bgcolor="yellow">
+   </table>
+  </td>
+ </tr>
+</table>
+
+<BR>
+
+<table border cellspacing="0" cellpadding="0">
+ <tr>
+  <td width="1%" bgcolor=blue>
+   XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX
+  </td>
+  <td bgcolor=green>
+   <table border="0" cellspacing="0" cellpadding="0" bgcolor="yellow">
+   </table>
+  </td>
+ </tr>
+</table>
+
+<BR>
+<table border cellspacing="0" cellpadding="1">
+ <tr>
+  <td width="1%" bgcolor=blue>
+   XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX
+  </td>
+  <td bgcolor=green>
+   <table border="0" cellspacing="0" cellpadding="0" bgcolor="yellow">
+   </table>
+  </td>
+ </tr>
+</table>
+
+<BR>
+<table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+  <td width="1%" bgcolor=blue>
+   XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX
+  </td>
+  <td width="1%" bgcolor=orange>
+   XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX
+  </td>
+  <td bgcolor=green>
+   <table border="0" cellspacing="0" cellpadding="0" bgcolor="yellow">
+   </table>
+  </td>
+ </tr>
+</table>
+
+<BR>
+<table borderx="1" cellspacing="0" cellpadding="0">
+ <tr>
+  <td width="1%" bgcolor=blue>
+   XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX
+  </td>
+  <td bgcolor=green>
+   x
+  </td>
+ </tr>
+</table>
 -->
\ No newline at end of file
--- mozilla-firefox-1.0.4.orig/layout/html/tests/table/bugs/bug119786.html
+++ mozilla-firefox-1.0.4/layout/html/tests/table/bugs/bug119786.html
@@ -1,48 +1,48 @@
 <html><head>
 
-<title>table creation</title><style type="text/css">
-caption { color: green; background-color: lightyellow; }
+<title>table creation</title><style type="text/css">
+caption { color: green; background-color: lightyellow; }
 </style>
-<script type="text/javascript">
-function createTable (caption) {
-  var table = document.createElement('table');
-  table.border = 1;
-  document.body.appendChild(table);
-  if (caption) {
-    table.createCaption();
-    table.caption.appendChild(document.createTextNode(caption));
-  }
-  table.createTHead();
-  var row = table.tHead.insertRow(table.tHead.rows.length);
-  row.insertCell(0).appendChild(document.createTextNode('Header'));
-
-  table.appendChild(document.createElement('tbody'));
-  row = table.tBodies[0].insertRow(table.tBodies[0].rows.length);
-  row.insertCell(0).appendChild(document.createTextNode('Kibology'));
-}
-function createTable1 (caption) {
-  var table = document.createElement('table');
-  table.border = 1;
-  if (caption) {
-    table.createCaption();
-    table.caption.appendChild(document.createTextNode(caption));
-  }
-  table.createTHead();
-  var row = table.tHead.insertRow(table.tHead.rows.length);
-  row.insertCell(0).appendChild(document.createTextNode('Header'));
-
-  table.appendChild(document.createElement('tbody'));
-  row = table.tBodies[0].insertRow(table.tBodies[0].rows.length);
-  row.insertCell(0).appendChild(document.createTextNode('Kibology'));
-  document.body.appendChild(table);
-
+<script type="text/javascript">
+function createTable (caption) {
+  var table = document.createElement('table');
+  table.border = 1;
+  document.body.appendChild(table);
+  if (caption) {
+    table.createCaption();
+    table.caption.appendChild(document.createTextNode(caption));
+  }
+  table.createTHead();
+  var row = table.tHead.insertRow(table.tHead.rows.length);
+  row.insertCell(0).appendChild(document.createTextNode('Header'));
+
+  table.appendChild(document.createElement('tbody'));
+  row = table.tBodies[0].insertRow(table.tBodies[0].rows.length);
+  row.insertCell(0).appendChild(document.createTextNode('Kibology'));
+}
+function createTable1 (caption) {
+  var table = document.createElement('table');
+  table.border = 1;
+  if (caption) {
+    table.createCaption();
+    table.caption.appendChild(document.createTextNode(caption));
+  }
+  table.createTHead();
+  var row = table.tHead.insertRow(table.tHead.rows.length);
+  row.insertCell(0).appendChild(document.createTextNode('Header'));
+
+  table.appendChild(document.createElement('tbody'));
+  row = table.tBodies[0].insertRow(table.tBodies[0].rows.length);
+  row.insertCell(0).appendChild(document.createTextNode('Kibology'));
+  document.body.appendChild(table);
+
 }</script></head>
 <body>
-<script type="text/javascript">
-createTable('Where is the table?');
-document.body.appendChild(document.createElement('hr'));
-createTable();
-document.body.appendChild(document.createElement('hr'));
-createTable1('Here is the table');
+<script type="text/javascript">
+createTable('Where is the table?');
+document.body.appendChild(document.createElement('hr'));
+createTable();
+document.body.appendChild(document.createElement('hr'));
+createTable1('Here is the table');
 </script><table border="1"><thead><tr><td>Header</td></tr></thead><caption>Where is the table?</caption><tbody><tr><td>Kibology</td></tr></tbody></table><hr><table border="1"><thead><tr><td>Header</td></tr></thead><tbody><tr><td>Kibology</td></tr></tbody></table><hr><table border="1"><thead><tr><td>Header</td></tr></thead><caption>Here is the table</caption><tbody><tr><td>Kibology</td></tr></tbody></table>
 </body></html>
\ No newline at end of file
--- mozilla-firefox-1.0.4.orig/layout/html/tests/table/bugs/bug123862.html
+++ mozilla-firefox-1.0.4/layout/html/tests/table/bugs/bug123862.html
@@ -1 +1,46 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
			"http://www.w3.org/TR/REC-html40/strict.dtd">
<html>
<head>
<title>Cols and colspan</title>
<style type="text/css">
<!--
table {margin: 1em 0; width: 200px; border: 2px solid black;}
td {border: 1px solid gray; background: #EFE;}
-->
</style>
</head>
<body>

<table>
<tr>
<td>no cols or colspans</td>
</tr>
</table>

<table cols="4">
<tr>
<td>cols=4</td>
</tr>
</table>

<table>
<tr>
<td colspan="4">colspan=4</td>
</tr>
</table>

<table cols="4">
<tr>
<td colspan="4">cols=4, colspan=4</td>
</tr>
</table>

<table cols="4">
<tr>
<td colspan="4">see previous</td>
</tr>
</table>

</body>
</html>
\ No newline at end of file
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
+			"http://www.w3.org/TR/REC-html40/strict.dtd">
+<html>
+<head>
+<title>Cols and colspan</title>
+<style type="text/css">
+<!--
+table {margin: 1em 0; width: 200px; border: 2px solid black;}
+td {border: 1px solid gray; background: #EFE;}
+-->
+</style>
+</head>
+<body>
+
+<table>
+<tr>
+<td>no cols or colspans</td>
+</tr>
+</table>
+
+<table cols="4">
+<tr>
+<td>cols=4</td>
+</tr>
+</table>
+
+<table>
+<tr>
+<td colspan="4">colspan=4</td>
+</tr>
+</table>
+
+<table cols="4">
+<tr>
+<td colspan="4">cols=4, colspan=4</td>
+</tr>
+</table>
+
+<table cols="4">
+<tr>
+<td colspan="4">see previous</td>
+</tr>
+</table>
+
+</body>
+</html>
--- mozilla-firefox-1.0.4.orig/layout/html/tests/table/bugs/bug14489.html
+++ mozilla-firefox-1.0.4/layout/html/tests/table/bugs/bug14489.html
@@ -1,69 +1,69 @@
-<html><body bgcolor="#c0c0c0">
-
-<table border="3">
-	<tr>
-		<td>
-
-			<table border="3" align="left" width=50%>
-				<tr>
-					<td>
-						blah blah blah blah blah blah blah blah blah blah blah blah blah
-						blah blah blah blah blah blah blah blah blah blah blah blah blah
-						blah blah blah blah blah blah blah blah blah blah blah blah blah
-						blah blah blah blah blah blah blah blah blah blah blah blah blah
-						blah blah blah blah blah blah blah blah blah blah blah blah blah
-					</td>
-				</tr>
-			</table>
-
-    </td>
-  </tr>
-</table>
-
-<br>
-
-<table border="3">
-	<tr>
-		<td>
-			blah blah
-			<table border="3" align="left" width=50%>
-				<tr>
-					<td>
-						blah blah blah blah blah blah blah blah blah blah blah blah blah
-						blah blah blah blah blah blah blah blah blah blah blah blah blah
-						blah blah blah blah blah blah blah blah blah blah blah blah blah
-						blah blah blah blah blah blah blah blah blah blah blah blah blah
-						blah blah blah blah blah blah blah blah blah blah blah blah blah
-					</td>
-				</tr>
-			</table>
-
-    </td>
-  </tr>
-</table>
-
-<br>
-
-<table border="3">
-	<tr>
-		<td>
-			blah blah
-			<p>
-			<table border="3" align="left" width=50%>
-				<tr>
-					<td>
-						blah blah blah blah blah blah blah blah blah blah blah blah blah
-						blah blah blah blah blah blah blah blah blah blah blah blah blah
-						blah blah blah blah blah blah blah blah blah blah blah blah blah
-						blah blah blah blah blah blah blah blah blah blah blah blah blah
-						blah blah blah blah blah blah blah blah blah blah blah blah blah
-					</td>
-				</tr>
-			</table>
-
-    </td>
-  </tr>
-</table>
-
-
-</body></html>
+<html><body bgcolor="#c0c0c0">
+
+<table border="3">
+	<tr>
+		<td>
+
+			<table border="3" align="left" width=50%>
+				<tr>
+					<td>
+						blah blah blah blah blah blah blah blah blah blah blah blah blah
+						blah blah blah blah blah blah blah blah blah blah blah blah blah
+						blah blah blah blah blah blah blah blah blah blah blah blah blah
+						blah blah blah blah blah blah blah blah blah blah blah blah blah
+						blah blah blah blah blah blah blah blah blah blah blah blah blah
+					</td>
+				</tr>
+			</table>
+
+    </td>
+  </tr>
+</table>
+
+<br>
+
+<table border="3">
+	<tr>
+		<td>
+			blah blah
+			<table border="3" align="left" width=50%>
+				<tr>
+					<td>
+						blah blah blah blah blah blah blah blah blah blah blah blah blah
+						blah blah blah blah blah blah blah blah blah blah blah blah blah
+						blah blah blah blah blah blah blah blah blah blah blah blah blah
+						blah blah blah blah blah blah blah blah blah blah blah blah blah
+						blah blah blah blah blah blah blah blah blah blah blah blah blah
+					</td>
+				</tr>
+			</table>
+
+    </td>
+  </tr>
+</table>
+
+<br>
+
+<table border="3">
+	<tr>
+		<td>
+			blah blah
+			<p>
+			<table border="3" align="left" width=50%>
+				<tr>
+					<td>
+						blah blah blah blah blah blah blah blah blah blah blah blah blah
+						blah blah blah blah blah blah blah blah blah blah blah blah blah
+						blah blah blah blah blah blah blah blah blah blah blah blah blah
+						blah blah blah blah blah blah blah blah blah blah blah blah blah
+						blah blah blah blah blah blah blah blah blah blah blah blah blah
+					</td>
+				</tr>
+			</table>
+
+    </td>
+  </tr>
+</table>
+
+
+</body></html>
--- mozilla-firefox-1.0.4.orig/layout/html/tests/table/bugs/bug222846.html
+++ mozilla-firefox-1.0.4/layout/html/tests/table/bugs/bug222846.html
@@ -1,29 +1,29 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<title>table dom test</title>
-<style type="text/css">
-  table {width:200px}
-table[summary="summ"] {font-size:24pt}
-</style>
-<script type="text/javascript">
-function dom(){
-var t = document.getElementById('t2');
-t.summary="summ";
-}
-</script>
-</head>
-
-<body onload="dom()">
-
-Both tables should look identical
-
-<table id="t2" border><caption>caption</caption><tbody><tr><td>cell1</td></tr></tbody></table>
-
-<table id="t2" summary="summ" border><caption>caption</caption><tbody><tr><td>cell1</td></tr></tbody></table>
-
-</body>
-
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<title>table dom test</title>
+<style type="text/css">
+  table {width:200px}
+table[summary="summ"] {font-size:24pt}
+</style>
+<script type="text/javascript">
+function dom(){
+var t = document.getElementById('t2');
+t.summary="summ";
+}
+</script>
+</head>
+
+<body onload="dom()">
+
+Both tables should look identical
+
+<table id="t2" border><caption>caption</caption><tbody><tr><td>cell1</td></tr></tbody></table>
+
+<table id="t2" summary="summ" border><caption>caption</caption><tbody><tr><td>cell1</td></tr></tbody></table>
+
+</body>
+
+</html>
--- mozilla-firefox-1.0.4.orig/layout/tools/BidiMirroring.txt
+++ mozilla-firefox-1.0.4/layout/tools/BidiMirroring.txt
@@ -1,238 +1,238 @@
-# BidiMirroring-1.txt
-# 
-# This file is an informative supplement to the UnicodeData file. It
-# lists characters that have the mirrored property
-# where there is another Unicode character that typically has a glyph
-# that is the mirror image of the original character's glyph.
-# The repertoire covered by the file is Unicode 3.0.1.
-# 
-# The file contains a list of lines with mappings from one code point
-# to another one for character-based mirroring.
-# Note that for "real" mirroring, a rendering engine needs to select
-# appropriate alternative glyphs, and that many Unicode characters do not
-# have a mirror-image Unicode character.
-# 
-# Each mapping line contains two fields, separated by a semicolon (';').
-# Each of the two fields contains a code point represented as a
-# variable-length hexadecimal value with 4 to 6 digits.
-# A comment indicates where the characters are "BEST FIT" mirroring.
-# 
-# Code points with the "mirrored" property but no appropriate mirrors are
-# listed as comments at the end of the file.
-# 
-# For information on bidi mirroring, see UTR #21: Bidirectional Algorithm,
-# at http://www.unicode.org/unicode/reports/tr9/
-# 
-# Please address any comments to <errata@unicode.org>.
-# Note that this is an archival address: messages will be checked,
-# but do not expect an immediate response.
-# 
-# This file was originally created by Markus Scherer
-# 
-# ############################################################
-
-0028; 0029 # LEFT PARENTHESIS
-0029; 0028 # RIGHT PARENTHESIS
-003C; 003E # LESS-THAN SIGN
-003E; 003C # GREATER-THAN SIGN
-005B; 005D # LEFT SQUARE BRACKET
-005D; 005B # RIGHT SQUARE BRACKET
-007B; 007D # LEFT CURLY BRACKET
-007D; 007B # RIGHT CURLY BRACKET
-00AB; 00BB # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
-00BB; 00AB # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
-2039; 203A # SINGLE LEFT-POINTING ANGLE QUOTATION MARK
-203A; 2039 # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
-2045; 2046 # LEFT SQUARE BRACKET WITH QUILL
-2046; 2045 # RIGHT SQUARE BRACKET WITH QUILL
-207D; 207E # SUPERSCRIPT LEFT PARENTHESIS
-207E; 207D # SUPERSCRIPT RIGHT PARENTHESIS
-208D; 208E # SUBSCRIPT LEFT PARENTHESIS
-208E; 208D # SUBSCRIPT RIGHT PARENTHESIS
-2208; 220B # ELEMENT OF
-2209; 220C # NOT AN ELEMENT OF
-220A; 220D # SMALL ELEMENT OF
-220B; 2208 # CONTAINS AS MEMBER
-220C; 2209 # DOES NOT CONTAIN AS MEMBER
-220D; 220A # SMALL CONTAINS AS MEMBER
-223C; 223D # TILDE OPERATOR
-223D; 223C # REVERSED TILDE
-2243; 22CD # ASYMPTOTICALLY EQUAL TO
-2252; 2253 # APPROXIMATELY EQUAL TO OR THE IMAGE OF
-2253; 2252 # IMAGE OF OR APPROXIMATELY EQUAL TO
-2254; 2255 # COLON EQUALS
-2255; 2254 # EQUALS COLON
-2264; 2265 # LESS-THAN OR EQUAL TO
-2265; 2264 # GREATER-THAN OR EQUAL TO
-2266; 2267 # LESS-THAN OVER EQUAL TO
-2267; 2266 # GREATER-THAN OVER EQUAL TO
-2268; 2269 # [BEST FIT] LESS-THAN BUT NOT EQUAL TO
-2269; 2268 # [BEST FIT] GREATER-THAN BUT NOT EQUAL TO
-226A; 226B # MUCH LESS-THAN
-226B; 226A # MUCH GREATER-THAN
-226E; 226F # [BEST FIT] NOT LESS-THAN
-226F; 226E # [BEST FIT] NOT GREATER-THAN
-2270; 2271 # [BEST FIT] NEITHER LESS-THAN NOR EQUAL TO
-2271; 2270 # [BEST FIT] NEITHER GREATER-THAN NOR EQUAL TO
-2272; 2273 # [BEST FIT] LESS-THAN OR EQUIVALENT TO
-2273; 2272 # [BEST FIT] GREATER-THAN OR EQUIVALENT TO
-2274; 2275 # [BEST FIT] NEITHER LESS-THAN NOR EQUIVALENT TO
-2275; 2274 # [BEST FIT] NEITHER GREATER-THAN NOR EQUIVALENT TO
-2276; 2277 # LESS-THAN OR GREATER-THAN
-2277; 2276 # GREATER-THAN OR LESS-THAN
-2278; 2279 # NEITHER LESS-THAN NOR GREATER-THAN
-2279; 2278 # NEITHER GREATER-THAN NOR LESS-THAN
-227A; 227B # PRECEDES
-227B; 227A # SUCCEEDS
-227C; 227D # PRECEDES OR EQUAL TO
-227D; 227C # SUCCEEDS OR EQUAL TO
-227E; 227F # [BEST FIT] PRECEDES OR EQUIVALENT TO
-227F; 227E # [BEST FIT] SUCCEEDS OR EQUIVALENT TO
-2280; 2281 # [BEST FIT] DOES NOT PRECEDE
-2281; 2280 # [BEST FIT] DOES NOT SUCCEED
-2282; 2283 # SUBSET OF
-2283; 2282 # SUPERSET OF
-2284; 2285 # [BEST FIT] NOT A SUBSET OF
-2285; 2284 # [BEST FIT] NOT A SUPERSET OF
-2286; 2287 # SUBSET OF OR EQUAL TO
-2287; 2286 # SUPERSET OF OR EQUAL TO
-2288; 2289 # [BEST FIT] NEITHER A SUBSET OF NOR EQUAL TO
-2289; 2288 # [BEST FIT] NEITHER A SUPERSET OF NOR EQUAL TO
-228A; 228B # [BEST FIT] SUBSET OF WITH NOT EQUAL TO
-228B; 228A # [BEST FIT] SUPERSET OF WITH NOT EQUAL TO
-228F; 2290 # SQUARE IMAGE OF
-2290; 228F # SQUARE ORIGINAL OF
-2291; 2292 # SQUARE IMAGE OF OR EQUAL TO
-2292; 2291 # SQUARE ORIGINAL OF OR EQUAL TO
-22A2; 22A3 # RIGHT TACK
-22A3; 22A2 # LEFT TACK
-22B0; 22B1 # PRECEDES UNDER RELATION
-22B1; 22B0 # SUCCEEDS UNDER RELATION
-22B2; 22B3 # NORMAL SUBGROUP OF
-22B3; 22B2 # CONTAINS AS NORMAL SUBGROUP
-22B4; 22B5 # NORMAL SUBGROUP OF OR EQUAL TO
-22B5; 22B4 # CONTAINS AS NORMAL SUBGROUP OR EQUAL TO
-22B6; 22B7 # ORIGINAL OF
-22B7; 22B6 # IMAGE OF
-22C9; 22CA # LEFT NORMAL FACTOR SEMIDIRECT PRODUCT
-22CA; 22C9 # RIGHT NORMAL FACTOR SEMIDIRECT PRODUCT
-22CB; 22CC # LEFT SEMIDIRECT PRODUCT
-22CC; 22CB # RIGHT SEMIDIRECT PRODUCT
-22CD; 2243 # REVERSED TILDE EQUALS
-22D0; 22D1 # DOUBLE SUBSET
-22D1; 22D0 # DOUBLE SUPERSET
-22D6; 22D7 # LESS-THAN WITH DOT
-22D7; 22D6 # GREATER-THAN WITH DOT
-22D8; 22D9 # VERY MUCH LESS-THAN
-22D9; 22D8 # VERY MUCH GREATER-THAN
-22DA; 22DB # LESS-THAN EQUAL TO OR GREATER-THAN
-22DB; 22DA # GREATER-THAN EQUAL TO OR LESS-THAN
-22DC; 22DD # EQUAL TO OR LESS-THAN
-22DD; 22DC # EQUAL TO OR GREATER-THAN
-22DE; 22DF # EQUAL TO OR PRECEDES
-22DF; 22DE # EQUAL TO OR SUCCEEDS
-22E0; 22E1 # [BEST FIT] DOES NOT PRECEDE OR EQUAL
-22E1; 22E0 # [BEST FIT] DOES NOT SUCCEED OR EQUAL
-22E2; 22E3 # [BEST FIT] NOT SQUARE IMAGE OF OR EQUAL TO
-22E3; 22E2 # [BEST FIT] NOT SQUARE ORIGINAL OF OR EQUAL TO
-22E4; 22E5 # [BEST FIT] SQUARE IMAGE OF OR NOT EQUAL TO
-22E5; 22E4 # [BEST FIT] SQUARE ORIGINAL OF OR NOT EQUAL TO
-22E6; 22E7 # [BEST FIT] LESS-THAN BUT NOT EQUIVALENT TO
-22E7; 22E6 # [BEST FIT] GREATER-THAN BUT NOT EQUIVALENT TO
-22E8; 22E9 # [BEST FIT] PRECEDES BUT NOT EQUIVALENT TO
-22E9; 22E8 # [BEST FIT] SUCCEEDS BUT NOT EQUIVALENT TO
-22EA; 22EB # [BEST FIT] NOT NORMAL SUBGROUP OF
-22EB; 22EA # [BEST FIT] DOES NOT CONTAIN AS NORMAL SUBGROUP
-22EC; 22ED # [BEST FIT] NOT NORMAL SUBGROUP OF OR EQUAL TO
-22ED; 22EC # [BEST FIT] DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL
-22F0; 22F1 # UP RIGHT DIAGONAL ELLIPSIS
-22F1; 22F0 # DOWN RIGHT DIAGONAL ELLIPSIS
-2308; 2309 # LEFT CEILING
-2309; 2308 # RIGHT CEILING
-230A; 230B # LEFT FLOOR
-230B; 230A # RIGHT FLOOR
-2329; 232A # LEFT-POINTING ANGLE BRACKET
-232A; 2329 # RIGHT-POINTING ANGLE BRACKET
-3008; 3009 # LEFT ANGLE BRACKET
-3009; 3008 # RIGHT ANGLE BRACKET
-300A; 300B # LEFT DOUBLE ANGLE BRACKET
-300B; 300A # RIGHT DOUBLE ANGLE BRACKET
-300C; 300D # [BEST FIT] LEFT CORNER BRACKET
-300D; 300C # [BEST FIT] RIGHT CORNER BRACKET
-300E; 300F # [BEST FIT] LEFT WHITE CORNER BRACKET
-300F; 300E # [BEST FIT] RIGHT WHITE CORNER BRACKET
-3010; 3011 # LEFT BLACK LENTICULAR BRACKET
-3011; 3010 # RIGHT BLACK LENTICULAR BRACKET
-3014; 3015 # [BEST FIT] LEFT TORTOISE SHELL BRACKET
-3015; 3014 # [BEST FIT] RIGHT TORTOISE SHELL BRACKET
-3016; 3017 # LEFT WHITE LENTICULAR BRACKET
-3017; 3016 # RIGHT WHITE LENTICULAR BRACKET
-3018; 3019 # LEFT WHITE TORTOISE SHELL BRACKET
-3019; 3018 # RIGHT WHITE TORTOISE SHELL BRACKET
-301A; 301B # LEFT WHITE SQUARE BRACKET
-301B; 301A # RIGHT WHITE SQUARE BRACKET
-
-# The following characters have no appropriate mirroring character
-
-# 2201; COMPLEMENT
-# 2202; PARTIAL DIFFERENTIAL
-# 2203; THERE EXISTS
-# 2204; THERE DOES NOT EXIST
-# 2211; N-ARY SUMMATION
-# 2215; DIVISION SLASH
-# 2216; SET MINUS
-# 221A; SQUARE ROOT
-# 221B; CUBE ROOT
-# 221C; FOURTH ROOT
-# 221D; PROPORTIONAL TO
-# 221F; RIGHT ANGLE
-# 2220; ANGLE
-# 2221; MEASURED ANGLE
-# 2222; SPHERICAL ANGLE
-# 2224; DOES NOT DIVIDE
-# 2226; NOT PARALLEL TO
-# 222B; INTEGRAL
-# 222C; DOUBLE INTEGRAL
-# 222D; TRIPLE INTEGRAL
-# 222E; CONTOUR INTEGRAL
-# 222F; SURFACE INTEGRAL
-# 2230; VOLUME INTEGRAL
-# 2231; CLOCKWISE INTEGRAL
-# 2232; CLOCKWISE CONTOUR INTEGRAL
-# 2233; ANTICLOCKWISE CONTOUR INTEGRAL
-# 2239; EXCESS
-# 223B; HOMOTHETIC
-# 223E; INVERTED LAZY S
-# 223F; SINE WAVE
-# 2240; WREATH PRODUCT
-# 2241; NOT TILDE
-# 2242; MINUS TILDE
-# 2244; NOT ASYMPTOTICALLY EQUAL TO
-# 2245; APPROXIMATELY EQUAL TO
-# 2246; APPROXIMATELY BUT NOT ACTUALLY EQUAL TO
-# 2247; NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO
-# 2248; ALMOST EQUAL TO
-# 2249; NOT ALMOST EQUAL TO
-# 224A; ALMOST EQUAL OR EQUAL TO
-# 224B; TRIPLE TILDE
-# 224C; ALL EQUAL TO
-# 225F; QUESTIONED EQUAL TO
-# 2260; NOT EQUAL TO
-# 2262; NOT IDENTICAL TO
-# 228C; MULTISET
-# 2298; CIRCLED DIVISION SLASH
-# 22A6; ASSERTION
-# 22A7; MODELS
-# 22A8; TRUE
-# 22A9; FORCES
-# 22AA; TRIPLE VERTICAL BAR RIGHT TURNSTILE
-# 22AB; DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE
-# 22AC; DOES NOT PROVE
-# 22AD; NOT TRUE
-# 22AE; DOES NOT FORCE
-# 22AF; NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE
-# 22B8; MULTIMAP
-# 22BE; RIGHT ANGLE WITH ARC
-# 22BF; RIGHT TRIANGLE
-# 2320; TOP HALF INTEGRAL
-# 2321; BOTTOM HALF INTEGRAL
+# BidiMirroring-1.txt
+# 
+# This file is an informative supplement to the UnicodeData file. It
+# lists characters that have the mirrored property
+# where there is another Unicode character that typically has a glyph
+# that is the mirror image of the original character's glyph.
+# The repertoire covered by the file is Unicode 3.0.1.
+# 
+# The file contains a list of lines with mappings from one code point
+# to another one for character-based mirroring.
+# Note that for "real" mirroring, a rendering engine needs to select
+# appropriate alternative glyphs, and that many Unicode characters do not
+# have a mirror-image Unicode character.
+# 
+# Each mapping line contains two fields, separated by a semicolon (';').
+# Each of the two fields contains a code point represented as a
+# variable-length hexadecimal value with 4 to 6 digits.
+# A comment indicates where the characters are "BEST FIT" mirroring.
+# 
+# Code points with the "mirrored" property but no appropriate mirrors are
+# listed as comments at the end of the file.
+# 
+# For information on bidi mirroring, see UTR #21: Bidirectional Algorithm,
+# at http://www.unicode.org/unicode/reports/tr9/
+# 
+# Please address any comments to <errata@unicode.org>.
+# Note that this is an archival address: messages will be checked,
+# but do not expect an immediate response.
+# 
+# This file was originally created by Markus Scherer
+# 
+# ############################################################
+
+0028; 0029 # LEFT PARENTHESIS
+0029; 0028 # RIGHT PARENTHESIS
+003C; 003E # LESS-THAN SIGN
+003E; 003C # GREATER-THAN SIGN
+005B; 005D # LEFT SQUARE BRACKET
+005D; 005B # RIGHT SQUARE BRACKET
+007B; 007D # LEFT CURLY BRACKET
+007D; 007B # RIGHT CURLY BRACKET
+00AB; 00BB # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+00BB; 00AB # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+2039; 203A # SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+203A; 2039 # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+2045; 2046 # LEFT SQUARE BRACKET WITH QUILL
+2046; 2045 # RIGHT SQUARE BRACKET WITH QUILL
+207D; 207E # SUPERSCRIPT LEFT PARENTHESIS
+207E; 207D # SUPERSCRIPT RIGHT PARENTHESIS
+208D; 208E # SUBSCRIPT LEFT PARENTHESIS
+208E; 208D # SUBSCRIPT RIGHT PARENTHESIS
+2208; 220B # ELEMENT OF
+2209; 220C # NOT AN ELEMENT OF
+220A; 220D # SMALL ELEMENT OF
+220B; 2208 # CONTAINS AS MEMBER
+220C; 2209 # DOES NOT CONTAIN AS MEMBER
+220D; 220A # SMALL CONTAINS AS MEMBER
+223C; 223D # TILDE OPERATOR
+223D; 223C # REVERSED TILDE
+2243; 22CD # ASYMPTOTICALLY EQUAL TO
+2252; 2253 # APPROXIMATELY EQUAL TO OR THE IMAGE OF
+2253; 2252 # IMAGE OF OR APPROXIMATELY EQUAL TO
+2254; 2255 # COLON EQUALS
+2255; 2254 # EQUALS COLON
+2264; 2265 # LESS-THAN OR EQUAL TO
+2265; 2264 # GREATER-THAN OR EQUAL TO
+2266; 2267 # LESS-THAN OVER EQUAL TO
+2267; 2266 # GREATER-THAN OVER EQUAL TO
+2268; 2269 # [BEST FIT] LESS-THAN BUT NOT EQUAL TO
+2269; 2268 # [BEST FIT] GREATER-THAN BUT NOT EQUAL TO
+226A; 226B # MUCH LESS-THAN
+226B; 226A # MUCH GREATER-THAN
+226E; 226F # [BEST FIT] NOT LESS-THAN
+226F; 226E # [BEST FIT] NOT GREATER-THAN
+2270; 2271 # [BEST FIT] NEITHER LESS-THAN NOR EQUAL TO
+2271; 2270 # [BEST FIT] NEITHER GREATER-THAN NOR EQUAL TO
+2272; 2273 # [BEST FIT] LESS-THAN OR EQUIVALENT TO
+2273; 2272 # [BEST FIT] GREATER-THAN OR EQUIVALENT TO
+2274; 2275 # [BEST FIT] NEITHER LESS-THAN NOR EQUIVALENT TO
+2275; 2274 # [BEST FIT] NEITHER GREATER-THAN NOR EQUIVALENT TO
+2276; 2277 # LESS-THAN OR GREATER-THAN
+2277; 2276 # GREATER-THAN OR LESS-THAN
+2278; 2279 # NEITHER LESS-THAN NOR GREATER-THAN
+2279; 2278 # NEITHER GREATER-THAN NOR LESS-THAN
+227A; 227B # PRECEDES
+227B; 227A # SUCCEEDS
+227C; 227D # PRECEDES OR EQUAL TO
+227D; 227C # SUCCEEDS OR EQUAL TO
+227E; 227F # [BEST FIT] PRECEDES OR EQUIVALENT TO
+227F; 227E # [BEST FIT] SUCCEEDS OR EQUIVALENT TO
+2280; 2281 # [BEST FIT] DOES NOT PRECEDE
+2281; 2280 # [BEST FIT] DOES NOT SUCCEED
+2282; 2283 # SUBSET OF
+2283; 2282 # SUPERSET OF
+2284; 2285 # [BEST FIT] NOT A SUBSET OF
+2285; 2284 # [BEST FIT] NOT A SUPERSET OF
+2286; 2287 # SUBSET OF OR EQUAL TO
+2287; 2286 # SUPERSET OF OR EQUAL TO
+2288; 2289 # [BEST FIT] NEITHER A SUBSET OF NOR EQUAL TO
+2289; 2288 # [BEST FIT] NEITHER A SUPERSET OF NOR EQUAL TO
+228A; 228B # [BEST FIT] SUBSET OF WITH NOT EQUAL TO
+228B; 228A # [BEST FIT] SUPERSET OF WITH NOT EQUAL TO
+228F; 2290 # SQUARE IMAGE OF
+2290; 228F # SQUARE ORIGINAL OF
+2291; 2292 # SQUARE IMAGE OF OR EQUAL TO
+2292; 2291 # SQUARE ORIGINAL OF OR EQUAL TO
+22A2; 22A3 # RIGHT TACK
+22A3; 22A2 # LEFT TACK
+22B0; 22B1 # PRECEDES UNDER RELATION
+22B1; 22B0 # SUCCEEDS UNDER RELATION
+22B2; 22B3 # NORMAL SUBGROUP OF
+22B3; 22B2 # CONTAINS AS NORMAL SUBGROUP
+22B4; 22B5 # NORMAL SUBGROUP OF OR EQUAL TO
+22B5; 22B4 # CONTAINS AS NORMAL SUBGROUP OR EQUAL TO
+22B6; 22B7 # ORIGINAL OF
+22B7; 22B6 # IMAGE OF
+22C9; 22CA # LEFT NORMAL FACTOR SEMIDIRECT PRODUCT
+22CA; 22C9 # RIGHT NORMAL FACTOR SEMIDIRECT PRODUCT
+22CB; 22CC # LEFT SEMIDIRECT PRODUCT
+22CC; 22CB # RIGHT SEMIDIRECT PRODUCT
+22CD; 2243 # REVERSED TILDE EQUALS
+22D0; 22D1 # DOUBLE SUBSET
+22D1; 22D0 # DOUBLE SUPERSET
+22D6; 22D7 # LESS-THAN WITH DOT
+22D7; 22D6 # GREATER-THAN WITH DOT
+22D8; 22D9 # VERY MUCH LESS-THAN
+22D9; 22D8 # VERY MUCH GREATER-THAN
+22DA; 22DB # LESS-THAN EQUAL TO OR GREATER-THAN
+22DB; 22DA # GREATER-THAN EQUAL TO OR LESS-THAN
+22DC; 22DD # EQUAL TO OR LESS-THAN
+22DD; 22DC # EQUAL TO OR GREATER-THAN
+22DE; 22DF # EQUAL TO OR PRECEDES
+22DF; 22DE # EQUAL TO OR SUCCEEDS
+22E0; 22E1 # [BEST FIT] DOES NOT PRECEDE OR EQUAL
+22E1; 22E0 # [BEST FIT] DOES NOT SUCCEED OR EQUAL
+22E2; 22E3 # [BEST FIT] NOT SQUARE IMAGE OF OR EQUAL TO
+22E3; 22E2 # [BEST FIT] NOT SQUARE ORIGINAL OF OR EQUAL TO
+22E4; 22E5 # [BEST FIT] SQUARE IMAGE OF OR NOT EQUAL TO
+22E5; 22E4 # [BEST FIT] SQUARE ORIGINAL OF OR NOT EQUAL TO
+22E6; 22E7 # [BEST FIT] LESS-THAN BUT NOT EQUIVALENT TO
+22E7; 22E6 # [BEST FIT] GREATER-THAN BUT NOT EQUIVALENT TO
+22E8; 22E9 # [BEST FIT] PRECEDES BUT NOT EQUIVALENT TO
+22E9; 22E8 # [BEST FIT] SUCCEEDS BUT NOT EQUIVALENT TO
+22EA; 22EB # [BEST FIT] NOT NORMAL SUBGROUP OF
+22EB; 22EA # [BEST FIT] DOES NOT CONTAIN AS NORMAL SUBGROUP
+22EC; 22ED # [BEST FIT] NOT NORMAL SUBGROUP OF OR EQUAL TO
+22ED; 22EC # [BEST FIT] DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL
+22F0; 22F1 # UP RIGHT DIAGONAL ELLIPSIS
+22F1; 22F0 # DOWN RIGHT DIAGONAL ELLIPSIS
+2308; 2309 # LEFT CEILING
+2309; 2308 # RIGHT CEILING
+230A; 230B # LEFT FLOOR
+230B; 230A # RIGHT FLOOR
+2329; 232A # LEFT-POINTING ANGLE BRACKET
+232A; 2329 # RIGHT-POINTING ANGLE BRACKET
+3008; 3009 # LEFT ANGLE BRACKET
+3009; 3008 # RIGHT ANGLE BRACKET
+300A; 300B # LEFT DOUBLE ANGLE BRACKET
+300B; 300A # RIGHT DOUBLE ANGLE BRACKET
+300C; 300D # [BEST FIT] LEFT CORNER BRACKET
+300D; 300C # [BEST FIT] RIGHT CORNER BRACKET
+300E; 300F # [BEST FIT] LEFT WHITE CORNER BRACKET
+300F; 300E # [BEST FIT] RIGHT WHITE CORNER BRACKET
+3010; 3011 # LEFT BLACK LENTICULAR BRACKET
+3011; 3010 # RIGHT BLACK LENTICULAR BRACKET
+3014; 3015 # [BEST FIT] LEFT TORTOISE SHELL BRACKET
+3015; 3014 # [BEST FIT] RIGHT TORTOISE SHELL BRACKET
+3016; 3017 # LEFT WHITE LENTICULAR BRACKET
+3017; 3016 # RIGHT WHITE LENTICULAR BRACKET
+3018; 3019 # LEFT WHITE TORTOISE SHELL BRACKET
+3019; 3018 # RIGHT WHITE TORTOISE SHELL BRACKET
+301A; 301B # LEFT WHITE SQUARE BRACKET
+301B; 301A # RIGHT WHITE SQUARE BRACKET
+
+# The following characters have no appropriate mirroring character
+
+# 2201; COMPLEMENT
+# 2202; PARTIAL DIFFERENTIAL
+# 2203; THERE EXISTS
+# 2204; THERE DOES NOT EXIST
+# 2211; N-ARY SUMMATION
+# 2215; DIVISION SLASH
+# 2216; SET MINUS
+# 221A; SQUARE ROOT
+# 221B; CUBE ROOT
+# 221C; FOURTH ROOT
+# 221D; PROPORTIONAL TO
+# 221F; RIGHT ANGLE
+# 2220; ANGLE
+# 2221; MEASURED ANGLE
+# 2222; SPHERICAL ANGLE
+# 2224; DOES NOT DIVIDE
+# 2226; NOT PARALLEL TO
+# 222B; INTEGRAL
+# 222C; DOUBLE INTEGRAL
+# 222D; TRIPLE INTEGRAL
+# 222E; CONTOUR INTEGRAL
+# 222F; SURFACE INTEGRAL
+# 2230; VOLUME INTEGRAL
+# 2231; CLOCKWISE INTEGRAL
+# 2232; CLOCKWISE CONTOUR INTEGRAL
+# 2233; ANTICLOCKWISE CONTOUR INTEGRAL
+# 2239; EXCESS
+# 223B; HOMOTHETIC
+# 223E; INVERTED LAZY S
+# 223F; SINE WAVE
+# 2240; WREATH PRODUCT
+# 2241; NOT TILDE
+# 2242; MINUS TILDE
+# 2244; NOT ASYMPTOTICALLY EQUAL TO
+# 2245; APPROXIMATELY EQUAL TO
+# 2246; APPROXIMATELY BUT NOT ACTUALLY EQUAL TO
+# 2247; NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO
+# 2248; ALMOST EQUAL TO
+# 2249; NOT ALMOST EQUAL TO
+# 224A; ALMOST EQUAL OR EQUAL TO
+# 224B; TRIPLE TILDE
+# 224C; ALL EQUAL TO
+# 225F; QUESTIONED EQUAL TO
+# 2260; NOT EQUAL TO
+# 2262; NOT IDENTICAL TO
+# 228C; MULTISET
+# 2298; CIRCLED DIVISION SLASH
+# 22A6; ASSERTION
+# 22A7; MODELS
+# 22A8; TRUE
+# 22A9; FORCES
+# 22AA; TRIPLE VERTICAL BAR RIGHT TURNSTILE
+# 22AB; DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE
+# 22AC; DOES NOT PROVE
+# 22AD; NOT TRUE
+# 22AE; DOES NOT FORCE
+# 22AF; NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE
+# 22B8; MULTIMAP
+# 22BE; RIGHT ANGLE WITH ARC
+# 22BF; RIGHT TRIANGLE
+# 2320; TOP HALF INTEGRAL
+# 2321; BOTTOM HALF INTEGRAL
--- mozilla-firefox-1.0.4.orig/layout/xul/base/src/nsBoxFrame.cpp
+++ mozilla-firefox-1.0.4/layout/xul/base/src/nsBoxFrame.cpp
@@ -104,6 +104,7 @@
 #include "nsIEventListenerManager.h"
 #include "nsIEventStateManager.h"
 #include "nsIDOMEvent.h"
+#include "nsIPrivateDOMEvent.h"
 
 // Needed for Print Preview
 #include "nsIDocument.h"
@@ -2634,6 +2635,10 @@
         NS_SUCCEEDED(manager->CreateEvent(aPresContext, nsnull, NS_LITERAL_STRING("Events"), getter_AddRefs(event)))) {
       event->InitEvent(aDOMEventName, PR_TRUE, PR_TRUE);
       PRBool noDefault;
+
+      nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));
+      privateEvent->SetTrusted(PR_TRUE);
+
       aPresContext->EventStateManager()->DispatchNewEvent(mContent, event,
                                                           &noDefault);
     }
--- mozilla-firefox-1.0.4.orig/layout/xul/base/src/nsButtonBoxFrame.cpp
+++ mozilla-firefox-1.0.4/layout/xul/base/src/nsButtonBoxFrame.cpp
@@ -151,7 +151,7 @@
 }
 
 void 
-nsButtonBoxFrame::MouseClicked (nsIPresContext* aPresContext, nsGUIEvent* aEvent) 
+nsButtonBoxFrame::DoMouseClick(nsGUIEvent* aEvent, PRBool aTrustEvent)
 {
   // Don't execute if we're disabled.
   nsAutoString disabled;
@@ -161,7 +161,8 @@
 
   // Execute the oncommand event handler.
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(NS_XUL_COMMAND);
+  nsMouseEvent event(aEvent ? NS_IS_TRUSTED_EVENT(aEvent) : aTrustEvent,
+                     NS_XUL_COMMAND, nsnull);
   if(aEvent) {
     event.isShift = ((nsInputEvent*)(aEvent))->isShift;
     event.isControl = ((nsInputEvent*)(aEvent))->isControl;
@@ -170,7 +171,7 @@
   }
 
   // Have the content handle the event, propagating it according to normal DOM rules.
-  nsIPresShell *shell = aPresContext->GetPresShell();
+  nsIPresShell *shell = GetPresContext()->GetPresShell();
   if (shell) {
     shell->HandleDOMEventWithTarget(mContent, &event, &status);
     // shell may no longer be alive, don't use it here unless you keep a ref
--- mozilla-firefox-1.0.4.orig/layout/xul/base/src/nsButtonBoxFrame.h
+++ mozilla-firefox-1.0.4/layout/xul/base/src/nsButtonBoxFrame.h
@@ -58,9 +58,14 @@
 
   NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough);
 
-  virtual void MouseClicked (nsIPresContext* aPresContext, nsGUIEvent* aEvent);
-
+  virtual void MouseClicked (nsIPresContext* aPresContext, nsGUIEvent* aEvent)
+  { DoMouseClick(aEvent, PR_FALSE); }
 
+  /**
+   * Our implementation of MouseClicked.
+   * @param aTrustEvent if PR_TRUE and aEvent is null, then assume the event was trusted
+   */
+  void DoMouseClick(nsGUIEvent* aEvent, PRBool aTrustEvent);
 }; // class nsButtonBoxFrame
 
 #endif /* nsButtonBoxFrame_h___ */
--- mozilla-firefox-1.0.4.orig/layout/xul/base/src/nsImageBoxFrame.cpp
+++ mozilla-firefox-1.0.4/layout/xul/base/src/nsImageBoxFrame.cpp
@@ -131,7 +131,7 @@
   }
 
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsEvent event(aMessage);
+  nsEvent event(PR_TRUE, aMessage);
 
   aContent->HandleDOMEvent(pres_context, &event, nsnull, aFlags, &status);
 }
--- mozilla-firefox-1.0.4.orig/layout/xul/base/src/nsMenuFrame.cpp
+++ mozilla-firefox-1.0.4/layout/xul/base/src/nsMenuFrame.cpp
@@ -85,6 +85,8 @@
 #include "nsGUIEvent.h"
 #include "nsIEventStateManager.h"
 #include "nsITimerInternal.h"
+#include "nsContentUtils.h"
+
 #define NS_MENU_POPUP_LIST_INDEX   0
 
 #if defined(XP_WIN) || defined(XP_OS2)
@@ -1648,7 +1650,11 @@
 
 
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(NS_XUL_COMMAND);
+  // Create a trusted event if the triggering event was trusted, or if
+  // we're called from chrome code (since at least one of our caller
+  // passes in a null event).
+  nsMouseEvent event(aEvent ? NS_IS_TRUSTED_EVENT(aEvent) :
+                     nsContentUtils::IsCallerChrome(), NS_XUL_COMMAND, nsnull);
   if (aEvent && (aEvent->eventStructType == NS_MOUSE_EVENT ||
                  aEvent->eventStructType == NS_KEY_EVENT ||
                  aEvent->eventStructType == NS_ACCESSIBLE_EVENT)) {
@@ -1693,8 +1699,8 @@
 nsMenuFrame::OnCreate()
 {
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(NS_XUL_POPUP_SHOWING);
-  
+  nsMouseEvent event(PR_TRUE, NS_XUL_POPUP_SHOWING, nsnull);
+
   nsCOMPtr<nsIContent> child;
   GetMenuChildrenElement(getter_AddRefs(child));
   
@@ -1782,8 +1788,8 @@
 nsMenuFrame::OnCreated()
 {
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(NS_XUL_POPUP_SHOWN);
-  
+  nsMouseEvent event(PR_TRUE, NS_XUL_POPUP_SHOWN, nsnull);
+
   nsCOMPtr<nsIContent> child;
   GetMenuChildrenElement(getter_AddRefs(child));
   
@@ -1808,8 +1814,8 @@
 nsMenuFrame::OnDestroy()
 {
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(NS_XUL_POPUP_HIDING);
-  
+  nsMouseEvent event(PR_TRUE, NS_XUL_POPUP_HIDING, nsnull);
+
   nsCOMPtr<nsIContent> child;
   GetMenuChildrenElement(getter_AddRefs(child));
   
@@ -1834,8 +1840,8 @@
 nsMenuFrame::OnDestroyed()
 {
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(NS_XUL_POPUP_HIDDEN);
-  
+  nsMouseEvent event(PR_TRUE, NS_XUL_POPUP_HIDDEN, nsnull);
+
   nsCOMPtr<nsIContent> child;
   GetMenuChildrenElement(getter_AddRefs(child));
   
--- mozilla-firefox-1.0.4.orig/layout/xul/base/src/nsPopupSetFrame.cpp
+++ mozilla-firefox-1.0.4/layout/xul/base/src/nsPopupSetFrame.cpp
@@ -573,7 +573,7 @@
 nsPopupSetFrame::OnCreate(PRInt32 aX, PRInt32 aY, nsIContent* aPopupContent)
 {
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(NS_XUL_POPUP_SHOWING);
+  nsMouseEvent event(PR_TRUE, NS_XUL_POPUP_SHOWING, nsnull);
   event.point.x = aX;
   event.point.y = aY;
 
@@ -650,7 +650,7 @@
 nsPopupSetFrame::OnCreated(PRInt32 aX, PRInt32 aY, nsIContent* aPopupContent)
 {
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(NS_XUL_POPUP_SHOWN);
+  nsMouseEvent event(PR_TRUE, NS_XUL_POPUP_SHOWN, nsnull);
   event.point.x = aX;
   event.point.y = aY;
 
@@ -672,8 +672,8 @@
 nsPopupSetFrame::OnDestroy(nsIContent* aPopupContent)
 {
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(NS_XUL_POPUP_HIDING);
- 
+  nsMouseEvent event(PR_TRUE, NS_XUL_POPUP_HIDING, nsnull);
+
   if (aPopupContent) {
     nsIPresShell *shell = mPresContext->GetPresShell();
     if (shell) {
@@ -691,7 +691,7 @@
 nsPopupSetFrame::OnDestroyed(nsIContent* aPopupContent)
 {
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(NS_XUL_POPUP_HIDDEN);
+  nsMouseEvent event(PR_TRUE, NS_XUL_POPUP_HIDDEN, nsnull);
 
   if (aPopupContent) {
     nsIPresShell *shell = mPresContext->GetPresShell();
--- mozilla-firefox-1.0.4.orig/layout/xul/base/src/nsResizerFrame.cpp
+++ mozilla-firefox-1.0.4/layout/xul/base/src/nsResizerFrame.cpp
@@ -249,7 +249,7 @@
 
 
     case NS_MOUSE_LEFT_CLICK:
-      MouseClicked(aPresContext);
+      MouseClicked(aPresContext, aEvent);
       break;
   }
   
@@ -355,10 +355,14 @@
 
 
 void 
-nsResizerFrame::MouseClicked (nsIPresContext* aPresContext) 
+nsResizerFrame::MouseClicked(nsIPresContext* aPresContext, nsGUIEvent *aEvent) 
 {
   // Execute the oncommand event handler.
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(NS_XUL_COMMAND);
-  mContent->HandleDOMEvent(aPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
+
+  nsMouseEvent event(aEvent ? NS_IS_TRUSTED_EVENT(aEvent) : PR_FALSE,
+                     NS_XUL_COMMAND, nsnull);
+
+  mContent->HandleDOMEvent(aPresContext, &event, nsnull, NS_EVENT_FLAG_INIT,
+                           &status);
 }
--- mozilla-firefox-1.0.4.orig/layout/xul/base/src/nsResizerFrame.h
+++ mozilla-firefox-1.0.4/layout/xul/base/src/nsResizerFrame.h
@@ -78,7 +78,7 @@
                               nsIAtom* aAttribute,
                               PRInt32 aModType);
 
-  virtual void MouseClicked (nsIPresContext* aPresContext);
+  virtual void MouseClicked(nsIPresContext* aPresContext, nsGUIEvent *aEvent);
 
 protected:
 	PRBool GetInitialDirection(eDirection& aDirection);
--- mozilla-firefox-1.0.4.orig/layout/xul/base/src/nsScrollBoxFrame.cpp
+++ mozilla-firefox-1.0.4/layout/xul/base/src/nsScrollBoxFrame.cpp
@@ -506,9 +506,11 @@
   if (!mContent)
     return;
 
-  nsScrollPortEvent* event = new nsScrollPortEvent(aOverflow ?
+  nsScrollPortEvent* event = new nsScrollPortEvent(PR_TRUE,
+                                                   aOverflow ?
                                                    NS_SCROLLPORT_OVERFLOW :
-                                                   NS_SCROLLPORT_UNDERFLOW);
+                                                   NS_SCROLLPORT_UNDERFLOW,
+                                                   nsnull);
   event->orient = aType;
   aShell->PostDOMEvent(mContent, event);
 }
@@ -786,15 +788,10 @@
                          nsGUIEvent* aEvent,
                          nsEventStatus* aEventStatus);
 
-  NS_IMETHOD Init(nsIPresContext*  aPresContext,
-              nsIContent*      aContent,
-              nsIFrame*        aParent,
-              nsStyleContext*  aContext,
-              nsIFrame*        aPrevInFlow);
-
   NS_DECL_NSITIMERCALLBACK
-  nsIPresContext* mPresContext;
-  
+
+protected:
+  PRPackedBool mTrustedEvent;
 };
 
 nsresult
@@ -819,16 +816,6 @@
 {
 }
 
-NS_IMETHODIMP
-nsAutoRepeatBoxFrame::Init(nsIPresContext*  aPresContext,
-              nsIContent*      aContent,
-              nsIFrame*        aParent,
-              nsStyleContext*  aContext,
-              nsIFrame*        aPrevInFlow)
-{
-  mPresContext = aPresContext;
-  return nsButtonBoxFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
-}
 
 NS_INTERFACE_MAP_BEGIN(nsAutoRepeatBoxFrame)
   NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
@@ -847,12 +834,15 @@
     case NS_MOUSE_ENTER:
     case NS_MOUSE_ENTER_SYNTH:
        nsRepeatService::GetInstance()->Start(this);
-    break;
+       mTrustedEvent = NS_IS_TRUSTED_EVENT(aEvent);
+       break;
 
     case NS_MOUSE_EXIT:
     case NS_MOUSE_EXIT_SYNTH:
        nsRepeatService::GetInstance()->Stop();
-    break;
+       // Not really necessary but do this to be safe
+       mTrustedEvent = PR_FALSE;
+       break;
   }
      
   return nsButtonBoxFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
@@ -861,7 +851,7 @@
 NS_IMETHODIMP
 nsAutoRepeatBoxFrame::Notify(nsITimer *timer)
 {
-  MouseClicked(mPresContext, nsnull);
+  DoMouseClick(nsnull, mTrustedEvent);
   return NS_OK;
 }
 
--- mozilla-firefox-1.0.4.orig/layout/xul/base/src/nsScrollbarButtonFrame.cpp
+++ mozilla-firefox-1.0.4/layout/xul/base/src/nsScrollbarButtonFrame.cpp
@@ -99,8 +99,8 @@
 
 NS_IMETHODIMP
 nsScrollbarButtonFrame::HandleEvent(nsIPresContext* aPresContext, 
-                                      nsGUIEvent* aEvent,
-                                      nsEventStatus* aEventStatus)
+                                    nsGUIEvent* aEvent,
+                                    nsEventStatus* aEventStatus)
 {  
   // XXX hack until handle release is actually called in nsframe.
   if (aEvent->message == NS_MOUSE_EXIT_SYNTH|| aEvent->message == NS_MOUSE_RIGHT_BUTTON_UP || aEvent->message == NS_MOUSE_LEFT_BUTTON_UP)
@@ -112,8 +112,8 @@
 
 NS_IMETHODIMP
 nsScrollbarButtonFrame::HandlePress(nsIPresContext* aPresContext, 
-                     nsGUIEvent*     aEvent,
-                     nsEventStatus*  aEventStatus)
+                                    nsGUIEvent*     aEvent,
+                                    nsEventStatus*  aEventStatus)
 {
   MouseClicked();
   nsRepeatService::GetInstance()->Start(this);
@@ -122,8 +122,8 @@
 
 NS_IMETHODIMP 
 nsScrollbarButtonFrame::HandleRelease(nsIPresContext* aPresContext, 
-                                 nsGUIEvent*     aEvent,
-                                 nsEventStatus*  aEventStatus)
+                                      nsGUIEvent*     aEvent,
+                                      nsEventStatus*  aEventStatus)
 {
   nsRepeatService::GetInstance()->Stop();
   return NS_OK;
--- mozilla-firefox-1.0.4.orig/layout/xul/base/src/nsTitleBarFrame.cpp
+++ mozilla-firefox-1.0.4/layout/xul/base/src/nsTitleBarFrame.cpp
@@ -191,7 +191,7 @@
 
 
     case NS_MOUSE_LEFT_CLICK:
-      MouseClicked(aPresContext);
+      MouseClicked(aPresContext, aEvent);
       break;
   }
   
@@ -231,10 +231,14 @@
 
 
 void 
-nsTitleBarFrame::MouseClicked (nsIPresContext* aPresContext) 
+nsTitleBarFrame::MouseClicked(nsIPresContext* aPresContext, nsGUIEvent* aEvent) 
 {
   // Execute the oncommand event handler.
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(NS_XUL_COMMAND);
-  mContent->HandleDOMEvent(aPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
+
+  nsMouseEvent event(aEvent ? NS_IS_TRUSTED_EVENT(aEvent) : PR_FALSE,
+                     NS_XUL_COMMAND, nsnull);
+
+  mContent->HandleDOMEvent(aPresContext, &event, nsnull, NS_EVENT_FLAG_INIT,
+                           &status);
 }
--- mozilla-firefox-1.0.4.orig/layout/xul/base/src/nsTitleBarFrame.h
+++ mozilla-firefox-1.0.4/layout/xul/base/src/nsTitleBarFrame.h
@@ -65,7 +65,7 @@
 
   NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough);
 
-  virtual void MouseClicked (nsIPresContext* aPresContext);
+  virtual void MouseClicked(nsIPresContext* aPresContext, nsGUIEvent* aEvent);
 
 protected:
 
--- mozilla-firefox-1.0.4.orig/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
+++ mozilla-firefox-1.0.4/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
@@ -1050,8 +1050,8 @@
   }
  
   if (verticalOverflowChanged) {
-    nsScrollPortEvent event(mVerticalOverflow ? NS_SCROLLPORT_OVERFLOW
-                            : NS_SCROLLPORT_UNDERFLOW);
+    nsScrollPortEvent event(PR_TRUE, mVerticalOverflow ? NS_SCROLLPORT_OVERFLOW
+                            : NS_SCROLLPORT_UNDERFLOW, nsnull);
     event.orient = nsScrollPortEvent::vertical;
 
     nsEventStatus status = nsEventStatus_eIgnore;
--- mozilla-firefox-1.0.4.orig/layout/xul/base/src/tree/src/nsTreeSelection.cpp
+++ mozilla-firefox-1.0.4/layout/xul/base/src/tree/src/nsTreeSelection.cpp
@@ -763,7 +763,7 @@
     shell->GetPresContext(getter_AddRefs(aPresContext));
 
     nsEventStatus status = nsEventStatus_eIgnore;
-    nsEvent event(NS_FORM_SELECTED);
+    nsEvent event(PR_TRUE, NS_FORM_SELECTED);
 
     content->HandleDOMEvent(aPresContext, &event, nsnull, NS_EVENT_FLAG_INIT,
                             &status);
--- mozilla-firefox-1.0.4.orig/view/public/nsIViewObserver.h
+++ mozilla-firefox-1.0.4/view/public/nsIViewObserver.h
@@ -43,7 +43,7 @@
 
 class nsIRenderingContext;
 struct nsRect;
-struct nsGUIEvent;
+class nsGUIEvent;
 
 #define NS_IVIEWOBSERVER_IID   \
 { 0x0f4bc34a, 0xc93b, 0x4699, \
--- mozilla-firefox-1.0.4.orig/view/src/nsViewManager.cpp
+++ mozilla-firefox-1.0.4/view/src/nsViewManager.cpp
@@ -1839,11 +1839,6 @@
 {
   *aStatus = nsEventStatus_eIgnore;
 
-  // Mark all events coming through here as trusted events, as the
-  // only code that calls this is the widget code that translates OS
-  // events into mozilla events.
-  aEvent->internalAppFlags |= NS_APP_EVENT_FLAG_TRUSTED;
-
   switch(aEvent->message)
     {
     case NS_SIZE:
--- mozilla-firefox-1.0.4.orig/webshell/public/nsILinkHandler.h
+++ mozilla-firefox-1.0.4/webshell/public/nsILinkHandler.h
@@ -44,7 +44,7 @@
 class nsIRequest;
 class nsIContent;
 class nsString;
-struct nsGUIEvent;
+class nsGUIEvent;
 
 // Interface ID for nsILinkHandler
 #define NS_ILINKHANDLER_IID \
--- mozilla-firefox-1.0.4.orig/widget/public/nsEvent.h
+++ mozilla-firefox-1.0.4/widget/public/nsEvent.h
@@ -57,25 +57,25 @@
   nsEventStatus_eConsumeDoDefault  
 };
 
-struct nsEvent;
+class nsEvent;
 
-struct nsGUIEvent;
-struct nsSizeEvent;
-struct nsSizeModeEvent;
-struct nsZLevelEvent;
-struct nsPaintEvent;
-struct nsScrollbarEvent;
-struct nsScrollPortEvent;
-struct nsInputEvent;
-struct nsMouseEvent;
-struct nsAccessibleEvent;
-struct nsKeyEvent;
-struct nsTextEvent;
-struct nsCompositionEvent;
-struct nsMouseScrollEvent;
-struct nsReconversionEvent;
-struct nsTooltipEvent;
-struct nsMenuEvent;
+class nsGUIEvent;
+class nsSizeEvent;
+class nsSizeModeEvent;
+class nsZLevelEvent;
+class nsPaintEvent;
+class nsScrollbarEvent;
+class nsScrollPortEvent;
+class nsInputEvent;
+class nsMouseEvent;
+class nsAccessibleEvent;
+class nsKeyEvent;
+class nsTextEvent;
+class nsCompositionEvent;
+class nsMouseScrollEvent;
+class nsReconversionEvent;
+class nsTooltipEvent;
+class nsMenuEvent;
 
 struct nsTextEventReply;
 struct nsReconversionEventReply;
--- mozilla-firefox-1.0.4.orig/widget/public/nsGUIEvent.h
+++ mozilla-firefox-1.0.4/widget/public/nsGUIEvent.h
@@ -22,6 +22,8 @@
  * Contributor(s):
  *   Makoto Kato  <m_kato@ga2.so-net.ne.jp>
  *   Dean Tessman <dean_tessman@hotmail.com>
+ *   Andrew Wellington <proton@wiretapped.net>
+ *   Graham Dennis <u3952328@anu.edu.au>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either the GNU General Public License Version 2 or later (the "GPL"), or 
@@ -90,7 +92,9 @@
 #define NS_POPUPBLOCKED_EVENT             25
 #define NS_BEFORE_PAGE_UNLOAD_EVENT       26
 
-
+// These flags are sort of a mess. They're sort of shared between event
+// listener flags and event flags, but only some of them. You've been
+// warned!
 #define NS_EVENT_FLAG_NONE                0x0000
 #define NS_EVENT_FLAG_INIT                0x0001
 #define NS_EVENT_FLAG_BUBBLE              0x0002
@@ -102,6 +106,10 @@
 #define NS_PRIV_EVENT_FLAG_SCRIPT         0x0080
 #define NS_EVENT_FLAG_NO_CONTENT_DISPATCH 0x0100
 #define NS_EVENT_FLAG_SYSTEM_EVENT        0x0200
+#define NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY 0x0400 // @see nsIDOM3Event::stopImmediatePropagation()
+#define NS_EVENT_FLAG_DISPATCHING         0x0800
+
+#define NS_PRIV_EVENT_UNTRUSTED_PERMITTED 0x8000
 
 #define NS_EVENT_CAPTURE_MASK             (~(NS_EVENT_FLAG_INIT | NS_EVENT_FLAG_BUBBLE | NS_EVENT_FLAG_NO_CONTENT_DISPATCH))
 #define NS_EVENT_BUBBLE_MASK              (~(NS_EVENT_FLAG_INIT | NS_EVENT_FLAG_CAPTURE | NS_EVENT_FLAG_NO_CONTENT_DISPATCH))
@@ -335,34 +343,54 @@
  * General event
  */
 
-struct nsEvent {
-  nsEvent(PRUint32 msg = 0, PRUint8 structType = NS_EVENT)
+class nsEvent
+{
+protected:
+  nsEvent(PRBool isTrusted, PRUint32 msg, PRUint8 structType)
     : eventStructType(structType),
       message(msg),
       point(0, 0),
       refPoint(0, 0),
       time(0),
       flags(0),
-      internalAppFlags(NS_APP_EVENT_FLAG_NONE),
+      internalAppFlags(isTrusted ? NS_APP_EVENT_FLAG_TRUSTED :
+                       NS_APP_EVENT_FLAG_NONE),
+      userType(0)
+  {
+  }
+
+public:
+  nsEvent(PRBool isTrusted, PRUint32 msg)
+    : eventStructType(NS_EVENT),
+      message(msg),
+      point(0, 0),
+      refPoint(0, 0),
+      time(0),
+      flags(0),
+      internalAppFlags(isTrusted ? NS_APP_EVENT_FLAG_TRUSTED :
+                       NS_APP_EVENT_FLAG_NONE),
       userType(0)
   {
   }
 
-  /// See event struct types
+  // See event struct types
   PRUint8     eventStructType;
-  /// See GUI MESSAGES,
+  // See GUI MESSAGES,
   PRUint32    message;              
-  /// in widget relative coordinates, modified to be relative to current view in layout.
+  // In widget relative coordinates, modified to be relative to
+  // current view in layout.
   nsPoint     point;               
-  // in widget relative coordinates, not modified by layout code.
+  // In widget relative coordinates, not modified by layout code.
   nsPoint     refPoint;               
-  /// elapsed time, in milliseconds, from the time the system was started to the time the message was created
+  // Elapsed time, in milliseconds, from the time the system was
+  // started to the time the message was created
   PRUint32    time;      
-  // flags to hold event flow stage and capture/bubble cancellation status
+  // Flags to hold event flow stage and capture/bubble cancellation
+  // status
   PRUint32    flags;
-  // flags for indicating more event state for Mozilla applications.
+  // Flags for indicating more event state for Mozilla applications.
   PRUint32    internalAppFlags;
-  // additional type info for user defined events
+  // Additional type info for user defined events
   nsHashKey*  userType;
 };
 
@@ -370,12 +398,18 @@
  * General graphic user interface event
  */
 
-struct nsGUIEvent : public nsEvent
+class nsGUIEvent : public nsEvent
 {
-  nsGUIEvent(PRUint32 msg = 0,
-             nsIWidget *w = nsnull,
-             PRUint8 structType = NS_GUI_EVENT)
-    : nsEvent(msg, structType),
+protected:
+  nsGUIEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w, PRUint8 structType)
+    : nsEvent(isTrusted, msg, structType),
+      widget(w), nativeMsg(nsnull)
+  {
+  }
+
+public:
+  nsGUIEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
+    : nsEvent(isTrusted, msg, NS_GUI_EVENT),
       widget(w), nativeMsg(nsnull)
   {
   }
@@ -390,11 +424,11 @@
  * Script error event
  */
 
-struct nsScriptErrorEvent : public nsEvent
+class nsScriptErrorEvent : public nsEvent
 {
-  nsScriptErrorEvent(PRUint32 msg = 0,
-                     PRUint8 structType = NS_SCRIPT_ERROR_EVENT)
-    : nsEvent(msg, structType),
+public:
+  nsScriptErrorEvent(PRBool isTrusted, PRUint32 msg)
+    : nsEvent(isTrusted, msg, NS_SCRIPT_ERROR_EVENT),
       lineNr(0), errorMsg(nsnull), fileName(nsnull)
   {
   }
@@ -404,10 +438,11 @@
   const PRUnichar*  fileName;
 };
 
-struct nsBeforePageUnloadEvent : public nsEvent
+class nsBeforePageUnloadEvent : public nsEvent
 {
-  nsBeforePageUnloadEvent(PRUint32 msg)
-    : nsEvent(msg, NS_BEFORE_PAGE_UNLOAD_EVENT)
+public:
+  nsBeforePageUnloadEvent(PRBool isTrusted, PRUint32 msg)
+    : nsEvent(isTrusted, msg, NS_BEFORE_PAGE_UNLOAD_EVENT)
   {
   }
 
@@ -418,12 +453,11 @@
  * Window resize event
  */
 
-struct nsSizeEvent : public nsGUIEvent
+class nsSizeEvent : public nsGUIEvent
 {
-  nsSizeEvent(PRUint32 msg = 0,
-              nsIWidget *w = nsnull,
-              PRUint8 structType = NS_SIZE_EVENT)
-    : nsGUIEvent(msg, w, structType),
+public:
+  nsSizeEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
+    : nsGUIEvent(isTrusted, msg, w, NS_SIZE_EVENT),
       windowSize(nsnull), mWinWidth(0), mWinHeight(0)
   {
   }
@@ -440,12 +474,11 @@
  * Window size mode event
  */
 
-struct nsSizeModeEvent : public nsGUIEvent
+class nsSizeModeEvent : public nsGUIEvent
 {
-  nsSizeModeEvent(PRUint32 msg = 0,
-                  nsIWidget *w = nsnull,
-                  PRUint8 structType = NS_SIZEMODE_EVENT)
-    : nsGUIEvent(msg, w, structType),
+public:
+  nsSizeModeEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
+    : nsGUIEvent(isTrusted, msg, w, NS_SIZEMODE_EVENT),
       mSizeMode(nsSizeMode_Normal)
   {
   }
@@ -457,12 +490,11 @@
  * Window z-level event
  */
 
-struct nsZLevelEvent : public nsGUIEvent
+class nsZLevelEvent : public nsGUIEvent
 {
-  nsZLevelEvent(PRUint32 msg = 0,
-                nsIWidget *w = nsnull,
-                PRUint8 structType = NS_ZLEVEL_EVENT)
-    : nsGUIEvent(msg, w, structType),
+public:
+  nsZLevelEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
+    : nsGUIEvent(isTrusted, msg, w, NS_ZLEVEL_EVENT),
       mPlacement(nsWindowZTop), mReqBelow(nsnull), mActualBelow(nsnull),
       mImmediate(PR_FALSE), mAdjusted(PR_FALSE)
   {
@@ -479,12 +511,11 @@
  * Window repaint event
  */
 
-struct nsPaintEvent : public nsGUIEvent
+class nsPaintEvent : public nsGUIEvent
 {
-  nsPaintEvent(PRUint32 msg = 0,
-               nsIWidget *w = nsnull,
-               PRUint8 structType = NS_PAINT_EVENT)
-    : nsGUIEvent(msg, w, structType),
+public:
+  nsPaintEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
+    : nsGUIEvent(isTrusted, msg, w, NS_PAINT_EVENT),
       renderingContext(nsnull), region(nsnull), rect(nsnull)
   {
   }
@@ -501,12 +532,11 @@
  * Scrollbar event
  */
 
-struct nsScrollbarEvent : public nsGUIEvent
+class nsScrollbarEvent : public nsGUIEvent
 {
-  nsScrollbarEvent(PRUint32 msg = 0,
-                   nsIWidget *w = nsnull,
-                   PRUint8 structType = NS_SCROLLBAR_EVENT)
-    : nsGUIEvent(msg, w, structType),
+public:
+  nsScrollbarEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
+    : nsGUIEvent(isTrusted, msg, w, NS_SCROLLBAR_EVENT),
       position(0)
   {
   }
@@ -515,18 +545,17 @@
   PRUint32        position; 
 };
 
-struct nsScrollPortEvent : public nsGUIEvent
+class nsScrollPortEvent : public nsGUIEvent
 {
+public:
   enum orientType {
     vertical   = 0,
     horizontal = 1,
     both       = 2
   };
 
-  nsScrollPortEvent(PRUint32 msg = 0,
-                    nsIWidget *w = nsnull,
-                    PRUint8 structType = NS_SCROLLPORT_EVENT)
-    : nsGUIEvent(msg, w, structType),
+  nsScrollPortEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
+    : nsGUIEvent(isTrusted, msg, w, NS_SCROLLPORT_EVENT),
       orient(vertical)
   {
   }
@@ -534,12 +563,19 @@
   orientType orient;
 };
 
-struct nsInputEvent : public nsGUIEvent
+class nsInputEvent : public nsGUIEvent
 {
-  nsInputEvent(PRUint32 msg = 0,
-               nsIWidget *w = nsnull,
-               PRUint8 structType = NS_INPUT_EVENT)
-    : nsGUIEvent(msg, w, structType),
+protected:
+  nsInputEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w,
+               PRUint8 structType)
+    : nsGUIEvent(isTrusted, msg, w, structType),
+      isShift(PR_FALSE), isControl(PR_FALSE), isAlt(PR_FALSE), isMeta(PR_FALSE)
+  {
+  }
+
+public:
+  nsInputEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
+    : nsGUIEvent(isTrusted, msg, w, NS_INPUT_EVENT),
       isShift(PR_FALSE), isControl(PR_FALSE), isAlt(PR_FALSE), isMeta(PR_FALSE)
   {
   }
@@ -558,12 +594,13 @@
  * Mouse event
  */
 
-struct nsMouseEvent : public nsInputEvent
+class nsMouseEvent : public nsInputEvent
 {
-  nsMouseEvent(PRUint32 msg = 0,
-               nsIWidget *w = nsnull,
-               PRUint8 structType = NS_MOUSE_EVENT)
-    : nsInputEvent(msg, w, structType),
+public:
+  enum reasonType { eReal, eSynthesized };
+
+  nsMouseEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
+    : nsInputEvent(isTrusted, msg, w, NS_MOUSE_EVENT),
       clickCount(0), acceptActivation(PR_FALSE)
   {
     if (msg == NS_MOUSE_MOVE) {
@@ -582,29 +619,27 @@
  * Accessible event
  */
 
-struct nsAccessibleEvent : public nsInputEvent
+class nsAccessibleEvent : public nsInputEvent
 {
-  nsAccessibleEvent(PRUint32 msg = 0,
-                    nsIWidget *w = nsnull,
-                    PRUint8 structType = NS_ACCESSIBLE_EVENT)
-    : nsInputEvent(msg, w, structType),
+public:
+  nsAccessibleEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
+    : nsInputEvent(isTrusted, msg, w, NS_ACCESSIBLE_EVENT),
       accessible(nsnull)
   {
   }
 
-  nsIAccessible*     accessible;           
+  nsIAccessible*  accessible;     
 };
 
 /**
  * Keyboard event
  */
 
-struct nsKeyEvent : public nsInputEvent
+class nsKeyEvent : public nsInputEvent
 {
-  nsKeyEvent(PRUint32 msg = 0,
-             nsIWidget *w = nsnull,
-             PRUint8 structType = NS_KEY_EVENT)
-    : nsInputEvent(msg, w, structType),
+public:
+  nsKeyEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
+    : nsInputEvent(isTrusted, msg, w, NS_KEY_EVENT),
       keyCode(0), charCode(0), isChar(0)
   {
   }
@@ -620,7 +655,8 @@
 /**
  * IME Related Events
  */
-struct nsTextRange {
+struct nsTextRange
+{
   nsTextRange()
     : mStartOffset(0), mEndOffset(0), mRangeType(0)
   {
@@ -633,7 +669,8 @@
 
 typedef nsTextRange* nsTextRangeArray;
 
-struct nsTextEventReply {
+struct nsTextEventReply
+{
   nsTextEventReply()
     : mCursorIsCollapsed(PR_FALSE)
   {
@@ -645,12 +682,11 @@
 
 typedef struct nsTextEventReply nsTextEventReply;
 
-struct nsTextEvent : public nsInputEvent
+class nsTextEvent : public nsInputEvent
 {
-  nsTextEvent(PRUint32 msg = 0,
-              nsIWidget *w = nsnull,
-              PRUint8 structType = NS_TEXT_EVENT)
-    : nsInputEvent(msg, w, structType),
+public:
+  nsTextEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
+    : nsInputEvent(isTrusted, msg, w, NS_TEXT_EVENT),
       theText(nsnull), rangeCount(0), rangeArray(nsnull), isChar(PR_FALSE)
   {
   }
@@ -662,30 +698,28 @@
   PRBool            isChar;
 };
 
-struct nsCompositionEvent : public nsInputEvent
+class nsCompositionEvent : public nsInputEvent
 {
-  nsCompositionEvent(PRUint32 msg = 0,
-                     nsIWidget *w = nsnull,
-                     PRUint8 structType = NS_COMPOSITION_EVENT)
-    : nsInputEvent(msg, w, structType)
+public:
+  nsCompositionEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
+    : nsInputEvent(isTrusted, msg, w, NS_COMPOSITION_EVENT)
   {
   }
 
   nsTextEventReply theReply;
 };
 
-struct nsMouseScrollEvent : public nsInputEvent
+class nsMouseScrollEvent : public nsInputEvent
 {
+public:
   enum nsMouseScrollFlags {
     kIsFullPage =   1 << 0,
     kIsVertical =   1 << 1,
     kIsHorizontal = 1 << 2
   };
 
-  nsMouseScrollEvent(PRUint32 msg = 0,
-                     nsIWidget *w = nsnull,
-                     PRUint8 structType = NS_MOUSE_SCROLL_EVENT)
-    : nsInputEvent(msg, w, structType),
+  nsMouseScrollEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
+    : nsInputEvent(isTrusted, msg, w, NS_MOUSE_SCROLL_EVENT),
       scrollFlags(0), delta(0)
   {
   }
@@ -703,12 +737,11 @@
   PRUnichar *mReconversionString;
 };
 
-struct nsReconversionEvent : public nsInputEvent
+class nsReconversionEvent : public nsInputEvent
 {
-  nsReconversionEvent(PRUint32 msg = 0,
-                      nsIWidget *w = nsnull,
-                      PRUint8 structType = NS_RECONVERSION_EVENT)
-    : nsInputEvent(msg, w, structType)
+public:
+  nsReconversionEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
+    : nsInputEvent(isTrusted, msg, w, NS_RECONVERSION_EVENT)
   {
   }
 
@@ -722,12 +755,11 @@
  * for the event
  */
 
-struct nsMenuEvent : public nsGUIEvent
+class nsMenuEvent : public nsGUIEvent
 {
-  nsMenuEvent(PRUint32 msg = 0,
-              nsIWidget *w = nsnull,
-              PRUint8 structType = NS_MENU_EVENT)
-    : nsGUIEvent(msg, w, structType),
+public:
+  nsMenuEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
+    : nsGUIEvent(isTrusted, msg, w, NS_MENU_EVENT),
       mMenuItem(nsnull), mCommand(0)
   {
   }
@@ -743,10 +775,11 @@
  * originator is a weak pointer (does not hold a strong reference).
  */
 
-struct nsFormEvent : public nsEvent
+class nsFormEvent : public nsEvent
 {
-  nsFormEvent(PRUint32 msg = 0, PRUint8 structType = NS_FORM_EVENT)
-    : nsEvent(msg, structType),
+public:
+  nsFormEvent(PRBool isTrusted, PRUint32 msg)
+    : nsEvent(isTrusted, msg, NS_FORM_EVENT),
       originator(nsnull)
   {
   }
@@ -757,12 +790,11 @@
 /**
 * Focus event
 */
-struct nsFocusEvent : public nsGUIEvent
+class nsFocusEvent : public nsGUIEvent
 {
-  nsFocusEvent(PRUint32 msg = 0,
-               nsIWidget *w = nsnull,
-               PRUint8 structType = NS_FOCUS_EVENT)
-    : nsGUIEvent(msg, w, structType),
+public:
+  nsFocusEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
+    : nsGUIEvent(isTrusted, msg, w, NS_FOCUS_EVENT),
       isMozWindowTakingFocus(PR_FALSE)
   {
   }
@@ -776,12 +808,11 @@
  * Custom commands from the operating system.  eg. WM_APPCOMMAND on Windows
  */
 
-struct nsAppCommandEvent : public nsInputEvent
+class nsAppCommandEvent : public nsInputEvent
 {
-  nsAppCommandEvent(PRUint32 msg = 0,
-                    nsIWidget *w = nsnull,
-                    PRUint8 structType = NS_APPCOMMAND_EVENT)
-    : nsInputEvent(msg, w, structType),
+public:
+  nsAppCommandEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
+    : nsInputEvent(isTrusted, msg, w, NS_APPCOMMAND_EVENT),
       appCommand(0)
   {
   }
@@ -792,11 +823,11 @@
 /**
  * blocked popup window event
  */
-struct nsPopupBlockedEvent : public nsEvent
+class nsPopupBlockedEvent : public nsEvent
 {
-  nsPopupBlockedEvent(PRUint32 msg = 0,
-                      PRUint8 structType = NS_POPUPBLOCKED_EVENT)
-    : nsEvent(msg, structType),
+public:
+  nsPopupBlockedEvent(PRBool isTrusted, PRUint32 msg)
+    : nsEvent(isTrusted, msg, NS_POPUPBLOCKED_EVENT),
       mRequestingWindowURI(nsnull), mPopupWindowURI(nsnull)
   {
   }
@@ -818,6 +849,22 @@
   nsDragDropEventStatus_eDrop  
 };
 
+/**
+ * Event status for an extended mouse button event
+ * The event (called clickCount) is type PRUint32:
+ * hence this struct will be of the same size
+ */
+typedef struct {
+  PRUint16 realClickCount;
+  PRUint8  button;
+  PRUint8  event;  // eg button went up / down
+} nsExtendedMouseEventStatus;
+
+enum {
+  /// different types of events
+  nsExtendedMouseEventStatus_up,
+  nsExtendedMouseEventStatus_down
+};
 
 #define NS_IS_MOUSE_EVENT(evnt) \
        (((evnt)->message == NS_MOUSE_LEFT_BUTTON_DOWN) || \
@@ -868,6 +915,23 @@
         ((evnt)->message == NS_DEACTIVATE) || \
         ((evnt)->message == NS_PLUGIN_ACTIVATE))
 
+#define NS_IS_TRUSTED_EVENT(event) \
+  (((event)->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED) != 0)
+
+// Mark an event as being dispatching.
+#define NS_MARK_EVENT_DISPATCH_STARTED(event) \
+  (event)->flags |= NS_EVENT_FLAG_DISPATCHING;
+
+#define NS_IS_EVENT_IN_DISPATCH(event) \
+  (((event)->flags & NS_EVENT_FLAG_DISPATCHING) != 0)
+
+// Mark an event as being done dispatching.
+#define NS_MARK_EVENT_DISPATCH_DONE(event) \
+  NS_ASSERTION(NS_IS_EVENT_IN_DISPATCH(event), \
+               "Event never got marked for dispatch!"); \
+  (event)->flags &= ~NS_EVENT_FLAG_DISPATCHING; \
+  (event)->flags |= NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY;
+
 /*
  * Virtual key bindings for keyboard events.
  * These come from nsIDOMKeyEvent.h, which is generated from MouseKeyEvent.idl.
--- mozilla-firefox-1.0.4.orig/widget/public/nsIEventListener.h
+++ mozilla-firefox-1.0.4/widget/public/nsIEventListener.h
@@ -40,7 +40,7 @@
 
 #include "nsISupports.h"
 
-struct nsGUIEvent;
+class nsGUIEvent;
 
 /**
  * Event listener interface.
--- mozilla-firefox-1.0.4.orig/widget/public/nsIWidget.h
+++ mozilla-firefox-1.0.4/widget/public/nsIWidget.h
@@ -62,7 +62,7 @@
 class   nsIMenuBar;
 class   nsIEventListener;
 class   nsIRollupListener;
-struct  nsGUIEvent;
+class   nsGUIEvent;
 struct  nsColorMap;
 
 /**
--- mozilla-firefox-1.0.4.orig/widget/src/beos/nsWindow.cpp
+++ mozilla-firefox-1.0.4/widget/src/beos/nsWindow.cpp
@@ -307,7 +307,7 @@
 
 PRBool nsWindow::DispatchStandardEvent(PRUint32 aMsg)
 {
-	nsGUIEvent event(aMsg, this);
+	nsGUIEvent event(PR_TRUE, aMsg, this);
 	InitEvent(event);
 
 	PRBool result = DispatchWindowEvent(&event);
@@ -1810,7 +1810,7 @@
 				return false;
 			NS_ASSERTION(info->nArgs == 1, "Wrong number of arguments to CallMethod");
 
-			nsMouseScrollEvent scrollEvent(NS_MOUSE_SCROLL, this);
+			nsMouseScrollEvent scrollEvent(PR_TRUE, NS_MOUSE_SCROLL, this);
 
 			scrollEvent.scrollFlags = nsMouseScrollEvent::kIsVertical;
 
@@ -2281,7 +2281,7 @@
 PRBool nsWindow::DispatchKeyEvent(PRUint32 aEventType, PRUint32 aCharCode,
                                   PRUint32 aKeyCode)
 {
-	nsKeyEvent event(aEventType, this);
+	nsKeyEvent event(PR_TRUE, aEventType, this);
 	nsPoint point;
 
 	point.x = 0;
@@ -2357,7 +2357,7 @@
 //-------------------------------------------------------------------------
 PRBool nsWindow::OnMove(PRInt32 aX, PRInt32 aY)
 {
-	nsGUIEvent event(NS_MOVE, this);
+	nsGUIEvent event(PR_TRUE, NS_MOVE, this);
 	InitEvent(event);
 	event.point.x = aX;
 	event.point.y = aY;
@@ -2386,7 +2386,7 @@
 			mView->ConstrainClippingRegion(&invalid);
 			mView->Flush();
 			mView->UnlockLooper();
-			nsPaintEvent event(NS_PAINT, this);
+			nsPaintEvent event(PR_TRUE, NS_PAINT, this);
 
 			InitEvent(event);
 			event.region = nsnull;
@@ -2424,7 +2424,7 @@
 	// call the event callback
 	if (mEventCallback)
 	{
-		nsSizeEvent event(NS_SIZE, this);
+		nsSizeEvent event(PR_TRUE, NS_SIZE, this);
 		InitEvent(event);
 		event.windowSize = &aWindowRect;
 		if(mView && mView->LockLooper())
@@ -2457,7 +2457,7 @@
 	PRBool result = PR_FALSE;
 	if(nsnull != mEventCallback || nsnull != mMouseListener)
 	{
-		nsMouseEvent event(aEventType, this);
+		nsMouseEvent event(PR_TRUE, aEventType, this);
 		InitEvent (event, &aPoint);
 		event.isShift   = mod & B_SHIFT_KEY;
 		event.isControl = mod & B_CONTROL_KEY;
--- mozilla-firefox-1.0.4.orig/widget/src/gtk/nsGtkEventHandler.cpp
+++ mozilla-firefox-1.0.4/widget/src/gtk/nsGtkEventHandler.cpp
@@ -450,7 +450,7 @@
 void handle_size_allocate(GtkWidget *w, GtkAllocation *alloc, gpointer p)
 {
   nsWindow *widget = (nsWindow *)p;
-  nsSizeEvent event(NS_SIZE, widget);
+  nsSizeEvent event(PR_TRUE, NS_SIZE, widget);
 
   InitAllocationEvent(alloc, event);
   NS_ADDREF(widget);
@@ -483,7 +483,7 @@
     return PR_TRUE;
 
   NS_ADDREF(win);
-  nsKeyEvent keyDownEvent(NS_KEY_DOWN, win);
+  nsKeyEvent keyDownEvent(PR_TRUE, NS_KEY_DOWN, win);
   InitKeyEvent(event, keyDownEvent);
   win->OnKey(keyDownEvent);
 
@@ -492,7 +492,7 @@
   //  character code.  Note we have to check for modifier keys, since
   // gtk returns a character value for them
   //
-  nsKeyEvent keyPressEvent(NS_KEY_PRESS, win);
+  nsKeyEvent keyPressEvent(PR_TRUE, NS_KEY_PRESS, win);
   InitKeyPressEvent(event, keyPressEvent);
   win->OnKey(keyPressEvent);
 
@@ -510,7 +510,7 @@
                                        gpointer p)
 {
   nsTextWidget* win = (nsTextWidget*)p;
-  nsKeyEvent kevent(NS_KEY_UP, win);
+  nsKeyEvent kevent(PR_TRUE, NS_KEY_UP, win);
 
   // Don't pass shift, control and alt as key release events
   if (event->keyval == GDK_Shift_L
@@ -565,7 +565,7 @@
   //   but lie about where it came from and say it is from the
   //   window that currently has focus inside our app...
   //
-  nsKeyEvent keyDownEvent(NS_KEY_DOWN, win);
+  nsKeyEvent keyDownEvent(PR_TRUE, NS_KEY_DOWN, win);
   InitKeyEvent(event, keyDownEvent);
   // if we need to suppress this NS_KEY_DOWN event, reset the flag
   if (suppressNextKeyDown == PR_TRUE)
@@ -581,7 +581,7 @@
   //
 
   // Call nsConvertCharCodeToUnicode() here to get kevent.charCode 
-  nsKeyEvent keyPressEvent(NS_KEY_PRESS, win);
+  nsKeyEvent keyPressEvent(PR_TRUE, NS_KEY_PRESS, win);
   InitKeyPressEvent(event, keyPressEvent);
 
   if (event->length) {
@@ -654,7 +654,7 @@
   if (nsWidget::sFocusWindow)
     win = nsWidget::sFocusWindow;
 
-  nsKeyEvent kevent(NS_KEY_UP, win);
+  nsKeyEvent kevent(PR_TRUE, NS_KEY_UP, win);
   InitKeyEvent(event, kevent);
 
   NS_ADDREF(win);
--- mozilla-firefox-1.0.4.orig/widget/src/gtk/nsWidget.cpp
+++ mozilla-firefox-1.0.4/widget/src/gtk/nsWidget.cpp
@@ -96,7 +96,7 @@
     // before we dispatch a key, check if it's the context menu key.
     // If so, send a context menu key event instead.
     if (IsContextMenuKey(aEvent)) {
-      nsMouseEvent contextMenuEvent;
+      nsMouseEvent contextMenuEvent(PR_TRUE, 0, nsnull);
       ConvertKeyEventToContextMenuEvent(&aEvent, &contextMenuEvent);
       ret = DispatchWindowEvent(&contextMenuEvent);
     }
@@ -641,7 +641,7 @@
 
 PRBool nsWidget::OnResize(nsRect &aRect)
 {
-  nsSizeEvent event(NS_SIZE, this);
+  nsSizeEvent event(PR_TRUE, NS_SIZE, this);
 
   InitEvent(event);
 
@@ -681,7 +681,7 @@
 
     ResetInternalVisibility();
 
-    nsGUIEvent event(NS_MOVE, this);
+    nsGUIEvent event(PR_TRUE, NS_MOVE, this);
     InitEvent(event);
     event.point.x = aX;
     event.point.y = aY;
@@ -1394,7 +1394,7 @@
 
 PRBool nsWidget::DispatchStandardEvent(PRUint32 aMsg)
 {
-  nsGUIEvent event(aMsg, this);
+  nsGUIEvent event(PR_TRUE, aMsg, this);
   InitEvent(event);
   PRBool result = DispatchWindowEvent(&event);
   return result;
@@ -1665,7 +1665,7 @@
   if (mIsDestroying)
     return;
 
-  nsMouseEvent event(NS_MOUSE_MOVE);
+  nsMouseEvent event(PR_TRUE, NS_MOUSE_MOVE, nsnull);
 
   // If there is a button motion target, use that instead of the
   // current widget
@@ -1757,7 +1757,7 @@
     return;
   }
 
-  nsMouseEvent event(NS_MOUSE_ENTER, this);
+  nsMouseEvent event(PR_TRUE, NS_MOUSE_ENTER, this);
 
   if (aGdkCrossingEvent != NULL) 
   {
@@ -1788,7 +1788,7 @@
     return;
   }
 
-  nsMouseEvent event(NS_MOUSE_EXIT, this);
+  nsMouseEvent event(PR_TRUE, NS_MOUSE_EXIT, this);
 
   if (aGdkCrossingEvent != NULL) 
   {
@@ -1809,7 +1809,7 @@
 /* virtual */ void
 nsWidget::OnButtonPressSignal(GdkEventButton * aGdkButtonEvent)
 {
-  nsMouseScrollEvent scrollEvent(NS_MOUSE_SCROLL, this);
+  nsMouseScrollEvent scrollEvent(PR_TRUE, NS_MOUSE_SCROLL, this);
   PRUint32 eventType = 0;
 
   // If you double click in GDK, it will actually generate a single
@@ -1890,7 +1890,7 @@
     break;
   }
 
-  nsMouseEvent event(eventType, this);
+  nsMouseEvent event(PR_TRUE, eventType, this);
   InitMouseEvent(aGdkButtonEvent, event);
 
   // Set the button motion target and remeber the widget and root coords
@@ -1916,7 +1916,7 @@
   // if we're a right-button-down on linux, we're trying to
   // popup a context menu. send that event to gecko also.
   if (eventType == NS_MOUSE_RIGHT_BUTTON_DOWN) {
-    nsMouseEvent contextMenuEvent(NS_CONTEXTMENU, this);
+    nsMouseEvent contextMenuEvent(PR_TRUE, NS_CONTEXTMENU, this);
     InitMouseEvent(aGdkButtonEvent, contextMenuEvent);
     DispatchMouseEvent(contextMenuEvent);
   }
@@ -1957,7 +1957,7 @@
     break;
 	}
 
-  nsMouseEvent event(eventType, this);
+  nsMouseEvent event(PR_TRUE, eventType, this);
   InitMouseEvent(aGdkButtonEvent, event);
 
   if (sButtonMotionTarget) {
@@ -1996,7 +1996,7 @@
 
   GTK_WIDGET_SET_FLAGS(mWidget, GTK_HAS_FOCUS);
 
-  nsFocusEvent event(NS_GOTFOCUS, this);
+  nsFocusEvent event(PR_TRUE, NS_GOTFOCUS, this);
 
 //  event.time = aGdkFocusEvent->time;;
 //  event.time = PR_Now();
@@ -2016,7 +2016,7 @@
 
   GTK_WIDGET_UNSET_FLAGS(mWidget, GTK_HAS_FOCUS);
 
-  nsFocusEvent event(NS_LOSTFOCUS, this);
+  nsFocusEvent event(PR_TRUE, NS_LOSTFOCUS, this);
 
 //  event.time = aGdkFocusEvent->time;;
 //  event.time = PR_Now();
@@ -2060,7 +2060,7 @@
 //////////////////////////////////////////////////////////////////
 void 
 nsWidget::InitMouseEvent(GdkEventButton * aGdkButtonEvent,
-						 nsMouseEvent &anEvent)
+                         nsMouseEvent &anEvent)
 {
   if (aGdkButtonEvent != NULL) {
     anEvent.point.x = nscoord(aGdkButtonEvent->x);
--- mozilla-firefox-1.0.4.orig/widget/src/gtk/nsWindow.cpp
+++ mozilla-firefox-1.0.4/widget/src/gtk/nsWindow.cpp
@@ -839,7 +839,7 @@
   aClipRegion->GetBoundingBox(&boundsRect.x, &boundsRect.y, &boundsRect.width, &boundsRect.height);
 #endif
 
-  nsPaintEvent event(NS_PAINT, this);
+  nsPaintEvent event(PR_TRUE, NS_PAINT, this);
   event.renderingContext = rc;
   event.time = GDK_CURRENT_TIME; // No time in EXPOSE events
   event.rect = &boundsRect;
@@ -1409,7 +1409,7 @@
   printf("nsWindow::DispatchSetFocusEvent %p\n", NS_STATIC_CAST(void *, this));
 #endif /* DEBUG_FOCUS */
 
-  nsGUIEvent event(NS_GOTFOCUS, this);
+  nsGUIEvent event(PR_TRUE, NS_GOTFOCUS, this);
 
   NS_ADDREF_THIS();
   DispatchFocus(event);
@@ -1429,7 +1429,7 @@
   printf("nsWindow::DispatchLostFocusEvent %p\n", NS_STATIC_CAST(void *, this));
 #endif /* DEBUG_FOCUS */
 
-  nsGUIEvent event(NS_LOSTFOCUS, this);
+  nsGUIEvent event(PR_TRUE, NS_LOSTFOCUS, this);
 
   NS_ADDREF_THIS();
   
@@ -1450,7 +1450,7 @@
 
   gJustGotDeactivate = PR_FALSE;
 
-  nsGUIEvent event(NS_ACTIVATE, this);
+  nsGUIEvent event(PR_TRUE, NS_ACTIVATE, this);
 
   NS_ADDREF_THIS();  
   DispatchFocus(event);
@@ -1471,7 +1471,7 @@
   IMEBeingActivate(PR_TRUE);
 #endif // USE_XIM
 
-  nsGUIEvent event(NS_DEACTIVATE, this);
+  nsGUIEvent event(PR_TRUE, NS_DEACTIVATE, this);
 
   NS_ADDREF_THIS();
   DispatchFocus(event);
@@ -1664,7 +1664,7 @@
   
   GTK_WIDGET_SET_FLAGS(mMozArea, GTK_HAS_FOCUS);
 
-  nsFocusEvent event(NS_GOTFOCUS, this);
+  nsFocusEvent event(PR_TRUE, NS_GOTFOCUS, this);
 #ifdef DEBUG  
   printf("send NS_GOTFOCUS from nsWindow::OnFocusInSignal\n");
 #endif
@@ -1685,7 +1685,7 @@
 
   GTK_WIDGET_UNSET_FLAGS(mMozArea, GTK_HAS_FOCUS);
 
-  nsFocusEvent event(NS_LOSTFOCUS, this);
+  nsFocusEvent event(PR_TRUE, NS_LOSTFOCUS, this);
   
 //  event.time = aGdkFocusEvent->time;;
 //  event.time = PR_Now();
@@ -1780,7 +1780,7 @@
   NS_ADDREF(win);
 
   // dispatch an "onclose" event. to delete immediately, call win->Destroy()
-  nsGUIEvent event(NS_XUL_CLOSE, win);
+  nsGUIEvent event(PR_TRUE, NS_XUL_CLOSE, win);
   nsEventStatus status;
   
   win->DispatchEvent(&event, status);
@@ -2798,7 +2798,7 @@
   }
   if (mIsToplevel || mListenForResizes) {
     //g_print("sending resize event\n");
-    nsSizeEvent sevent(NS_SIZE, this);
+    nsSizeEvent sevent(PR_TRUE, NS_SIZE, this);
     sevent.windowSize = new nsRect (0, 0, sizeWidth, sizeHeight);
     sevent.mWinWidth = sizeWidth;
     sevent.mWinHeight = sizeHeight;
@@ -2982,7 +2982,7 @@
 #endif
 
   if (mIsToplevel) {
-    nsSizeEvent sevent(NS_SIZE, this);
+    nsSizeEvent sevent(PR_TRUE, NS_SIZE, this);
     sevent.windowSize = new nsRect (event->xconfigure.x, event->xconfigure.y,
                                     event->xconfigure.width, event->xconfigure.height);
     sevent.point.x = event->xconfigure.x;
@@ -3129,7 +3129,7 @@
 // These are all of our drag and drop operations
 
 void
-nsWindow::InitDragEvent (nsMouseEvent &aEvent)
+nsWindow::InitDragEvent(nsMouseEvent &aEvent)
 {
   // set the keyboard modifiers
   gint x, y;
@@ -3254,7 +3254,7 @@
   // notify the drag service that we are starting a drag motion.
   dragSessionGTK->TargetStartDragMotion();
 
-  nsMouseEvent event(NS_DRAGDROP_OVER, innerMostWidget);
+  nsMouseEvent event(PR_TRUE, NS_DRAGDROP_OVER, innerMostWidget);
 
   InitDragEvent(event);
 
@@ -3393,7 +3393,7 @@
 
   innerMostWidget->AddRef();
 
-  nsMouseEvent event(NS_DRAGDROP_OVER, innerMostWidget);
+  nsMouseEvent event(PR_TRUE, NS_DRAGDROP_OVER, innerMostWidget);
 
   InitDragEvent(event);
 
@@ -3483,7 +3483,7 @@
   g_print("nsWindow::OnDragLeave\n");
 #endif /* DEBUG_DND_EVENTS */
 
-  nsMouseEvent event(NS_DRAGDROP_EXIT, this);
+  nsMouseEvent event(PR_TRUE, NS_DRAGDROP_EXIT, this);
 
   AddRef();
 
@@ -3519,7 +3519,7 @@
   g_print("nsWindow::OnDragEnter\n");
 #endif /* DEBUG_DND_EVENTS */
   
-  nsMouseEvent event(NS_DRAGDROP_ENTER, this);
+  nsMouseEvent event(PR_TRUE, NS_DRAGDROP_ENTER, this);
 
   event.point.x = aX;
   event.point.y = aY;
@@ -3740,7 +3740,7 @@
 nsresult nsWindow::UpdateICSpot(nsIMEGtkIC *aXIC)
 {
   // set spot location
-  nsCompositionEvent compEvent(NS_COMPOSITION_QUERY, this);
+  nsCompositionEvent compEvent(PR_TRUE, NS_COMPOSITION_QUERY, this);
   static gint oldx =0;
   static gint oldy =0;
   static gint oldw =0;
@@ -4003,7 +4003,7 @@
     return;
   }
 #endif // USE_XIM 
-  nsCompositionEvent compEvent(NS_COMPOSITION_START, this);
+  nsCompositionEvent compEvent(PR_TRUE, NS_COMPOSITION_START, this);
   compEvent.time = aTime;
 
   OnComposition(compEvent);
@@ -4076,7 +4076,7 @@
 nsWindow::IMEComposeText(GdkEventKey *aEvent,
                          const PRUnichar *aText, const PRInt32 aLen,
                          const char *aFeedback) {
-  nsTextEvent textEvent(NS_TEXT_TEXT, this);
+  nsTextEvent textEvent(PR_TRUE, NS_TEXT_TEXT, this);
   if (aEvent) {
     textEvent.isShift = (aEvent->state & GDK_SHIFT_MASK) ? PR_TRUE : PR_FALSE;
     textEvent.isControl = (aEvent->state & GDK_CONTROL_MASK) ? PR_TRUE : PR_FALSE;
@@ -4114,7 +4114,7 @@
   }
 #endif // USE_XIM 
 
-  nsCompositionEvent compEvent(NS_COMPOSITION_END, this);
+  nsCompositionEvent compEvent(PR_TRUE, NS_COMPOSITION_END, this);
   compEvent.time = aTime;
   OnComposition(compEvent);
 
--- mozilla-firefox-1.0.4.orig/widget/src/cocoa/nsChildView.mm
+++ mozilla-firefox-1.0.4/widget/src/cocoa/nsChildView.mm
@@ -507,7 +507,7 @@
     GlobalToLocal(&localWhere);
     
     nsChildView* childView = (nsChildView*) userData;
-    nsMouseEvent geckoEvent(NS_MOUSE_LEFT_BUTTON_DOWN, childView);
+    nsMouseEvent geckoEvent(PR_TRUE, NS_MOUSE_LEFT_BUTTON_DOWN, childView);
     geckoEvent.nativeMsg = &macEvent;
     geckoEvent.time = PR_IntervalNow();
     geckoEvent.clickCount = 1;
@@ -1558,7 +1558,7 @@
   StPortSetter port(curPort);
   
   // initialize the paint event
-  nsPaintEvent paintEvent(NS_PAINT, this);
+  nsPaintEvent paintEvent(PR_TRUE, NS_PAINT, this);
   paintEvent.renderingContext = aContext;       // nsPaintEvent
   paintEvent.rect             = &aRect;
 
@@ -1858,7 +1858,7 @@
 PRBool nsChildView::ReportDestroyEvent()
 {
   // nsEvent
-  nsGUIEvent event(NS_DESTROY, this);
+  nsGUIEvent event(PR_TRUE, NS_DESTROY, this);
   event.time        = PR_IntervalNow();
 
   // dispatch event
@@ -1872,7 +1872,7 @@
 PRBool nsChildView::ReportMoveEvent()
 {
   // nsEvent
-  nsGUIEvent moveEvent(NS_MOVE, this);
+  nsGUIEvent moveEvent(PR_TRUE, NS_MOVE, this);
   moveEvent.point.x     = mBounds.x;
   moveEvent.point.y     = mBounds.y;
   moveEvent.time        = PR_IntervalNow();
@@ -1888,7 +1888,7 @@
 PRBool nsChildView::ReportSizeEvent()
 {
   // nsEvent
-  nsSizeEvent sizeEvent(NS_SIZE, this);
+  nsSizeEvent sizeEvent(PR_TRUE, NS_SIZE, this);
   sizeEvent.time        = PR_IntervalNow();
 
   // nsSizeEvent
@@ -2154,7 +2154,7 @@
     return NS_OK;
   }
   
-  nsMouseEvent geckoEvent;
+  nsMouseEvent geckoEvent(PR_TRUE, 0, nsnull);
   
   // we're given the point in global coordinates. We need to convert it to
   // window coordinates for convert:message:toGeckoEvent
@@ -2215,7 +2215,7 @@
 -(NSMenu*)menuForEvent:(NSEvent*)theEvent
 {
   // Fire the context menu event into Gecko.
-  nsMouseEvent geckoEvent;
+  nsMouseEvent geckoEvent(PR_TRUE, 0, nsnull);
   [self convert:theEvent message:NS_CONTEXTMENU toGeckoEvent:&geckoEvent];
   
   // send event into Gecko by going directly to the
@@ -2564,7 +2564,7 @@
   [self performSelector:@selector(clickHoldCallback:) withObject:theEvent afterDelay:2.0];
 #endif
 
-  nsMouseEvent geckoEvent;
+  nsMouseEvent geckoEvent(PR_TRUE, 0, nsnull);
   [self convert:theEvent message:NS_MOUSE_LEFT_BUTTON_DOWN toGeckoEvent:&geckoEvent];
   geckoEvent.clickCount = [theEvent clickCount];
   
@@ -2594,7 +2594,7 @@
     [self stopHandScroll:theEvent];
     return;
   }
-  nsMouseEvent geckoEvent;
+  nsMouseEvent geckoEvent(PR_TRUE, 0, nsnull);
   [self convert:theEvent message:NS_MOUSE_LEFT_BUTTON_UP toGeckoEvent:&geckoEvent];
   
   NSPoint mouseLoc = [theEvent locationInWindow];
@@ -2629,7 +2629,7 @@
   if ([ChildView  areHandScrollModifiers:[theEvent modifierFlags]]) {
     return;
   }
-  nsMouseEvent geckoEvent;
+  nsMouseEvent geckoEvent(PR_TRUE, 0, nsnull);
   [self convert:theEvent message:NS_MOUSE_MOVE toGeckoEvent:&geckoEvent];
 
   NSPoint mouseLoc = [theEvent locationInWindow];
@@ -2656,7 +2656,7 @@
     [self updateHandScroll:theEvent];
     return;
   }
-  nsMouseEvent geckoEvent;
+  nsMouseEvent geckoEvent(PR_TRUE, 0, nsnull);
   [self convert:theEvent message:NS_MOUSE_MOVE toGeckoEvent:&geckoEvent];
 
   EventRecord macEvent;
@@ -2700,7 +2700,7 @@
 {
   // The right mouse went down.  Fire off a right mouse down and
   // then send the context menu event.
-  nsMouseEvent geckoEvent;
+  nsMouseEvent geckoEvent(PR_TRUE, 0, nsnull);
 
   [self convert: theEvent message: NS_MOUSE_RIGHT_BUTTON_DOWN toGeckoEvent:&geckoEvent];
 
@@ -2721,7 +2721,7 @@
 
 - (void)rightMouseUp:(NSEvent *)theEvent
 {
-  nsMouseEvent geckoEvent;
+  nsMouseEvent geckoEvent(PR_TRUE, 0, nsnull);
 
   [self convert: theEvent message: NS_MOUSE_RIGHT_BUTTON_UP toGeckoEvent:&geckoEvent];
 
@@ -2742,7 +2742,7 @@
 
 - (void)otherMouseDown:(NSEvent *)theEvent
 {
-  nsMouseEvent geckoEvent;
+  nsMouseEvent geckoEvent(PR_TRUE, 0, nsnull);
   [self convert:theEvent message:NS_MOUSE_MIDDLE_BUTTON_DOWN toGeckoEvent:&geckoEvent];
   geckoEvent.clickCount = [theEvent clickCount];
   
@@ -2755,7 +2755,7 @@
 
 - (void)otherMouseUp:(NSEvent *)theEvent
 {
-  nsMouseEvent geckoEvent;
+  nsMouseEvent geckoEvent(PR_TRUE, 0, nsnull);
   [self convert:theEvent message:NS_MOUSE_MIDDLE_BUTTON_UP toGeckoEvent:&geckoEvent];
   
   // send event into Gecko by going directly to the
@@ -2772,7 +2772,7 @@
   // Gecko as the number of lines to scroll.  We go ahead and use a 
   // default kNumLines of 4 for now (until I learn how we can get settings from
   // the OS). --dwh
-  nsMouseScrollEvent geckoEvent;
+  nsMouseScrollEvent geckoEvent(PR_TRUE, 0, nsnull);
 
   [self convert:theEvent message:NS_MOUSE_SCROLL toGeckoEvent:&geckoEvent];
   PRInt32 incomingDeltaX = (PRInt32)[theEvent deltaX];
@@ -2922,7 +2922,7 @@
 #endif
 
   // static void init_composition_event( *aEvent, int aType)
-  nsCompositionEvent event(aEventType, mGeckoChild);
+  nsCompositionEvent event(PR_TRUE, aEventType, mGeckoChild);
   event.time = PR_IntervalNow();
   mGeckoChild->DispatchWindowEvent(event);
   return event.theReply.mCursorPosition;
@@ -2939,7 +2939,7 @@
   NSLog(@" markRange = %d, %d;  selRange = %d, %d\n", markRange.location, markRange.length, selRange.location, selRange.length);
 #endif
 
-  nsTextEvent textEvent(NS_TEXT_TEXT, mGeckoChild);
+  nsTextEvent textEvent(PR_TRUE, NS_TEXT_TEXT, mGeckoChild);
   textEvent.time = PR_IntervalNow();
   textEvent.theText = aBuffer;
   if (!doCommit)
@@ -2973,7 +2973,7 @@
   if (len == 1 && !mInComposition)
   {
     // dispatch keypress event with char instead of textEvent
-    nsKeyEvent geckoEvent(NS_KEY_PRESS, mGeckoChild);
+    nsKeyEvent geckoEvent(PR_TRUE, NS_KEY_PRESS, mGeckoChild);
     geckoEvent.time      = PR_IntervalNow();
     geckoEvent.charCode  = bufPtr[0]; // gecko expects OS-translated unicode
     geckoEvent.isChar    = PR_TRUE;
@@ -3108,7 +3108,8 @@
   NSLog(@" selectedRange = %d, %d\n", mSelectedRange.location, mSelectedRange.length);
 #endif
 
-  nsReconversionEvent reconversionEvent(NS_RECONVERSION_QUERY, mGeckoChild);
+  nsReconversionEvent reconversionEvent(PR_TRUE, NS_RECONVERSION_QUERY,
+                                        mGeckoChild);
   reconversionEvent.time = PR_IntervalNow();
 
   nsresult rv = mGeckoChild->DispatchWindowEvent(reconversionEvent);
@@ -3227,7 +3228,7 @@
   if (!isARepeat && nonDeadKeyPress)
   {
     // Fire a key down.
-    nsKeyEvent geckoEvent;
+    nsKeyEvent geckoEvent(PR_TRUE, 0, nsnull);
     geckoEvent.point.x = geckoEvent.point.y = 0;
     [self convert: theEvent message: NS_KEY_DOWN
           isChar: &isChar
@@ -3256,7 +3257,7 @@
   if (!mInComposition && nonDeadKeyPress)
   {
     // Fire a key press.
-    nsKeyEvent geckoEvent;
+    nsKeyEvent geckoEvent(PR_TRUE, 0, nsnull);
     geckoEvent.point.x = geckoEvent.point.y = 0;
     isChar = PR_FALSE;
     [self convert: theEvent message: NS_KEY_PRESS
@@ -3310,7 +3311,7 @@
     return;
 
   // Fire a key up.
-  nsKeyEvent geckoEvent;
+  nsKeyEvent geckoEvent(PR_TRUE, 0, nsnull);
   geckoEvent.point.x = geckoEvent.point.y = 0;
   PRBool isChar;
   [self convert: theEvent message: NS_KEY_UP
@@ -3354,7 +3355,7 @@
 // This method is called when we are about to be focused.
 - (BOOL)becomeFirstResponder
 {
-  nsFocusEvent event(NS_GOTFOCUS, mGeckoChild);
+  nsFocusEvent event(PR_TRUE, NS_GOTFOCUS, mGeckoChild);
 
   mGeckoChild->DispatchWindowEvent(event);
   return [super becomeFirstResponder];
@@ -3363,7 +3364,7 @@
 // This method is called when are are about to lose focus.
 - (BOOL)resignFirstResponder
 {
-  nsFocusEvent event(NS_LOSTFOCUS, mGeckoChild);
+  nsFocusEvent event(PR_TRUE, NS_LOSTFOCUS, mGeckoChild);
 
   mGeckoChild->DispatchWindowEvent(event);
 
--- mozilla-firefox-1.0.4.orig/widget/src/cocoa/nsCocoaWindow.mm
+++ mozilla-firefox-1.0.4/widget/src/cocoa/nsCocoaWindow.mm
@@ -1498,7 +1498,7 @@
 //-------------------------------------------------------------------------
 void nsCocoaWindow::ComeToFront() {
 #if 0
-  nsZLevelEvent  event(NS_SETZLEVEL, this);
+  nsZLevelEvent  event(PR_TRUE, NS_SETZLEVEL, this);
 
   event.point.x = mBounds.x;
   event.point.y = mBounds.y;
@@ -1564,7 +1564,7 @@
   
   ChildView* view = NS_REINTERPRET_CAST(ChildView*, aView);
   
-  nsMouseEvent geckoEvent(0, view ? [view widget] : this)
+  nsMouseEvent geckoEvent(PR_TRUE, 0, view ? [view widget] : this);
   
   geckoEvent.nativeMsg = anEvent;
   geckoEvent.time = PR_IntervalNow();
@@ -1660,7 +1660,7 @@
 nsCocoaWindow::ReportSizeEvent()
 {
   // nsEvent
-  nsSizeEvent sizeEvent(NS_SIZE, this);
+  nsSizeEvent sizeEvent(PR_TRUE, NS_SIZE, this);
   sizeEvent.time        = PR_IntervalNow();
 
   // nsSizeEvent
--- mozilla-firefox-1.0.4.orig/widget/src/cocoa/nsMenuBarX.cpp
+++ mozilla-firefox-1.0.4/widget/src/cocoa/nsMenuBarX.cpp
@@ -402,7 +402,7 @@
     nsCOMPtr<nsIPresContext> presContext;
     MenuHelpersX::WebShellToPresContext(webShell, getter_AddRefs(presContext));
 
-    nsMouseEvent event(NS_XUL_COMMAND);
+    nsMouseEvent event(PR_TRUE, NS_XUL_COMMAND, nsnull);
 
     inDispatchTo->HandleDOMEvent(presContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
 	}
@@ -490,7 +490,7 @@
           nsAutoString menuIDstring;
           menu->GetAttr(kNameSpaceID_None, nsWidgetAtoms::id, menuIDstring);
           if ( menuIDstring == NS_LITERAL_STRING("menu_Help") ) {
-            nsMenuEvent event;
+            nsMenuEvent event(PR_TRUE, 0, nsnull);
             MenuHandle handle = nsnull;
 #if !TARGET_CARBON
             ::HMGetHelpMenuHandle(&handle);
--- mozilla-firefox-1.0.4.orig/widget/src/cocoa/nsMenuItemX.cpp
+++ mozilla-firefox-1.0.4/widget/src/cocoa/nsMenuItemX.cpp
@@ -261,7 +261,7 @@
   MenuHelpersX::WebShellToPresContext(webShell, getter_AddRefs(presContext));
 
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(NS_XUL_COMMAND);
+  nsMouseEvent event(PR_TRUE, NS_XUL_COMMAND, nsnull);
 
   // See if we have a command element.  If so, we execute on the command instead
   // of on our content element.
--- mozilla-firefox-1.0.4.orig/widget/src/cocoa/nsMenuX.cpp
+++ mozilla-firefox-1.0.4/widget/src/cocoa/nsMenuX.cpp
@@ -747,7 +747,7 @@
     if (listener) {
       MenuRef menuRef;
       ::GetEventParameter(event, kEventParamDirectObject, typeMenuRef, NULL, sizeof(menuRef), NULL, &menuRef);
-      nsMenuEvent menuEvent(NS_MENU_SELECTED);
+      nsMenuEvent menuEvent(PR_TRUE, NS_MENU_SELECTED, nsnull);
       menuEvent.time = PR_IntervalNow();
       menuEvent.mCommand = (PRUint32) menuRef;
       if (kind == kEventMenuOpening) {
@@ -973,8 +973,8 @@
 nsMenuX::OnCreate()
 {
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(NS_XUL_POPUP_SHOWING);
-  
+  nsMouseEvent event(PR_TRUE, NS_XUL_POPUP_SHOWING, nsnull);
+
   nsCOMPtr<nsIContent> popupContent;
   GetMenuPopupContent(getter_AddRefs(popupContent));
 
@@ -1056,7 +1056,7 @@
 nsMenuX::OnCreated()
 {
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(NS_XUL_POPUP_SHOWN);
+  nsMouseEvent event(PR_TRUE, NS_XUL_POPUP_SHOWN, nsnull);
   
   nsCOMPtr<nsIContent> popupContent;
   GetMenuPopupContent(getter_AddRefs(popupContent));
@@ -1092,7 +1092,7 @@
     return PR_TRUE;
 
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(NS_XUL_POPUP_HIDING);
+  nsMouseEvent event(PR_TRUE, NS_XUL_POPUP_HIDING, nsnull);
   
   nsCOMPtr<nsIWebShell>  webShell = do_QueryReferent(mWebShellWeakRef);
   if (!webShell) {
@@ -1122,7 +1122,7 @@
 nsMenuX::OnDestroyed()
 {
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(NS_XUL_POPUP_HIDDEN);
+  nsMouseEvent event(PR_TRUE, NS_XUL_POPUP_HIDDEN, nsnull);
   
   nsCOMPtr<nsIWebShell>  webShell = do_QueryReferent(mWebShellWeakRef);
   if (!webShell) {
--- mozilla-firefox-1.0.4.orig/widget/src/gtk2/nsCommonWidget.cpp
+++ mozilla-firefox-1.0.4/widget/src/gtk2/nsCommonWidget.cpp
@@ -157,7 +157,7 @@
 void
 nsCommonWidget::DispatchGotFocusEvent(void)
 {
-    nsGUIEvent event(NS_GOTFOCUS, this);
+    nsGUIEvent event(PR_TRUE, NS_GOTFOCUS, this);
     nsEventStatus status;
     DispatchEvent(&event, status);
 }
@@ -165,7 +165,7 @@
 void
 nsCommonWidget::DispatchLostFocusEvent(void)
 {
-    nsGUIEvent event(NS_LOSTFOCUS, this);
+    nsGUIEvent event(PR_TRUE, NS_LOSTFOCUS, this);
     nsEventStatus status;
     DispatchEvent(&event, status);
 }
@@ -173,7 +173,7 @@
 void
 nsCommonWidget::DispatchActivateEvent(void)
 {
-    nsGUIEvent event(NS_ACTIVATE, this);
+    nsGUIEvent event(PR_TRUE, NS_ACTIVATE, this);
     nsEventStatus status;
     DispatchEvent(&event, status);
 }
@@ -181,7 +181,7 @@
 void
 nsCommonWidget::DispatchDeactivateEvent(void)
 {
-    nsGUIEvent event(NS_DEACTIVATE, this);
+    nsGUIEvent event(PR_TRUE, NS_DEACTIVATE, this);
     nsEventStatus status;
     DispatchEvent(&event, status);
 }
@@ -189,7 +189,7 @@
 void
 nsCommonWidget::DispatchResizeEvent(nsRect &aRect, nsEventStatus &aStatus)
 {
-    nsSizeEvent event(NS_SIZE, this);
+    nsSizeEvent event(PR_TRUE, NS_SIZE, this);
 
     event.windowSize = &aRect;
     event.point.x = aRect.x;
@@ -438,7 +438,7 @@
 
     nsCOMPtr<nsIWidget> kungFuDeathGrip = this;
 
-    nsGUIEvent event(NS_DESTROY, this);
+    nsGUIEvent event(PR_TRUE, NS_DESTROY, this);
     nsEventStatus status;
     DispatchEvent(&event, status);
 }
--- mozilla-firefox-1.0.4.orig/widget/src/gtk2/nsDragService.cpp
+++ mozilla-firefox-1.0.4/widget/src/gtk2/nsDragService.cpp
@@ -838,7 +838,7 @@
             (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
         listTarget->target = g_strdup(gMimeListType);
         listTarget->flags = 0;
-        listTarget->info = (guint)listAtom;
+        listTarget->info = (guint)(NS_PTR_TO_INT32(listAtom));
         PR_LOG(sDragLm, PR_LOG_DEBUG,
                ("automatically adding target %s with id %ld\n",
                listTarget->target, listAtom));
@@ -877,7 +877,7 @@
                              (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
                             listTarget->target = g_strdup(gTextUriListType);
                             listTarget->flags = 0;
-                            listTarget->info = (guint)listAtom;
+                            listTarget->info = (guint)NS_PTR_TO_INT32(listAtom);
                             PR_LOG(sDragLm, PR_LOG_DEBUG,
                                    ("automatically adding target %s with \
                                    id %ld\n", listTarget->target, listAtom));
@@ -914,7 +914,7 @@
                           (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
                         target->target = g_strdup(flavorStr);
                         target->flags = 0;
-                        target->info = (guint)atom;
+                        target->info = (guint)NS_PTR_TO_INT32(atom);
                         PR_LOG(sDragLm, PR_LOG_DEBUG,
                                ("adding target %s with id %ld\n",
                                target->target, atom));
@@ -931,7 +931,7 @@
                              (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
                             plainTarget->target = g_strdup(kTextMime);
                             plainTarget->flags = 0;
-                            plainTarget->info = (guint)plainAtom;
+                            plainTarget->info = (guint)NS_PTR_TO_INT32(plainAtom);
                             PR_LOG(sDragLm, PR_LOG_DEBUG,
                                    ("automatically adding target %s with \
                                    id %ld\n", plainTarget->target, plainAtom));
@@ -948,7 +948,7 @@
                              (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
                             urlTarget->target = g_strdup(gMozUrlType);
                             urlTarget->flags = 0;
-                            urlTarget->info = (guint)urlAtom;
+                            urlTarget->info = (guint)NS_PTR_TO_INT32(urlAtom);
                             PR_LOG(sDragLm, PR_LOG_DEBUG,
                                    ("automatically adding target %s with \
                                    id %ld\n", urlTarget->target, urlAtom));
--- mozilla-firefox-1.0.4.orig/widget/src/gtk2/nsGtkKeyUtils.cpp
+++ mozilla-firefox-1.0.4/widget/src/gtk2/nsGtkKeyUtils.cpp
@@ -270,7 +270,7 @@
             case GDK_KP_Add:
                 return '+';
             case GDK_KP_Separator:
-                return '|';
+                return ',';
             case GDK_KP_Subtract:
                 return '-';
             case GDK_KP_Decimal:
--- mozilla-firefox-1.0.4.orig/widget/src/gtk2/nsWindow.cpp
+++ mozilla-firefox-1.0.4/widget/src/gtk2/nsWindow.cpp
@@ -1193,7 +1193,7 @@
     // XXX figure out the region/rect stuff!
     nsRect rect(aEvent->area.x, aEvent->area.y,
                 aEvent->area.width, aEvent->area.height);
-    nsPaintEvent event(NS_PAINT, this);
+    nsPaintEvent event(PR_TRUE, NS_PAINT, this);
 
     event.point.x = aEvent->area.x;
     event.point.y = aEvent->area.y;
@@ -1235,7 +1235,7 @@
         mBounds.y = newrect.y;
     }
 
-    nsGUIEvent event(NS_MOVE, this);
+    nsGUIEvent event(PR_TRUE, NS_MOVE, this);
 
     event.point.x = aEvent->x;
     event.point.y = aEvent->y;
@@ -1273,7 +1273,7 @@
 void
 nsWindow::OnDeleteEvent(GtkWidget *aWidget, GdkEventAny *aEvent)
 {
-    nsGUIEvent event(NS_XUL_CLOSE, this);
+    nsGUIEvent event(PR_TRUE, NS_XUL_CLOSE, this);
 
     event.point.x = 0;
     event.point.y = 0;
@@ -1285,7 +1285,7 @@
 void
 nsWindow::OnEnterNotifyEvent(GtkWidget *aWidget, GdkEventCrossing *aEvent)
 {
-    nsMouseEvent event(NS_MOUSE_ENTER, this);
+    nsMouseEvent event(PR_TRUE, NS_MOUSE_ENTER, this);
 
     event.point.x = nscoord(aEvent->x);
     event.point.y = nscoord(aEvent->y);
@@ -1299,7 +1299,7 @@
 void
 nsWindow::OnLeaveNotifyEvent(GtkWidget *aWidget, GdkEventCrossing *aEvent)
 {
-    nsMouseEvent event(NS_MOUSE_EXIT, this);
+    nsMouseEvent event(PR_TRUE, NS_MOUSE_EXIT, this);
 
     event.point.x = nscoord(aEvent->x);
     event.point.y = nscoord(aEvent->y);
@@ -1331,7 +1331,7 @@
         gPluginFocusWindow->LoseNonXEmbedPluginFocus();
     }
 
-    nsMouseEvent event(NS_MOUSE_MOVE, this);
+    nsMouseEvent event(PR_TRUE, NS_MOUSE_MOVE, this);
 
     if (synthEvent) {
         event.point.x = nscoord(xevent.xmotion.x);
@@ -1396,6 +1396,9 @@
         return;
 
     switch (aEvent->button) {
+    case 1:
+        eventType = NS_MOUSE_LEFT_BUTTON_DOWN;
+        break;
     case 2:
         eventType = NS_MOUSE_MIDDLE_BUTTON_DOWN;
         break;
@@ -1403,20 +1406,19 @@
         eventType = NS_MOUSE_RIGHT_BUTTON_DOWN;
         break;
     default:
-        eventType = NS_MOUSE_LEFT_BUTTON_DOWN;
         break;
     }
 
     nsCOMPtr<nsIWidget> kungFuDeathGrip = this;
 
-    nsMouseEvent event(eventType, this);
+    nsMouseEvent event(PR_TRUE, eventType, this);
     InitButtonEvent(event, aEvent);
 
     DispatchEvent(&event, status);
 
     // right menu click on linux should also pop up a context menu
     if (eventType == NS_MOUSE_RIGHT_BUTTON_DOWN) {
-        nsMouseEvent contextMenuEvent(NS_CONTEXTMENU, this);
+        nsMouseEvent contextMenuEvent(PR_TRUE, NS_CONTEXTMENU, this);
         InitButtonEvent(contextMenuEvent, aEvent);
         DispatchEvent(&contextMenuEvent, status);
     }
@@ -1445,7 +1447,7 @@
         break;
     }
 
-    nsMouseEvent  event(eventType, this);
+    nsMouseEvent  event(PR_TRUE, eventType, this);
     InitButtonEvent(event, aEvent);
 
     nsEventStatus status;
@@ -1582,12 +1584,12 @@
         mInKeyRepeat = PR_TRUE;
 
         // send the key down event
-        nsKeyEvent downEvent(NS_KEY_DOWN, this);
+        nsKeyEvent downEvent(PR_TRUE, NS_KEY_DOWN, this);
         InitKeyEvent(downEvent, aEvent);
         DispatchEvent(&downEvent, status);
     }
 
-    nsKeyEvent event(NS_KEY_PRESS, this);
+    nsKeyEvent event(PR_TRUE, NS_KEY_PRESS, this);
     InitKeyEvent(event, aEvent);
     event.charCode = nsConvertCharCodeToUnicode(aEvent);
     if (event.charCode) {
@@ -1615,7 +1617,7 @@
     // before we dispatch a key, check if it's the context menu key.
     // If so, send a context menu key event instead.
     if (is_context_menu_key(event)) {
-        nsMouseEvent contextMenuEvent;
+        nsMouseEvent contextMenuEvent(PR_TRUE, 0, nsnull);
         key_event_to_context_menu_event(&event, &contextMenuEvent);
         DispatchEvent(&contextMenuEvent, status);
     }
@@ -1660,7 +1662,7 @@
         return TRUE;
     }
 
-    nsKeyEvent event(NS_KEY_UP, this);
+    nsKeyEvent event(PR_TRUE, NS_KEY_UP, this);
     InitKeyEvent(event, aEvent);
 
     DispatchEvent(&event, status);
@@ -1677,7 +1679,7 @@
 void
 nsWindow::OnScrollEvent(GtkWidget *aWidget, GdkEventScroll *aEvent)
 {
-    nsMouseScrollEvent event(NS_MOUSE_SCROLL, this);
+    nsMouseScrollEvent event(PR_TRUE, NS_MOUSE_SCROLL, this);
     InitMouseScrollEvent(event, aEvent);
 
     // check to see if we should rollup
@@ -1713,7 +1715,7 @@
     LOG(("nsWindow::OnWindowStateEvent [%p] changed %d new_window_state %d\n",
          (void *)this, aEvent->changed_mask, aEvent->new_window_state));
 
-    nsSizeModeEvent event(NS_SIZEMODE, this);
+    nsSizeModeEvent event(PR_TRUE, NS_SIZEMODE, this);
 
     // We don't care about anything but changes in the maximized/icon
     // states
@@ -1802,7 +1804,7 @@
     // notify the drag service that we are starting a drag motion.
     dragSessionGTK->TargetStartDragMotion();
 
-    nsMouseEvent event(NS_DRAGDROP_OVER, innerMostWidget);
+    nsMouseEvent event(PR_TRUE, NS_DRAGDROP_OVER, innerMostWidget);
 
     InitDragEvent(event);
 
@@ -1915,7 +1917,7 @@
 
     innerMostWidget->AddRef();
 
-    nsMouseEvent event(NS_DRAGDROP_OVER, innerMostWidget);
+    nsMouseEvent event(PR_TRUE, NS_DRAGDROP_OVER, innerMostWidget);
 
     InitDragEvent(event);
 
@@ -1984,7 +1986,7 @@
 {
     LOG(("nsWindow::OnDragLeave(%p)\n", this));
 
-    nsMouseEvent event(NS_DRAGDROP_EXIT, this);
+    nsMouseEvent event(PR_TRUE, NS_DRAGDROP_EXIT, this);
 
     AddRef();
 
@@ -2018,8 +2020,8 @@
 nsWindow::OnDragEnter(nscoord aX, nscoord aY)
 {
     LOG(("nsWindow::OnDragEnter(%p)\n", this));
-    
-    nsMouseEvent event(NS_DRAGDROP_ENTER, this);
+
+    nsMouseEvent event(PR_TRUE, NS_DRAGDROP_ENTER, this);
 
     event.point.x = aX;
     event.point.y = aY;
@@ -3860,7 +3862,7 @@
 nsWindow::DispatchAccessibleEvent(nsIAccessible** aAccessible)
 {
     PRBool result = PR_FALSE;
-    nsAccessibleEvent event(NS_GETACCESSIBLE, this);
+    nsAccessibleEvent event(PR_TRUE, NS_GETACCESSIBLE, this);
 
     *aAccessible = nsnull;
 
@@ -3976,7 +3978,7 @@
 
     mComposingText = PR_TRUE;
 
-    nsCompositionEvent compEvent(NS_COMPOSITION_START, this);
+    nsCompositionEvent compEvent(PR_TRUE, NS_COMPOSITION_START, this);
 
     nsEventStatus status;
     DispatchEvent(&compEvent, status);
@@ -3993,7 +3995,7 @@
         IMEComposeStart();
 
     LOGIM(("IMEComposeText\n"));
-    nsTextEvent textEvent(NS_TEXT_TEXT, this);
+    nsTextEvent textEvent(PR_TRUE, NS_TEXT_TEXT, this);
 
     if (aLen != 0) {
         textEvent.theText = (PRUnichar*)aText;
@@ -4025,7 +4027,7 @@
 
     mComposingText = PR_FALSE;
 
-    nsCompositionEvent compEvent(NS_COMPOSITION_END, this);
+    nsCompositionEvent compEvent(PR_TRUE, NS_COMPOSITION_END, this);
 
     nsEventStatus status;
     DispatchEvent(&compEvent, status);
@@ -4271,7 +4273,7 @@
         // Get the range of the current attribute(s)
         pango_attr_iterator_range(aFeedbackIterator, &start, &end);
 
-        PRUint32 feedbackType;
+        PRUint32 feedbackType = 0;
         // XIMReverse | XIMUnderline
         if (aPangoAttrUnderline && aPangoAttrReverse) {
             feedbackType = NS_TEXTRANGE_SELECTEDCONVERTEDTEXT;
--- mozilla-firefox-1.0.4.orig/widget/src/mac/nsMacControl.cpp
+++ mozilla-firefox-1.0.4/widget/src/mac/nsMacControl.cpp
@@ -261,7 +261,7 @@
 		mValue = aNewValue;
 		mLastValue = mValue;	// safely assume that the control has been repainted already
 
-		nsGUIEvent guiEvent(NS_CONTROL_CHANGE, this);
+		nsGUIEvent guiEvent(PR_TRUE, NS_CONTROL_CHANGE, this);
  		guiEvent.time	 	= PR_IntervalNow();
 		Inherited::DispatchWindowEvent(guiEvent);
 	}
--- mozilla-firefox-1.0.4.orig/widget/src/mac/nsMacEventHandler.cpp
+++ mozilla-firefox-1.0.4/widget/src/mac/nsMacEventHandler.cpp
@@ -150,7 +150,7 @@
   if (!inWidget)
     return nsEventStatus_eIgnore;
 
-  nsMouseScrollEvent scrollEvent(NS_MOUSE_SCROLL, inWidget);
+  nsMouseScrollEvent scrollEvent(PR_TRUE, NS_MOUSE_SCROLL, inWidget);
   
   scrollEvent.scrollFlags = 
     (inAxis == kEventMouseWheelAxisX) ? nsMouseScrollEvent::kIsHorizontal : nsMouseScrollEvent::kIsVertical;
@@ -227,7 +227,7 @@
 	if (!aWidget)
 		return;
 
-	nsGUIEvent	guiEvent(aEventType, aWidget);
+	nsGUIEvent guiEvent(PR_TRUE, aEventType, aWidget);
 	guiEvent.time = PR_IntervalNow();
 	aWidget->DispatchWindowEvent(guiEvent);
 }
@@ -241,7 +241,7 @@
 	if (!aWidget)
 		return;
 
-	nsSizeModeEvent	event(NS_SIZEMODE, aWidget);
+	nsSizeModeEvent event(PR_TRUE, NS_SIZEMODE, aWidget);
 	event.time = PR_IntervalNow();
 	event.mSizeMode = aMode;
 	aWidget->DispatchWindowEvent(event);
@@ -573,7 +573,7 @@
 		focusedWidget = mTopLevelWidget;
 
 	// nsEvent
-	nsMenuEvent menuEvent(NS_MENU_SELECTED, focusedWidget);
+	nsMenuEvent menuEvent(PR_TRUE, NS_MENU_SELECTED, focusedWidget);
 	menuEvent.point.x		= aOSEvent.where.h;
 	menuEvent.point.y		= aOSEvent.where.v;
 	menuEvent.time			= PR_IntervalNow();
@@ -668,7 +668,7 @@
 	// update the tracking of which widget the mouse is now over.
 	gEventDispatchHandler.SetWidgetPointed(widgetHit);
 	
-	nsMouseEvent geckoEvent(aMessage, widgetHit);
+	nsMouseEvent geckoEvent(PR_TRUE, aMessage, widgetHit);
 
 	// nsEvent
 	geckoEvent.point = widgetHitPoint;
@@ -1145,7 +1145,7 @@
 	{
 		case keyUp:
       {
-        nsKeyEvent keyUpEvent(NS_KEY_UP);
+        nsKeyEvent keyUpEvent(PR_TRUE, NS_KEY_UP, nsnull);
         InitializeKeyEvent(keyUpEvent, aOSEvent, focusedWidget, NS_KEY_UP);
         result = focusedWidget->DispatchWindowEvent(keyUpEvent);
         break;
@@ -1153,7 +1153,8 @@
 
     case keyDown:	
       {
-        nsKeyEvent keyDownEvent(NS_KEY_DOWN), keyPressEvent(NS_KEY_PRESS);
+        nsKeyEvent keyDownEvent(PR_TRUE, NS_KEY_DOWN, nsnull);
+        nsKeyEvent keyPressEvent(PR_TRUE, NS_KEY_PRESS, nsnull);
         InitializeKeyEvent(keyDownEvent, aOSEvent, focusedWidget, NS_KEY_DOWN);
         result = focusedWidget->DispatchWindowEvent(keyDownEvent);
 
@@ -1171,7 +1172,7 @@
         // before we dispatch this key, check if it's the contextmenu key.
         // If so, send a context menu event instead.
         if ( IsContextMenuKey(keyPressEvent) ) {
-          nsMouseEvent contextMenuEvent;
+          nsMouseEvent contextMenuEvent(PR_TRUE, 0, nsnull);
           ConvertKeyEventToContextMenuEvent(&keyPressEvent, &contextMenuEvent);
           result = focusedWidget->DispatchWindowEvent(contextMenuEvent);
           NS_ASSERTION(NS_SUCCEEDED(result), "cannot DispatchWindowEvent");
@@ -1185,7 +1186,7 @@
 
     case autoKey:
       {
-        nsKeyEvent keyPressEvent(NS_KEY_PRESS);
+        nsKeyEvent keyPressEvent(PR_TRUE, NS_KEY_PRESS, nsnull);
         InitializeKeyEvent(keyPressEvent, aOSEvent, focusedWidget, NS_KEY_PRESS);
         result = focusedWidget->DispatchWindowEvent(keyPressEvent);
         break;
@@ -1251,7 +1252,7 @@
   // simulate key down event if this isn't an autoKey event
   if (aOSEvent.what == keyDown)
   {
-    nsKeyEvent keyDownEvent(NS_KEY_DOWN);
+    nsKeyEvent keyDownEvent(PR_TRUE, NS_KEY_DOWN, nsnull);
     InitializeKeyEvent(keyDownEvent, aOSEvent, focusedWidget, NS_KEY_DOWN, &isCharacter, PR_FALSE);
     result = focusedWidget->DispatchWindowEvent(keyDownEvent);
     NS_ASSERTION(NS_SUCCEEDED(result), "cannot DispatchWindowEvent keydown");
@@ -1265,7 +1266,7 @@
   }
 
   // simulate key press events
-  nsKeyEvent keyPressEvent(NS_KEY_PRESS);
+  nsKeyEvent keyPressEvent(PR_TRUE, NS_KEY_PRESS, nsnull);
   InitializeKeyEvent(keyPressEvent, aOSEvent, focusedWidget, NS_KEY_PRESS, &isCharacter, PR_FALSE);
 
   if (isCharacter) 
@@ -1299,7 +1300,7 @@
       // before we dispatch a key, check if it's the context menu key.
       // If so, send a context menu event instead.
       if ( IsContextMenuKey(keyPressEvent) ) {
-        nsMouseEvent contextMenuEvent;
+        nsMouseEvent contextMenuEvent(PR_TRUE, 0, nsnull);
         ConvertKeyEventToContextMenuEvent(&keyPressEvent, &contextMenuEvent);
         result = focusedWidget->DispatchWindowEvent(contextMenuEvent);
         NS_ASSERTION(NS_SUCCEEDED(result), "cannot DispatchWindowEvent");
@@ -1575,7 +1576,7 @@
       if ( ignoreClickInContent )
         break;
 						
-			nsMouseEvent mouseEvent;
+			nsMouseEvent mouseEvent(PR_TRUE, 0, nsnull);
 			PRUint32 mouseButton = NS_MOUSE_LEFT_BUTTON_DOWN;
 			if ( aOSEvent.modifiers & controlKey )
 			  mouseButton = NS_MOUSE_RIGHT_BUTTON_DOWN;
@@ -1614,8 +1615,8 @@
 			{        
 				// set the activation and focus on the widget hit, if it accepts it
 				{
-					nsMouseEvent mouseActivateEvent;
-			        ConvertOSEventToMouseEvent(aOSEvent, mouseActivateEvent, NS_MOUSE_ACTIVATE);
+					nsMouseEvent mouseActivateEvent(PR_TRUE, 0, nsnull);
+          ConvertOSEventToMouseEvent(aOSEvent, mouseActivateEvent, NS_MOUSE_ACTIVATE);
 					widgetHit->DispatchMouseEvent(mouseActivateEvent);
 				}
 
@@ -1625,7 +1626,7 @@
 				// if we're a control-click, send in an additional NS_CONTEXTMENU event
 				// after the mouse down.
 				if ( mouseButton == NS_MOUSE_RIGHT_BUTTON_DOWN ) {
-    			nsMouseEvent contextMenuEvent;
+    			nsMouseEvent contextMenuEvent(PR_TRUE, 0, nsnull);
     			ConvertOSEventToMouseEvent(aOSEvent, contextMenuEvent, NS_CONTEXTMENU);
     			contextMenuEvent.isControl = PR_FALSE;    			
 					widgetHit->DispatchMouseEvent(contextMenuEvent);
@@ -1667,7 +1668,7 @@
 {
 	PRBool retVal = PR_FALSE;
 
-	nsMouseEvent mouseEvent;
+	nsMouseEvent mouseEvent(PR_TRUE, 0, nsnull);
 	ConvertOSEventToMouseEvent(aOSEvent, mouseEvent, NS_MOUSE_LEFT_BUTTON_UP);
 
 	nsWindow* widgetReleased = (nsWindow*)mouseEvent.widget;
@@ -1701,7 +1702,7 @@
   
 	PRBool retVal = PR_FALSE;
 
-	nsMouseEvent mouseEvent;
+	nsMouseEvent mouseEvent(PR_TRUE, 0, nsnull);
 	ConvertOSEventToMouseEvent(aOSEvent, mouseEvent, NS_MOUSE_MOVE);
 
 	if (lastWidgetHit)
@@ -2477,7 +2478,8 @@
   if (!focusedWidget)
     focusedWidget = mTopLevelWidget;
 
-  nsReconversionEvent reconversionEvent(NS_RECONVERSION_QUERY, focusedWidget);
+  nsReconversionEvent reconversionEvent(PR_TRUE, NS_RECONVERSION_QUERY,
+                                        focusedWidget);
   reconversionEvent.time = PR_IntervalNow();
 
   nsresult res = focusedWidget->DispatchWindowEvent(reconversionEvent);
@@ -2517,7 +2519,8 @@
 	//
 	// create the nsCompositionEvent
 	//
-	nsCompositionEvent		compositionEvent(NS_COMPOSITION_START, focusedWidget);
+	nsCompositionEvent compositionEvent(PR_TRUE, NS_COMPOSITION_START,
+                                      focusedWidget);
 	compositionEvent.time = PR_IntervalNow();
 
 	nsresult res = focusedWidget->DispatchWindowEvent(compositionEvent);
@@ -2554,7 +2557,8 @@
 	//
 	// create the nsCompositionEvent
 	//
-	nsCompositionEvent		compositionEvent(NS_COMPOSITION_END, focusedWidget);
+	nsCompositionEvent compositionEvent(PR_TRUE, NS_COMPOSITION_END,
+                                      focusedWidget);
 	compositionEvent.time = PR_IntervalNow();
 
 	return(focusedWidget->DispatchWindowEvent(compositionEvent));
@@ -2617,7 +2621,7 @@
 	//
 	// create the nsTextEvent
 	//
-	nsTextEvent		textEvent(NS_TEXT_TEXT, focusedWidget);
+	nsTextEvent textEvent(PR_TRUE, NS_TEXT_TEXT, focusedWidget);
 	textEvent.time = PR_IntervalNow();
 	textEvent.theText = mIMECompositionStr->get();
 	textEvent.rangeCount = textRangeCount;
--- mozilla-firefox-1.0.4.orig/widget/src/mac/nsMacWindow.cpp
+++ mozilla-firefox-1.0.4/widget/src/mac/nsMacWindow.cpp
@@ -1713,7 +1713,7 @@
 NS_IMETHODIMP
 nsMacWindow::ComeToFront()
 {
-  nsZLevelEvent  event(NS_SETZLEVEL, this);
+  nsZLevelEvent event(PR_TRUE, NS_SETZLEVEL, this);
 
   event.point.x = mBounds.x;
   event.point.y = mBounds.y;
--- mozilla-firefox-1.0.4.orig/widget/src/mac/nsMenuBarX.cpp
+++ mozilla-firefox-1.0.4/widget/src/mac/nsMenuBarX.cpp
@@ -499,7 +499,7 @@
           nsAutoString menuIDstring;
           menu->GetAttr(kNameSpaceID_None, nsWidgetAtoms::id, menuIDstring);
           if ( menuIDstring == NS_LITERAL_STRING("menu_Help") ) {
-            nsMenuEvent event;
+            nsMenuEvent event(PR_TRUE, 0, nsnull);
             MenuHandle handle = nsnull;
 #if !TARGET_CARBON
             ::HMGetHelpMenuHandle(&handle);
@@ -988,7 +988,7 @@
   MenuHelpersX::WebShellToPresContext(webShell, getter_AddRefs(presContext));
 
   nsEventStatus status = nsEventStatus_eConsumeNoDefault;
-  nsMouseEvent event(NS_XUL_COMMAND);
+  nsMouseEvent event(PR_TRUE, NS_XUL_COMMAND, nsnull);
 
   // FIXME: Should probably figure out how to init this with the actual
   // pressed keys, but this is a big old edge case anyway. -dwh
--- mozilla-firefox-1.0.4.orig/widget/src/mac/nsMenuX.cpp
+++ mozilla-firefox-1.0.4/widget/src/mac/nsMenuX.cpp
@@ -753,7 +753,7 @@
     if (listener) {
       MenuRef menuRef;
       ::GetEventParameter(event, kEventParamDirectObject, typeMenuRef, NULL, sizeof(menuRef), NULL, &menuRef);
-      nsMenuEvent menuEvent(NS_MENU_SELECTED);
+      nsMenuEvent menuEvent(PR_TRUE, NS_MENU_SELECTED, nsnull);
       menuEvent.time = PR_IntervalNow();
       menuEvent.mCommand = (PRUint32) menuRef;
       if (kind == kEventMenuOpening) {
@@ -979,7 +979,7 @@
 nsMenuX::OnCreate()
 {
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(NS_XUL_POPUP_SHOWING);
+  nsMouseEvent event(PR_TRUE, NS_XUL_POPUP_SHOWING, nsnull);
   
   nsCOMPtr<nsIContent> popupContent;
   GetMenuPopupContent(getter_AddRefs(popupContent));
@@ -1061,7 +1061,7 @@
 nsMenuX::OnCreated()
 {
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(NS_XUL_POPUP_SHOWN);
+  nsMouseEvent event(PR_TRUE, NS_XUL_POPUP_SHOWN, nsnull);
   
   nsCOMPtr<nsIContent> popupContent;
   GetMenuPopupContent(getter_AddRefs(popupContent));
@@ -1097,7 +1097,7 @@
     return PR_TRUE;
 
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(NS_XUL_POPUP_HIDING);
+  nsMouseEvent event(PR_TRUE, NS_XUL_POPUP_HIDING, nsnull);
   
   nsCOMPtr<nsIWebShell>  webShell = do_QueryReferent(mWebShellWeakRef);
   if (!webShell) {
@@ -1127,7 +1127,7 @@
 nsMenuX::OnDestroyed()
 {
   nsEventStatus status = nsEventStatus_eIgnore;
-  nsMouseEvent event(NS_XUL_POPUP_HIDDEN);
+  nsMouseEvent event(PR_TRUE, NS_XUL_POPUP_HIDDEN, nsnull);
   
   nsCOMPtr<nsIWebShell>  webShell = do_QueryReferent(mWebShellWeakRef);
   if (!webShell) {
--- mozilla-firefox-1.0.4.orig/widget/src/mac/nsWindow.cpp
+++ mozilla-firefox-1.0.4/widget/src/mac/nsWindow.cpp
@@ -1717,7 +1717,7 @@
 		return;
 
 	// initialize the paint event
-	nsPaintEvent paintEvent(NS_PAINT, this);
+	nsPaintEvent paintEvent(PR_TRUE, NS_PAINT, this);
 	paintEvent.renderingContext = aContext;         // nsPaintEvent
 	paintEvent.rect             = &aRect;
 
@@ -2112,7 +2112,7 @@
 PRBool nsWindow::ReportDestroyEvent()
 {
 	// nsEvent
-	nsGUIEvent moveEvent(NS_DESTROY, this);
+	nsGUIEvent moveEvent(PR_TRUE, NS_DESTROY, this);
 	moveEvent.message			= NS_DESTROY;
 	moveEvent.time				= PR_IntervalNow();
 
@@ -2127,7 +2127,7 @@
 PRBool nsWindow::ReportMoveEvent()
 {
 	// nsEvent
-	nsGUIEvent moveEvent(NS_MOVE, this);
+	nsGUIEvent moveEvent(PR_TRUE, NS_MOVE, this);
 	moveEvent.point.x			= mBounds.x;
 	moveEvent.point.y			= mBounds.y;
 	moveEvent.time				= PR_IntervalNow();
@@ -2143,7 +2143,7 @@
 PRBool nsWindow::ReportSizeEvent()
 {
 	// nsEvent
-	nsSizeEvent sizeEvent(NS_SIZE, this);
+	nsSizeEvent sizeEvent(PR_TRUE, NS_SIZE, this);
 	sizeEvent.time				= PR_IntervalNow();
 
 	// nsSizeEvent
--- mozilla-firefox-1.0.4.orig/widget/src/os2/nsFrameWindow.cpp
+++ mozilla-firefox-1.0.4/widget/src/os2/nsFrameWindow.cpp
@@ -357,9 +357,9 @@
             UpdateClientSize();
             DispatchResizeEvent( mSizeClient.width, mSizeClient.height);
          }
- 
+
          if ( pSwp->fl & (SWP_MAXIMIZE | SWP_MINIMIZE | SWP_RESTORE)) {
-	    nsSizeModeEvent event(NS_SIZEMODE, this);
+           nsSizeModeEvent event(PR_TRUE, NS_SIZEMODE, this);
             if ( pSwp->fl & SWP_MAXIMIZE)
               event.mSizeMode = nsSizeMode_Maximized;
             else if ( pSwp->fl & SWP_MINIMIZE)
--- mozilla-firefox-1.0.4.orig/widget/src/os2/nsWindow.cpp
+++ mozilla-firefox-1.0.4/widget/src/os2/nsWindow.cpp
@@ -509,7 +509,7 @@
 
 PRBool nsWindow::DispatchStandardEvent(PRUint32 aMsg)
 {
-  nsGUIEvent event(aMsg, this);
+  nsGUIEvent event(PR_TRUE, aMsg, this);
   InitEvent(event);
 
   PRBool result = DispatchWindowEvent(&event);
@@ -524,7 +524,7 @@
 //-------------------------------------------------------------------------
 PRBool nsWindow::DispatchAppCommandEvent(PRUint32 aEventCommand)
 {
-  nsAppCommandEvent event(NS_APPCOMMAND_START, this);
+  nsAppCommandEvent event(PR_TRUE, NS_APPCOMMAND_START, this);
 
   InitEvent(event);
   event.appCommand = NS_APPCOMMAND_START + aEventCommand;
@@ -2163,7 +2163,7 @@
 //
 PRBool nsWindow::OnKey( MPARAM mp1, MPARAM mp2)
 {
-   nsKeyEvent pressEvent;
+   nsKeyEvent pressEvent(PR_TRUE, 0, nsnull);
    USHORT     fsFlags = SHORT1FROMMP(mp1);
    USHORT     usVKey = SHORT2FROMMP(mp2);
    USHORT     usChar = SHORT1FROMMP(mp2);
@@ -2204,7 +2204,8 @@
    // have the unicode charcode in.
 
    nsPoint point(0,0);
-   nsKeyEvent event((fsFlags & KC_KEYUP) ? NS_KEY_UP : NS_KEY_DOWN, this);
+   nsKeyEvent event(PR_TRUE, (fsFlags & KC_KEYUP) ? NS_KEY_UP : NS_KEY_DOWN,
+                    this);
    InitEvent( event, &point);
    event.keyCode   = WMChar2KeyCode( mp1, mp2);
    event.isShift   = (fsFlags & KC_SHIFT) ? PR_TRUE : PR_FALSE;
@@ -2308,7 +2309,7 @@
 
 void nsWindow::ConstrainZLevel(HWND *aAfter) {
 
-  nsZLevelEvent  event(NS_SETZLEVEL, this);
+  nsZLevelEvent  event(PR_TRUE, NS_SETZLEVEL, this);
   nsWindow      *aboveWindow = 0;
 
   InitEvent(event);
@@ -2356,7 +2357,7 @@
 //#if 0
         case WM_COMMAND: // fire off menu selections
         {
-           nsMenuEvent event(NS_MENU_SELECTED, this);
+           nsMenuEvent event(PR_TRUE, NS_MENU_SELECTED, this);
            event.mCommand = SHORT1FROMMP(mp1);
            InitEvent(event);
            result = DispatchWindowEvent(&event);
@@ -2381,7 +2382,7 @@
 #if 0  // Tooltips appear to be gone
         case WMU_SHOW_TOOLTIP:
         {
-          nsTooltipEvent event(NS_SHOW_TOOLTIP, this);
+          nsTooltipEvent event(PR_TRUE, NS_SHOW_TOOLTIP, this);
           InitEvent( event );
           event.tipIndex = LONGFROMMP(mp1);
           result = DispatchWindowEvent(&event);
@@ -2458,7 +2459,7 @@
         case WM_QUERYCONVERTPOS:
           {
             PRECTL pCursorRect = (PRECTL)mp1;
-            nsCompositionEvent event(NS_COMPOSITION_QUERY, this);
+            nsCompositionEvent event(PR_TRUE, NS_COMPOSITION_QUERY, this);
             nsPoint point;
             point.x = 0;
             point.y = 0;
@@ -2547,7 +2548,7 @@
                   (WinQuerySysValue(HWND_DESKTOP, SV_CYMOTIONSTART) / 2))
               isCopy = TRUE;
 
-            nsKeyEvent event(NS_KEY_PRESS, this);
+            nsKeyEvent event(PR_TRUE, NS_KEY_PRESS, this);
             nsPoint point(0,0);
             InitEvent( event, &point);
 
@@ -2860,7 +2861,7 @@
 PRBool nsWindow::OnMove(PRInt32 aX, PRInt32 aY)
 {            
   // Params here are in XP-space for the desktop
-  nsGUIEvent event(NS_MOVE, this);
+  nsGUIEvent event(PR_TRUE, NS_MOVE, this);
   InitEvent( event);
   event.point.x = aX;
   event.point.y = aY;
@@ -2898,7 +2899,7 @@
           // call the event callback 
           if (mEventCallback) 
           {
-              nsPaintEvent event(NS_PAINT, this);
+              nsPaintEvent event(PR_TRUE, NS_PAINT, this);
               InitEvent(event);
      
               // build XP rect from in-ex window rect
@@ -2975,7 +2976,7 @@
 {
    PRBool result;
    // call the event callback 
-   nsSizeEvent event(NS_SIZE, this);
+   nsSizeEvent event(PR_TRUE, NS_SIZE, this);
    nsRect      rect( 0, 0, aX, aY);
 
    InitEvent( event);
@@ -3001,7 +3002,7 @@
     return result;
   }
 
-  nsMouseEvent event(aEventType, this);
+  nsMouseEvent event(PR_TRUE, aEventType, this);
 
   // Mouse leave & enter messages don't seem to have position built in.
   if( aEventType && aEventType != NS_MOUSE_ENTER && aEventType != NS_MOUSE_EXIT)
@@ -3226,7 +3227,7 @@
 {
   // call the event callback 
   if (mEventCallback) {
-    nsFocusEvent event(aEventType, this);
+    nsFocusEvent event(PR_TRUE, aEventType, this);
     InitEvent(event);
 
     //focus and blur event should go to their base widget loc, not current mouse pos
@@ -3275,7 +3276,7 @@
 PRBool nsWindow::OnVScroll( MPARAM mp1, MPARAM mp2)
 {
     if (nsnull != mEventCallback) {
-        nsMouseScrollEvent scrollEvent(NS_MOUSE_SCROLL, this);
+        nsMouseScrollEvent scrollEvent(PR_TRUE, NS_MOUSE_SCROLL, this);
         InitEvent(scrollEvent);
         scrollEvent.isShift = WinIsKeyDown( VK_SHIFT);
         scrollEvent.isControl = WinIsKeyDown( VK_CTRL);
@@ -3310,7 +3311,7 @@
 PRBool nsWindow::OnHScroll( MPARAM mp1, MPARAM mp2)
 {
     if (nsnull != mEventCallback) {
-        nsMouseScrollEvent scrollEvent(NS_MOUSE_SCROLL, this);
+        nsMouseScrollEvent scrollEvent(PR_TRUE, NS_MOUSE_SCROLL, this);
         InitEvent(scrollEvent);
         scrollEvent.isShift = WinIsKeyDown( VK_SHIFT);
         scrollEvent.isControl = WinIsKeyDown( VK_CTRL);
--- mozilla-firefox-1.0.4.orig/widget/src/photon/nsWidget.cpp
+++ mozilla-firefox-1.0.4/widget/src/photon/nsWidget.cpp
@@ -359,7 +359,7 @@
 
   // call the event callback
   if( mEventCallback ) {
-		nsSizeEvent event;
+		nsSizeEvent event(PR_TRUE, 0, nsnull);
 
 	  InitEvent(event, NS_SIZE);
 
@@ -384,7 +384,7 @@
 // Move
 //------
 PRBool nsWidget::OnMove( PRInt32 aX, PRInt32 aY ) {
-  nsGUIEvent event;
+  nsGUIEvent event(PR_TRUE, 0, nsnull);
   InitEvent(event, NS_MOVE);
   event.point.x = aX;
   event.point.y = aY;
@@ -857,21 +857,21 @@
   w->AddRef();
  
   if (aPhKeyEvent->key_flags & Pk_KF_Key_Down) {
-		nsKeyEvent keyDownEvent(NS_KEY_DOWN, w);
+		nsKeyEvent keyDownEvent(PR_TRUE, NS_KEY_DOWN, w);
 		InitKeyEvent(aPhKeyEvent, keyDownEvent);
 		w->OnKey(keyDownEvent);
 
-		nsKeyEvent keyPressEvent(NS_KEY_PRESS, w);
+		nsKeyEvent keyPressEvent(PR_TRUE, NS_KEY_PRESS, w);
 		InitKeyPressEvent(aPhKeyEvent, keyPressEvent);
 		w->OnKey(keyPressEvent);
   	}
   else if (aPhKeyEvent->key_flags & Pk_KF_Key_Repeat) {
-		nsKeyEvent keyPressEvent(NS_KEY_PRESS, w);
+		nsKeyEvent keyPressEvent(PR_TRUE, NS_KEY_PRESS, w);
 		InitKeyPressEvent(aPhKeyEvent, keyPressEvent);
 		w->OnKey(keyPressEvent);
   	}
   else if (PkIsKeyDown(aPhKeyEvent->key_flags) == 0) {
-		nsKeyEvent kevent(NS_KEY_UP, w);
+		nsKeyEvent kevent(PR_TRUE, NS_KEY_UP, w);
 		InitKeyEvent(aPhKeyEvent, kevent);
 		w->OnKey(kevent);
   	}
@@ -948,7 +948,7 @@
       case Ph_EV_PTR_MOTION_NOBUTTON:
        	{
 	    	PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event );
-	    	nsMouseEvent   theMouseEvent;
+	    	nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull);
 
         if( ptrev ) {
 
@@ -967,7 +967,7 @@
        {
 
 	    	PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event );
-   		  nsMouseEvent   theMouseEvent;
+   		  nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull);
 
 				/* there should be no reason to do this - mozilla should figure out how to call SetFocus */
 				/* this though fixes the problem with the plugins capturing the focus */
@@ -989,7 +989,7 @@
 
 					// if we're a right-button-up we're trying to popup a context menu. send that event to gecko also
 					if( ptrev->buttons & Ph_BUTTON_MENU ) {
-						nsMouseEvent contextMenuEvent;
+						nsMouseEvent contextMenuEvent(PR_TRUE, 0, nsnull);
 						InitMouseEvent( ptrev, this, contextMenuEvent, NS_CONTEXTMENU );
 						result = DispatchMouseEvent( contextMenuEvent );
 						}
@@ -1001,7 +1001,7 @@
 		case Ph_EV_BUT_RELEASE:
 		  {
 			  PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event );
-			  nsMouseEvent      theMouseEvent;
+			  nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull);
 			  
 			  if (event->subtype==Ph_EV_RELEASE_REAL || event->subtype==Ph_EV_RELEASE_PHANTOM) {
 				  if (ptrev) {
@@ -1027,7 +1027,7 @@
 		case Ph_EV_PTR_MOTION_BUTTON:
       	{
         PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event );
-	    	nsMouseEvent   theMouseEvent;
+	    	nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull);
 
         if( ptrev ) {
 
@@ -1055,13 +1055,13 @@
 
       case Ph_EV_DRAG:
 	    	{
-          nsMouseEvent   theMouseEvent;
+          nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull);
 
           switch(event->subtype) {
 
 		  			case Ph_EV_DRAG_COMPLETE: 
             	{
- 		      		nsMouseEvent      theMouseEvent;
+ 		      		nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull);
               PhPointerEvent_t* ptrev2 = (PhPointerEvent_t*) PhGetData( event );
               ScreenToWidgetPos( ptrev2->pos );
               InitMouseEvent(ptrev2, this, theMouseEvent, NS_MOUSE_LEFT_BUTTON_UP );
@@ -1098,7 +1098,7 @@
 
 				if( evtype != 0 ) {
 					PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event );
-					nsMouseEvent theMouseEvent;
+					nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull);
 					ScreenToWidgetPos( ptrev->pos );
 					InitMouseEvent( ptrev, this, theMouseEvent, evtype );
 					result = DispatchMouseEvent( theMouseEvent );
@@ -1200,7 +1200,7 @@
 
 void nsWidget::DispatchDragDropEvent( PhEvent_t *phevent, PRUint32 aEventType, PhPoint_t *pos ) {
   nsEventStatus status;
-  nsMouseEvent event;
+  nsMouseEvent event(PR_TRUE, 0, nsnull);
 
   InitEvent( event, aEventType );
 
--- mozilla-firefox-1.0.4.orig/widget/src/photon/nsWidget.h
+++ mozilla-firefox-1.0.4/widget/src/photon/nsWidget.h
@@ -248,7 +248,7 @@
   PRBool     DispatchMouseEvent(nsMouseEvent& aEvent);
   inline PRBool     DispatchStandardEvent(PRUint32 aMsg)
 		{
-		nsGUIEvent event;
+		nsGUIEvent event(PR_TRUE, 0, nsnull);
 		InitEvent(event, aMsg);
 		return DispatchWindowEvent(&event);
 		}
--- mozilla-firefox-1.0.4.orig/widget/src/photon/nsWindow.cpp
+++ mozilla-firefox-1.0.4/widget/src/photon/nsWindow.cpp
@@ -597,7 +597,7 @@
 		}
 
 	if( mIsToplevel || mListenForResizes ) {
-		nsSizeEvent sevent;
+		nsSizeEvent sevent(PR_TRUE, 0, nsnull);
 		sevent.message = NS_SIZE;
 		sevent.widget = this;
 		
@@ -628,7 +628,7 @@
 			  NS_ADDREF(win);
 			  
 			  // dispatch an "onclose" event. to delete immediately, call win->Destroy()
-			  nsGUIEvent event;
+			  nsGUIEvent event(PR_TRUE, 0, nsnull);
 			  nsEventStatus status;
 			  
 			  event.message = NS_XUL_CLOSE;
@@ -669,7 +669,7 @@
   nsresult    result;
   PhTile_t  * dmg = NULL;
   PRBool      aClipState;
-  nsPaintEvent pev;
+  nsPaintEvent pev(PR_TRUE, 0, nsnull);
   PhRect_t   extent;
 
   if( !pWin || !pWin->mContext ) return;
--- mozilla-firefox-1.0.4.orig/widget/src/windows/nsBidiKeyboard.cpp
+++ mozilla-firefox-1.0.4/widget/src/windows/nsBidiKeyboard.cpp
@@ -55,16 +55,16 @@
 
   NS_ASSERTION(*currentLocaleName, 
     "currentLocaleName has string length == 0");
-
-#if 0
-  /* This implementation of automatic keyboard layout switching is too buggy to be useful
-     and the feature itself is inconsistent with Windows. See Bug 162242 */
+
+#if 0
+  /* This implementation of automatic keyboard layout switching is too buggy to be useful
+     and the feature itself is inconsistent with Windows. See Bug 162242 */
   if (strcmp(mCurrentLocaleName, currentLocaleName)) {
     if (!::LoadKeyboardLayout(currentLocaleName, KLF_ACTIVATE | KLF_SUBSTITUTE_OK)) {
       return NS_ERROR_FAILURE;
     }
-  }
-#endif
+  }
+#endif
 
   return NS_OK;
 }
--- mozilla-firefox-1.0.4.orig/widget/src/windows/nsFilePicker.cpp
+++ mozilla-firefox-1.0.4/widget/src/windows/nsFilePicker.cpp
@@ -118,6 +118,7 @@
   PRBool result = PR_FALSE;
   PRUnichar fileBuffer[FILE_BUFFER_SIZE+1];
   wcsncpy(fileBuffer,  mDefault.get(), FILE_BUFFER_SIZE);
+  fileBuffer[FILE_BUFFER_SIZE] = '\0'; // null terminate in case copy truncated
 
   NS_NAMED_LITERAL_STRING(htmExt, "html");
   nsAutoString initialDir;
@@ -232,7 +233,18 @@
       result = nsToolkit::mGetOpenFileName(&ofn);
     }
     else if (mMode == modeSave) {
-      ofn.Flags |= OFN_NOREADONLYRETURN | OFN_NODEREFERENCELINKS;
+      ofn.Flags |= OFN_NOREADONLYRETURN;
+
+      // Don't follow shortcuts when saving a shortcut, this can be used
+      // to trick users (bug 271732)
+      NS_ConvertUTF16toUTF8 ext(mDefault);
+      ext.Trim(" .", PR_FALSE, PR_TRUE); // watch out for trailing dots and space
+      ToLowerCase(ext);
+      if (StringEndsWith(ext, NS_LITERAL_CSTRING(".lnk")) ||
+          StringEndsWith(ext, NS_LITERAL_CSTRING(".pif")) ||
+          StringEndsWith(ext, NS_LITERAL_CSTRING(".url")))
+        ofn.Flags |= OFN_NODEREFERENCELINKS;
+
       result = nsToolkit::mGetSaveFileName(&ofn);
       if (!result) {
         // Error, find out what kind.
--- mozilla-firefox-1.0.4.orig/widget/src/windows/nsNativeDragTarget.cpp
+++ mozilla-firefox-1.0.4/widget/src/windows/nsNativeDragTarget.cpp
@@ -182,7 +182,7 @@
                                                POINTL   aPT)
 {
   nsEventStatus status;
-  nsMouseEvent event(aEventType, mWindow);
+  nsMouseEvent event(PR_TRUE, aEventType, mWindow);
 
   nsWindow * win = NS_STATIC_CAST(nsWindow *, mWindow);
   win->InitEvent(event);
--- mozilla-firefox-1.0.4.orig/widget/src/windows/nsWindow.cpp
+++ mozilla-firefox-1.0.4/widget/src/windows/nsWindow.cpp
@@ -1101,7 +1101,7 @@
 
 PRBool nsWindow::DispatchStandardEvent(PRUint32 aMsg)
 {
-  nsGUIEvent event(aMsg, this);
+  nsGUIEvent event(PR_TRUE, aMsg, this);
   InitEvent(event);
 
   PRBool result = DispatchWindowEvent(&event);
@@ -1116,7 +1116,7 @@
 //-------------------------------------------------------------------------
 PRBool nsWindow::DispatchAppCommandEvent(PRUint32 aEventCommand)
 {
-  nsAppCommandEvent event(NS_APPCOMMAND_START, this);
+  nsAppCommandEvent event(PR_TRUE, NS_APPCOMMAND_START, this);
 
   InitEvent(event);
   event.appCommand = NS_APPCOMMAND_START + aEventCommand;
@@ -2923,7 +2923,7 @@
 //-------------------------------------------------------------------------
 PRBool nsWindow::DispatchKeyEvent(PRUint32 aEventType, WORD aCharCode, UINT aVirtualCharCode, LPARAM aKeyData)
 {
-  nsKeyEvent event(aEventType, this);
+  nsKeyEvent event(PR_TRUE, aEventType, this);
   nsPoint point(0, 0);
 
   InitEvent(event, &point); // this add ref's event.widget
@@ -3165,9 +3165,9 @@
 }
 
 
-void nsWindow::ConstrainZLevel(HWND *aAfter) {
-
-  nsZLevelEvent  event(NS_SETZLEVEL, this);
+void nsWindow::ConstrainZLevel(HWND *aAfter)
+{
+  nsZLevelEvent  event(PR_TRUE, NS_SETZLEVEL, this);
   nsWindow      *aboveWindow = 0;
 
   InitEvent(event);
@@ -3709,13 +3709,13 @@
         case WM_COMMAND: {
           WORD wNotifyCode = HIWORD(wParam); // notification code 
           if ((CBN_SELENDOK == wNotifyCode) || (CBN_SELENDCANCEL == wNotifyCode)) { // Combo box change
-            nsGUIEvent event(NS_CONTROL_CHANGE, this);
+            nsGUIEvent event(PR_TRUE, NS_CONTROL_CHANGE, this);
             nsPoint point(0,0);
             InitEvent(event, &point); // this add ref's event.widget
             result = DispatchWindowEvent(&event);
             NS_RELEASE(event.widget);
           } else if (wNotifyCode == 0) { // Menu selection
-            nsMenuEvent event(NS_MENU_SELECTED, this);
+            nsMenuEvent event(PR_TRUE, NS_MENU_SELECTED, this);
             event.mCommand = LOWORD(wParam);
             InitEvent(event);
             result = DispatchWindowEvent(&event);
@@ -4153,7 +4153,7 @@
               gJustGotDeactivate = PR_TRUE;
             } else {
               gJustGotActivate = PR_TRUE;
-              nsMouseEvent event(NS_MOUSE_ACTIVATE, this);
+              nsMouseEvent event(PR_TRUE, NS_MOUSE_ACTIVATE, this);
               InitEvent(event);
 
               event.acceptActivation = PR_TRUE;
@@ -4295,7 +4295,7 @@
               pl.length = sizeof(pl);
               ::GetWindowPlacement(mWnd, &pl);
 
-              nsSizeModeEvent event(NS_SIZEMODE, this);
+              nsSizeModeEvent event(PR_TRUE, NS_SIZEMODE, this);
               if (pl.showCmd == SW_SHOWMAXIMIZED)
                 event.mSizeMode = nsSizeMode_Maximized;
               else if (pl.showCmd == SW_SHOWMINIMIZED)
@@ -4419,7 +4419,7 @@
 #endif
             nsAutoString fileStr(szFileName);
             nsEventStatus status;
-            nsDragDropEvent event(NS_DRAGDROP_EVENT, this);
+            nsDragDropEvent event(PR_TRUE, NS_DRAGDROP_EVENT, this);
             InitEvent(event);
             event.mType      = nsDragDropEventStatus_eDrop;
             event.mIsFileURL = PR_FALSE;
@@ -4623,7 +4623,7 @@
 #endif
           }
           
-          nsMouseScrollEvent scrollEvent(NS_MOUSE_SCROLL, this);
+          nsMouseScrollEvent scrollEvent(PR_TRUE, NS_MOUSE_SCROLL, this);
           scrollEvent.scrollFlags = nsMouseScrollEvent::kIsVertical;
           if (ulScrollLines == WHEEL_PAGESCROLL) {
             scrollEvent.scrollFlags |= nsMouseScrollEvent::kIsFullPage;
@@ -4963,7 +4963,7 @@
   mBounds.x = aX;
   mBounds.y = aY;
 
-  nsGUIEvent event(NS_MOVE, this);
+  nsGUIEvent event(PR_TRUE, NS_MOVE, this);
   InitEvent(event);
   event.point.x = aX;
   event.point.y = aY;
@@ -5012,7 +5012,7 @@
         if (mEventCallback) 
         {
 
-            nsPaintEvent event(NS_PAINT, this);
+            nsPaintEvent event(PR_TRUE, NS_PAINT, this);
 
             InitEvent(event);
 
@@ -5100,7 +5100,7 @@
 {
   // call the event callback 
   if (mEventCallback) {
-    nsSizeEvent event(NS_SIZE, this);
+    nsSizeEvent event(PR_TRUE, NS_SIZE, this);
     InitEvent(event);
     event.windowSize = &aWindowRect;
     RECT r;
@@ -5132,7 +5132,7 @@
     return result;
   }
 
-  nsMouseEvent event(aEventType, this);
+  nsMouseEvent event(PR_TRUE, aEventType, this);
   if (aEventType == NS_CONTEXTMENU_KEY) {
     nsPoint zero(0, 0);
     InitEvent(event, &zero);
@@ -5390,7 +5390,7 @@
 
   *aAcc = nsnull;
 
-  nsAccessibleEvent event(aEventType, this);
+  nsAccessibleEvent event(PR_TRUE, aEventType, this);
   InitEvent(event, aPoint);
 
   event.isShift   = IS_VK_DOWN(NS_VK_SHIFT);
@@ -5420,7 +5420,7 @@
 {
   // call the event callback 
   if (mEventCallback) {
-    nsFocusEvent event(aEventType, this);
+    nsFocusEvent event(PR_TRUE, aEventType, this);
     InitEvent(event);
 
     //focus and blur event should go to their base widget loc, not current mouse pos
@@ -5674,7 +5674,7 @@
   if((nsnull == mIMECompString) || (nsnull == mIMECompUnicode))
 	return;
 
-  nsTextEvent		event(NS_TEXT_TEXT, this);
+  nsTextEvent		event(PR_TRUE, NS_TEXT_TEXT, this);
   nsPoint			point(0, 0);
   size_t			unicharSize;
   CANDIDATEFORM		candForm;
@@ -5785,7 +5785,7 @@
 nsWindow::HandleStartComposition(HIMC hIMEContext)
 {
 	NS_ASSERTION( !mIMEIsComposing, "conflict state");
-	nsCompositionEvent	event(NS_COMPOSITION_START, this);
+	nsCompositionEvent	event(PR_TRUE, NS_COMPOSITION_START, this);
 	nsPoint				point(0, 0);
 	CANDIDATEFORM		candForm;
 
@@ -5847,7 +5847,7 @@
 nsWindow::HandleEndComposition(void)
 {
 	NS_ASSERTION(mIMEIsComposing, "conflict state");
-	nsCompositionEvent	event(NS_COMPOSITION_END, this);
+	nsCompositionEvent	event(PR_TRUE, NS_COMPOSITION_END, this);
 	nsPoint				point(0, 0);
 
 	if (gPinYinIMECaretCreated)  
@@ -6454,7 +6454,7 @@
     }
 
     // Get reconversion string
-    nsReconversionEvent event(NS_RECONVERSION_QUERY, this);
+    nsReconversionEvent event(PR_TRUE, NS_RECONVERSION_QUERY, this);
     nsPoint point(0, 0);
 
     InitEvent(event, &point);
@@ -6723,7 +6723,7 @@
 
 void nsWindow::GetCompositionWindowPos(HIMC hIMC, PRUint32 aEventType, COMPOSITIONFORM *cpForm)
 {
-  nsTextEvent		event;
+  nsTextEvent event(PR_TRUE, 0, this);
   POINT point;
   point.x = 0;
   point.y = 0;
--- mozilla-firefox-1.0.4.orig/widget/src/xlib/nsAppShell.cpp
+++ mozilla-firefox-1.0.4/widget/src/xlib/nsAppShell.cpp
@@ -605,7 +605,7 @@
     HandleDragMotionEvent(event, aWidget);
   }
 
-  nsMouseEvent mevent(NS_MOUSE_MOVE, aWidget);
+  nsMouseEvent mevent(PR_TRUE, NS_MOUSE_MOVE, aWidget);
   XEvent aEvent;
 
   mevent.point.x = event->xmotion.x;
@@ -636,7 +636,7 @@
 {
   PRUint32 eventType = 0;
   PRBool currentlyDragging = mDragging;
-  nsMouseScrollEvent scrollEvent(NS_MOUSE_SCROLL, aWidget);
+  nsMouseScrollEvent scrollEvent(PR_TRUE, NS_MOUSE_SCROLL, aWidget);
 
   PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("Button event for window 0x%lx button %d type %s\n",
                                        event->xany.window,
@@ -695,7 +695,7 @@
     break;
   }
 
-  nsMouseEvent mevent(eventType, aWidget);
+  nsMouseEvent mevent(PR_TRUE, eventType, aWidget);
   mevent.isShift = mShiftDown;
   mevent.isControl = mCtrlDown;
   mevent.isAlt = mAltDown;
@@ -788,7 +788,7 @@
     }
   }
 
-  nsSizeEvent sevent(NS_SIZE, aWidget);
+  nsSizeEvent sevent(PR_TRUE, NS_SIZE, aWidget);
   sevent.windowSize = new nsRect (event->xconfigure.x, event->xconfigure.y,
                                   event->xconfigure.width, event->xconfigure.height);
   sevent.point.x = event->xconfigure.x;
@@ -888,7 +888,7 @@
     return;
   }
 
-  nsKeyEvent keyEvent(NS_KEY_DOWN, focusWidget);
+  nsKeyEvent keyEvent(PR_TRUE, NS_KEY_DOWN, focusWidget);
 
   XComposeStatus compose;
 
@@ -910,7 +910,7 @@
 
   focusWidget->DispatchKeyEvent(keyEvent);
 
-  nsKeyEvent pressEvent(NS_KEY_PRESS, focusWidget);
+  nsKeyEvent pressEvent(PR_TRUE, NS_KEY_PRESS, focusWidget);
   pressEvent.keyCode = nsKeyCode::ConvertKeySymToVirtualKey(keysym);
   pressEvent.charCode = nsConvertCharCodeToUnicode(&event->xkey);
   pressEvent.time = event->xkey.time;
@@ -959,7 +959,7 @@
     return;
   }
 
-  nsKeyEvent keyEvent(NS_KEY_UP, aWidget);
+  nsKeyEvent keyEvent(PR_TRUE, NS_KEY_UP, aWidget);
 
   keyEvent.keyCode = nsKeyCode::ConvertKeySymToVirtualKey(keysym);
   keyEvent.time = event->xkey.time;
@@ -982,7 +982,7 @@
 {
   PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("FocusIn event for window 0x%lx\n",
                                        event->xfocus.window));
-  nsFocusEvent focusEvent(NS_GOTFOCUS, aWidget);
+  nsFocusEvent focusEvent(PR_TRUE, NS_GOTFOCUS, aWidget);
   
   NS_ADDREF(aWidget);
   aWidget->DispatchWindowEvent(focusEvent);
@@ -994,7 +994,7 @@
 {
   PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("FocusOut event for window 0x%lx\n",
                                        event->xfocus.window));
-  nsFocusEvent focusEvent(NS_LOSTFOCUS, aWidget);
+  nsFocusEvent focusEvent(PR_TRUE, NS_LOSTFOCUS, aWidget);
 
   NS_ADDREF(aWidget);
   aWidget->DispatchWindowEvent(focusEvent);
@@ -1031,7 +1031,7 @@
     HandleDragEnterEvent(event, aWidget);
   }
 
-  nsMouseEvent enterEvent(NS_MOUSE_ENTER, aWidget);
+  nsMouseEvent enterEvent(PR_TRUE, NS_MOUSE_ENTER, aWidget);
 
   enterEvent.time = event->xcrossing.time;
   enterEvent.point.x = nscoord(event->xcrossing.x);
@@ -1059,7 +1059,7 @@
     HandleDragLeaveEvent(event, aWidget);
   }
 
-  nsMouseEvent leaveEvent(NS_MOUSE_EXIT, aWidget);
+  nsMouseEvent leaveEvent(PR_TRUE, NS_MOUSE_EXIT, aWidget);
 
   leaveEvent.time = event->xcrossing.time;
   leaveEvent.point.x = nscoord(event->xcrossing.x);
@@ -1123,7 +1123,7 @@
 
 void nsAppShell::HandleSelectionRequestEvent(XEvent *event, nsWidget *aWidget)
 {
-  nsGUIEvent ev(0, aWidget);
+  nsGUIEvent ev(PR_TRUE, 0, aWidget);
 
   ev.nativeMsg = (void *)event;
 
@@ -1146,7 +1146,7 @@
   if (currentlyDragging) {
     dragServiceXlib->UpdatePosition(event->xmotion.x, event->xmotion.y);
 
-    nsMouseEvent mevent(NS_DRAGDROP_OVER, aWidget);
+    nsMouseEvent mevent(PR_TRUE, NS_DRAGDROP_OVER, aWidget);
     mevent.point.x = event->xmotion.x;
     mevent.point.y = event->xmotion.y;
 
@@ -1170,7 +1170,7 @@
   }
 
   if (currentlyDragging) {
-    nsMouseEvent enterEvent(NS_DRAGDROP_ENTER, aWidget);
+    nsMouseEvent enterEvent(PR_TRUE, NS_DRAGDROP_ENTER, aWidget);
   
     enterEvent.point.x = event->xcrossing.x;
     enterEvent.point.y = event->xcrossing.y;
@@ -1197,7 +1197,7 @@
   }
 
   if (currentlyDragging) {
-    nsMouseEvent leaveEvent(NS_DRAGDROP_EXIT, aWidget);
+    nsMouseEvent leaveEvent(PR_TRUE, NS_DRAGDROP_EXIT, aWidget);
   
     leaveEvent.point.x = event->xcrossing.x;
     leaveEvent.point.y = event->xcrossing.y;
@@ -1224,7 +1224,7 @@
   }
 
   if (currentlyDragging) {
-    nsMouseEvent mevent(NS_DRAGDROP_DROP, aWidget);
+    nsMouseEvent mevent(PR_TRUE, NS_DRAGDROP_DROP, aWidget);
     mevent.point.x = event->xbutton.x;
     mevent.point.y = event->xbutton.y;
   
@@ -1238,7 +1238,7 @@
 
 void nsAppShell::ForwardEvent(XEvent *event, nsWidget *aWidget)
 {
-  nsGUIEvent ev(0, aWidget);
+  nsGUIEvent ev(PR_TRUE, 0, aWidget);
   ev.nativeMsg = (void *)event;
 
   aWidget->DispatchWindowEvent(ev);
--- mozilla-firefox-1.0.4.orig/widget/src/xlib/nsWidget.cpp
+++ mozilla-firefox-1.0.4/widget/src/xlib/nsWidget.cpp
@@ -1064,7 +1064,7 @@
 PRBool nsWidget::DispatchDestroyEvent(void) {
   PRBool result = PR_FALSE;
   if (nsnull != mEventCallback) {
-    nsGUIEvent event(NS_DESTROY, this);
+    nsGUIEvent event(PR_TRUE, NS_DESTROY, this);
     AddRef();
     result = DispatchWindowEvent(event);
     Release();
--- mozilla-firefox-1.0.4.orig/widget/src/xlib/nsWindow.cpp
+++ mozilla-firefox-1.0.4/widget/src/xlib/nsWindow.cpp
@@ -381,7 +381,7 @@
 NS_IMETHODIMP nsWindow::SetFocus(PRBool aRaise)
 {
   nsEventStatus status;
-  nsFocusEvent event(NS_GOTFOCUS, this);
+  nsFocusEvent event(PR_TRUE, NS_GOTFOCUS, this);
   //  nsGUIEvent eventActivate;
 
   if (mBaseWindow)
@@ -396,7 +396,7 @@
   DispatchEvent(&event, status);
   Release();
   
-  nsGUIEvent actEvent(NS_ACTIVATE, this);
+  nsGUIEvent actEvent(PR_TRUE, NS_ACTIVATE, this);
   
   AddRef();
   DispatchWindowEvent(actEvent);
@@ -448,7 +448,7 @@
   }
   nsWidget::Resize(aWidth, aHeight, aRepaint);
 
-  nsSizeEvent sevent(NS_SIZE, this);
+  nsSizeEvent sevent(PR_TRUE, NS_SIZE, this);
   nsRect sevent_windowSize(0, 0, aWidth, aHeight);
   sevent.windowSize = &sevent_windowSize;
   sevent.mWinWidth = aWidth;
@@ -481,7 +481,7 @@
 
   nsWidget::Resize(aX, aY, aWidth, aHeight, aRepaint);
 
-  nsSizeEvent sevent(NS_SIZE, this);
+  nsSizeEvent sevent(PR_TRUE, NS_SIZE, this);
   nsRect sevent_windowSize(0, 0, aWidth, aHeight);
   sevent.windowSize = &sevent_windowSize;
   sevent.mWinWidth = aWidth;
@@ -548,7 +548,7 @@
                    nsIRegion *aClipRegion)
 {
   if (mEventCallback) {
-    nsPaintEvent event(NS_PAINT, this);
+    nsPaintEvent event(PR_TRUE, NS_PAINT, this);
     nsRect rect(aX, aY, aWidth, aHeight);
     event.point.x = aX;
     event.point.y = aY; 
--- mozilla-firefox-1.0.4.orig/themes/classic/communicator/alerts/alert.css
+++ mozilla-firefox-1.0.4/themes/classic/communicator/alerts/alert.css
@@ -75,10 +75,10 @@
 .alertText[clickable="true"]:hover:active {
   color: #424F63;
 }
-
-.alertTextBox
-{
-  padding-right: 10px;
-  padding-top: 5px;
-}
-
+
+.alertTextBox
+{
+  padding-right: 10px;
+  padding-top: 5px;
+}
+
--- mozilla-firefox-1.0.4.orig/xpfe/appshell/src/nsAppShellService.cpp
+++ mozilla-firefox-1.0.4/xpfe/appshell/src/nsAppShellService.cpp
@@ -438,7 +438,7 @@
   PRInt32 initialHeight = 100, initialWidth = 100;
     
 #if defined(XP_MAC) || defined(XP_MACOSX)
-  const char* defaultHiddenWindowURL = "chrome://global/content/hiddenWindow.xul";
+  static const char* defaultHiddenWindowURL = "chrome://global/content/hiddenWindow.xul";
   PRUint32    chromeMask = 0;
   nsCOMPtr<nsIPrefBranch> prefBranch;
   nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
@@ -447,7 +447,7 @@
   rv = prefBranch->GetCharPref("browser.hiddenWindowChromeURL", getter_Copies(prefVal));
   const char* hiddenWindowURL = prefVal.get() ? prefVal.get() : defaultHiddenWindowURL;
 #else
-  const char* hiddenWindowURL = "about:blank";
+  static const char hiddenWindowURL[] = "resource://gre/res/hiddenWindow.html";
   PRUint32    chromeMask =  nsIWebBrowserChrome::CHROME_ALL;
 #endif
 
@@ -1704,4 +1704,4 @@
   return QueryInterface(uuid, result);
 }
 
-#endif
\ No newline at end of file
+#endif
--- mozilla-firefox-1.0.4.orig/xpfe/appshell/src/nsWebShellWindow.cpp
+++ mozilla-firefox-1.0.4/xpfe/appshell/src/nsWebShellWindow.cpp
@@ -945,7 +945,7 @@
         pnsMenuBar->QueryInterface(NS_GET_IID(nsIMenuListener), getter_AddRefs(menuListener));
 
         //fake event
-        nsMenuEvent fake;
+        nsMenuEvent fake(PR_TRUE, 0, nsnull);
         menuListener->MenuConstruct(fake, aParentWindow, menubarNode, mWebShell);
 
         // Parent should own menubar now
@@ -1501,7 +1501,7 @@
       docViewer->GetPresContext(getter_AddRefs(presContext));
 
       nsEventStatus status = nsEventStatus_eIgnore;
-      nsMouseEvent event(NS_XUL_CLOSE);
+      nsMouseEvent event(PR_TRUE, NS_XUL_CLOSE, nsnull);
 
       nsresult rv = globalObject->HandleDOMEvent(presContext, &event, nsnull,
                                                  NS_EVENT_FLAG_INIT, &status);
--- mozilla-firefox-1.0.4.orig/xpfe/appshell/src/nsXULWindow.cpp
+++ mozilla-firefox-1.0.4/xpfe/appshell/src/nsXULWindow.cpp
@@ -43,6 +43,7 @@
 #include "nsIDOMDocumentEvent.h"
 #include "nsIDOMXULDocument.h"
 #include "nsIDOMElement.h"
+#include "nsIPrivateDOMEvent.h"
 #include "nsIDOMEventTarget.h"
 #include "nsIDOMXULElement.h"
 #include "nsIDOMWindowInternal.h"
@@ -243,6 +244,10 @@
       if (event) {
         event->InitEvent(NS_LITERAL_STRING("windowZLevel"), PR_TRUE, PR_FALSE);
         PRBool noDefault;
+
+        nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));
+        privateEvent->SetTrusted(PR_TRUE);
+
         nsCOMPtr<nsIDOMEventTarget> targ(do_QueryInterface(doc));
         if (targ)
           targ->DispatchEvent(event, &noDefault);
--- mozilla-firefox-1.0.4.orig/xpfe/bootstrap/nsNativeAppSupportOS2.h
+++ mozilla-firefox-1.0.4/xpfe/bootstrap/nsNativeAppSupportOS2.h
@@ -20,7 +20,7 @@
  * Contributor(s): 
  *   Bill Law       law@netscape.com
  *   IBM Corp.
- *   Achim Hasenmueller <achimha@innotek.de>
+ *   Achim Hasenmueller <achimha@innotek.de>
  */
 
 // Splash screen dialog ID.
@@ -32,296 +32,296 @@
 // DDE application name
 #define ID_DDE_APPLICATION_NAME 102
 
-/* 
- * OS/2 DDEML library headers
- * For more information, please refer to the Windows documentation
- */
-
-#ifndef _H_DDEML
-#define _H_DDEML
-
-/* all structures must be byte aligned */
-#pragma pack(1)
-
-/* custom type definitions */
-typedef LHANDLE HCONV;
-typedef LHANDLE HCONVLIST;
-typedef LHANDLE HDATA;
-typedef LHANDLE HDDEINST;
-typedef LHANDLE HSZ;
-typedef HCONV *PHCONV;
-typedef HCONVLIST *PHCONVLIST;
-typedef HDATA *PHDATA;
-typedef HDDEINST *PHDDEINST;
-typedef HSZ *PHSZ;
-typedef HDATA (APIENTRY FNDDECB)(ULONG, USHORT, USHORT, HCONV, HSZ, HSZ, HDATA, ULONG, ULONG);
-typedef FNDDECB *PFNDDECB;
-
-/* constant definitions */
-#define XCLASS_BOOL 0x1000
-#define XCLASS_DATA 0x2000
-#define XCLASS_FLAGS 0x4000
-#define XCLASS_NOTIFICATION 0x8000
-#define XTYPF_NOBLOCK 0x0002
-#define XTYPF_NODATA 0x0004
-#define XTYPF_ACKREQ 0x0008
-#define XTYP_ERROR (0x0000 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
-#define XTYP_ADVDATA (0x0010 | XCLASS_FLAGS)
-#define XTYP_ADVREQ (0x0020 | XCLASS_DATA | XTYPF_NOBLOCK)
-#define XTYP_ADVSTART (0x0030 | XCLASS_BOOL)
-#define XTYP_ADVSTOP (0x0040 | XCLASS_NOTIFICATION)
-#define XTYP_EXECUTE (0x0050 | XCLASS_FLAGS)
-#define XTYP_CONNECT (0x0060 | XCLASS_BOOL | XTYPF_NOBLOCK)
-#define XTYP_CONNECT_CONFIRM (0x0070 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
-#define XTYP_XACT_COMPLETE (0x0080 | XCLASS_NOTIFICATION)
-#define XTYP_POKE (0x0090 | XCLASS_FLAGS)
-#define XTYP_REGISTER (0x00A0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
-#define XTYP_REQUEST (0x00B0 | XCLASS_DATA)
-#define XTYP_DISCONNECT (0x00C0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
-#define XTYP_UNREGISTER (0x00D0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
-#define XTYP_WILDCONNECT (0x00E0 | XCLASS_DATA | XTYPF_NOBLOCK)
-#define XTYP_MONITOR (0x00F0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
-#define ST_CONNECTED ((USHORT)0x0001)
-#define ST_ADVISE ((USHORT)0x0002)
-#define ST_ISLOCAL ((USHORT)0x0004)
-#define ST_BLOCKED ((USHORT)0x0008)
-#define ST_CLIENT ((USHORT)0x0010)
-#define ST_TERMINATED ((USHORT)0x0020)
-#define ST_INLIST ((USHORT)0x0040)
-#define ST_BLOCKNEXT ((USHORT)0x0080)
-#define ST_ISSELF ((USHORT)0x0100)
-#define XST_NULL 0
-#define XST_INCOMPLETE 1
-#define XST_CONNECTED 2
-#define XST_INITSENT 3
-#define XST_INITACKRCVD 4
-#define XST_REQSENT 5
-#define XST_DATARCVD 6
-#define XST_POKESENT 7
-#define XST_POKEACKRCVD 8
-#define XST_EXECSENT 9
-#define XST_EXECACKRCVD 10
-#define XST_ADVSENT 11
-#define XST_UNADVSENT 12
-#define XST_ADVACKRCVD 13
-#define XST_UNADVACKRCVD 14
-#define XST_ADVDATASENT 15
-#define XST_ADVDATAACKRCVD 16
-#define MF_HSZ ((ULONG)0x01000000L)
-#define MF_SENDMSGS ((ULONG)0x02000000L)
-#define MF_POSTMSGS ((ULONG)0x04000000L)
-#define MF_CALLBACKS ((ULONG)0x08000000L)
-#define MF_ERRORS ((ULONG)0x10000000L)
-#define MF_LINKS ((ULONG)0x20000000L)
-#define MF_CONV ((ULONG)0x40000000L)
-#define CBF_FAIL_SELFCONNECTIONS ((ULONG)0x00001000L)
-#define CBF_FAIL_CONNECTIONS ((ULONG)0x00002000L)
-#define CBF_FAIL_ADVISES ((ULONG)0x00004000L)
-#define CBF_FAIL_EXECUTES ((ULONG)0x00008000L)
-#define CBF_FAIL_POKES ((ULONG)0x00010000L)
-#define CBF_FAIL_REQUESTS ((ULONG)0x00020000L)
-#define CBF_FAIL_ALLSVRXACTIONS ((ULONG)0x0003f000L)
-#define CBF_SKIP_CONNECT_CONFIRMS ((ULONG)0x00040000L)
-#define CBF_SKIP_REGISTRATIONS ((ULONG)0x00080000L)
-#define CBF_SKIP_UNREGISTRATIONS ((ULONG)0x00100000L)
-#define CBF_SKIP_DISCONNECTS ((ULONG)0x00200000L)
-#define CBF_SKIP_ALLNOTIFICATIONS ((ULONG)0x003c0000L)
-#define CBF_MASK ((ULONG)0x00FFF000L)
-#define APPF_CLIENTONLY ((ULONG)0x00000010L)
-#define APPF_FILTERINITS ((ULONG)0x00000020L)
-#define APPF_MASK ((ULONG)0x00000FF0L)
-#define APPCLASS_STANDARD ((ULONG)0x00000000L)
-#define APPCLASS_MONITOR ((ULONG)0x00000001L)
-#define APPCLASS_MASK ((ULONG)0x0000000FL)
-#define CBR_BLOCK ((ULONG)-1L)
-#define QID_SYNC ((ULONG)-1L)
-#define TIMEOUT_ASYNC ((ULONG)-1L)
-#define CADV_LATEACK 0xFFFF
-#define MH_CREATE ((USHORT)0x0001)
-#define MH_KEEP ((USHORT)0x0002)
-#define MH_DELETE ((USHORT)0x0003)
-#define MH_CLEANUP ((USHORT)0x0004)
-#define MH_SYS_CREATE ((USHORT)0x0005)
-#define MH_SYS_KEEP ((USHORT)0x0006)
-#define MH_SYS_DELETE ((USHORT)0x0007)
-#define DDEERR_NO_ERROR 0
-#define DDEERR_FIRST 0x7000
-#define DDEERR_BUSY 0x7001
-#define DDEERR_INVALID_USAGE 0x7002
-#define DDEERR_INVALID_PARAMETER 0x7003
-#define DDEERR_MEMORY_ERROR 0x7004
-#define DDEERR_NO_CONV_ESTABLISHED 0x7005
-#define DDEERR_NO_MEMORY 0x7006
-#define DDEERR_NO_MSG_QUEUE 0x7007
-#define DDEERR_NOT_INITIALIZED 0x7008
-#define DDEERR_NOT_PROCESSED 0x7009
-#define DDEERR_POSTMSG_FAILED 0x700a
-#define DDEERR_REENTRANCY 0x700b
-#define DDEERR_SERVER_DIED 0x700c
-#define DDEERR_SYSTEM_ERROR 0x700d
-#define DDEERR_TIMEOUT_ADVACK 0x700e
-#define DDEERR_TIMEOUT_EXECACK 0x700f
-#define DDEERR_TIMEOUT_POKEACK 0x7010
-#define DDEERR_TIMEOUT_DATAACK 0x7011
-#define DDEERR_TIMEOUT_UNADVACK 0x7012
-#define DDEERR_UNKNOWN_QUEUE_ID 0x7013
-#define DDEERR_LAST 0x70FF
-#define CSH_CASESENSITIVE ((ULONG)0x00000001L)
-#define CSH_ERROR 0L
-#define CSH_EQ 1L
-#define CSH_LT 2L
-#define CSH_GT 3L
-#define HDATA_APPOWNED ((ULONG)DDEPM_NOFREE)
-#define EC_ENABLEALL ((USHORT) 0x0000)
-#define EC_ENABLEONE ST_BLOCKNEXT
-#define EC_DISABLE ST_BLOCKED
-#define EC_QUERYWAITING ((USHORT)0x0002)
-#define DNS_REGISTER ((ULONG)0x00000001L)
-#define DNS_UNREGISTER ((ULONG)0x00000002L)
-#define DNS_FILTERON ((ULONG)0x00000004L)
-#define DNS_FILTEROFF ((ULONG)0x00000008L)
-
-/* structure definitions */
-typedef struct
-{
-   ULONG       cb;
-   ULONG       hUser;
-   HCONV       hConvPartner;
-   HSZ         hszServicePartner;
-   HSZ         hszServiceRequest;
-   HSZ         hszTopic;
-   HSZ         hszItem;
-   USHORT      usFormat;
-   USHORT      fsType;
-   USHORT      fsStatus;
-   USHORT      usState;
-   ULONG       ulLastError;
-   HCONVLIST   hConvList;
-   CONVCONTEXT ConvCtxt;
-   HWND        hwnd;
-   HWND        hwndPartner;
-} CONVINFO, *PCONVINFO;
-
-typedef struct
-{
-   HSZ hszService;
-   HSZ hszTopic;
-} HSZPAIR, *PHSZPAIR;
-
-typedef struct
-{
-   ULONG       cb;
-   ULONG       ulTime;
-   ULONG       hTask;
-   ULONG       ulRet;
-   USHORT      fsType;
-   USHORT      usFormat;
-   HCONV       hConv;
-   HSZ         hsz1;
-   HSZ         hsz2;
-   HDATA       hData;
-   ULONG       ulData1;
-   ULONG       ulData2;
-   CONVCONTEXT ConvCtxt;
-   ULONG       cbData;
-   BYTE        abData[32];
-} MONCBSTRUCT, *PMONCBSTRUCT;
-
-typedef struct
-{
-   ULONG cb;
-   BOOL  fConnect;
-   ULONG ulTime;
-   ULONG hTaskPartner;
-   HSZ   hszService;
-   HSZ   hszTopic;
-   HCONV hConvClient;
-   HCONV hConvServer;
-} MONCONVSTRUCT, *PMONCONVSTRUCT;
-
-typedef struct
-{
-   ULONG cb;
-   ULONG ulLastError;
-   ULONG ulTime;
-   ULONG hTask;
-} MONERRSTRUCT, *PMONERRSTRUCT;
-
-typedef struct
-{
-   ULONG  cb;
-   USHORT fsAction;
-   ULONG  ulTime;
-   HSZ    hsz;
-   ULONG  hTask;
-   ULONG  ulReserved;
-   CHAR    szString[1];
-} MONHSZSTRUCT, *PMONHSZSTRUCT;
-
-typedef struct
-{
-   ULONG  cb;
-   ULONG  ulTime;
-   ULONG  hTask;
-   HSZ    hszService;
-   HSZ    hszTopic;
-   HSZ    hszItem;
-   HCONV  hConvServer;
-   HCONV  hConvClient;
-   BOOL   fServer;
-   BOOL   fEstablished;
-   USHORT fsStatus;
-   USHORT usFormat;
-} MONLINKSTRUCT, *PMONLINKSTRUCT;
-
-typedef struct
-{
-   ULONG  cb;
-   HWND   hwndTo;
-   ULONG  ulTime;
-   ULONG  hTask;
-   ULONG  idMsg;
-   MPARAM mp1;
-   MPARAM mp2;
-   USHORT fsStatus;
-   USHORT usFormat;
-   USHORT offszString1;
-   USHORT offszString2;
-   ULONG  cbData;
-   BYTE   abData[32];
-} MONMSGSTRUCT, *PMONMSGSTRUCT;
-
-
-/* API definitions */
-BOOL (* APIENTRY WinDdeAbandonTransaction)(HDDEINST, HCONV, ULONG);
-PVOID (* APIENTRY WinDdeAccessData)(HDATA, PULONG);
-HDATA (* APIENTRY WinDdeAddData)(HDATA, PVOID, ULONG, ULONG);
-ULONG (* APIENTRY WinDdeCompareStringHandles)(HSZ, HSZ, ULONG);
-HCONV (* APIENTRY WinDdeConnect)(HDDEINST, HSZ, HSZ, PCONVCONTEXT);
-HCONVLIST (* APIENTRY WinDdeConnectList)(HDDEINST, HSZ, HSZ, HCONVLIST, PCONVCONTEXT);
-HDATA (* APIENTRY WinDdeCreateDataHandle)(PVOID, ULONG, ULONG, HSZ, USHORT, ULONG);
-HSZ (* APIENTRY WinDdeCreateStringHandle)(PSZ, ULONG);
-BOOL (* APIENTRY WinDdeDisconnect)(HCONV);
-BOOL (* APIENTRY WinDdeDisconnectList)(HCONVLIST);
-BOOL (* APIENTRY  WinDdeEnableCallback)(HDDEINST, HCONV, ULONG);
-BOOL (* APIENTRY WinDdeFreeDataHandle)(HDATA);
-BOOL (* APIENTRY WinDdeFreeStringHandle)(HSZ);
-ULONG (* APIENTRY WinDdeGetData)(HDATA, PVOID, ULONG, ULONG);
-ULONG (* APIENTRY WinDdeInitialize)(PHDDEINST, PFNDDECB, ULONG, ULONG);
-BOOL (* APIENTRY WinDdeKeepStringHandle)(HSZ);
-HDATA (* APIENTRY WinDdeNameService)(HDDEINST, HSZ, HSZ, ULONG);
-BOOL (* APIENTRY WinDdePostAdvise)(HDDEINST, HSZ, HSZ);
-ULONG (* APIENTRY WinDdeQueryConvInfo)(HCONV, ULONG, PCONVINFO);
-HCONV (* APIENTRY WinDdeQueryNextServer)(HCONVLIST, HCONV);
-ULONG (* APIENTRY WinDdeQueryString)(HSZ, PSZ, ULONG, ULONG);
-HCONV (* APIENTRY WinDdeReconnect)(HCONV);
-BOOL (* APIENTRY WinDdeSetUserHandle)(HCONV, ULONG, ULONG);
-HDATA (* APIENTRY WinDdeSubmitTransaction)(PVOID, ULONG, HCONV, HSZ, USHORT, USHORT, ULONG, PULONG);
-BOOL (* APIENTRY WinDdeUninitialize)(HDDEINST);
-
-/* restore structure packing */
-#pragma pack()
-
+/* 
+ * OS/2 DDEML library headers
+ * For more information, please refer to the Windows documentation
+ */
+
+#ifndef _H_DDEML
+#define _H_DDEML
+
+/* all structures must be byte aligned */
+#pragma pack(1)
+
+/* custom type definitions */
+typedef LHANDLE HCONV;
+typedef LHANDLE HCONVLIST;
+typedef LHANDLE HDATA;
+typedef LHANDLE HDDEINST;
+typedef LHANDLE HSZ;
+typedef HCONV *PHCONV;
+typedef HCONVLIST *PHCONVLIST;
+typedef HDATA *PHDATA;
+typedef HDDEINST *PHDDEINST;
+typedef HSZ *PHSZ;
+typedef HDATA (APIENTRY FNDDECB)(ULONG, USHORT, USHORT, HCONV, HSZ, HSZ, HDATA, ULONG, ULONG);
+typedef FNDDECB *PFNDDECB;
+
+/* constant definitions */
+#define XCLASS_BOOL 0x1000
+#define XCLASS_DATA 0x2000
+#define XCLASS_FLAGS 0x4000
+#define XCLASS_NOTIFICATION 0x8000
+#define XTYPF_NOBLOCK 0x0002
+#define XTYPF_NODATA 0x0004
+#define XTYPF_ACKREQ 0x0008
+#define XTYP_ERROR (0x0000 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
+#define XTYP_ADVDATA (0x0010 | XCLASS_FLAGS)
+#define XTYP_ADVREQ (0x0020 | XCLASS_DATA | XTYPF_NOBLOCK)
+#define XTYP_ADVSTART (0x0030 | XCLASS_BOOL)
+#define XTYP_ADVSTOP (0x0040 | XCLASS_NOTIFICATION)
+#define XTYP_EXECUTE (0x0050 | XCLASS_FLAGS)
+#define XTYP_CONNECT (0x0060 | XCLASS_BOOL | XTYPF_NOBLOCK)
+#define XTYP_CONNECT_CONFIRM (0x0070 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
+#define XTYP_XACT_COMPLETE (0x0080 | XCLASS_NOTIFICATION)
+#define XTYP_POKE (0x0090 | XCLASS_FLAGS)
+#define XTYP_REGISTER (0x00A0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
+#define XTYP_REQUEST (0x00B0 | XCLASS_DATA)
+#define XTYP_DISCONNECT (0x00C0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
+#define XTYP_UNREGISTER (0x00D0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
+#define XTYP_WILDCONNECT (0x00E0 | XCLASS_DATA | XTYPF_NOBLOCK)
+#define XTYP_MONITOR (0x00F0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
+#define ST_CONNECTED ((USHORT)0x0001)
+#define ST_ADVISE ((USHORT)0x0002)
+#define ST_ISLOCAL ((USHORT)0x0004)
+#define ST_BLOCKED ((USHORT)0x0008)
+#define ST_CLIENT ((USHORT)0x0010)
+#define ST_TERMINATED ((USHORT)0x0020)
+#define ST_INLIST ((USHORT)0x0040)
+#define ST_BLOCKNEXT ((USHORT)0x0080)
+#define ST_ISSELF ((USHORT)0x0100)
+#define XST_NULL 0
+#define XST_INCOMPLETE 1
+#define XST_CONNECTED 2
+#define XST_INITSENT 3
+#define XST_INITACKRCVD 4
+#define XST_REQSENT 5
+#define XST_DATARCVD 6
+#define XST_POKESENT 7
+#define XST_POKEACKRCVD 8
+#define XST_EXECSENT 9
+#define XST_EXECACKRCVD 10
+#define XST_ADVSENT 11
+#define XST_UNADVSENT 12
+#define XST_ADVACKRCVD 13
+#define XST_UNADVACKRCVD 14
+#define XST_ADVDATASENT 15
+#define XST_ADVDATAACKRCVD 16
+#define MF_HSZ ((ULONG)0x01000000L)
+#define MF_SENDMSGS ((ULONG)0x02000000L)
+#define MF_POSTMSGS ((ULONG)0x04000000L)
+#define MF_CALLBACKS ((ULONG)0x08000000L)
+#define MF_ERRORS ((ULONG)0x10000000L)
+#define MF_LINKS ((ULONG)0x20000000L)
+#define MF_CONV ((ULONG)0x40000000L)
+#define CBF_FAIL_SELFCONNECTIONS ((ULONG)0x00001000L)
+#define CBF_FAIL_CONNECTIONS ((ULONG)0x00002000L)
+#define CBF_FAIL_ADVISES ((ULONG)0x00004000L)
+#define CBF_FAIL_EXECUTES ((ULONG)0x00008000L)
+#define CBF_FAIL_POKES ((ULONG)0x00010000L)
+#define CBF_FAIL_REQUESTS ((ULONG)0x00020000L)
+#define CBF_FAIL_ALLSVRXACTIONS ((ULONG)0x0003f000L)
+#define CBF_SKIP_CONNECT_CONFIRMS ((ULONG)0x00040000L)
+#define CBF_SKIP_REGISTRATIONS ((ULONG)0x00080000L)
+#define CBF_SKIP_UNREGISTRATIONS ((ULONG)0x00100000L)
+#define CBF_SKIP_DISCONNECTS ((ULONG)0x00200000L)
+#define CBF_SKIP_ALLNOTIFICATIONS ((ULONG)0x003c0000L)
+#define CBF_MASK ((ULONG)0x00FFF000L)
+#define APPF_CLIENTONLY ((ULONG)0x00000010L)
+#define APPF_FILTERINITS ((ULONG)0x00000020L)
+#define APPF_MASK ((ULONG)0x00000FF0L)
+#define APPCLASS_STANDARD ((ULONG)0x00000000L)
+#define APPCLASS_MONITOR ((ULONG)0x00000001L)
+#define APPCLASS_MASK ((ULONG)0x0000000FL)
+#define CBR_BLOCK ((ULONG)-1L)
+#define QID_SYNC ((ULONG)-1L)
+#define TIMEOUT_ASYNC ((ULONG)-1L)
+#define CADV_LATEACK 0xFFFF
+#define MH_CREATE ((USHORT)0x0001)
+#define MH_KEEP ((USHORT)0x0002)
+#define MH_DELETE ((USHORT)0x0003)
+#define MH_CLEANUP ((USHORT)0x0004)
+#define MH_SYS_CREATE ((USHORT)0x0005)
+#define MH_SYS_KEEP ((USHORT)0x0006)
+#define MH_SYS_DELETE ((USHORT)0x0007)
+#define DDEERR_NO_ERROR 0
+#define DDEERR_FIRST 0x7000
+#define DDEERR_BUSY 0x7001
+#define DDEERR_INVALID_USAGE 0x7002
+#define DDEERR_INVALID_PARAMETER 0x7003
+#define DDEERR_MEMORY_ERROR 0x7004
+#define DDEERR_NO_CONV_ESTABLISHED 0x7005
+#define DDEERR_NO_MEMORY 0x7006
+#define DDEERR_NO_MSG_QUEUE 0x7007
+#define DDEERR_NOT_INITIALIZED 0x7008
+#define DDEERR_NOT_PROCESSED 0x7009
+#define DDEERR_POSTMSG_FAILED 0x700a
+#define DDEERR_REENTRANCY 0x700b
+#define DDEERR_SERVER_DIED 0x700c
+#define DDEERR_SYSTEM_ERROR 0x700d
+#define DDEERR_TIMEOUT_ADVACK 0x700e
+#define DDEERR_TIMEOUT_EXECACK 0x700f
+#define DDEERR_TIMEOUT_POKEACK 0x7010
+#define DDEERR_TIMEOUT_DATAACK 0x7011
+#define DDEERR_TIMEOUT_UNADVACK 0x7012
+#define DDEERR_UNKNOWN_QUEUE_ID 0x7013
+#define DDEERR_LAST 0x70FF
+#define CSH_CASESENSITIVE ((ULONG)0x00000001L)
+#define CSH_ERROR 0L
+#define CSH_EQ 1L
+#define CSH_LT 2L
+#define CSH_GT 3L
+#define HDATA_APPOWNED ((ULONG)DDEPM_NOFREE)
+#define EC_ENABLEALL ((USHORT) 0x0000)
+#define EC_ENABLEONE ST_BLOCKNEXT
+#define EC_DISABLE ST_BLOCKED
+#define EC_QUERYWAITING ((USHORT)0x0002)
+#define DNS_REGISTER ((ULONG)0x00000001L)
+#define DNS_UNREGISTER ((ULONG)0x00000002L)
+#define DNS_FILTERON ((ULONG)0x00000004L)
+#define DNS_FILTEROFF ((ULONG)0x00000008L)
+
+/* structure definitions */
+typedef struct
+{
+   ULONG       cb;
+   ULONG       hUser;
+   HCONV       hConvPartner;
+   HSZ         hszServicePartner;
+   HSZ         hszServiceRequest;
+   HSZ         hszTopic;
+   HSZ         hszItem;
+   USHORT      usFormat;
+   USHORT      fsType;
+   USHORT      fsStatus;
+   USHORT      usState;
+   ULONG       ulLastError;
+   HCONVLIST   hConvList;
+   CONVCONTEXT ConvCtxt;
+   HWND        hwnd;
+   HWND        hwndPartner;
+} CONVINFO, *PCONVINFO;
+
+typedef struct
+{
+   HSZ hszService;
+   HSZ hszTopic;
+} HSZPAIR, *PHSZPAIR;
+
+typedef struct
+{
+   ULONG       cb;
+   ULONG       ulTime;
+   ULONG       hTask;
+   ULONG       ulRet;
+   USHORT      fsType;
+   USHORT      usFormat;
+   HCONV       hConv;
+   HSZ         hsz1;
+   HSZ         hsz2;
+   HDATA       hData;
+   ULONG       ulData1;
+   ULONG       ulData2;
+   CONVCONTEXT ConvCtxt;
+   ULONG       cbData;
+   BYTE        abData[32];
+} MONCBSTRUCT, *PMONCBSTRUCT;
+
+typedef struct
+{
+   ULONG cb;
+   BOOL  fConnect;
+   ULONG ulTime;
+   ULONG hTaskPartner;
+   HSZ   hszService;
+   HSZ   hszTopic;
+   HCONV hConvClient;
+   HCONV hConvServer;
+} MONCONVSTRUCT, *PMONCONVSTRUCT;
+
+typedef struct
+{
+   ULONG cb;
+   ULONG ulLastError;
+   ULONG ulTime;
+   ULONG hTask;
+} MONERRSTRUCT, *PMONERRSTRUCT;
+
+typedef struct
+{
+   ULONG  cb;
+   USHORT fsAction;
+   ULONG  ulTime;
+   HSZ    hsz;
+   ULONG  hTask;
+   ULONG  ulReserved;
+   CHAR    szString[1];
+} MONHSZSTRUCT, *PMONHSZSTRUCT;
+
+typedef struct
+{
+   ULONG  cb;
+   ULONG  ulTime;
+   ULONG  hTask;
+   HSZ    hszService;
+   HSZ    hszTopic;
+   HSZ    hszItem;
+   HCONV  hConvServer;
+   HCONV  hConvClient;
+   BOOL   fServer;
+   BOOL   fEstablished;
+   USHORT fsStatus;
+   USHORT usFormat;
+} MONLINKSTRUCT, *PMONLINKSTRUCT;
+
+typedef struct
+{
+   ULONG  cb;
+   HWND   hwndTo;
+   ULONG  ulTime;
+   ULONG  hTask;
+   ULONG  idMsg;
+   MPARAM mp1;
+   MPARAM mp2;
+   USHORT fsStatus;
+   USHORT usFormat;
+   USHORT offszString1;
+   USHORT offszString2;
+   ULONG  cbData;
+   BYTE   abData[32];
+} MONMSGSTRUCT, *PMONMSGSTRUCT;
+
+
+/* API definitions */
+BOOL (* APIENTRY WinDdeAbandonTransaction)(HDDEINST, HCONV, ULONG);
+PVOID (* APIENTRY WinDdeAccessData)(HDATA, PULONG);
+HDATA (* APIENTRY WinDdeAddData)(HDATA, PVOID, ULONG, ULONG);
+ULONG (* APIENTRY WinDdeCompareStringHandles)(HSZ, HSZ, ULONG);
+HCONV (* APIENTRY WinDdeConnect)(HDDEINST, HSZ, HSZ, PCONVCONTEXT);
+HCONVLIST (* APIENTRY WinDdeConnectList)(HDDEINST, HSZ, HSZ, HCONVLIST, PCONVCONTEXT);
+HDATA (* APIENTRY WinDdeCreateDataHandle)(PVOID, ULONG, ULONG, HSZ, USHORT, ULONG);
+HSZ (* APIENTRY WinDdeCreateStringHandle)(PSZ, ULONG);
+BOOL (* APIENTRY WinDdeDisconnect)(HCONV);
+BOOL (* APIENTRY WinDdeDisconnectList)(HCONVLIST);
+BOOL (* APIENTRY  WinDdeEnableCallback)(HDDEINST, HCONV, ULONG);
+BOOL (* APIENTRY WinDdeFreeDataHandle)(HDATA);
+BOOL (* APIENTRY WinDdeFreeStringHandle)(HSZ);
+ULONG (* APIENTRY WinDdeGetData)(HDATA, PVOID, ULONG, ULONG);
+ULONG (* APIENTRY WinDdeInitialize)(PHDDEINST, PFNDDECB, ULONG, ULONG);
+BOOL (* APIENTRY WinDdeKeepStringHandle)(HSZ);
+HDATA (* APIENTRY WinDdeNameService)(HDDEINST, HSZ, HSZ, ULONG);
+BOOL (* APIENTRY WinDdePostAdvise)(HDDEINST, HSZ, HSZ);
+ULONG (* APIENTRY WinDdeQueryConvInfo)(HCONV, ULONG, PCONVINFO);
+HCONV (* APIENTRY WinDdeQueryNextServer)(HCONVLIST, HCONV);
+ULONG (* APIENTRY WinDdeQueryString)(HSZ, PSZ, ULONG, ULONG);
+HCONV (* APIENTRY WinDdeReconnect)(HCONV);
+BOOL (* APIENTRY WinDdeSetUserHandle)(HCONV, ULONG, ULONG);
+HDATA (* APIENTRY WinDdeSubmitTransaction)(PVOID, ULONG, HCONV, HSZ, USHORT, USHORT, ULONG, PULONG);
+BOOL (* APIENTRY WinDdeUninitialize)(HDDEINST);
+
+/* restore structure packing */
+#pragma pack()
+
 #endif /* _H_DDEML */
 
 typedef ULONG DWORD;
--- mozilla-firefox-1.0.4.orig/xpfe/bootstrap/icons/windows/readme.txt
+++ mozilla-firefox-1.0.4/xpfe/bootstrap/icons/windows/readme.txt
@@ -1,80 +1,80 @@
-***** BEGIN LICENSE BLOCK *****
-Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
-The contents of this file are subject to the Mozilla Public License Version 
-1.1 (the "License"); you may not use this file except in compliance with 
-the License. You may obtain a copy of the License at 
-http://www.mozilla.org/MPL/
-
-Software distributed under the License is distributed on an "AS IS" basis,
-WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-for the specific language governing rights and limitations under the
-License.
-
-The Original Code is readme.txt by Brian Bober
-
-Portions created by the Initial Developer are Copyright (C) 2003
-the Initial Developer. All Rights Reserved.
-
-Contributor(s):
-
-Alternatively, the contents of this file may be used under the terms of
-either the GNU General Public License Version 2 or later (the "GPL"), or
-the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-in which case the provisions of the GPL or the LGPL are applicable instead
-of those above. If you wish to allow use of your version of this file only
-under the terms of either the GPL or the LGPL, and not to allow others to
-use your version of this file under the terms of the MPL, indicate your
-decision by deleting the provisions above and replace them with the notice
-and other provisions required by the GPL or the LGPL. If you do not delete
-the provisions above, a recipient may use your version of this file under
-the terms of any one of the MPL, the GPL or the LGPL.
-
-***** END LICENSE BLOCK *****
-
-
-
-The icons in this directory are Win32 program icons, file association icons, 
-and window icons (to appear in the upper left corner of various windows).
-
-
-
-Requirements:
-Each icon should contain the follwing devices images:
-48x48, 32x32, and 16x16 - 16 color
-48x48, 32x32, and 16x16 - True color
-48x48, 32x32, and 16x16 - True color XP (Contains alpha shadows)
-
-At this time, we don't think 256 color is a good idea since Windows does
-a good job dithering and some systems will use 256 color icons even when
-True Color exists.
-
-See bug http://bugzilla.mozilla.org/show_bug.cgi?id=99380 for a lot of rambling about
-icons.
-
-
-
-Window icons:
-Should be named using the following convention: [NAME]-window.ico where [NAME]
-represents the name of the window. Example:
-history-window.ico
-
-Blank template icon should be available as: template-window.ico
-
-XXXFIXME 
-Some icons have been given names such as downloadManager.ico and is because 
-there are two naming schemes for windows. This should be remedied. 
-Bug http://bugzilla.mozilla.org/show_bug.cgi?id=199576
-XXXFIXME
-
-
-File association icons:
-Should be named using the following convention: [NAME]-file.ico where [NAME]
-represents the type of file it is. Example:
-image-file.ico
-
-Blank template icon should be available as: template-file.ico
-
-
-Program icon:
-Currently, the only available program icon is mozilla.ico
+***** BEGIN LICENSE BLOCK *****
+Version: MPL 1.1/GPL 2.0/LGPL 2.1
+
+The contents of this file are subject to the Mozilla Public License Version 
+1.1 (the "License"); you may not use this file except in compliance with 
+the License. You may obtain a copy of the License at 
+http://www.mozilla.org/MPL/
+
+Software distributed under the License is distributed on an "AS IS" basis,
+WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+for the specific language governing rights and limitations under the
+License.
+
+The Original Code is readme.txt by Brian Bober
+
+Portions created by the Initial Developer are Copyright (C) 2003
+the Initial Developer. All Rights Reserved.
+
+Contributor(s):
+
+Alternatively, the contents of this file may be used under the terms of
+either the GNU General Public License Version 2 or later (the "GPL"), or
+the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+in which case the provisions of the GPL or the LGPL are applicable instead
+of those above. If you wish to allow use of your version of this file only
+under the terms of either the GPL or the LGPL, and not to allow others to
+use your version of this file under the terms of the MPL, indicate your
+decision by deleting the provisions above and replace them with the notice
+and other provisions required by the GPL or the LGPL. If you do not delete
+the provisions above, a recipient may use your version of this file under
+the terms of any one of the MPL, the GPL or the LGPL.
+
+***** END LICENSE BLOCK *****
+
+
+
+The icons in this directory are Win32 program icons, file association icons, 
+and window icons (to appear in the upper left corner of various windows).
+
+
+
+Requirements:
+Each icon should contain the follwing devices images:
+48x48, 32x32, and 16x16 - 16 color
+48x48, 32x32, and 16x16 - True color
+48x48, 32x32, and 16x16 - True color XP (Contains alpha shadows)
+
+At this time, we don't think 256 color is a good idea since Windows does
+a good job dithering and some systems will use 256 color icons even when
+True Color exists.
+
+See bug http://bugzilla.mozilla.org/show_bug.cgi?id=99380 for a lot of rambling about
+icons.
+
+
+
+Window icons:
+Should be named using the following convention: [NAME]-window.ico where [NAME]
+represents the name of the window. Example:
+history-window.ico
+
+Blank template icon should be available as: template-window.ico
+
+XXXFIXME 
+Some icons have been given names such as downloadManager.ico and is because 
+there are two naming schemes for windows. This should be remedied. 
+Bug http://bugzilla.mozilla.org/show_bug.cgi?id=199576
+XXXFIXME
+
+
+File association icons:
+Should be named using the following convention: [NAME]-file.ico where [NAME]
+represents the type of file it is. Example:
+image-file.ico
+
+Blank template icon should be available as: template-file.ico
+
+
+Program icon:
+Currently, the only available program icon is mozilla.ico
--- mozilla-firefox-1.0.4.orig/xpfe/communicator/resources/content/contentAreaClick.js
+++ mozilla-firefox-1.0.4/xpfe/communicator/resources/content/contentAreaClick.js
@@ -141,7 +141,9 @@
         }
         break;
       default:
-        linkNode = findParentNode(event.originalTarget, "a");
+        linkNode = event.originalTarget;
+        while (linkNode && !(linkNode instanceof HTMLAnchorElement))
+          linkNode = linkNode.parentNode;
         // <a> cannot be nested.  So if we find an anchor without an
         // href, there is no useful <a> around the target
         if (linkNode && !linkNode.hasAttribute("href"))
@@ -193,7 +195,7 @@
     }
 
     if (pref && !isKeyPress && event.button == 1 &&
-        !findParentNode(event.originalTarget, "scrollbar") &&
+        !event.getPreventDefault()
         pref.getBoolPref("middlemouse.contentLoadURL")) {
       if (middleMousePaste(event)) {
         event.preventBubble();
--- mozilla-firefox-1.0.4.orig/xpfe/communicator/resources/content/contentAreaUtils.js
+++ mozilla-firefox-1.0.4/xpfe/communicator/resources/content/contentAreaUtils.js
@@ -179,27 +179,6 @@
   }
 }
 
-function findParentNode(node, parentNode)
-{
-  if (node && node.nodeType == Node.TEXT_NODE) {
-    node = node.parentNode;
-  }
-  while (node) {
-    var nodeName = node.localName;
-    if (!nodeName)
-      return null;
-    nodeName = nodeName.toLowerCase();
-    if (nodeName == "body" || nodeName == "html" ||
-        nodeName == "#document") {
-      return null;
-    }
-    if (nodeName == parentNode)
-      return node;
-    node = node.parentNode;
-  }
-  return null;
-}
-
 // Clientelle: (Make sure you don't break any of these)
 //  - File    ->  Save Page/Frame As...
 //  - Context ->  Save Page/Frame As...
--- mozilla-firefox-1.0.4.orig/xpfe/communicator/resources/content/nsContextMenu.js
+++ mozilla-firefox-1.0.4/xpfe/communicator/resources/content/nsContextMenu.js
@@ -248,7 +248,7 @@
 
         // See if the user clicked on an image.
         if ( this.target.nodeType == Node.ELEMENT_NODE ) {
-             if ( this.target.localName.toUpperCase() == "IMG" ) {
+             if ( this.target instanceof HTMLImageElement ) {
                 this.onImage = true;
                 this.imageURL = this.target.src;
 
@@ -268,9 +268,7 @@
                         areas.length = 0;
                         for ( var i = 0; i < areas.length && !this.onLink; i++ ) {
                             var area = areas[i];
-                            if ( area.nodeType == Node.ELEMENT_NODE
-                                 &&
-                                 area.localName.toUpperCase() == "AREA" ) {
+                            if ( area instanceof HTMLAreaElement ) {
                                 // Get type (rect/circle/polygon/default).
                                 var type = area.getAttribute( "type" );
                                 var coords = this.parseCoords( area );
@@ -295,7 +293,7 @@
                         }
                     }
                 }
-             } else if ( this.target.localName.toUpperCase() == "OBJECT"
+             } else if ( this.target instanceof HTMLObjectElement
                          &&
                          // See if object tag is for an image.
                          this.objectIsImage( this.target ) ) {
@@ -303,7 +301,7 @@
                 this.onImage = true;
                 // URL must be constructed.
                 this.imageURL = this.objectImageURL( this.target );
-             } else if ( this.target.localName.toUpperCase() == "INPUT") {
+             } else if ( this.target instanceof HTMLInputElement ) {
                type = this.target.getAttribute("type");
                if(type && type.toUpperCase() == "IMAGE") {
                  this.onImage = true;
@@ -313,9 +311,9 @@
                } else /* if (this.target.getAttribute( "type" ).toUpperCase() == "TEXT") */ {
                  this.onTextInput = this.isTargetATextBox(this.target);
                }
-            } else if ( this.target.localName.toUpperCase() == "TEXTAREA" ) {
+            } else if ( this.target instanceof HTMLTextAreaElement ) {
                  this.onTextInput = true;
-            } else if ( this.target.localName.toUpperCase() == "HTML" ) {
+            } else if ( this.target instanceof HTMLHtmlElement ) {
                // pages with multiple <body>s are lame. we'll teach them a lesson.
                var bodyElt = this.target.ownerDocument.getElementsByTagName("body")[0];
                if ( bodyElt ) {
@@ -382,13 +380,11 @@
         var elem = this.target;
         while ( elem ) {
             if ( elem.nodeType == Node.ELEMENT_NODE ) {
-                var localname = elem.localName.toUpperCase();
-                
                 // Link?
                 if ( !this.onLink && 
-                    ( (localname === "A" && elem.href) ||
-                      localname === "AREA" ||
-                      localname === "LINK" ||
+                    ( (elem instanceof HTMLAnchorElement && elem.href) ||
+                      elem instanceof HTMLAreaElement ||
+                      elem instanceof HTMLLinkElement ||
                       elem.getAttributeNS( "http://www.w3.org/1999/xlink", "type") == "simple" ) ) {
                     // Clicked on a link.
                     this.onLink = true;
@@ -410,14 +406,12 @@
                 if ( !this.onMetaDataItem ) {
                     // We currently display metadata on anything which fits
                     // the below test.
-                    if ( ( localname === "BLOCKQUOTE" && 'cite' in elem && elem.cite)  ||
-                         ( localname === "Q" && 'cite' in elem && elem.cite)           ||
-                         ( localname === "TABLE" && 'summary' in elem && elem.summary) ||
-                         ( ( localname === "INS" || localname === "DEL" ) &&
-                           ( ( 'cite' in elem && elem.cite ) ||
-                             ( 'dateTime' in elem && elem.dateTime ) ) )               ||
-                         ( 'title' in elem && elem.title )                             ||
-                         ( 'lang' in elem && elem.lang ) ) {
+                    if ( ( elem instanceof HTMLQuoteElement && elem.cite)    ||
+                         ( elem instanceof HTMLTableElement && elem.summary) ||
+                         ( elem instanceof HTMLModElement &&
+                             ( elem.cite || elem.dateTime ) )                ||
+                         ( elem instanceof HTMLElement &&
+                             ( elem.title || elem.lang ) ) ) {
                         dump("On metadata item.\n");
                         this.onMetaDataItem = true;
                     }
@@ -879,29 +873,12 @@
     },
     isTargetATextBox : function ( node )
     {
-      if (node.nodeType != Node.ELEMENT_NODE)
-        return false;
+      if (node instanceof HTMLInputElement)
+        return (node.type == "text" || node.type == "password")
 
-      if (node.localName.toUpperCase() == "INPUT") {
-        var attrib = "";
-        var type = node.getAttribute("type");
-
-        if (type)
-          attrib = type.toUpperCase();
-
-        return( (attrib != "IMAGE") &&
-                (attrib != "CHECKBOX") &&
-                (attrib != "RADIO") &&
-                (attrib != "SUBMIT") &&
-                (attrib != "RESET") &&
-                (attrib != "HIDDEN") &&
-                (attrib != "RESET") &&
-                (attrib != "BUTTON") );
-      } else  {
-        return(node.localName.toUpperCase() == "TEXTAREA");
-      }
+      return (node instanceof HTMLTextAreaElement);
     },
-    
+
     // Determines whether or not the separator with the specified ID should be 
     // shown or not by determining if there are any non-hidden items between it
     // and the previous separator. 
--- mozilla-firefox-1.0.4.orig/xpfe/components/search/src/nsInternetSearchService.cpp
+++ mozilla-firefox-1.0.4/xpfe/components/search/src/nsInternetSearchService.cpp
@@ -997,8 +997,25 @@
 
 		// get available search engines
 		nsCOMPtr<nsIFile>			nativeDir;
-		if (NS_SUCCEEDED(rv = GetSearchFolder(getter_AddRefs(nativeDir))))
-		{
+
+		nsCOMPtr<nsIProperties> dirService(do_GetService("@mozilla.org/file/directory_service;1", &rv));
+		if (NS_FAILED(rv))	return rv;
+
+		nsCOMPtr<nsISimpleEnumerator> dirList;
+		rv = dirService->Get(NS_APP_SEARCH_DIR_LIST, NS_GET_IID(nsISimpleEnumerator), getter_AddRefs(dirList));
+		if (NS_FAILED(rv))	return rv;
+
+		PRBool hasMore;
+		while (NS_SUCCEEDED(dirList->HasMoreElements(&hasMore)) && hasMore)   
+                {
+			nsCOMPtr<nsISupports> supports;
+			rv = dirList->GetNext(getter_AddRefs(supports));
+			if (NS_FAILED(rv))
+				continue;
+			nativeDir = do_QueryInterface(supports, &rv);
+			if (NS_FAILED(rv))
+				continue;
+
 			rv = GetSearchEngineList(nativeDir, PR_FALSE, PR_FALSE);
 			
 			// read in category list
@@ -2574,6 +2591,15 @@
 	nsCOMPtr<nsIFile>	outFile;
 	if (NS_FAILED(rv = GetSearchFolder(getter_AddRefs(outFile))))		return(rv);
 
+	PRBool exists; 
+	rv = outFile->Exists(&exists); 
+	if (NS_FAILED(rv)) return(rv);
+	if (!exists)
+	{
+		rv = outFile->Create(nsIFile::DIRECTORY_TYPE, 0755);
+		if (NS_FAILED(rv)) return(rv);
+	}
+
 	const PRUnichar	*dataBuf = nsnull;
 	if (NS_FAILED(rv = context->GetBufferConst(&dataBuf)))	return(rv);
 
@@ -4133,7 +4159,7 @@
   *searchDir = nsnull;
 	
   nsCOMPtr<nsIFile> aDir;
-  nsresult rv = NS_GetSpecialDirectory(NS_APP_SEARCH_DIR, getter_AddRefs(aDir));
+  nsresult rv = NS_GetSpecialDirectory(NS_USER_SEARCH_DIR, getter_AddRefs(aDir));
   if (NS_FAILED(rv)) return rv;
   
   *searchDir = aDir;
--- mozilla-firefox-1.0.4.orig/xpfe/global/resources/content/bindings/browser.xml
+++ mozilla-firefox-1.0.4/xpfe/global/resources/content/bindings/browser.xml
@@ -322,6 +322,10 @@
         null
       </field>
 
+      <field name="mDestroyed">
+        false
+      </field>
+
       <property name="userTypedValue"
                 onget="return this._userTypedValue;"
                 onset="this.userTypedClear = 0; return this._userTypedValue = val;"/>
@@ -360,12 +364,31 @@
       
       <destructor>
         <![CDATA[
+          this.destroy();
+        ]]>
+      </destructor>
+
+      <!-- This is necessary because the destructor is not called
+           promptly when we are removed from a tabbrowser. This will be
+           explicitly called by tabbrowser -->
+      <method name="destroy">
+        <body>
+        <![CDATA[
+          if (this.mDestroyed)
+            return;
+          this.mDestroyed = true;
+
           if (this.mDragDropHandler)
             this.mDragDropHandler.detach();
+          this.mDragDropHandler = null;
 
           this.securityUI = null;
+          this.focusedWindow = null;
+          this.focusedElement = null;
+          this._webBrowserFind = null;
         ]]>
-      </destructor>
+        </body>
+      </method>
     </implementation>
 
     <handlers>
--- mozilla-firefox-1.0.4.orig/xpfe/global/resources/content/bindings/tabbrowser.xml
+++ mozilla-firefox-1.0.4/xpfe/global/resources/content/bindings/tabbrowser.xml
@@ -649,12 +649,12 @@
 
             var origURIStr = safeGetProperty(targetDoc, "documentURI");
             var origURI = ioService.newURI(href, docCharset, baseURI);
-
+            
             const nsIScriptSecMan =
               Components.interfaces.nsIScriptSecurityManager;
 
             try {
-              secMan.checkLoadURI(origURI, uri,
+              secMan.checkLoadURI(origURI, uri, 
                                   nsIScriptSecMan.DISALLOW_SCRIPT);
             } catch(e) {
               return;
@@ -999,6 +999,19 @@
             // clean up the before/afterselected attributes before removing the tab
             oldTab.selected = false;
 
+            // Because of the way XBL works (fields just set JS
+            // properties on the element) and the code we have in place
+            // to preserve the JS objects for any elements that have
+            // JS properties set on them, the browser element won't be
+            // destroyed until the document goes away.  So we force a
+            // cleanup ourselves.
+            // This has to hapen before we remove the child so that the
+            // XBL implementation of nsIObserver still works.
+            oldBrowser.destroy();
+
+            if (oldBrowser == this.mCurrentBrowser)
+              this.mCurrentBrowser = null;
+
             this.mTabContainer.removeChild(oldTab);
             this.mPanelContainer.removeChild(oldBrowser);
 
--- mozilla-firefox-1.0.4.orig/mailnews/base/search/src/nsMsgFilterService.cpp
+++ mozilla-firefox-1.0.4/mailnews/base/search/src/nsMsgFilterService.cpp
@@ -571,6 +571,8 @@
           {
             m_curFilter->SetEnabled(PR_FALSE);
             destIFolder->ThrowAlertMsg("filterDisabled",m_msgWindow);
+            // we need to explicitly save the filter file.
+            m_filters->SaveToDefaultFile();
             // In the case of applying multiple filters
             // we might want to remove the filter from the list, but 
             // that's a bit evil since we really don't know that we own
--- mozilla-firefox-1.0.4.orig/mailnews/extensions/palmsync/palm.html
+++ mozilla-firefox-1.0.4/mailnews/extensions/palmsync/palm.html
@@ -1,633 +1,633 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>
-  <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><title>Netscape Address Book Sync for Palm Devices</title>
-  
-  <meta name="author" content="Robin Clark"></head><body>
-<div align="center">
-<div align="left">
-<h2><span style="font-family: helvetica,arial,sans-serif;"><span style="font-weight: bold;">Mozilla Address Book Sync for Palm<small><small><small><small><sup>TM</sup></small></small></small></small>
-Devices</span></span></h2>
-<br>
-</div>
-<span style="font-family: helvetica,arial,sans-serif;"></span></div>
-<big><span style="font-family: helvetica,arial,sans-serif;"> <small>Mozilla Address Book Sync for Palm<small><sup>TM</sup></small> devices lets you
-transfer data  between Mozilla address books and your Palm-compatible
-device. <br>
-<br>
-<span style="font-weight: bold;">Note</span>: For information on HotSync</small></span></big><sup>&REG;</sup><big><span style="font-family: helvetica,arial,sans-serif;"><small> setup, consult
-your Palm device's documentation.<br>
-</small></span></big>
-<hr style="width: 100%; height: 2px;"><a href="#Getting_Started"><span style="font-family: helvetica,arial,sans-serif;"><span style="font-weight: bold;">Getting Started</span></span></a><br>
-<div style="margin-left: 40px;"><a href="#Requirements"><font face="Helvetica, Arial, sans-serif">Requirements</font></a><br>
-<a href="#Installing_"><font face="Helvetica, Arial, sans-serif">Using Mozilla Address Book Palm Sync</font></a><br>
-<a href="#Synchronizing_"><font face="Helvetica, Arial, sans-serif">Synchronizing
-With  Your Palm Device</font></a><br>
-<a href="#Uninstalling_"><font face="Helvetica, Arial, sans-serif">Uninstalling Mozilla  Address Book Sync</font></a><br>
-</div>
-<a href="#Uninstalling_"><font face="Helvetica, Arial, sans-serif"> </font></a> <br style="font-family: helvetica,arial,sans-serif;">
-<a href="#Troubleshooting"><span style="font-family: helvetica,arial,sans-serif;"><span style="font-weight: bold;">Troubleshooting</span></span></a><br>
-<div style="margin-left: 40px;"><a href="#HotSync_"><font face="Helvetica, Arial, sans-serif">HotSync Problems</font></a><br>
-<a href="#Record_"><font face="Helvetica, Arial, sans-serif">Record
-Problems</font></a><br>
-</div>
-<a href="#Record_"><big> </big></a><small><big><br style="font-family: helvetica,arial,sans-serif;">
-</big> <span style="font-family: helvetica,arial,sans-serif;"><big><span style="font-weight: bold;"><a href="#Field_Mapping">Field Mapping</a><br>
-</span></big></span></small>
-<div style="margin-left: 40px;"><small><span style="font-family: helvetica,arial,sans-serif;"><big><a href="#Categories">Categories and Address Books</a><span style="font-weight: bold;"></span></big></span></small><br>
-<small><span style="font-family: helvetica,arial,sans-serif;"><big><span style="font-weight: bold;"></span></big></span></small></div>
-<small><span style="font-family: helvetica,arial,sans-serif;"><big> </big> <br>
-</span></small>
-<hr style="width: 100%; height: 2px;"><small><span style="font-family: helvetica,arial,sans-serif;"><br>
-</span></small>
-<h1><small><span style="font-family: helvetica,arial,sans-serif;"><a name="Getting_Started"></a>Getting  Started</span></small></h1>
-<span style="font-family: helvetica,arial,sans-serif;">When you are
-ready to begin transferring data between your Mozilla address book and
-your Palm device, follow the instructions under <a href="#Installing_">Using Mozilla Address Book Palm Sync</a>. </span><br style="font-family: helvetica,arial,sans-serif;">
-<br>
-<h1><small><span style="font-family: helvetica,arial,sans-serif;"> </span></small></h1>
-<h2><small><font face="Helvetica, Arial, sans-serif"><a name="Requirements"></a>Requirements</font></small></h2>
-<font face="Helvetica, Arial, sans-serif"> </font>
-<ul>
-  <li><font face="Helvetica, Arial, sans-serif">Mozilla<br>
-</font></li>
-  <li><font face="Helvetica, Arial, sans-serif">Any Palm-compatible
-Platform device  (e.g., Palm III and above, Palm m100 series, Palm m500
-series and above, Handspring<small><sup>TM</sup></small> Visor)</font></li>
-  <li><font face="Helvetica, Arial, sans-serif">Palm Desktop 3.5.3 or
-greater and </font><span style="font-family: arial;">HotSync version
-3.1.1 or greater</span><font face="Helvetica, Arial, sans-serif"><span style="font-family: arial;">.</span> If you have an older version, you
-can download an upgrade from the Palm web site (<a href="http://www.palm.com">www.palm.com</a>).</font></li>
-</ul>
-<h2><small><font face="Helvetica, Arial, sans-serif"><a name="Installing_"></a>Using Mozilla Address Book Palm Sync</font></small></h2>
-<font face="Helvetica, Arial, sans-serif">Before using Mozilla Address
-Book Palm Sync, make sure your Palm device contains the latest address
-book data. If </font><font face="Helvetica, Arial, sans-serif">you have
-updated  or entered new address book data in your Palm Desktop
-software, you should  first perform a HotSync to update your Palm
-device's address books with the latest data. This will insure that your
-latest Palm address book data will be synchronized with your Mozilla
-address books.</font><br>
-<font face="Helvetica, Arial, sans-serif"> <br>
-The Mozilla Address Book Palm Sync installer utility lets your Palm
-device synchronize directly with your Mozilla address books by
-replacing the Palm  Desktop Address Book Sync with Mozilla Address Book
-Sync. <br>
-<br>
-To start using Mozilla Address Book Palm Sync:<br>
-</font>
-<ol>
-  <li><font face="Helvetica, Arial, sans-serif">Start Mozilla Address
-Book Palm Sync:<br>
-    </font> </li>
-  <ol>
-    <li><font face="Helvetica, Arial, sans-serif">Open the Windows
-Start menu.</font></li>
-    <li><font face="Helvetica, Arial, sans-serif">Choose Programs.</font></li>
-    <li><font face="Helvetica, Arial, sans-serif">From the Programs
-menu, choose Mozilla.<br>
-</font></li>
-    <li><font face="Helvetica, Arial, sans-serif">From the Mozilla
-menu, choose Palm Tools.</font></li>
-    <li><font face="Helvetica, Arial, sans-serif">From the Palm Tools
-menu, choose Address Book Palm Sync Install.</font></li>
-  </ol>
-</ol>
-<div style="margin-left: 40px;"><span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Note</span><span style="font-family: helvetica,arial,sans-serif;">: If Mozilla is
-already running, it uses the address books in the current user profile
-for synchronization. If Mozilla is not running, it starts and displays
-the Profile Manager (if you have more than one profile) so that you can
-choose the profile to use for synchronization.</span><br>
-</div>
-<ol style="list-style-type: decimal;" start="2">
-  <li type="1"><font face="Helvetica, Arial, sans-serif">Press the
-HotSync button on your Palm device to start synchronizing.</font></li>
-</ol>
-<span style="font-weight: bold; font-family: arial;">Note</span><span style="font-family: arial;">: To install Mozilla Address Book Palm
-Sync from the command line, change to the directory where you installed Mozilla and enter the command <span style="font-style: italic;">PalmSyncInstall.exe</span>.</span><font face="Helvetica, Arial, sans-serif"><br>
-</font><span style="font-family: arial;"></span>
-<h2><small><font face="Helvetica, Arial, sans-serif"><a name="Synchronizing_"></a>Synchronizing With Your  Palm Device</font></small></h2>
-<font face="Helvetica, Arial, sans-serif">After you synchronize with
-your Palm device, your Palm address book will contain all the records in
-your Mozilla address books. Each Mozilla address book is listed as a
-category in your Palm address book. Your Mozilla address book will
-contain a new address book for each category in your Palm address book.
-For more information, see <a href="#Field_">Field Mapping</a>.<br>
-<br>
-</font><b><font face="Helvetica, Arial, sans-serif">Synchronizing With
-Another Mozilla User Profile</font></b><br>
-<font face="Helvetica, Arial, sans-serif">To synchronize your Palm
-device with a different Mozilla user profile, you must first quit
-Mozilla. Start Mozilla again, and choose the user profile you want to
-synchronize with.&nbsp; Press the HotSync button on your Palm device to
-synchronize.<br>
-<br>
-<span style="font-weight: bold;">Synchronizing With Another Program</span><br>
-If you want to synchronize with another program, you must first <a href="#Uninstalling_">uninstall </a>Mozilla Address Book Palm Sync.<br>
-<br>
-<span style="font-weight: bold;">Verifying that Netcape Address Book
-Palm Sync Is Installed</span><br>
-</font><font face="Helvetica, Arial, sans-serif">To verify that you
-have established a HotSync connection with Mozilla, right-click the
-HotSync Manager icon in the system tray, and choose Custom. The Custom
-dialog box should display "Mozilla Address Book" in the Conduit list. </font><br>
-<h3><small><font face="Helvetica, Arial, sans-serif"><small>Synchronization
-Guidelines</small></font></small></h3>
-<font face="Helvetica, Arial, sans-serif"><small><b>Maximum number of
-address books</b></small><br>
-</font><font face="Helvetica, Arial, sans-serif">A maximum of 15
-address books can be synchronized.<br>
-</font>
-<ul>
-  <li><font face="Helvetica, Arial, sans-serif">Mozilla Address Book
-Palm Sync can synchronize only the first 15 address books due to the
-Palm device's limit of 15 categories. Before you synchronize, make sure
-that the total number of categories plus the total number of Mozilla
-address books does not exceed 15. Palm categories that have the same
-name as a Mozilla address book will be merged when you synchronize, so
-they should only be counted once.</font></li>
-  <li><font face="Helvetica, Arial, sans-serif">If your Palm address
-book already contains 15 categories, you can either remove some
-categories before you synchronize or make sure that your Mozilla
-address books are named the same as the Palm categories, so that they
-will get merged when you synchronize.</font></li>
-</ul>
-<font face="Helvetica, Arial, sans-serif"><small><b>Mozilla address
-book fields</b></small><br>
-Mozilla address book fields, with the exception of the Notes and
-Address fields, cannot contain multiple lines. When you synchronize,
-field values in your Palm address book will be converted to single line
-entries in your Mozilla address book, with each line separated by a
-comma.</font><br>
-<font face="Helvetica, Arial, sans-serif"><br>
-<br>
-<small style="font-weight: bold;">Palm Categories and Mozilla Address
-Books</small><br>
-On your Palm device, address records are stored in categories. In
-Mozilla, address records are stored in address books. Mozilla Address
-Book Sync matches Palm categories and Mozilla address books. After a
-successful synchronization, each Palm device category will have a
-corresponding Mozilla address book. <br>
-<br> Palm category names are limited to 15 characters, so if you have a
-Mozilla address book name that is longer than 15 characters, its
-corresponding category name will be truncated on the Palm device.<br>
-</font> <br>
-<h3><small><font face="Helvetica, Arial, sans-serif"><a name="Uninstalling_"></a>Uninstalling Mozilla Address Book Palm Sync</font></small></h3>
-<span style="font-family: helvetica,arial,sans-serif;">You only need to
-uninstall Mozilla Address Book Palm Sync if you want to synchronize
-your Palm Device with a different program. If you only plan to
-synchronize with Mozilla, you don't need to uninstall Address Book Palm
-Sync.</span><br>
-<br>
-<font face="Helvetica, Arial, sans-serif"><b>Note</b>: Before
-uninstalling Mozilla Address Book Palm Sync, make sure your Palm device
-contains the latest address book data. If </font><font face="Helvetica, Arial, sans-serif">you have updated  or entered new
-address book data in your Mozilla address book, you should  perform
-another HotSync to update your Palm device's address books with the
-latest data. This will insure that your Palm address book contains the
-latest data from your Mozilla address books before you uninstall Mozilla Address Book Palm Sync.</font><br>
-<br>
-<font face="Helvetica, Arial, sans-serif">To uninstall Mozilla Address
-Book Palm Sync:<br>
-</font>
-<ol>
-  <li><font face="Helvetica, Arial, sans-serif">Start the Mozilla
-Address Book Palm Sync uninstaller:<br>
-    </font> </li>
-  <ol>
-    <li><font face="Helvetica, Arial, sans-serif">Open the Windows
-Start menu.</font></li>
-    <li><font face="Helvetica, Arial, sans-serif">Choose Programs.</font></li>
-    <li><font face="Helvetica, Arial, sans-serif">From the Programs
-menu, choose Mozilla.<br>
-</font></li>
-    <li><font face="Helvetica, Arial, sans-serif">From the Mozilla
-menu, choose Palm Tools.</font></li>
-    <li><font face="Helvetica, Arial, sans-serif">From the Palm Tools
-menu, choose Address Book Palm Sync Uninstall.</font></li>
-  </ol>
-</ol>
-<span style="font-weight: bold; font-family: arial;">Note</span><span style="font-family: arial;">: To uninstall Mozilla Address Book Palm
-Sync from the command line, change to the directory where you installed Mozilla and enter the command <span style="font-style: italic;">PalmSyncInstall.exe
-/u</span>.</span><br>
-<font face="Helvetica, Arial, sans-serif"><br>
-You have successfully uninstalled Mozilla Address Book Palm Sync. The </font><font face="Helvetica, Arial, sans-serif">Palm Desktop Address Book Sync is
-now enabled. You can synchronize your Palm device with your Mozilla
-address book again at any time by following the instructions under </font><font face="Helvetica, Arial, sans-serif"><a href="http://jazz/users/robinf/private/Buffy_Help/palm.html#Installing_">Installing Mozilla Address Book Palm Sync</a></font>. <br>
-<br>
-<h2><small><font face="Helvetica, Arial, sans-serif"> </font></small></h2>
-<hr width="100%" size="2">
-<h1><small><span style="font-family: helvetica,arial,sans-serif;"><a name="Troubleshooting"></a>Troubleshooting</span></small></h1>
-<h1><small><span style="font-family: helvetica,arial,sans-serif;"> </span></small></h1>
-<h2><small><font face="Helvetica, Arial, sans-serif"><a name="HotSync_"></a>HotSync
-Problems</font></small></h2>
-<span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Problem:</span><span style="font-family: helvetica,arial,sans-serif;">I cannot get my Palm
-organizer to HotSync with my Mozilla address book.<br>
-</span><span style="font-weight: bold; font-family: helvetica,arial,sans-serif;"><br>
-Possible Solutions:<br style="font-family: helvetica,arial,sans-serif;">
-</span>
-<ul style="font-family: helvetica,arial,sans-serif;">
-  <li>Make sure that you installed the HotSync Manager software, and
-that the HotSync Manager icon appears in your system tray.</li>
-  <li>Make sure that you started the Mozilla Address Book Palm Sync
-Install utility.</li>
-  <li>Close all HotSync windows on your PC.</li>
-  <li>Verify that your Palm device is securely placed in its cradle.</li>
-  <li>Make sure that no other programs are using the same serial port
-as the HotSync manager. To verify your serial port settings, click the
-HotSync Manager icon in the system tray and choose Setup.</li>
-  <li>Close the HotSync Manager and then open it again.<br>
-  </li>
-</ul>
-<span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Problem:</span><span style="font-family: helvetica,arial,sans-serif;"> The HotSync Manager
-keeps timing out.</span><br style="font-family: helvetica,arial,sans-serif;">
-<br style="font-family: helvetica,arial,sans-serif;">
-<span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Possible
-Solution:</span><br style="font-family: helvetica,arial,sans-serif;">
-<ul style="font-family: helvetica,arial,sans-serif;">
-  <li>The time out interval for HotSync Manager is one minute. If
-HotSync times out while waiting for Mozilla to launch, make sure
-that you start Mozilla before starting synchronization.</li>
-</ul>
-<span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Problem:</span><span style="font-family: helvetica,arial,sans-serif;"> The HotSync process
-takes a long time.</span><br style="font-family: helvetica,arial,sans-serif;">
-<br style="font-family: helvetica,arial,sans-serif;">
-<span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Possible
-Solutions: </span><span style="font-family: helvetica,arial,sans-serif;">You can reduce the
-time it takes to synchronize by doing the following:</span><br style="font-family: helvetica,arial,sans-serif;">
-<ul>
-  <li style="font-family: helvetica,arial,sans-serif;">Please note that
-depending on the number of address book records and the speed of your
-PC, the first time you synchronize may take a while. Subsequent
-synchronizations will be faster.</li>
-  <li><span style="font-family: helvetica,arial,sans-serif;">Set unused
-applications to Do Nothing in the HotSync Manager Custom menu.</span><br>
-  </li>
-</ul>
-<h2><small><font face="Helvetica, Arial, sans-serif"><a name="Record_"></a>Record
-Problems</font></small></h2>
-<span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Problem:</span><span style="font-family: helvetica,arial,sans-serif;"> Some Mozilla records
-do not appear in the Palm device after synchronizing.<br>
-<br style="font-family: helvetica,arial,sans-serif;">
-</span> <span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Possible
-Solution: </span><span style="font-family: helvetica,arial,sans-serif;"><br>
-</span>
-<ul style="font-family: helvetica,arial,sans-serif;">
-  <li>Only the first 15 address books are synchronized. Make sure the
-records are in an address book that actually got synchronized.</li>
-</ul>
-<span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Problem:</span><span style="font-family: helvetica,arial,sans-serif;"> Some records appear
-duplicated.<br>
-<br>
-</span> <span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Possible
-Solution: </span><span style="font-family: helvetica,arial,sans-serif;"><br>
-</span>
-<ul style="font-family: helvetica,arial,sans-serif;">
-  <li>Delete the unwanted records either from your Palm device or from
-your Mozilla address book.</li>
-  <li>If a HotSync terminates unexpectedly (due to a power loss, for
-example), it is possible that the next time you perform a HotSync, some
-records will be duplicated.<br>
-  </li>
-</ul>
-<span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Problem:</span><span style="font-family: helvetica,arial,sans-serif;"> Changes I made to a
-record on my Palm device were not transferred to my Mozilla address
-book.</span><br style="font-family: helvetica,arial,sans-serif;">
-<br style="font-family: helvetica,arial,sans-serif;">
-<span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Possible
-Solution: <br>
-</span>
-<ul style="font-family: helvetica,arial,sans-serif;">
-  <li>Make sure that the field that changed is supported. See <a href="#Field_Mapping">Field Mapping</a>.</li>
-</ul>
-<span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Problem:</span><span style="font-family: helvetica,arial,sans-serif;"> Some Palm device
-fields appear in a different order after synchronizing.</span><br style="font-family: helvetica,arial,sans-serif;">
-<br style="font-family: helvetica,arial,sans-serif;">
-<span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Possible
-Solution: </span><span style="font-family: helvetica,arial,sans-serif;"><br>
-<br>
-On the Palm device, there are five phone fields. When you synchronize,
-the order of these fields is reset according to the current field
-mapping. <br>
-<br>
-</span><span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Problem:</span><span style="font-family: helvetica,arial,sans-serif;"> Fields that contain
-multiple lines get changed when I synchronize.<br>
-<br style="font-family: helvetica,arial,sans-serif;">
-</span> <span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Possible
-Solution: </span><span style="font-family: helvetica,arial,sans-serif;"><br>
-</span>
-<ul>
-  <li><span style="font-family: helvetica,arial,sans-serif;">Unlike
-fields on the Palm device, all Mozilla fields, with the exception of
-the Notes and Address fields, cannot consist of multiple lines. When
-synchronizing, field values on the Palm device that contain multiple
-lines will be changed to single line entries, with each line separated
-by a comma.<br>
-    </span></li>
-</ul>
-<span style="font-family: helvetica,arial,sans-serif;"><br>
-</span>
-<hr width="100%" size="2"><small><br style="font-family: helvetica,arial,sans-serif;">
-</small>
-<h1><a name="Field_Mapping"></a><small><span style="font-family: helvetica,arial,sans-serif;"><a name="Field_"></a>Field
-Mapping</span></small></h1>
-<div class="Body" style="font-family: helvetica,arial,sans-serif;">This
-section describes the conversions that occur when transferring data
-between Mozilla address book(s) and your Palm device's address book.
-Apart from the special conversion rules that apply to specific fields,
-some general rules apply:</div>
-<ul style="font-family: helvetica,arial,sans-serif;">
-  <li> Text fields are truncated to the maximum allowed length on the
-destination platform.</li>
-  <li> Text fields that can contain multiple lines on the Palm device
-but not in Mozilla will be changed to single line entries with each
-line separated by a comma.<br>
-  </li>
-  <li> Fields that are available in Mozilla but not on the Palm device
-and vice versa will not be modified during synchronization.</li>
-</ul>
-<div class="Heading1" style="font-family: helvetica,arial,sans-serif;"><a name="Categories"></a><b><font size="+1">Categories and Address Books<br>
-<br>
-</font></b></div>
-<div class="Body" style="font-family: helvetica,arial,sans-serif;">The
-following table describes what happens to categories and address books
-during synchronization.<br>
-<br>
-</div>
-<table border="1" cellspacing="0" cellpadding="3" style="font-family: helvetica,arial,sans-serif;">
-  <tbody>
-    <tr>
-      <th>
-      <div class="CellHeading">Mozilla Address Book action</div>
-      </th>
-      <th>
-      <div class="CellHeading">Palm category action</div>
-      </th>
-      <th>
-      <div class="CellHeading">Synchronization</div>
-      </th>
-    </tr>
-    <tr>
-      <td>
-      <div class="CellBody">New address book created</div>
-      </td>
-      <td>
-      <div class="CellBody">n/a</div>
-      </td>
-      <td>
-      <div class="CellBody">New Palm category created if there is an
-available category.&nbsp; The Palm device can only contain 15
-categories.&nbsp; If the maximum has been reached then this address book
-will not be synchronized.</div>
-      </td>
-    </tr>
-    <tr>
-      <td>
-      <div class="CellBody">Address book deleted</div>
-      </td>
-      <td>
-      <div class="CellBody">Category not changed, or&nbsp; <br>
-category deleted</div>
-      </td>
-      <td>
-      <div class="CellBody">All of the records from this address book
-will be deleted and if the category still exists it will be deleted as
-well.</div>
-      </td>
-    </tr>
-    <tr>
-      <td style="vertical-align: top;">Address book renamed<br>
-      </td>
-      <td style="vertical-align: top;">n/a<br>
-      </td>
-      <td style="vertical-align: top;">All
-of the records from this address book remain in the same category. The
-category is not renamed on the Palm device. However, after syncing, the
-Mozilla address book will be renamed to match the category name on the
-Palm device. Therefore, to rename a Mozilla address book, rename it on
-the Palm device and then sync.<br>
-      </td>
-    </tr>
-    <tr>
-      <td>
-      <div class="CellBody">n/a</div>
-      </td>
-      <td>
-      <div class="CellBody">New category created</div>
-      </td>
-      <td>
-      <div class="CellBody">A new address book with the same name as
-the category will be created in Mozilla.&nbsp; All new records filed in
-the category will be created in the new address book.</div>
-      </td>
-    </tr>
-    <tr>
-      <td>
-      <div class="CellBody">n/a</div>
-      </td>
-      <td>
-      <div class="CellBody">Category deleted</div>
-      </td>
-      <td>
-      <div class="CellBody">Records go to the Unfiled Mozilla address
-book.</div>
-      </td>
-    </tr>
-    <tr>
-      <td style="vertical-align: top;">n/a</td>
-      <td style="vertical-align: top;">Category renamed</td>
-      <td style="vertical-align: top;">The category will be renamed to
-match the address book it corresponds to. To rename a Mozilla address book, rename it on the Palm device and then sync.<br>
-</td>
-    </tr>
-    <tr>
-      <td style="vertical-align: top;">n/a<br>
-      </td>
-      <td style="vertical-align: top;">Records in "Unfiled" category<br>
-      </td>
-      <td style="vertical-align: top;">Records appear in the Unfiled Mozilla address book.<br>
-      </td>
-    </tr>
-  </tbody>
-</table>
-<p style="font-family: helvetica,arial,sans-serif;"><a name="Fields"></a><b><font size="+1">Fields</font></b> </p>
-<div class="Body" style="font-family: helvetica,arial,sans-serif;">&nbsp;
-<table border="1" cellspacing="0" cellpadding="3">
-  <tbody>
-    <tr>
-      <th>
-      <div class="CellHeading">Mozilla field</div>
-      </th>
-      <th>
-      <div class="CellHeading">Palm field</div>
-      </th>
-      <th>
-      <div class="CellHeading">Notes</div>
-      </th>
-    </tr>
-    <tr>
-      <td>
-      <div class="CellBody">First name</div>
-      </td>
-      <td>
-      <div class="CellBody">First name</div>
-      </td>
-      <td>
-      <div class="CellBody">&nbsp;</div>
-      </td>
-    </tr>
-    <tr>
-      <td>
-      <div class="CellBody">Last name</div>
-      </td>
-      <td>
-      <div class="CellBody">Last name</div>
-      </td>
-      <td>
-      <div class="CellBody">&nbsp;</div>
-      </td>
-    </tr>
-    <tr>
-      <td>
-      <div class="CellBody">Display name</div>
-      </td>
-      <td>
-      <div class="CellBody">&nbsp;</div>
-      </td>
-      <td>
-      <div class="CellBody">There is no Palm field for Display
-name.&nbsp; The Palm can be configured to list records by Last name,
-First name or Company, Last name&nbsp;</div>
-      </td>
-    </tr>
-    <tr>
-      <td>
-      <div class="CellBody">Email Address</div>
-      </td>
-      <td>
-      <div class="CellBody">E-mail</div>
-      </td>
-      <td>
-      <div class="CellBody">&nbsp;</div>
-      </td>
-    </tr>
-    <tr>
-      <td>
-      <div class="CellBody">Nickname</div>
-      </td>
-      <td>
-      <div class="CellBody">&nbsp;</div>
-      </td>
-      <td>
-      <div class="CellBody">Not synchronized</div>
-      </td>
-    </tr>
-    <tr>
-      <td>
-      <div class="CellBody">Title</div>
-      </td>
-      <td>
-      <div class="CellBody">Title</div>
-      </td>
-      <td>
-      <div class="CellBody">&nbsp;</div>
-      </td>
-    </tr>
-    <tr>
-      <td>
-      <div class="CellBody">Organization</div>
-      </td>
-      <td>
-      <div class="CellBody">Company</div>
-      </td>
-      <td>
-      <div class="CellBody">&nbsp;</div>
-      </td>
-    </tr>
-    <tr>
-      <td>Department</td>
-      <td><br>
-      </td>
-      <td>There is no corresponding Palm field for Department.&nbsp;</td>
-    </tr>
-    <tr>
-      <td>Notes</td>
-      <td>Note</td>
-      <td>Multiple lines are allowed in this field.</td>
-    </tr>
-    <tr>
-      <td>Address</td>
-      <td>Address</td>
-      <td>Multiple lines are allowed in this field.</td>
-    </tr>
-    <tr>
-      <td>City</td>
-      <td>City</td>
-      <td><br>
-      </td>
-    </tr>
-    <tr>
-      <td>State</td>
-      <td>State</td>
-      <td><br>
-      </td>
-    </tr>
-    <tr>
-      <td>Zip</td>
-      <td>Zip Code</td>
-      <td><br>
-      </td>
-    </tr>
-    <tr>
-      <td>Country</td>
-      <td>Country</td>
-      <td><br>
-      </td>
-    </tr>
-    <tr>
-      <td>Work phone</td>
-      <td>Work</td>
-      <td><br>
-      </td>
-    </tr>
-    <tr>
-      <td>Home phone</td>
-      <td>Home</td>
-      <td><br>
-      </td>
-    </tr>
-    <tr>
-      <td>Fax</td>
-      <td>Fax</td>
-      <td><br>
-      </td>
-    </tr>
-    <tr>
-      <td>Pager</td>
-      <td><br>
-      </td>
-      <td>Only 5 phone fields are available on the Palm.&nbsp; Work,
-Home, Fax, Email, and Mobile are synchronized.</td>
-    </tr>
-    <tr>
-      <td>Cellular</td>
-      <td>Mobile</td>
-      <td><br>
-      </td>
-    </tr>
-    <tr>
-      <td>Prefers to receive rich text (HTML) mail</td>
-      <td><br>
-      </td>
-      <td>Not synchronized.</td>
-    </tr>
-  </tbody>
-</table>
-</div>
-<br style="font-family: helvetica,arial,sans-serif;">
-<hr style="width: 100%; height: 2px;"><span style="font-style: italic; font-family: arial;">12 May 2003</span><br style="font-family: arial;">
-<br style="font-family: arial;">
-<span style="font-family: arial;">Copyright&COPY;&nbsp; 1994-2003 The Mozilla Organization.</span><br style="font-family: helvetica,arial,sans-serif;">
-<br style="font-family: helvetica,arial,sans-serif;">
-<br style="font-family: helvetica,arial,sans-serif;">
-<br>
-<br>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>
+  <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><title>Netscape Address Book Sync for Palm Devices</title>
+  
+  <meta name="author" content="Robin Clark"></head><body>
+<div align="center">
+<div align="left">
+<h2><span style="font-family: helvetica,arial,sans-serif;"><span style="font-weight: bold;">Mozilla Address Book Sync for Palm<small><small><small><small><sup>TM</sup></small></small></small></small>
+Devices</span></span></h2>
+<br>
+</div>
+<span style="font-family: helvetica,arial,sans-serif;"></span></div>
+<big><span style="font-family: helvetica,arial,sans-serif;"> <small>Mozilla Address Book Sync for Palm<small><sup>TM</sup></small> devices lets you
+transfer data  between Mozilla address books and your Palm-compatible
+device. <br>
+<br>
+<span style="font-weight: bold;">Note</span>: For information on HotSync</small></span></big><sup>&REG;</sup><big><span style="font-family: helvetica,arial,sans-serif;"><small> setup, consult
+your Palm device's documentation.<br>
+</small></span></big>
+<hr style="width: 100%; height: 2px;"><a href="#Getting_Started"><span style="font-family: helvetica,arial,sans-serif;"><span style="font-weight: bold;">Getting Started</span></span></a><br>
+<div style="margin-left: 40px;"><a href="#Requirements"><font face="Helvetica, Arial, sans-serif">Requirements</font></a><br>
+<a href="#Installing_"><font face="Helvetica, Arial, sans-serif">Using Mozilla Address Book Palm Sync</font></a><br>
+<a href="#Synchronizing_"><font face="Helvetica, Arial, sans-serif">Synchronizing
+With  Your Palm Device</font></a><br>
+<a href="#Uninstalling_"><font face="Helvetica, Arial, sans-serif">Uninstalling Mozilla  Address Book Sync</font></a><br>
+</div>
+<a href="#Uninstalling_"><font face="Helvetica, Arial, sans-serif"> </font></a> <br style="font-family: helvetica,arial,sans-serif;">
+<a href="#Troubleshooting"><span style="font-family: helvetica,arial,sans-serif;"><span style="font-weight: bold;">Troubleshooting</span></span></a><br>
+<div style="margin-left: 40px;"><a href="#HotSync_"><font face="Helvetica, Arial, sans-serif">HotSync Problems</font></a><br>
+<a href="#Record_"><font face="Helvetica, Arial, sans-serif">Record
+Problems</font></a><br>
+</div>
+<a href="#Record_"><big> </big></a><small><big><br style="font-family: helvetica,arial,sans-serif;">
+</big> <span style="font-family: helvetica,arial,sans-serif;"><big><span style="font-weight: bold;"><a href="#Field_Mapping">Field Mapping</a><br>
+</span></big></span></small>
+<div style="margin-left: 40px;"><small><span style="font-family: helvetica,arial,sans-serif;"><big><a href="#Categories">Categories and Address Books</a><span style="font-weight: bold;"></span></big></span></small><br>
+<small><span style="font-family: helvetica,arial,sans-serif;"><big><span style="font-weight: bold;"></span></big></span></small></div>
+<small><span style="font-family: helvetica,arial,sans-serif;"><big> </big> <br>
+</span></small>
+<hr style="width: 100%; height: 2px;"><small><span style="font-family: helvetica,arial,sans-serif;"><br>
+</span></small>
+<h1><small><span style="font-family: helvetica,arial,sans-serif;"><a name="Getting_Started"></a>Getting  Started</span></small></h1>
+<span style="font-family: helvetica,arial,sans-serif;">When you are
+ready to begin transferring data between your Mozilla address book and
+your Palm device, follow the instructions under <a href="#Installing_">Using Mozilla Address Book Palm Sync</a>. </span><br style="font-family: helvetica,arial,sans-serif;">
+<br>
+<h1><small><span style="font-family: helvetica,arial,sans-serif;"> </span></small></h1>
+<h2><small><font face="Helvetica, Arial, sans-serif"><a name="Requirements"></a>Requirements</font></small></h2>
+<font face="Helvetica, Arial, sans-serif"> </font>
+<ul>
+  <li><font face="Helvetica, Arial, sans-serif">Mozilla<br>
+</font></li>
+  <li><font face="Helvetica, Arial, sans-serif">Any Palm-compatible
+Platform device  (e.g., Palm III and above, Palm m100 series, Palm m500
+series and above, Handspring<small><sup>TM</sup></small> Visor)</font></li>
+  <li><font face="Helvetica, Arial, sans-serif">Palm Desktop 3.5.3 or
+greater and </font><span style="font-family: arial;">HotSync version
+3.1.1 or greater</span><font face="Helvetica, Arial, sans-serif"><span style="font-family: arial;">.</span> If you have an older version, you
+can download an upgrade from the Palm web site (<a href="http://www.palm.com">www.palm.com</a>).</font></li>
+</ul>
+<h2><small><font face="Helvetica, Arial, sans-serif"><a name="Installing_"></a>Using Mozilla Address Book Palm Sync</font></small></h2>
+<font face="Helvetica, Arial, sans-serif">Before using Mozilla Address
+Book Palm Sync, make sure your Palm device contains the latest address
+book data. If </font><font face="Helvetica, Arial, sans-serif">you have
+updated  or entered new address book data in your Palm Desktop
+software, you should  first perform a HotSync to update your Palm
+device's address books with the latest data. This will insure that your
+latest Palm address book data will be synchronized with your Mozilla
+address books.</font><br>
+<font face="Helvetica, Arial, sans-serif"> <br>
+The Mozilla Address Book Palm Sync installer utility lets your Palm
+device synchronize directly with your Mozilla address books by
+replacing the Palm  Desktop Address Book Sync with Mozilla Address Book
+Sync. <br>
+<br>
+To start using Mozilla Address Book Palm Sync:<br>
+</font>
+<ol>
+  <li><font face="Helvetica, Arial, sans-serif">Start Mozilla Address
+Book Palm Sync:<br>
+    </font> </li>
+  <ol>
+    <li><font face="Helvetica, Arial, sans-serif">Open the Windows
+Start menu.</font></li>
+    <li><font face="Helvetica, Arial, sans-serif">Choose Programs.</font></li>
+    <li><font face="Helvetica, Arial, sans-serif">From the Programs
+menu, choose Mozilla.<br>
+</font></li>
+    <li><font face="Helvetica, Arial, sans-serif">From the Mozilla
+menu, choose Palm Tools.</font></li>
+    <li><font face="Helvetica, Arial, sans-serif">From the Palm Tools
+menu, choose Address Book Palm Sync Install.</font></li>
+  </ol>
+</ol>
+<div style="margin-left: 40px;"><span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Note</span><span style="font-family: helvetica,arial,sans-serif;">: If Mozilla is
+already running, it uses the address books in the current user profile
+for synchronization. If Mozilla is not running, it starts and displays
+the Profile Manager (if you have more than one profile) so that you can
+choose the profile to use for synchronization.</span><br>
+</div>
+<ol style="list-style-type: decimal;" start="2">
+  <li type="1"><font face="Helvetica, Arial, sans-serif">Press the
+HotSync button on your Palm device to start synchronizing.</font></li>
+</ol>
+<span style="font-weight: bold; font-family: arial;">Note</span><span style="font-family: arial;">: To install Mozilla Address Book Palm
+Sync from the command line, change to the directory where you installed Mozilla and enter the command <span style="font-style: italic;">PalmSyncInstall.exe</span>.</span><font face="Helvetica, Arial, sans-serif"><br>
+</font><span style="font-family: arial;"></span>
+<h2><small><font face="Helvetica, Arial, sans-serif"><a name="Synchronizing_"></a>Synchronizing With Your  Palm Device</font></small></h2>
+<font face="Helvetica, Arial, sans-serif">After you synchronize with
+your Palm device, your Palm address book will contain all the records in
+your Mozilla address books. Each Mozilla address book is listed as a
+category in your Palm address book. Your Mozilla address book will
+contain a new address book for each category in your Palm address book.
+For more information, see <a href="#Field_">Field Mapping</a>.<br>
+<br>
+</font><b><font face="Helvetica, Arial, sans-serif">Synchronizing With
+Another Mozilla User Profile</font></b><br>
+<font face="Helvetica, Arial, sans-serif">To synchronize your Palm
+device with a different Mozilla user profile, you must first quit
+Mozilla. Start Mozilla again, and choose the user profile you want to
+synchronize with.&nbsp; Press the HotSync button on your Palm device to
+synchronize.<br>
+<br>
+<span style="font-weight: bold;">Synchronizing With Another Program</span><br>
+If you want to synchronize with another program, you must first <a href="#Uninstalling_">uninstall </a>Mozilla Address Book Palm Sync.<br>
+<br>
+<span style="font-weight: bold;">Verifying that Netcape Address Book
+Palm Sync Is Installed</span><br>
+</font><font face="Helvetica, Arial, sans-serif">To verify that you
+have established a HotSync connection with Mozilla, right-click the
+HotSync Manager icon in the system tray, and choose Custom. The Custom
+dialog box should display "Mozilla Address Book" in the Conduit list. </font><br>
+<h3><small><font face="Helvetica, Arial, sans-serif"><small>Synchronization
+Guidelines</small></font></small></h3>
+<font face="Helvetica, Arial, sans-serif"><small><b>Maximum number of
+address books</b></small><br>
+</font><font face="Helvetica, Arial, sans-serif">A maximum of 15
+address books can be synchronized.<br>
+</font>
+<ul>
+  <li><font face="Helvetica, Arial, sans-serif">Mozilla Address Book
+Palm Sync can synchronize only the first 15 address books due to the
+Palm device's limit of 15 categories. Before you synchronize, make sure
+that the total number of categories plus the total number of Mozilla
+address books does not exceed 15. Palm categories that have the same
+name as a Mozilla address book will be merged when you synchronize, so
+they should only be counted once.</font></li>
+  <li><font face="Helvetica, Arial, sans-serif">If your Palm address
+book already contains 15 categories, you can either remove some
+categories before you synchronize or make sure that your Mozilla
+address books are named the same as the Palm categories, so that they
+will get merged when you synchronize.</font></li>
+</ul>
+<font face="Helvetica, Arial, sans-serif"><small><b>Mozilla address
+book fields</b></small><br>
+Mozilla address book fields, with the exception of the Notes and
+Address fields, cannot contain multiple lines. When you synchronize,
+field values in your Palm address book will be converted to single line
+entries in your Mozilla address book, with each line separated by a
+comma.</font><br>
+<font face="Helvetica, Arial, sans-serif"><br>
+<br>
+<small style="font-weight: bold;">Palm Categories and Mozilla Address
+Books</small><br>
+On your Palm device, address records are stored in categories. In
+Mozilla, address records are stored in address books. Mozilla Address
+Book Sync matches Palm categories and Mozilla address books. After a
+successful synchronization, each Palm device category will have a
+corresponding Mozilla address book. <br>
+<br> Palm category names are limited to 15 characters, so if you have a
+Mozilla address book name that is longer than 15 characters, its
+corresponding category name will be truncated on the Palm device.<br>
+</font> <br>
+<h3><small><font face="Helvetica, Arial, sans-serif"><a name="Uninstalling_"></a>Uninstalling Mozilla Address Book Palm Sync</font></small></h3>
+<span style="font-family: helvetica,arial,sans-serif;">You only need to
+uninstall Mozilla Address Book Palm Sync if you want to synchronize
+your Palm Device with a different program. If you only plan to
+synchronize with Mozilla, you don't need to uninstall Address Book Palm
+Sync.</span><br>
+<br>
+<font face="Helvetica, Arial, sans-serif"><b>Note</b>: Before
+uninstalling Mozilla Address Book Palm Sync, make sure your Palm device
+contains the latest address book data. If </font><font face="Helvetica, Arial, sans-serif">you have updated  or entered new
+address book data in your Mozilla address book, you should  perform
+another HotSync to update your Palm device's address books with the
+latest data. This will insure that your Palm address book contains the
+latest data from your Mozilla address books before you uninstall Mozilla Address Book Palm Sync.</font><br>
+<br>
+<font face="Helvetica, Arial, sans-serif">To uninstall Mozilla Address
+Book Palm Sync:<br>
+</font>
+<ol>
+  <li><font face="Helvetica, Arial, sans-serif">Start the Mozilla
+Address Book Palm Sync uninstaller:<br>
+    </font> </li>
+  <ol>
+    <li><font face="Helvetica, Arial, sans-serif">Open the Windows
+Start menu.</font></li>
+    <li><font face="Helvetica, Arial, sans-serif">Choose Programs.</font></li>
+    <li><font face="Helvetica, Arial, sans-serif">From the Programs
+menu, choose Mozilla.<br>
+</font></li>
+    <li><font face="Helvetica, Arial, sans-serif">From the Mozilla
+menu, choose Palm Tools.</font></li>
+    <li><font face="Helvetica, Arial, sans-serif">From the Palm Tools
+menu, choose Address Book Palm Sync Uninstall.</font></li>
+  </ol>
+</ol>
+<span style="font-weight: bold; font-family: arial;">Note</span><span style="font-family: arial;">: To uninstall Mozilla Address Book Palm
+Sync from the command line, change to the directory where you installed Mozilla and enter the command <span style="font-style: italic;">PalmSyncInstall.exe
+/u</span>.</span><br>
+<font face="Helvetica, Arial, sans-serif"><br>
+You have successfully uninstalled Mozilla Address Book Palm Sync. The </font><font face="Helvetica, Arial, sans-serif">Palm Desktop Address Book Sync is
+now enabled. You can synchronize your Palm device with your Mozilla
+address book again at any time by following the instructions under </font><font face="Helvetica, Arial, sans-serif"><a href="http://jazz/users/robinf/private/Buffy_Help/palm.html#Installing_">Installing Mozilla Address Book Palm Sync</a></font>. <br>
+<br>
+<h2><small><font face="Helvetica, Arial, sans-serif"> </font></small></h2>
+<hr width="100%" size="2">
+<h1><small><span style="font-family: helvetica,arial,sans-serif;"><a name="Troubleshooting"></a>Troubleshooting</span></small></h1>
+<h1><small><span style="font-family: helvetica,arial,sans-serif;"> </span></small></h1>
+<h2><small><font face="Helvetica, Arial, sans-serif"><a name="HotSync_"></a>HotSync
+Problems</font></small></h2>
+<span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Problem:</span><span style="font-family: helvetica,arial,sans-serif;">I cannot get my Palm
+organizer to HotSync with my Mozilla address book.<br>
+</span><span style="font-weight: bold; font-family: helvetica,arial,sans-serif;"><br>
+Possible Solutions:<br style="font-family: helvetica,arial,sans-serif;">
+</span>
+<ul style="font-family: helvetica,arial,sans-serif;">
+  <li>Make sure that you installed the HotSync Manager software, and
+that the HotSync Manager icon appears in your system tray.</li>
+  <li>Make sure that you started the Mozilla Address Book Palm Sync
+Install utility.</li>
+  <li>Close all HotSync windows on your PC.</li>
+  <li>Verify that your Palm device is securely placed in its cradle.</li>
+  <li>Make sure that no other programs are using the same serial port
+as the HotSync manager. To verify your serial port settings, click the
+HotSync Manager icon in the system tray and choose Setup.</li>
+  <li>Close the HotSync Manager and then open it again.<br>
+  </li>
+</ul>
+<span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Problem:</span><span style="font-family: helvetica,arial,sans-serif;"> The HotSync Manager
+keeps timing out.</span><br style="font-family: helvetica,arial,sans-serif;">
+<br style="font-family: helvetica,arial,sans-serif;">
+<span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Possible
+Solution:</span><br style="font-family: helvetica,arial,sans-serif;">
+<ul style="font-family: helvetica,arial,sans-serif;">
+  <li>The time out interval for HotSync Manager is one minute. If
+HotSync times out while waiting for Mozilla to launch, make sure
+that you start Mozilla before starting synchronization.</li>
+</ul>
+<span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Problem:</span><span style="font-family: helvetica,arial,sans-serif;"> The HotSync process
+takes a long time.</span><br style="font-family: helvetica,arial,sans-serif;">
+<br style="font-family: helvetica,arial,sans-serif;">
+<span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Possible
+Solutions: </span><span style="font-family: helvetica,arial,sans-serif;">You can reduce the
+time it takes to synchronize by doing the following:</span><br style="font-family: helvetica,arial,sans-serif;">
+<ul>
+  <li style="font-family: helvetica,arial,sans-serif;">Please note that
+depending on the number of address book records and the speed of your
+PC, the first time you synchronize may take a while. Subsequent
+synchronizations will be faster.</li>
+  <li><span style="font-family: helvetica,arial,sans-serif;">Set unused
+applications to Do Nothing in the HotSync Manager Custom menu.</span><br>
+  </li>
+</ul>
+<h2><small><font face="Helvetica, Arial, sans-serif"><a name="Record_"></a>Record
+Problems</font></small></h2>
+<span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Problem:</span><span style="font-family: helvetica,arial,sans-serif;"> Some Mozilla records
+do not appear in the Palm device after synchronizing.<br>
+<br style="font-family: helvetica,arial,sans-serif;">
+</span> <span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Possible
+Solution: </span><span style="font-family: helvetica,arial,sans-serif;"><br>
+</span>
+<ul style="font-family: helvetica,arial,sans-serif;">
+  <li>Only the first 15 address books are synchronized. Make sure the
+records are in an address book that actually got synchronized.</li>
+</ul>
+<span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Problem:</span><span style="font-family: helvetica,arial,sans-serif;"> Some records appear
+duplicated.<br>
+<br>
+</span> <span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Possible
+Solution: </span><span style="font-family: helvetica,arial,sans-serif;"><br>
+</span>
+<ul style="font-family: helvetica,arial,sans-serif;">
+  <li>Delete the unwanted records either from your Palm device or from
+your Mozilla address book.</li>
+  <li>If a HotSync terminates unexpectedly (due to a power loss, for
+example), it is possible that the next time you perform a HotSync, some
+records will be duplicated.<br>
+  </li>
+</ul>
+<span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Problem:</span><span style="font-family: helvetica,arial,sans-serif;"> Changes I made to a
+record on my Palm device were not transferred to my Mozilla address
+book.</span><br style="font-family: helvetica,arial,sans-serif;">
+<br style="font-family: helvetica,arial,sans-serif;">
+<span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Possible
+Solution: <br>
+</span>
+<ul style="font-family: helvetica,arial,sans-serif;">
+  <li>Make sure that the field that changed is supported. See <a href="#Field_Mapping">Field Mapping</a>.</li>
+</ul>
+<span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Problem:</span><span style="font-family: helvetica,arial,sans-serif;"> Some Palm device
+fields appear in a different order after synchronizing.</span><br style="font-family: helvetica,arial,sans-serif;">
+<br style="font-family: helvetica,arial,sans-serif;">
+<span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Possible
+Solution: </span><span style="font-family: helvetica,arial,sans-serif;"><br>
+<br>
+On the Palm device, there are five phone fields. When you synchronize,
+the order of these fields is reset according to the current field
+mapping. <br>
+<br>
+</span><span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Problem:</span><span style="font-family: helvetica,arial,sans-serif;"> Fields that contain
+multiple lines get changed when I synchronize.<br>
+<br style="font-family: helvetica,arial,sans-serif;">
+</span> <span style="font-weight: bold; font-family: helvetica,arial,sans-serif;">Possible
+Solution: </span><span style="font-family: helvetica,arial,sans-serif;"><br>
+</span>
+<ul>
+  <li><span style="font-family: helvetica,arial,sans-serif;">Unlike
+fields on the Palm device, all Mozilla fields, with the exception of
+the Notes and Address fields, cannot consist of multiple lines. When
+synchronizing, field values on the Palm device that contain multiple
+lines will be changed to single line entries, with each line separated
+by a comma.<br>
+    </span></li>
+</ul>
+<span style="font-family: helvetica,arial,sans-serif;"><br>
+</span>
+<hr width="100%" size="2"><small><br style="font-family: helvetica,arial,sans-serif;">
+</small>
+<h1><a name="Field_Mapping"></a><small><span style="font-family: helvetica,arial,sans-serif;"><a name="Field_"></a>Field
+Mapping</span></small></h1>
+<div class="Body" style="font-family: helvetica,arial,sans-serif;">This
+section describes the conversions that occur when transferring data
+between Mozilla address book(s) and your Palm device's address book.
+Apart from the special conversion rules that apply to specific fields,
+some general rules apply:</div>
+<ul style="font-family: helvetica,arial,sans-serif;">
+  <li> Text fields are truncated to the maximum allowed length on the
+destination platform.</li>
+  <li> Text fields that can contain multiple lines on the Palm device
+but not in Mozilla will be changed to single line entries with each
+line separated by a comma.<br>
+  </li>
+  <li> Fields that are available in Mozilla but not on the Palm device
+and vice versa will not be modified during synchronization.</li>
+</ul>
+<div class="Heading1" style="font-family: helvetica,arial,sans-serif;"><a name="Categories"></a><b><font size="+1">Categories and Address Books<br>
+<br>
+</font></b></div>
+<div class="Body" style="font-family: helvetica,arial,sans-serif;">The
+following table describes what happens to categories and address books
+during synchronization.<br>
+<br>
+</div>
+<table border="1" cellspacing="0" cellpadding="3" style="font-family: helvetica,arial,sans-serif;">
+  <tbody>
+    <tr>
+      <th>
+      <div class="CellHeading">Mozilla Address Book action</div>
+      </th>
+      <th>
+      <div class="CellHeading">Palm category action</div>
+      </th>
+      <th>
+      <div class="CellHeading">Synchronization</div>
+      </th>
+    </tr>
+    <tr>
+      <td>
+      <div class="CellBody">New address book created</div>
+      </td>
+      <td>
+      <div class="CellBody">n/a</div>
+      </td>
+      <td>
+      <div class="CellBody">New Palm category created if there is an
+available category.&nbsp; The Palm device can only contain 15
+categories.&nbsp; If the maximum has been reached then this address book
+will not be synchronized.</div>
+      </td>
+    </tr>
+    <tr>
+      <td>
+      <div class="CellBody">Address book deleted</div>
+      </td>
+      <td>
+      <div class="CellBody">Category not changed, or&nbsp; <br>
+category deleted</div>
+      </td>
+      <td>
+      <div class="CellBody">All of the records from this address book
+will be deleted and if the category still exists it will be deleted as
+well.</div>
+      </td>
+    </tr>
+    <tr>
+      <td style="vertical-align: top;">Address book renamed<br>
+      </td>
+      <td style="vertical-align: top;">n/a<br>
+      </td>
+      <td style="vertical-align: top;">All
+of the records from this address book remain in the same category. The
+category is not renamed on the Palm device. However, after syncing, the
+Mozilla address book will be renamed to match the category name on the
+Palm device. Therefore, to rename a Mozilla address book, rename it on
+the Palm device and then sync.<br>
+      </td>
+    </tr>
+    <tr>
+      <td>
+      <div class="CellBody">n/a</div>
+      </td>
+      <td>
+      <div class="CellBody">New category created</div>
+      </td>
+      <td>
+      <div class="CellBody">A new address book with the same name as
+the category will be created in Mozilla.&nbsp; All new records filed in
+the category will be created in the new address book.</div>
+      </td>
+    </tr>
+    <tr>
+      <td>
+      <div class="CellBody">n/a</div>
+      </td>
+      <td>
+      <div class="CellBody">Category deleted</div>
+      </td>
+      <td>
+      <div class="CellBody">Records go to the Unfiled Mozilla address
+book.</div>
+      </td>
+    </tr>
+    <tr>
+      <td style="vertical-align: top;">n/a</td>
+      <td style="vertical-align: top;">Category renamed</td>
+      <td style="vertical-align: top;">The category will be renamed to
+match the address book it corresponds to. To rename a Mozilla address book, rename it on the Palm device and then sync.<br>
+</td>
+    </tr>
+    <tr>
+      <td style="vertical-align: top;">n/a<br>
+      </td>
+      <td style="vertical-align: top;">Records in "Unfiled" category<br>
+      </td>
+      <td style="vertical-align: top;">Records appear in the Unfiled Mozilla address book.<br>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<p style="font-family: helvetica,arial,sans-serif;"><a name="Fields"></a><b><font size="+1">Fields</font></b> </p>
+<div class="Body" style="font-family: helvetica,arial,sans-serif;">&nbsp;
+<table border="1" cellspacing="0" cellpadding="3">
+  <tbody>
+    <tr>
+      <th>
+      <div class="CellHeading">Mozilla field</div>
+      </th>
+      <th>
+      <div class="CellHeading">Palm field</div>
+      </th>
+      <th>
+      <div class="CellHeading">Notes</div>
+      </th>
+    </tr>
+    <tr>
+      <td>
+      <div class="CellBody">First name</div>
+      </td>
+      <td>
+      <div class="CellBody">First name</div>
+      </td>
+      <td>
+      <div class="CellBody">&nbsp;</div>
+      </td>
+    </tr>
+    <tr>
+      <td>
+      <div class="CellBody">Last name</div>
+      </td>
+      <td>
+      <div class="CellBody">Last name</div>
+      </td>
+      <td>
+      <div class="CellBody">&nbsp;</div>
+      </td>
+    </tr>
+    <tr>
+      <td>
+      <div class="CellBody">Display name</div>
+      </td>
+      <td>
+      <div class="CellBody">&nbsp;</div>
+      </td>
+      <td>
+      <div class="CellBody">There is no Palm field for Display
+name.&nbsp; The Palm can be configured to list records by Last name,
+First name or Company, Last name&nbsp;</div>
+      </td>
+    </tr>
+    <tr>
+      <td>
+      <div class="CellBody">Email Address</div>
+      </td>
+      <td>
+      <div class="CellBody">E-mail</div>
+      </td>
+      <td>
+      <div class="CellBody">&nbsp;</div>
+      </td>
+    </tr>
+    <tr>
+      <td>
+      <div class="CellBody">Nickname</div>
+      </td>
+      <td>
+      <div class="CellBody">&nbsp;</div>
+      </td>
+      <td>
+      <div class="CellBody">Not synchronized</div>
+      </td>
+    </tr>
+    <tr>
+      <td>
+      <div class="CellBody">Title</div>
+      </td>
+      <td>
+      <div class="CellBody">Title</div>
+      </td>
+      <td>
+      <div class="CellBody">&nbsp;</div>
+      </td>
+    </tr>
+    <tr>
+      <td>
+      <div class="CellBody">Organization</div>
+      </td>
+      <td>
+      <div class="CellBody">Company</div>
+      </td>
+      <td>
+      <div class="CellBody">&nbsp;</div>
+      </td>
+    </tr>
+    <tr>
+      <td>Department</td>
+      <td><br>
+      </td>
+      <td>There is no corresponding Palm field for Department.&nbsp;</td>
+    </tr>
+    <tr>
+      <td>Notes</td>
+      <td>Note</td>
+      <td>Multiple lines are allowed in this field.</td>
+    </tr>
+    <tr>
+      <td>Address</td>
+      <td>Address</td>
+      <td>Multiple lines are allowed in this field.</td>
+    </tr>
+    <tr>
+      <td>City</td>
+      <td>City</td>
+      <td><br>
+      </td>
+    </tr>
+    <tr>
+      <td>State</td>
+      <td>State</td>
+      <td><br>
+      </td>
+    </tr>
+    <tr>
+      <td>Zip</td>
+      <td>Zip Code</td>
+      <td><br>
+      </td>
+    </tr>
+    <tr>
+      <td>Country</td>
+      <td>Country</td>
+      <td><br>
+      </td>
+    </tr>
+    <tr>
+      <td>Work phone</td>
+      <td>Work</td>
+      <td><br>
+      </td>
+    </tr>
+    <tr>
+      <td>Home phone</td>
+      <td>Home</td>
+      <td><br>
+      </td>
+    </tr>
+    <tr>
+      <td>Fax</td>
+      <td>Fax</td>
+      <td><br>
+      </td>
+    </tr>
+    <tr>
+      <td>Pager</td>
+      <td><br>
+      </td>
+      <td>Only 5 phone fields are available on the Palm.&nbsp; Work,
+Home, Fax, Email, and Mobile are synchronized.</td>
+    </tr>
+    <tr>
+      <td>Cellular</td>
+      <td>Mobile</td>
+      <td><br>
+      </td>
+    </tr>
+    <tr>
+      <td>Prefers to receive rich text (HTML) mail</td>
+      <td><br>
+      </td>
+      <td>Not synchronized.</td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<br style="font-family: helvetica,arial,sans-serif;">
+<hr style="width: 100%; height: 2px;"><span style="font-style: italic; font-family: arial;">12 May 2003</span><br style="font-family: arial;">
+<br style="font-family: arial;">
+<span style="font-family: arial;">Copyright&COPY;&nbsp; 1994-2003 The Mozilla Organization.</span><br style="font-family: helvetica,arial,sans-serif;">
+<br style="font-family: helvetica,arial,sans-serif;">
+<br style="font-family: helvetica,arial,sans-serif;">
+<br>
+<br>
 </body></html>
\ No newline at end of file
--- mozilla-firefox-1.0.4.orig/mailnews/imap/src/nsImapMailFolder.cpp
+++ mozilla-firefox-1.0.4/mailnews/imap/src/nsImapMailFolder.cpp
@@ -3717,6 +3717,7 @@
       if (!parentFolder || !canFileMessages)
       {
         filter->SetEnabled(PR_FALSE);
+        m_filterList->SaveToDefaultFile();
         destIFolder->ThrowAlertMsg("filterDisabled",msgWindow);
         return NS_MSG_NOT_A_MAIL_FOLDER;
       }
--- mozilla-firefox-1.0.4.orig/mailnews/local/src/nsParseMailbox.cpp
+++ mozilla-firefox-1.0.4/mailnews/local/src/nsParseMailbox.cpp
@@ -1690,9 +1690,10 @@
           else
           {
             err = MoveIncorporatedMessage(msgHdr, m_mailDB, destIFolder, filter, msgWindow);
+            m_msgMovedByFilter = NS_SUCCEEDED(err);
             // cleanup after mailHdr in source DB because we moved the message.
-            m_mailDB->RemoveHeaderMdbRow(msgHdr);
-            m_msgMovedByFilter = PR_TRUE;
+            if (m_msgMovedByFilter)
+              m_mailDB->RemoveHeaderMdbRow(msgHdr);
           }
           if (NS_SUCCEEDED(err))
           {
@@ -1894,6 +1895,9 @@
   if (!parentFolder || !canFileMessages)
   {
     filter->SetEnabled(PR_FALSE);
+    // we need to explicitly save the filter file.
+    if (m_filterList)
+      m_filterList->SaveToDefaultFile();
     destIFolder->ThrowAlertMsg("filterDisabled", msgWindow);
     return NS_MSG_NOT_A_MAIL_FOLDER;
   }
--- mozilla-firefox-1.0.4.orig/debian/inspector/00dom-inspector
+++ mozilla-firefox-1.0.4/debian/inspector/00dom-inspector
@@ -0,0 +1 @@
+extension,{641d8d09-7dda-4850-8228-ac0ab65e2ac9}
--- mozilla-firefox-1.0.4.orig/debian/inspector/install.rdf
+++ mozilla-firefox-1.0.4/debian/inspector/install.rdf
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+     xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+
+  <Description about="urn:mozilla:install-manifest">
+    <em:id>{641d8d09-7dda-4850-8228-ac0ab65e2ac9}</em:id>
+    <em:version>1.0</em:version>
+    
+    <!-- Target Application this extension can install into, 
+        with minimum and maximum supported versions. --> 
+    <em:targetApplication>
+      <Description>
+        <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+        <em:minVersion>1.0</em:minVersion>
+        <em:maxVersion>1.0</em:maxVersion>
+      </Description>
+    </em:targetApplication>
+    
+    <!-- Front End MetaData -->
+    <em:name>DOM Inspector</em:name>
+    <em:description>A powerful tool for viewing and manipulating documents.</em:description>
+    <em:creator>Joe Hewitt</em:creator>
+    
+    <!-- Packages, Skins and Locales that this extension registers -->
+    <em:file>
+      <Description about="urn:mozilla:extension:file:inspector.jar">
+        <em:package>content/inspector/</em:package>
+	<em:locale>locale/en-US/inspector/</em:locale>
+	<em:skin>skin/classic/inspector/</em:skin>
+	<em:skin>skin/modern/inspector/</em:skin>
+      </Description>
+    </em:file>
+  </Description>      
+  
+</RDF>
--- mozilla-firefox-1.0.4.orig/debian/inspector/Uninstall
+++ mozilla-firefox-1.0.4/debian/inspector/Uninstall
@@ -0,0 +1,4 @@
+register	global	package	inspector
+register	global	skin	classic/1.0
+register	global	skin	modern/1.0
+register	global	locale	en-US
--- mozilla-firefox-1.0.4.orig/debian/control
+++ mozilla-firefox-1.0.4/debian/control
@@ -0,0 +1,35 @@
+Source: mozilla-firefox
+Section: web
+Priority: optional
+Maintainer: Eric Dorland <eric@debian.org>
+Uploaders: Mike Hommey <glandium@debian.org>
+Build-Depends: debhelper (>= 4.0), libx11-dev, libxp-dev, libxt-dev, libgtk2.0-dev, zlib1g-dev, liborbit2-dev, libidl-dev (>= 0.8.0), zip, libxft-dev, libpng12-dev, libmng-dev, libjpeg62-dev, libxrender-dev, libkrb5-dev, libgnome2-dev, libgconf2-dev, libgnomevfs2-dev, patch, sharutils, m4, gcc-3.4 [amd64], g++-3.4 [amd64]
+Standards-Version: 3.6.1
+
+Package: mozilla-firefox
+Architecture: any
+Depends: fontconfig, psmisc, debianutils (>= 1.16), ${shlibs:Depends}
+Suggests: mozilla-firefox-gnome-support (= ${Source-Version}), latex-xft-fonts, xprint
+Provides: www-browser
+Description: lightweight web browser based on Mozilla
+ Firefox is a redesign of the Mozilla browser component, similar to
+ Galeon, K-Meleon and Camino, but written using the XUL user interface
+ language and designed to be lightweight and cross-platform.
+ .
+ This browser was previously known as Firebird and Phoenix.
+
+Package: mozilla-firefox-dom-inspector
+Architecture: any
+Depends: ${shlibs:Depends}, mozilla-firefox (= ${Source-Version})
+Description: tool for inspecting the DOM of pages in Mozilla Firefox
+ This is a tool that allows you to inspect the DOM for web pages in
+ Mozilla Firefox.  This is of great use to people who are doing
+ Mozilla chrome development or web page development.
+
+Package: mozilla-firefox-gnome-support
+Architecture: any
+Depends: ${shlibs:Depends}, mozilla-firefox (= ${Source-Version})
+Description: Support for Gnome in Mozilla Firefox
+ This is an extension to Mozilla Firefox that allows it to use
+ protocol handlers from Gnome-VFS, such as smb or sftp, and other
+ Gnome integration features.
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox.menu
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox.menu
@@ -0,0 +1,4 @@
+?package(mozilla-firefox):needs="x11" section="Apps/Net" \
+        title="Mozilla Firefox" \
+	icon="/usr/share/pixmaps/mozilla-firefox.xpm" \
+	command="firefox" hints="Web Browsers"
--- mozilla-firefox-1.0.4.orig/debian/debsearch.src
+++ mozilla-firefox-1.0.4/debian/debsearch.src
@@ -0,0 +1,26 @@
+# Mozilla Firebird plugin file
+#
+# Debian package lookup
+# by Fergus McKenzie-Kay copying code 
+# by Spencer Wysinger <http://wysinger.com/>
+#
+# Last updated: August 12, 2003
+
+<search 
+	name="Deb Search"
+	description="Perform a search for Debian packages"
+	action="http://packages.debian.org/cgi-bin/search_packages.pl"
+	searchForm="http://packages.debian.org/"
+	queryEncoding="utf-8"
+	queryCharset="utf-8"
+	method="GET"
+>
+
+<input name="searchon" value="names">
+<input name="subword" value="1">
+<input name="version" value="all">
+<input name="release" value="all">
+<input name="keywords" user="">
+<input name="sourceid" value="mozilla-search">
+
+</search>
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox-gnome-support.install
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox-gnome-support.install
@@ -0,0 +1 @@
+debian/tmp/usr/lib/mozilla-firefox/components/*gnome* usr/lib/mozilla-firefox/components
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox.preinst
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox.preinst
@@ -0,0 +1,60 @@
+#!/bin/sh -e
+
+LIBDIR=/usr/lib/mozilla-firefox
+VARDIR=/var/lib/mozilla-firefox
+
+if [ "$1" = "upgrade" ]; then
+    if [ -d "/usr/lib/mozilla-firebird/defaults/pref" ]; then
+        rm -rf /usr/lib/mozilla-firebird/defaults/pref
+    fi
+
+    # Remove old alternative to www-browser that version < 0.6.1-1 installed
+    if dpkg --compare-versions "$2" lt 0.6.1-1; then
+      update-alternatives --remove www-browser /usr/bin/MozillaFirebird || true
+    fi
+
+    # Remove old conf files 
+    if dpkg --compare-versions "$2" lt 0.9.1-3; then
+      rm -f /etc/mozilla-firefox/pref/all.js
+      rm -f /etc/mozilla-firefox/pref/security-prefs.js
+      rm -f /etc/mozilla-firefox/pref/unix.js
+      rm -f /etc/mozilla-firefox/pref/xpinstall.js
+      rm -f /etc/mozilla-firefox/pref/non-shared.txt
+    fi
+
+    if dpkg --compare-versions "$2" lt 0.10.1+1.0PR-5; then
+      if [ -f /etc/mozilla-firefox/profile/US/bookmarks.html ]; then
+        mv /etc/mozilla-firefox/profile/US/bookmarks.html /etc/mozilla-firefox/profile/bookmarks.html
+      fi
+      [ -d /etc/mozilla-firefox/profile/US ] && rmdir --ignore-fail-on-non-empty /etc/mozilla-firefox/profile/US
+    fi
+
+    if dpkg --compare-versions "$2" lt 1.0-1; then
+      rm -f /etc/mozilla-firefox/pref/firefox-l10n.js
+      rm -f /etc/mozilla-firefox/pref/vendor.js
+
+      # Remove old link
+      rm -f ${LIBDIR}/defaults/pref
+
+      # Remove old installed-chrome.txt
+      rm -f ${VARDIR}/chrome/installed-chrome.txt
+    fi
+
+    if dpkg --compare-versions "$2" lt 1.0-3; then
+      for f in `find ${LIBDIR}/extensions/ -maxdepth 1 -name '{*}' -type l`; do
+        if [ "`readlink -f $f`" = "${LIBDIR}/defaults/profile/extensions/`basename $f`" ]; then
+            rm -f $f
+        fi
+      done
+      if [ -e ${LIBDIR}/defaults/profile/extensions/installed-extensions.txt ] || [ -L ${LIBDIR}/defaults/profile/extensions/installed-extensions.txt ]; then
+        rm -f ${LIBDIR}/defaults/profile/extensions/installed-extensions.txt
+      fi
+    fi
+
+    # Move of default profile into /etc
+    if dpkg --compare-versions "$2" lt 1.0+dfsg.1-1; then
+        rm -rf /usr/lib/mozilla-firefox/defaults/profile
+    fi
+fi
+
+#DEBHELPER#
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox-dom-inspector.install
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox-dom-inspector.install
@@ -0,0 +1,9 @@
+debian/tmp/usr/lib/mozilla-firefox/components/libinspector.so usr/lib/mozilla-firefox/extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/components
+debian/tmp/usr/lib/mozilla-firefox/components/inspector.xpt usr/lib/mozilla-firefox/extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/components
+debian/tmp/usr/lib/mozilla-firefox/chrome/inspector.jar usr/lib/mozilla-firefox/extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/chrome
+debian/tmp/usr/lib/mozilla-firefox/res/inspector/viewer-registry.rdf usr/lib/mozilla-firefox/res/inspector
+debian/tmp/usr/lib/mozilla-firefox/res/inspector/search-registry.rdf usr/lib/mozilla-firefox/res/inspector
+debian/inspector/install.rdf usr/lib/mozilla-firefox/extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}
+debian/inspector/Uninstall usr/lib/mozilla-firefox/extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/uninstall
+debian/inspector/00dom-inspector var/lib/mozilla-firefox/extensions.d
+debian/tmp/usr/lib/mozilla-firefox/defaults/pref/inspector.js usr/lib/mozilla-firefox/extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/defaults/preferences
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox-xremote-client
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox-xremote-client
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+##
+## Set MOZILLA_FIVE_HOME
+##
+MOZILLA_FIVE_HOME="/usr/lib/mozilla-firefox"
+
+export MOZILLA_FIVE_HOME
+
+##
+## Set LD_LIBRARY_PATH
+##
+if [ "$LD_LIBRARY_PATH" ]
+then
+  LD_LIBRARY_PATH=/usr/lib/mozilla-firefox:/usr/lib/mozilla-firefox/plugins:/usr/lib/mozilla/plugins:/usr/lib:$LD_LIBRARY_PATH
+else
+  LD_LIBRARY_PATH=/usr/lib/mozilla-firefox:/usr/lib/mozilla-firefox/plugins:/usr/lib/mozilla/plugins:/usr/lib
+fi
+ export LD_LIBRARY_PATH
+
+/usr/lib/mozilla-firefox/firefox-bin -a firefox -remote "$1"
--- mozilla-firefox-1.0.4.orig/debian/changelog
+++ mozilla-firefox-1.0.4/debian/changelog
@@ -0,0 +1,1933 @@
+mozilla-firefox (1.0.4-2sarge4) stable-security; urgency=critical
+
+  * netwerk/base/src/nsStandardURL.cpp: Patch from bz#307259 to fix
+    CAN-2005-2871, a buffer overflow vulnerability in IDN
+    processing. (Closes: #327452)
+
+ -- Eric Dorland <eric@debian.org>  Tue, 13 Sep 2005 23:09:49 -0400
+
+mozilla-firefox (1.0.4-2sarge3) stable-security; urgency=critical
+
+  * Revert completely the last release's changes, they were duds.
+  * Apply the changes from 1.0.4 to 1.0.6, which should almost all be
+    security related.
+  * browser/app/module.ver, browser/config/version.txt,
+    browser/installer/unix/installer.cfg,
+    browser/installer/windows/installer.cfg: Change version number from
+    1.0.6 to 1.0.4, as a bit of a cheat.
+
+ -- Eric Dorland <eric@debian.org>  Thu, 25 Aug 2005 01:24:25 -0400
+
+mozilla-firefox (1.0.4-2sarge2) stable-security; urgency=critical
+
+  * Fixes for various security vulnerabilities. (Closes: #318061)
+  * The previous (unreleased) version fixes MFSA2005-51: "The return of
+    frame-injection spoofing" aka CAN-2005-1937, which is really just the
+    return of CAN-2004-0718.
+  * accessible/src/base/nsBaseWidgetAccessible.cpp,
+    content/base/public/nsContentUtils.h,
+    content/base/src/nsContentUtils.cpp, content/base/src/nsDocument.cpp,
+    content/base/src/nsDocument.h, content/base/src/nsDocumentViewer.cpp,
+    content/base/src/nsGenericDOMDataNode.cpp,
+    content/base/src/nsGenericElement.cpp,
+    content/base/src/nsGenericElement.h,
+    content/base/src/nsImageLoadingContent.cpp,
+    content/base/src/nsSelection.cpp,
+    content/events/public/nsIEventListenerManager.h,
+    content/events/public/nsIPrivateDOMEvent.h,
+    content/events/public/nsMutationEvent.h,
+    content/events/src/nsDOMEvent.cpp,
+    content/events/src/nsEventListenerManager.cpp,
+    content/events/src/nsEventListenerManager.h,
+    content/events/src/nsEventStateManager.cpp,
+    content/html/content/src/nsGenericHTMLElement.cpp,
+    content/html/content/src/nsHTMLButtonElement.cpp,
+    content/html/content/src/nsHTMLFormElement.cpp,
+    content/html/content/src/nsHTMLInputElement.cpp,
+    content/html/content/src/nsHTMLScriptElement.cpp,
+    content/html/content/src/nsHTMLSelectElement.cpp,
+    content/html/content/src/nsHTMLTextAreaElement.cpp,
+    content/svg/content/src/nsSVGElement.cpp,
+    content/xbl/src/nsXBLBinding.cpp, content/xbl/src/nsXBLBinding.h,
+    content/xbl/src/nsXBLPrototypeHandler.cpp,
+    content/xml/content/src/nsXMLElement.cpp,
+    content/xml/document/src/nsXMLDocument.cpp,
+    content/xul/content/src/nsXULElement.cpp,
+    content/xul/document/src/nsXULCommandDispatcher.cpp,
+    content/xul/document/src/nsXULDocument.cpp,
+    dom/public/idl/events/Makefile.in, dom/src/base/nsDOMClassInfo.cpp,
+    dom/src/base/nsDOMClassInfo.h, dom/src/base/nsGlobalWindow.cpp,
+    dom/src/base/nsGlobalWindow.h, dom/src/base/nsJSEnvironment.cpp,
+    dom/src/base/nsWindowRoot.cpp, dom/src/base/nsWindowRoot.h,
+    extensions/xmlextras/base/src/nsXMLHttpRequest.cpp,
+    layout/html/base/src/nsGfxScrollFrame.cpp,
+    layout/html/base/src/nsObjectFrame.cpp,
+    layout/html/base/src/nsPresShell.cpp,
+    layout/html/forms/public/nsIFormControlFrame.h,
+    layout/html/forms/src/nsComboboxControlFrame.cpp,
+    layout/html/forms/src/nsComboboxControlFrame.h,
+    layout/html/forms/src/nsFileControlFrame.h,
+    layout/html/forms/src/nsFormControlFrame.cpp,
+    layout/html/forms/src/nsFormControlFrame.h,
+    layout/html/forms/src/nsGfxButtonControlFrame.cpp,
+    layout/html/forms/src/nsHTMLButtonControlFrame.cpp,
+    layout/html/forms/src/nsHTMLButtonControlFrame.h,
+    layout/html/forms/src/nsImageControlFrame.cpp,
+    layout/html/forms/src/nsListControlFrame.cpp,
+    layout/html/forms/src/nsListControlFrame.h,
+    layout/html/forms/src/nsTextControlFrame.cpp,
+    layout/html/forms/src/nsTextControlFrame.h,
+    layout/xul/base/src/nsBoxFrame.cpp,
+    layout/xul/base/src/nsButtonBoxFrame.cpp,
+    layout/xul/base/src/nsButtonBoxFrame.h,
+    layout/xul/base/src/nsImageBoxFrame.cpp,
+    layout/xul/base/src/nsMenuFrame.cpp,
+    layout/xul/base/src/nsPopupSetFrame.cpp,
+    layout/xul/base/src/nsResizerFrame.cpp,
+    layout/xul/base/src/nsResizerFrame.h,
+    layout/xul/base/src/nsScrollBoxFrame.cpp,
+    layout/xul/base/src/nsScrollbarButtonFrame.cpp,
+    layout/xul/base/src/nsTitleBarFrame.cpp,
+    layout/xul/base/src/nsTitleBarFrame.h,
+    layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp,
+    layout/xul/base/src/tree/src/nsTreeSelection.cpp,
+    toolkit/components/satchel/src/nsFormFillController.cpp,
+    view/public/nsIViewObserver.h, view/src/nsViewManager.cpp,
+    webshell/public/nsILinkHandler.h, widget/public/nsEvent.h,
+    widget/public/nsGUIEvent.h, widget/public/nsIEventListener.h,
+    widget/public/nsIWidget.h, widget/src/beos/nsWindow.cpp,
+    widget/src/cocoa/nsChildView.mm, widget/src/cocoa/nsCocoaWindow.mm,
+    widget/src/cocoa/nsMenuBarX.cpp, widget/src/cocoa/nsMenuItemX.cpp,
+    widget/src/cocoa/nsMenuX.cpp, widget/src/gtk/nsGtkEventHandler.cpp,
+    widget/src/gtk/nsWidget.cpp, widget/src/gtk/nsWindow.cpp,
+    widget/src/gtk2/nsCommonWidget.cpp, widget/src/gtk2/nsWindow.cpp,
+    widget/src/mac/nsMacControl.cpp, widget/src/mac/nsMacEventHandler.cpp,
+    widget/src/mac/nsMacWindow.cpp, widget/src/mac/nsMenuBarX.cpp,
+    widget/src/mac/nsMenuX.cpp, widget/src/mac/nsWindow.cpp,
+    widget/src/os2/nsFrameWindow.cpp, widget/src/os2/nsWindow.cpp,
+    widget/src/photon/nsWidget.cpp, widget/src/photon/nsWidget.h,
+    widget/src/photon/nsWindow.cpp,
+    widget/src/windows/nsNativeDragTarget.cpp,
+    widget/src/windows/nsWindow.cpp, widget/src/xlib/nsAppShell.cpp,
+    widget/src/xlib/nsWidget.cpp, widget/src/xlib/nsWindow.cpp,
+    xpfe/appshell/src/nsWebShellWindow.cpp,
+    xpfe/appshell/src/nsXULWindow.cpp: Huge patch from bz#289940 to fix
+    MFSA2005-45: "Content-generated event vulnerabilities" aka
+    CAN-2005-2260.
+  * content/base/src/nsContentUtils.cpp,
+    dom/public/idl/events/nsIDOMNSEventTarget.idl: Fixes for the above
+    patch.
+  * content/xbl/src/nsXBLBinding.cpp: Patch from bz#292591 to fix
+    MFSA2005-46: "XBL scripts ran even when Javascript disabled" aka
+    CAN-2005-2261.
+  * browser/base/content/browser.js,
+    browser/base/content/setWallpaper.xul: Patch from bz#292737 to fix
+    MFSA2005-47: "Code execution via "Set as Wallpaper"", aka
+    CAN-2005-2262.
+  * xpinstall/src/nsJSInstallTriggerGlobal.cpp,
+    xpinstall/src/nsXPITriggerInfo.h, xpinstall/src/nsXPITriggerInfo.cpp:
+    Patch from bz#293331 to fix MFSA2005-48: "Same-origin violation with
+    InstallTrigger callback" aka CAN-2005-2263.
+  * browser/base/content/browser.js: Patch from bz#294074 to fix
+    MFSA2005-49: "Script injection from Firefox sidebar panel using
+    data:" aka CAN-2005-2264.
+  * xpinstall/src/nsJSInstall.cpp, xpinstall/src/nsJSWinProfile.cpp,
+    xpinstall/src/nsJSInstallTriggerGlobal.cpp,
+    xpinstall/src/nsJSInstallVersion.cpp, xpinstall/src/nsJSFile.cpp,
+    xpinstall/src/nsJSWinReg.cpp, xpinstall/src/nsJSFileSpecObj.cpp:
+    Patches from bz#295854 to fix MFSA2005-50: "Possibly exploitable crash
+    in InstallVersion.compareTo" aka CAN-2005-2265.
+  * content/html/document/src/nsHTMLDocument.cpp: Patch from bz#296830 to
+    fix MFSA2005-52: " Same origin violation: frame calling top.focus()"
+    aka CAN-2005-2266.
+  * browser/base/content/browser.js, docshell/base/nsDocShell.cpp,
+    docshell/base/nsDocShell.h, docshell/base/nsIDocShellLoadInfo.idl,
+    docshell/base/nsIWebNavigation.idl: Patch from bz#298255 for
+    MFSA2005-53: "Standalone applications can run arbitrary code through
+    the browser" aka CAN-2005-2267.
+  * dom/src/base/nsGlobalWindow.cpp: Patch from bz#298934 for MFSA2005-54:
+    "Javascript prompt origin spoofing" aka CAN-2005-2268.
+  * browser/base/content/browser.js,
+    browser/base/content/utilityOverlay.js,
+    toolkit/components/help/content/help.js,
+    xpfe/communicator/resources/content/contentAreaUtils.js,
+    xpfe/communicator/resources/content/contentAreaClick.js,
+    xpfe/communicator/resources/content/nsContextMenu.js: Patches from
+    bz#298892 to fix MFSA2005-55: "XHTML node spoofing" aka CAN-2005-2269.
+  * js/src/xpconnect/src/XPCDispObject.cpp,
+    js/src/xpconnect/src/XPCIDispatchExtension.cpp,
+    js/src/xpconnect/src/xpccomponents.cpp,
+    js/src/xpconnect/src/xpcjsruntime.cpp,
+    js/src/xpconnect/src/xpcprivate.h,
+    js/src/xpconnect/src/xpcwrappednativeinfo.cpp,
+    js/src/xpconnect/src/xpcwrappednativejsops.cpp,
+    js/src/xpconnect/src/xpcwrappednativescope.cpp: Patch from bz#294795
+    to partially fix MFSA2005-56: "Code execution through shared function
+    objects" aka CAN-2005-2270.
+  * js/src/jsobj.c, js/src/jsregexp.c: Apply patches from bz#296397 to fix
+    the rest of CAN-2005-2270. 
+
+ -- Eric Dorland <eric@debian.org>  Fri, 12 Aug 2005 19:52:58 -0400
+
+mozilla-firefox (1.0.4-2sarge1) stable-security; urgency=critical
+
+  * dom/src/base/nsGlobalWindow.cpp,
+    embedding/components/windowwatcher/src/nsWindowWatcher.cpp: Apply
+    patch from bz#296850 to fix CAN-2004-0718, injection spoofing
+    vulnerability.
+
+ -- Eric Dorland <eric@debian.org>  Sun, 12 Jun 2005 02:16:41 -0400
+
+mozilla-firefox (1.0.4-2) unstable; urgency=critical
+
+  * debian/control: Build-depend on libxft-dev not libxft2-dev to appease
+    finicky sparc buildd.
+
+ -- Eric Dorland <eric@debian.org>  Mon, 16 May 2005 21:17:57 -0400
+
+mozilla-firefox (1.0.4-1) unstable; urgency=critical
+
+  * New upstream release. Fixes CAN-2005-1477 and CAN-2005-1476. (Closes: #308620)
+  * debian/update-mozilla-firefox-chrome.8: Patch from A Costa to fix the
+    spelling of maintenace. (Closes: #305968)
+  * debian/mozilla-firefox.desktop: Patch from Steinar H. Gunderson to add
+    a Norwegian translation. (Closes: #305983)
+
+ -- Eric Dorland <eric@debian.org>  Thu, 12 May 2005 22:59:47 -0400
+
+mozilla-firefox (1.0.3-2) unstable; urgency=high
+
+  * browser/app/profile/firefox.js: Disable SSLv2 and 40-bit ciphers by
+    default. 
+  * debian/mozilla-firefox.NEWS: Explain the SSL change.
+  * extensions/transformiix/source/base/Double.cpp: Patch from David
+    Mosberger-Tang (fixed up by me) to fix unaligned access on ia64 (and
+    perhaps other platforms). (Closes: #303518)
+  * xpcom/reflect/xptcall/public/xptcstubsdecl.inc,
+    xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ipf64.s,
+    xpcom/reflect/xptcall/src/md/unix/xptcstubs_ipf64.cpp: Another patch
+    from David Mosberger-Tang to fix extension loading on ia64. (Closes:
+    #303515)
+
+ -- Eric Dorland <eric@debian.org>  Thu, 21 Apr 2005 01:25:02 -0400
+
+mozilla-firefox (1.0.3-1) unstable; urgency=low
+
+  * New upstream release, fixes various security issues, so urgency high.
+  * js/src/fdlibm/fdlibm.h: Fix from David Mosberger to define ia64 as
+    little-endian arch (also added for mipsel). (Closes: #303438)
+
+ -- Eric Dorland <eric@debian.org>  Sun, 17 Apr 2005 23:13:01 -0400
+
+mozilla-firefox (1.0.2-3) unstable; urgency=high
+
+  * gfx/src/freetype/nsFreeType.cpp,
+    netwerk/protocol/http/src/nsHttpConnectionMgr.cpp,
+    security/nss/lib/pki1/oiddata.h, security/nss/lib/pki1/pki1.h,
+    widget/src/gtk2/nsDragService.cpp: Fixes for gcc-4.0,
+    bz#289238. (Closes: #301485)
+  * js/src/jsstr.c: Fix for JS memory access security bug, patch from
+    bz#288688. (Closes: #302775)
+
+ -- Eric Dorland <eric@debian.org>  Wed,  6 Apr 2005 01:36:11 -0400
+
+mozilla-firefox (1.0.2-2) unstable; urgency=high
+
+  * Last upload should of been marked urgency=high because of the security
+    fixes.
+  * debian/mozilla-firefox.postinst: Fix ridiculous typos. (Closes:
+    #300685)
+  * debian/mozilla-firefox-runner: Use pgrep to detect esd and arts
+    instead. Thanks Craig Small for the advice. (Closes: #302086)
+
+ -- Eric Dorland <eric@debian.org>  Fri,  1 Apr 2005 01:18:18 -0500
+
+mozilla-firefox (1.0.2-1) unstable; urgency=low
+
+  * New upstream release. Fixes CAN-2005-0399, CAN-2005-0401,
+    CAN-2005-0402. (Closes: #301243)
+  * debian/control: Update suggest for xprint rename. (Closes: #300976)
+  * xpcom/reflect/xptcall/src/md/unix/{Makefile.in,
+    xptcinvoke_asm_parisc_linux.s, xptcstubs_asm_parisc_linux.s}: Apply
+    patch from Ivar (Contributed by Randolph Chung) to fix Firefox on
+    hppa. (Closes: #286038)
+
+ -- Eric Dorland <eric@debian.org>  Fri, 25 Mar 2005 02:30:10 -0500
+
+mozilla-firefox (1.0.1-3) unstable; urgency=low
+
+  * widget/src/gtk2/nsGtkKeyUtils.cpp: Patch from bz#108170 to fix broken
+    keymap for Germans. (Closes: #299781)
+  * toolkit/mozapps/extensions/src/nsExtensionManager.js.in: avoid
+    crashing when extension's install.rdf is broken. (Closes: #298796)
+    (MH)
+  * debian/mozilla-firefox.prerm: Remove
+    /usr/lib/mozilla-firefox/defaults/profile/extensions/Extensions.rdf on
+    uninstall. (Closes: #298636)
+  * debian/mozilla-firefox.postinst: Add little echo to tell people to
+    restart firefox after upgrades.
+  * debian/presubj: Add a note there about restarting firefox before
+    submitting bugs.
+  * debian/mozilla-firefox-runner: Properly quote $@ expansion. (Closes:
+    #300195)
+  * browser/locales/en-US/searchplugins/
+    {yahoo.src,google.src,eBay.src,dictionary.src,creativecommons.src,
+    amazondotcom.src}: Set updateCheckDays to 0, which avoids duplicated
+    search entries in the menu. (Closes: #299006, #299813)
+
+ -- Eric Dorland <eric@debian.org>  Sun, 20 Mar 2005 17:08:12 -0500
+
+mozilla-firefox (1.0.1-2) unstable; urgency=high
+
+  * Changes by Mike Hommey:
+  * Urgency: high due to RC bug fix.
+  * debian/update-mozilla-firefox-chrome: Re-initialize Extensions.rdf
+    inside the script instead of relying on mozilla-firefox's default
+    behaviour, which just fails when defaults/profile/extensions/ \
+    Extensions.rdf doesn't exist (and it seems some people like to remove
+    files in /etc). (Closes: #294175)
+  
+  * Changes by Eric Dorland:
+  * debian/mozilla-firefox.menu: Capitalize "browsers". Thanks Gerfried
+    Fuchs.
+  * debian/mozilla-firefox-runner: Fix from Marc Horowitz to fix sound
+    device detection. (Closes: #297088)
+  * toolkit/content/widgets/tabbrowser.xml: Apply patch from bz#283063, to
+    fix a memory leak when closing tabs. (Closes: #296749)
+  * xpfe/global/resources/content/bindings/browser.xml,
+    xpfe/global/resources/content/bindings/tabbrowser.xml,
+    toolkit/content/widgets/browser.xml,
+    toolkit/content/widgets/tabbrowser.xml: Apply patches from bz#131456
+    to fix various tab related memory leaks. (Closes: #280586)
+  * netwerk/protocol/http/src/nsHttpHandler.cpp: Patch from bz#265536 to
+    differentiate between AMD64 and i386. (Closes: #282592)
+
+ -- Eric Dorland <eric@debian.org>  Sat,  5 Mar 2005 18:46:09 -0500
+
+mozilla-firefox (1.0.1-1) unstable; urgency=high
+
+  * New upstream release. (Closes: #296851)
+    - This release fixes the Secunia window injection bug, 
+      CAN-2004-1156. (Closes: #293664)
+  
+  * Changes by Mike Hommey: 
+  * debian/rules: Some clean-up.
+  * debian/control: Changed my maintainer address.
+  * debian/README.Debian: Add a note about automatic updates for
+    extensions. (Closes: #296761)
+
+  * Changes by Eric Dorland:
+  * browser/app/profile/firefox.js: Remove disable IDN pref, it's the
+    default now anyway.
+
+ -- Eric Dorland <eric@debian.org>  Tue,  1 Mar 2005 02:03:48 -0500
+
+mozilla-firefox (1.0+dfsg.1-6) unstable; urgency=high
+
+  * The "And I thought IE had security bugs!" release.
+  * toolkit/content/widgets/tabbrowser.xml,
+    xpfe/global/resources/content/bindings/tabbrowser.xml: Fix
+    "Firetabbing" vulnerability from bugzilla#280056, fixes
+    CAN-2005-0231. (Closes: #294415)
+  * modules/plugin/base/src/nsPluginHostImpl.cpp: Fix "Fireflashing"
+    vulnerability from bugzilla#280664, fixes CAN-2005-0232. (Also Closes:
+    #294415)
+  * build/unix/run-mozilla.sh: Patch from Javier Fernández-Sanguino Peña
+    to fix insecure temp file usage in run-mozilla.sh. (Closes: #294127)
+  * netwerk/base/src/nsStandardURL.cpp, netwerk/base/src/nsStandardURL.h:
+    Patch from bugzilla#261934 to make the network.enableIDN preference
+    work and again.
+  * browser/app/profile/firefox.js: Disable IDN by default. This doesn't
+    close #293975, but drops its severity. 
+  * debian/README.Debian: Add warning and describe how to enable IDN.
+
+ -- Eric Dorland <eric@debian.org>  Wed,  9 Feb 2005 22:56:17 -0500
+
+mozilla-firefox (1.0+dfsg.1-5) unstable; urgency=low
+
+  * debian/mozilla-firefox.desktop: Don't translate "Mozilla Firefox" into
+    French.
+  * browser/app/profile/firefox.js: Set mozilla.widget.raise-on-setfocus
+    to false to prevent unecessary window raising. (Closes: #292049)
+  * debian/rules: Don't compile statically on mips and mipsel, since it's
+    broken for now.
+
+ -- Eric Dorland <eric@debian.org>  Sun,  6 Feb 2005 15:02:36 -0500
+
+mozilla-firefox (1.0+dfsg.1-4) unstable; urgency=low
+
+  * debian/mozilla-firefox.desktop: Add French translations from Jerome
+    Warnier. I will accept more, but closing this bug. (Closes: #292506)
+  * debian/README.Debian: Update the Emacs keybindings instructions.
+    (Closes: #291691)
+  * debian/mozilla-firefox.1: 
+    - Remove -splash from the manpage, it has never worked. (Closes: 
+      #287088)
+    - Add units to -height and -width description. (Closes: #285142)
+
+ -- Eric Dorland <eric@debian.org>  Wed,  2 Feb 2005 01:42:53 -0500
+
+mozilla-firefox (1.0+dfsg.1-3) experimental; urgency=low
+
+  * debian/mozilla-firefox.desktop: Add %u to the exec line so that apps
+    know it can handle URLs. (Closes: #290132)
+  * debian/README.Debian: 
+    - Improve button reversal instructions. Thanks Christian Mayrhuber
+    - Fix reference to ~/.firefox. 
+  * debian/rules: Enable static building. This will build firefox as one
+    large binary (mostly) and should speed a few things up, especially
+    program load time. I'd like to hear about any speedup (or slow down)
+    you exprience. Porters, please build this for your arch to make sure
+    this doesn't break anything.
+
+ -- Eric Dorland <eric@debian.org>  Thu, 20 Jan 2005 01:40:34 -0500
+
+mozilla-firefox (1.0+dfsg.1-2) unstable; urgency=medium
+
+  * debian/mozilla-firefox-gnome-support.postrm,
+    debian/mozilla-firefox-dom-inspector.postrm: Don't die if
+    update-mozilla-firefox-chrome dies. (Closes: #287355)
+
+ -- Eric Dorland <eric@debian.org>  Sun,  9 Jan 2005 23:51:10 -0500
+
+mozilla-firefox (1.0+dfsg.1-1) unstable; urgency=low
+
+  * Not a new upstream release.
+  * other-licenses/branding/firefox, other-licenses/7zstub/firefox: Remove
+    these from the .orig.tar.gz, since they are not DFSG-free. We're not
+    using the files anyway, so out they go. (Not sure the 7zstub stuff is
+    non-free, but it's Windows only so no harm)
+  * debian/rules: 
+    - Remove explicit low-optimization on alpha, since Falk
+      Hueffner claims it works.
+    - Move entire defaults/profile directory into /etc/mozilla-firefox, 
+      rather than just the bookmarks.html. (Closes: #285538)
+  * debian/mozilla-firefox.links: Link entire defaults/profile now.
+  * debian/mozilla-firefox.preinst: Add upgrade code to remove old
+    defaults/profile to make way for new symlink.
+  * debian/mozilla-firefox.dirs: Just create etc/mozilla-firefox.
+
+ -- Eric Dorland <eric@debian.org>  Sun, 19 Dec 2004 01:31:44 -0500
+
+mozilla-firefox (1.0-5) unstable; urgency=medium
+
+  * Changes by Mike Hommey:
+  * toolkit/mozapps/extensions/src/nsExtensionManager.js.in: Make the
+    extensions upgrade work again. (Closes: #282143)
+  * debian/rules: Better DEB_BUILD_OPTIONS handling, better debugging
+    build (DEB_BUILD_OPTIONS="nostrip debug")
+  * toolkit/mozapps/extensions/src/nsExtensionManager.js.in,
+    toolkit/mozapps/extensions/content/extensions.js: Allow users to
+    disable globally installed extensions.
+
+  * Changes by Eric Dorland:
+  * debian/rules: Remove explicit low-optimization on sparc. Apparently
+    there was an issue for a number of arches that required lower
+    optimization settings, but it is now resolved. So porters, please
+    check -O2 on arm, alpha, powerpc and ia64 and let me know if it's
+    safe. Thanks David S. Miller. (Closes: #284533)
+
+ -- Eric Dorland <eric@debian.org>  Tue,  7 Dec 2004 01:06:48 -0500
+
+mozilla-firefox (1.0-4) unstable; urgency=medium
+
+  * debian/control: Make mozilla-firefox-gnome-support and xprt-xprintorg
+    Suggests, no Recommends after a look at policy. (Closes: #282432)
+  * debian/README.Debian: 
+    - Refer to .mozilla/firefox, not .firefox.
+    - Explain how to reenable emacs style keybindings. (Closes: #282321)
+
+ -- Eric Dorland <eric@debian.org>  Sat, 27 Nov 2004 20:40:10 -0500
+
+mozilla-firefox (1.0-3) unstable; urgency=low
+
+  * Changes by Mike Hommey
+  * The "becoming more and more an iceweasel" release.
+  * debian/firefox.js:
+    + Enable firefox's internal locale autodetection.
+    + Disable default browser question at startup. (Closes: #280752)
+  * debian/mozilla-firefox-runner: Removed our locale autodetection.
+    That means now locales installed in user profiles are automatically
+    used, and that there is no need for /var/lib/mozilla-firefox/locales.d
+    anymore.
+  * debian/mozilla-firefox.dirs: Removed creation of
+    /var/lib/mozilla-firefox/locales.d.
+  * debian/rules: Removed creation of the locale file in
+    /var/lib/mozilla-firefox/locales.d.
+  * debian/presubj: Put some more recent information.
+  * htmlparser/src/nsParser.cpp: Applied patch from bz#57717 so that empty
+    html files don't get <html><body></body></html> when viewing source.
+  * browser/base/content/aboutDialog.css: increase the User Agent element
+    height as in bz#238137 (but up to MacOSX's height) to show the full User
+    Agent string.
+  * xpcom/io/nsAppDirectoryServiceDefs.h,
+    xpcom/io/nsAppFileLocationProvider.cpp,
+    xpfe/components/search/src/nsInternetSearchService.cpp: Applied patch from
+    bz#123315 so that Internet search services in user profiles are supported.
+    (Closes: #219053)
+  * debian/mozilla-firefox-runner:
+    + Remove compatibility.ini only if it is older than
+      /usr/lib/mozilla-firefox/components.ini. That way, we only rebuild it
+      after an update-mozilla-firefox-chrome.
+    + Detect if we're being run through sudo without the -H option, in which
+      case we force setting of $HOME. (Closes: #218156)
+  * browser/app/profile/firefox.js: Sync'ed with debian/firefox.js.
+  * toolkit/mozapps/extensions/src/nsExtensionManager.js.in:
+    + Removed some error messages that get there because firefox is trying to
+      write in the /usr/lib/mozilla-firefox directory as a user. They are
+      useless and lead users to think something is going wrong while it's the
+      (stupid but) normal way firefox works.
+    + Avoid creation of directories when attempting to read files, that
+      throwed uncaught exceptions breaking some stuff in several different
+      ways when extensions don't follow the new scheme for extensions.
+    + Avoid copying stuff from
+      /usr/lib/mozilla-firefox/defaults/profile/extensions/ to
+      /usr/lib/mozilla-firefox/extensions/, that's the *very* old way of
+      installing extensions, which, since the old scheme has been thrown away,
+      won't work anyway, if any extension provides files out there.
+    + CheckForMismatches: Avoid to disable already disabled global extensions,
+      and don't propose to upgrade the locked extensions. That fixes a
+      never-ending loop occuring when running firefox for the first time in a
+      user account, while some global extensions are expired.
+      (Closes: #278722, #281537)
+  * debian/mozilla-firefox.prerm, debian/mozilla-firefox.preinst: Moved
+    removal of links to /usr/lib/mozilla-firefox/defaults/profile/extensions/
+    sitting in /usr/lib/mozilla-firefox/extensions/, if any remaining, from
+    prerm to preinst. We remove them once and for all, they won't be created
+    by us anymore.
+  * debian/update-mozilla-firefox-chrome:
+    + Removed support for extensions in
+      /usr/lib/mozilla-firefox/defaults/profile/extensions/.
+    + Removed some clean-up that had been introduced to help the Extensions
+      Manager not to die, and which, actually, did not work out quite so well.
+      Anyways, with the changes this time, the EM is supposed to support much
+      more problems than ever before (as usual ;) ) so we don't need that
+      anymore.
+    + Avoid stupid mv error messages when firefox-bin -register fails (which
+      is not supposed to happen, but you're never too careful)
+  * debian/update-mozilla-firefox-chrome, debian/mozilla-firefox.preinst:
+    Move removal of some very old stuff to preinst, to do it once and for all
+    instead of doing it every time we run update-mozilla-firefox-chrome.
+  * netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp: Applied patch from
+    bz#124561 to get a prompt for username/password in case anonymous login
+    fails.
+  * debian/mozilla-firefox-runner:
+    + Added check for more arguments so that the url in the command line get
+      detected more accurately.
+    + When a file name is given on the command line, prepend "file://" and
+      change spaces into %20. (Closes: #281800)
+
+  * Changes by Eric Dorland
+  * debian/mozilla-firefox.prerm: Patch from Philipp Weis to fix order of
+    find arguments. (Closes: #280852)
+  * debian/mozilla-firefox.desktop: Support new mime type handler in Gnome
+    2.8. (Closes: #281274) (MH: I added some more myme-types)
+  * debian/mozilla-firefox.postinst: Run update-desktop-database if it
+    exists.
+  * widget/src/gtk/nsWidget.cpp: We don't use gtk anymore, might as well
+    revert these patches. Thanks Stephane Despret. 
+
+ -- Eric Dorland <eric@debian.org>  Thu, 18 Nov 2004 22:16:28 -0500
+
+mozilla-firefox (1.0-2) unstable; urgency=low
+
+  * Changes by Mike Hommey
+  * The "don't do too much on the same day, it's bad for health" release.
+  * debian/firefox.js: Re-activated the extensions update service, and
+    removed the update url.
+  * browser/app/profile/firefox.js: Sync'ed with debian/firefox.js.
+  * debian/mozilla-firefox-dom-inspector.preinst: Removed old inspector.js
+    file.
+  * toolkit/mozapps/extensions/src/nsExtensionManager.js.in,
+    toolkit/mozapps/extensions/content/extensions.js: Disabled possibility
+    to update locked extensions and themes. Locked extensions being the
+    ones installed by the packaging system, they should be updated through
+    that.
+  * toolkit/mozapps/update/src/nsUpdateService.js.in: Disabled application
+    update functionnality. Firefox should be updated through the packaging
+    system.
+  * browser/components/prefwindow/content/pref-advanced.xul: Removed the
+    preferences panel item to activate application update, since it is
+    totally disabled.
+  * debian/mozilla-firefox-runner: Remove compatibility.ini instead of
+    compreg.dat. (Eric: This will cause a rebuild of the compreg.dat)
+  
+  * Changes by Eric Dorland:
+  * debian/mozilla-firefox.NEWS: Fix typos.
+  * README.Debian: 
+    - Add note about application update being completely disabled.
+    - Fix path to XUL.mfsal
+
+ -- Eric Dorland <eric@debian.org>  Wed, 10 Nov 2004 22:56:22 -0500
+
+mozilla-firefox (1.0-1) unstable; urgency=medium
+
+  * New upstream release (Closes: #280449)
+  
+  * Changes by Mike Hommey:
+  * netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp: Apply new patch
+    #164795 from bz#266835 + some tweaks as previously. This might lead to
+    encoding problems with the password, but it is supposed to be ASCII
+    anyway.
+  * toolkit/mozapps/extensions/src/nsExtensionManager.js.in: Reworked the
+    previous patches so that the Extensions Manager shows extensions that
+    have been disabled due to version mismatch, and added a workaround so
+    that components registration works correctly.
+  * debian/update-mozilla-firefox-chrome: Removed part that is useless due
+    to last changes in the Extensions Manager.
+  * Make the inspector a real extension again:
+    - debian/inspector/00dom-inspector: File for
+      /var/lib/mozilla-firefox/extensions.d.
+    - debian/inspector/Uninstall: Uninstall file needed in extension 
+      directory.
+    - debian/inspector/install.rdf: install.rdf taken from older versions, 
+      and adapted to newer versions, adding registered chrome.
+    - debian/mozilla-firefox-dom-inspector.dirs: Removed. Everything will 
+      be created by dh_install.
+    - debian/mozilla-firefox-dom-inspector.install: install
+      debian/inspector.rdf and most inspector files in the right place in
+      /usr/lib/mozilla-firefox/extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}
+      and /var/lib/mozilla-firefox
+  * Make the classic theme a real extension, even though it's still in 
+    the main package:
+    - debian/theme/00classic: File for 
+      /var/lib/mozilla-firefox/extensions.d.
+    - debian/theme/Uninstall: Uninstall file needed in extension 
+      directory.
+    - debian/mozilla-firefox.install: Install all files in the right 
+      place in
+      /usr/lib/mozilla-firefox/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}
+    - debian/mozilla-firefox.dirs: Removed creation of
+      /usr/lib/mozilla-firefox/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/chrome, 
+      it will be done by dh_install.
+    - browser/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf.in:
+      Added chrome to be registered.
+  * Removed support for /var/lib/mozilla-firefox/chrome.d:
+    - debian/mozilla-firefox.dirs: Removed creation of the directory.
+    - debian/rules: Removed creation of files there, and put the
+      installed-chrome.txt, excluding inspector and classic theme stuff,
+      directly in /usr/lib/mozilla-firefox/chrome.
+    - debian/update-mozilla-firefox-chrome: Removed all
+      /var/lib/mozilla-firefox/chrome.d related stuff.
+    - debian/mozilla-firefox.links: Removed installed-chrome.txt link.
+    - toolkit/mozapps/extensions/src/nsExtensionManager.js.in: disable
+      extensions that fail to install chrome.
+  * debian/mozilla-firefox-runner: Remove user profile compreg.dat at
+    launch time.
+  * Moved some files in /var/lib/mozilla-firefox:
+    - debian/mozilla-firefox.links: Add a symlink for Extensions.rdf 
+      and components.ini, from /usr to /var.
+    - debian/mozilla-firefox.prerm: Don't remove files we don't 
+      provide and remove files at their new locations.
+    - debian/mozilla-firefox.preinst: Remove
+      /var/lib/mozilla-firefox/installed-chrome.txt.
+    - debian/update-mozilla-firefox-chrome: Create links for 
+      Extensions.rdf and components.ini after register call, and remove 
+      components.ini before.
+  * Clean-up in files generated by update-mozilla-firefox-chrome:
+    - debian/mozilla-firefox.links: Put all the links generated by
+      update-mozilla-firefox-chrome into the package.
+    - debian/mozilla-firefox.prerm: Remove all /var files generated 
+      in the remove target, and changed the way we clean-up 
+      /var/lib/mozilla-firefox.
+  * debian/mozilla-firefox.install: Removed chromelist.txt.
+  * Add support for extensions preferences:
+    - debian/update-mozilla-firefox-chrome: Handle
+      /usr/lib/mozilla-firefox/defaults.ini file.
+    - debian/mozilla-firefox.links: Add a symlink to /var for 
+      defaults.ini.
+    - toolkit/mozapps/extensions/src/nsExtensionManager.js.in: Added 
+      defaults registration in -register command.
+    - mozilla-firefox-dom-inspector.install: Move inspector.js into 
+      the appropriate extension specific directory.
+  * Move preferences back into /usr:
+    - debian/rules: Don't move the prefs into 
+      /etc/mozilla-firefox/pref, and put the vendor thing into /usr 
+      as well, and remove firefox-l10.js file.
+    - debian/mozilla-firefox.preinst: remove old prefs in /etc and 
+      old symlink /usr/lib/mozilla-firefox/defaults/pref.
+    - debian/firefox.js: new Debian default preferences file.
+    - debian/mozilla-firefox.install: install firefox.js in
+      /etc/mozilla-firefox/pref.
+    - debian/mozilla-firefox.links: rename
+      /usr/lib/mozilla-firefox/defaults/pref symlink to
+      /usr/lib/mozilla-firefox/defaults/syspref.
+    - toolkit/mozapps/extensions/src/nsExtensionManager.js.in: Added 
+      a hook so that defaults/syspref gets registered in defaults.ini 
+      after all other extensions preferences.
+  * debian/mozilla-firefox.preinst: only clean-up stuff if we are
+    upgrading from a version known to still have the files. Added some
+    more clean-up.
+  * debian/mozilla-firefox.install: Removed useless init.d.
+  * modules/libpref/src/init/all.js: Fixed all chrome URLs which refered to
+    mozilla stuff.
+  * debian/update-mozilla-firefox-chrome: Remove some more files before running
+    firefox-bin -register.
+
+  * Changes by Eric Dorland:
+  * debian/mozilla-firefox.NEWS: Add warning about broken extension and
+    locale packages with this release. 
+  * debian/mozilla-firefox-runner: Comment out warning about xprint,
+    xprint isn't necessarily needed for printing since postscript was
+    reenabled. (Closes: #279858)
+
+ -- Eric Dorland <eric@debian.org>  Wed, 10 Nov 2004 00:33:44 -0500
+
+mozilla-firefox (0.99+1.0RC1-4) unstable; urgency=low
+
+  * debian/mozilla-firefox-runner:
+    - Fixed to run properly with dash. (Closes: #279549).
+    - Fixed indentation.
+    - Added a basic debugger support.
+  * debian/mozilla-firefox.1: Added information about debugger options.
+  * debian/rules: Added a debug option to DEB_BUILD_OPTIONS. If you want to
+    build a fully gdb'able package, use DEB_BUILD_OPTIONS="noopt nostrip
+    debug"
+  * netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp: Apply new patch from
+    bz#266835.
+    - Further change this patch to use Append rather than AppendLiteral,
+      which doesn't seem to exist. (ED)
+
+ -- Mike Hommey <mh@glandium.org>  Thu,  4 Nov 2004 22:01:51 +0900
+
+mozilla-firefox (0.99+1.0RC1-3) unstable; urgency=low
+
+  * netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp: Apply patch from
+    bz#266835 to fix anonymous user password issue. (Closes: #226784)
+  * toolkit/mozapps/extensions/src/nsExtensionManager.js.in: (MH)
+    - Fully apply previous patches, which for some reason left a spurious code
+      line which made the extensions manager not like expired extensions
+      anymore. (Closes: #279140)
+    - Enhanced extensions manager so that the behaviour described in
+      https://bugzilla.mozilla.org/show_bug.cgi?id=247846#c14 *actually*
+      works. Extensions packagers are invited to move their chrome files
+      accordingly, and remove /var/lib/mozilla-firefox/chrome.d files so that
+      extensions chrome don't get registered when they are forced-disable due
+      to version mismatch or some other reason.
+  * debian/mozilla-firefox-runner: 
+    - Fix some thinkos. (MH)
+    - Fix for loading files from the command line. (Closes: #279018) (MH)
+    - Removed setting --display from $DISPLAY, let it get it from the 
+      environment, but pass --display if it is set. (Mike, 
+      I'm worried this will screw up some session 
+      managers, let me know what you think, we can revert it)
+    - Removed FIREFOX_OPEN_IN stuff, so that firefox now obeys to "open 
+      links from other applications in" setting. (Closes: #279073) (MH)
+    - Enhanced command line parsing, and drop empty arguments. 
+      (Closes: #279138) (MH)
+    - No need for a find to look for XUL.mfasl, we already have its 
+      location from the path list taken from profiles.ini. (MH)
+    - Better detection of dsp wrapper, when FIREFOX_DSP=auto. 
+      (Closes: #254611) (MH)
+    - Correctly open local files even when firefox was not previously 
+      running. (Closes: #279018) (MH)
+  * debian/mozilla-firefox.1: (MH)
+    - Removed references to FIREFOX_OPEN_IN.
+    - Added the -safe-mode option.
+  * debian/mozilla-firefoxrc: Removed FIREFOX_OPEN_IN. (MH)
+  
+ -- Eric Dorland <eric@debian.org>  Tue,  2 Nov 2004 00:46:28 -0500
+
+mozilla-firefox (0.99+1.0RC1-2) unstable; urgency=medium
+
+  * browser/app/profile/firefox.js: Disable browser update checking by
+    default.
+  * debian/mozilla-firefox-runner: Apply patch from Aurelien Jarno to fix
+    variable name typo. (Closes: #278844)
+
+ -- Eric Dorland <eric@debian.org>  Fri, 29 Oct 2004 23:50:59 -0400
+
+mozilla-firefox (0.99+1.0RC1-1) unstable; urgency=medium
+
+  * New upstream release.
+  * layout/xul/base/src/nsImageBoxFrame.{cpp,h}: Remove some conflicts
+    from a previous patch.
+
+ -- Eric Dorland <eric@debian.org>  Thu, 28 Oct 2004 23:33:46 -0400
+
+mozilla-firefox (0.10.1+1.0PR-5) unstable; urgency=low
+
+  * debian/rules: (MH)
+    - Use upstream extensions set. This will eventually get a
+      correct help menu and fix some yet undiscovered UI issues. 
+      (Closes: #257946)
+    - Added support for DEB_BUILD_OPTIONS=noopt.
+    - Changed OPTFLAGS assignment.
+    - Remove whitespace characters in version number for UserAgent
+      branding.
+    - Install mozilla-firefox-runner into /usr/lib/mozilla-firefox/firefox
+      (Closes: #278477)
+  * debian/mozilla-firefox.links: (MH)
+    - Link /usr/bin/firefox and /usr/bin/mozilla-firefox to 
+      /usr/lib/mozilla-firefox/firefox.
+    - Removed obsolete profile/US links.
+  * debian/mozilla-firefox.dirs: Create /etc/mozilla/profile instead of
+    /etc/mozilla/profile/US. (MH)
+  * toolkit/xre/nsAppRunner.cpp: Fix crash in nsCmdLineService::Initialize
+    when argc is changed by gtk (when treating gtk specific arguments)
+    (MH)
+  * debian/mozilla-firefox-runner (Changes by MH):
+    - Removed workaround for bug #122990. First, xmlterm is not an activated
+      extension, and secondly, if it still requires the TERM environment
+      variable, it is the user's duty to set it to whatever he wants, not
+      firefox's start script's.
+    - Removed the ulimit -c setting. First, it is set by default to 0 on a
+      newly installed debian, and secondly, it is user's choice to set it or
+      not if he needs to get core files.
+    - Removed unused shell variables.
+    - Removed unsetting AUDIODEV variable. If it still crashes, it does belong
+      to some other code than firefox. The AUDIODEV environment variable is
+      used nowhere in firefox code:
+      http://lxr.mozilla.org/aviarybranch/search?string=AUDIODEV
+      Note that there is a "A crash which occurred when AUDIODEV doesn't
+      contain "/" was fixed." log message in esound version 0.2.33 changes and
+      that the bug may have belonged there.
+    - Replaced ${HOME}/.mozilla-firefoxrc file by a ${HOME}/.mozilla/firefox/rc
+      file. The former is still supported, though, but will bring a warning
+      message. If both are present, only the latter is taken into account.
+    - Changed the way system and user FIREFOX_DSP and FIREFOX_OPEN_IN
+      variables are handled. First, use system values defined in
+      /etc/mozilla-firefox/mozilla-firefoxrc, then override with
+      ${HOME}/.mozilla/firefox/rc and then with runtime environment variables.
+    - Don't die when DISPLAY is not set. Display can be passed by --display
+      option, and if not set and needed (some options don't require it),
+      firefox will complain.
+    - Some shell code simplifications by using some coreutils.
+    - Added better command line parsing.
+    - Added verbosity mode.
+    - Removed setting of FONTCONFIG_PATH, /usr/lib/mozilla-firefox/res/Xft
+      doesn't exist
+    - Factorized localization detection.
+  * debian/mozilla-firefox.1 (MH):
+    - Made some clean-up between dashes and hyphens.
+    - Removed obsolete options and added new ones.
+    - Added informations about some debian specific stuff.
+  * debian/update-mozilla-firefox-chrome: Changed the way we move files to
+    /var/lib/mozilla-firefox. It will avoid creating files with a * in their
+    name whenever registration failed. (MH)
+  * debian/README.Debian: Update java instructions, tell them to just use
+    java-package.
+
+ -- Eric Dorland <eric@debian.org>  Thu, 28 Oct 2004 21:30:40 -0400
+
+mozilla-firefox (0.10.1+1.0PR-4) unstable; urgency=medium
+
+  * This release mostly courtesy Mike Hommey. 
+  * layout/src/xul/base/src/nsImageBoxFrame.*: Backported patch from
+    bz#255372. (Closes: #278046)
+  * toolkit/mozapps/extensions/src/nsExtensionManager.js.in: Force locking
+    globally installed extensions, that will prevent extensions packages
+    files to be unexpectedly removed by firefox.
+  * debian/control: Add Mike Hommey as an Uploader.
+  * debian/mozilla-firefox.install: Removed content-packs.jar which is
+    mozilla-browser specific.
+  * debian/mozilla-firefox.dirs: 
+    - Remove leading /'s.  
+    - Create
+    /usr/lib/mozilla-firefox/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}
+    /chrome directory so that preview is shown in the Themes Manager. Yes,
+    this is stupid, but it is the way firefox wants it (and it's not even
+    created by make install, nor in the official binary tarball. It is
+    only created at run time, but you know what ? under *nix, a normal
+    user can't create that directory) (Closes: #276404)
+  * debian/rules: Add a /etc/mozilla-firefox/pref/vendor.js file adding
+    the debian package version to the UserAgent. (Closes: #268654)
+  * debian/README.Debian: Update java instructions. I'd love some more
+    definitive pointers. (Closes: #277983)
+
+ -- Eric Dorland <eric@debian.org>  Tue, 26 Oct 2004 00:11:48 -0400
+
+mozilla-firefox (0.10.1+1.0PR-3) experimental; urgency=low
+
+  * debian/control: 
+    - Rename the mozilla-firefox-gnome-vfs package
+      mozilla-firefox-gnome-support since it does more than vfs. No 
+      need for Replaces or anything, since it never actually made it to 
+      the archive.
+    - Remove strict build dependencies on g++ and binutils, since the 
+      fixed versions have hit sarge.
+    - Remove hppa build depends, since gcc has also been fixed there.
+    - Build-depend on libgnome2-dev and libgconf2-dev to build in more 
+      gnome support.
+    - Have mozilla-firefox recommend it's gnome support. 
+  * debian/rules: 
+    - Remove hppa CC redefinitions.
+    - Exclude *gnome* not just *gnomevfs*.
+    - dh_install for gnome-support.
+  * debian/mozilla-firefox-gnome-vfs.*: Rename to
+    mozilla-firefox-gnome-support.*.
+  * debian/mozilla-firefox-gnome-support.install: Grab *gnome*, not just
+    *gnomevfs*.
+
+ -- Eric Dorland <eric@debian.org>  Thu, 21 Oct 2004 23:04:53 -0400
+
+mozilla-firefox (0.10.1+1.0PR-2) experimental; urgency=low
+
+  * debian/mozilla-firefox-runner: 
+    - Patch from Sam Morris to handle cleanup of directories with 
+      unusual names.
+    - Fix return value check, patch from rgselk. (Closes: #269690)
+  * debian/mozilla-firefox.1: List full path to firefox-bin. (Closes:
+    #275563)
+  * debian/rules: 
+    - --with-gssapi=/usr, enable Negotiate extension. (Closes:
+      #274258)
+    - Enable gnomevfs support, 
+  * debian/control: 
+    - Build-depend on libkrb5-dev.
+    - Build-depend on libgnomevfs2-dev.
+    - New gnomevfs package, based on work by Mike Hommey. (Closes: 
+      #262062)
+  * debian/mozilla-firefox-gnome-vfs.post{inst,rm}: Added, same as
+    corresponding files from mozilla-firefox-dom-inspector.
+  * debian/mozilla-firefox-gnome-vfs.install: Install gnomevfs components.
+  * browser/app/profile/firefox.js: Set
+    network.negotiate-auth.trusted-uris to https:// to enable the
+    negotiate extension over secure links.
+  * config/rules.mk: Tweak patch from Thiemo Seufer to include svg_doc in
+    non-optimization. (Closes: #273353)
+
+ -- Eric Dorland <eric@debian.org>  Sun, 17 Oct 2004 21:25:08 -0400
+
+mozilla-firefox (0.10.1+1.0PR-1) experimental; urgency=critical
+
+  * New upstream release, fixes security issue bz#259708. (Closes:
+    #274493)
+
+ -- Eric Dorland <eric@debian.org>  Sun,  3 Oct 2004 03:32:43 -0400
+
+mozilla-firefox (0.10+1.0PR-1) experimental; urgency=low
+
+  * New upstream release. (Closes: #273700, #267003)
+  * toolkit/mozapps/extensions/src/nsExtensionManager.js.in,
+    netwerk/dns/src/nsIDNService.cpp,
+    modules/libpr0n/decoders/bmp/nsBMPDecoder.cpp,
+    gfx/src/windows/nsImageWin.cpp, gfx/src/shared/gfxImageFrame.cpp,
+    browser/app/profile/firefox.js: Resolve conflicts between my tree and
+    upstream.
+  * browser/app/Makefile.in: Fix $(DESTDIR) variable.
+  * accessible/src/atk/nsAccessibleWrap.cpp,
+    accessible/src/atk/nsAccessibleWrap.h: Apply patch from bugzilla for
+    alpha fix that's more likely to make it into CVS.
+  * debian/update-mozilla-firefox-chrome: Patch from Mike Hommey to make
+    update-mozilla-firefox-chrome more verbose on -v.
+  * debian/rules:
+    - Remove typeaheadfind for new find toolbar to work. (Mike Hommey) 
+      (Closes: #267170)
+    - Changes to reflect new upstream files. 
+  * debian/control: 
+    - Remove build-depend on libcairo-dev.
+    - Build depend on libxt-dev, seems to be necessary now. (Closes: 
+      #274311)
+  * debian/docs: Removed, as browser/README.html disappeared. (Mike Hommey)
+  * debian/mozilla-firefox.dirs: 
+    - Changes to reflect new upstream files.
+    - Removed obsolete libnullplugin.so.
+  * debian/mozilla-firefox.install: 
+     - Remove .jar's that aren't there anymore.
+     - Removed obsolete libnullplugin.so.
+  * debian/mozilla-firefox-dom-inspector.dirs,
+    debian/mozilla-firefox-dom-inspector.install, debian/rules: Upstream
+    doesn't consider DOM Inspector as a real extension, and do not provide
+    the appropriate files to make it appear in the extensions
+    manager. Removed all the extension related stuff in the package. (Mike
+    Hommey)
+  * other-licenses/libart_lgpl: Removed, was for SVG, no longer needed.
+  * modules/plugin/samples/default/unix/*: Reverted debian specific
+    changes, we don't want them in the diff since libnullplugin won't get
+    installed.
+
+ -- Eric Dorland <eric@debian.org>  Fri,  1 Oct 2004 18:50:46 -0400
+
+mozilla-firefox (0.9.3-6) unstable; urgency=high
+
+  * gfx/src/gtk/fontEncoding.properties: Uncomment symbol fonts. (Closes:
+    #272927)
+  * debian/control: Build-depend on binutils (>= 2.15-4) but only on mips
+    and mipsel. (Closes: #273353)
+  * configure.in, configure, rules.mk: Patch from Thiemo Seufer to
+    increase stability and performance on mips. (Closes: #272159)
+  * debian/mozilla-firefox-runner: Detect failure of ping()
+    better. (Closes: #267393)
+  * layout/html/document/src/html.css: Testing fix for xprint problems.
+
+ -- Eric Dorland <eric@debian.org>  Mon, 27 Sep 2004 17:07:37 -0400
+
+mozilla-firefox (0.9.3-5) unstable; urgency=high
+
+  * debian/update-mozilla-firefox-chrome: Apply another patch form Mike
+    Hommey to fix a few more issues in the script. (Closes: #271480)
+  * Fixes to Secunia security bugs, ported from bugzilla: 
+    (Closes: #271888)
+    - browser/base/content/browser.js, 
+      xpfe/communicator/resources/content/contentAreaDD.js: Fix for
+      drag and drop exploit, bz#250862.
+    - caps/include/nsScriptSecurityManager.h, caps/src/caps.properties,
+      caps/src/nsScriptSecurityManager.cpp: Fix for enablePrivilege
+      exploit, bz#253942.
+    - gfx/src/shared/gfxImageFrame.cpp, gfx/src/windows/nsImageWin.cpp,
+      modules/libpr0n/decoders/bmp/nsBMPDecoder.cpp: Fix for various
+      overflows in the BMP code, bz#255067.
+    - netwerk/dns/src/nsIDNService.cpp: Fix for bug in non-ASCII 
+      characters in domain names, bz#256316
+    - content/xbl/src/nsXBLPrototypeHandler.cpp: Clipboard injection 
+      fix, bz#257523.
+
+ -- Eric Dorland <eric@debian.org>  Thu, 16 Sep 2004 20:06:47 -0400
+
+mozilla-firefox (0.9.3-4) unstable; urgency=high
+
+  * Urgency high, go into testing dammit!
+  * Apply patch from Mike Hommey as -3.1, which wasn't actually
+    released. See below. (Closes: #271480)
+  * debian/rules: Patch from Matthew Mueller to fix underquoted
+    argument. (Closes: #271432)
+  * debian/control: Build depend on binutils (>= 2.15-3) with fixed mips
+    support. We still need a fixed gcc.
+
+ -- Eric Dorland <eric@debian.org>  Mon, 13 Sep 2004 20:41:27 -0400
+
+mozilla-firefox (0.9.3-3.1) unstable; urgency=low
+
+  * debian/rules: removed
+    /usr/lib/mozilla-firefox/defaults/profile/extensions/installed-extensions.txt
+  * debian/update-mozilla-firefox-chrome:
+    + Added a "verbose" mode.
+    + Added warning messages (only shown in verbose mode) about some
+      extensions specific issues. This is intended to be useful for extensions
+      maintainers.
+    + Check if the installed-extensions.txt file disappears, which tells if the
+      mozilla-firefox -register went ok.
+  * debian/update-mozilla-firefox-chrome.8:
+    + Fixed typos.
+    + Added reference to the -v option for the verbose mode.
+  * debian/mozilla-firefox-runner: enhanced the profile directory check. It
+    didn't work if the path indicated in the profiles.ini was not absolute.
+
+ -- Mike Hommey <mh@glandium.org>  Mon, 13 Sep 2004 20:31:21 +0900
+
+mozilla-firefox (0.9.3-3) unstable; urgency=high
+
+  * Acknowlege NMU from Mike Hommey. He did a fantastic job in porting a
+    large amount of fixes from upstream CVS. I owe him several large
+    beverages of his choice. (Closes: #259046, #259836)
+  * Port all of Mike's changes to my local CVS.
+  * debian/mozilla-firefox-runner: 
+    - Pass command-line arguments to get_locale so they can actually 
+      be used. (Closes: #240058)
+    - Apply patch from Mike Hommey to use the profiles.ini to find the 
+      path to the profile to clean XUL.mfasl. (Closes: #267326)
+  * debian/update-mozilla-firefox-chrome: Patch from Mike Hommey to fix
+    some bashisms introduced by his NMU.
+  * xpcom/reflect/xptcall/src/md/unix/Makefile.in,
+    xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips.s,
+    xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp,
+    xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.s.m4,
+    xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.s: Patch from
+    Thiemo Seufer to fix mips. This requires patches to gcc and binutils
+    to work and fully close #270621.
+
+ -- Eric Dorland <eric@debian.org>  Wed,  8 Sep 2004 21:13:35 -0400
+
+mozilla-firefox (0.9.3-2.2) unstable; urgency=high
+
+  * The "never edit the diff file unless you're sure nothing will be
+    missing" release.
+  * debian/mozilla-firefox.prerm: restore the uncut version.
+  * debian/control, debian/rules: Use gcc-3.2 to build on hppa, because of
+    toolchain bug #254549.
+
+ -- Mike Hommey <mh@glandium.org>  Mon, 23 Aug 2004 19:45:54 +0900
+
+mozilla-firefox (0.9.3-2.1) unstable; urgency=high
+
+  * Non Maintainer Upload for RC Fixes.
+  * Applied changes to toolkit/mozapps/extensions/src/nsExtensionManager.js.in
+    and toolkit/mozapps/extensions/locale/extensions.properties to solve some
+    issues with extensions management. (taken from CVS)
+  * Applied other changes to
+    toolkit/mozapps/extensions/src/nsExtensionManager.js.in,
+    toolkit/mozapps/extensions/public/nsIExtensionManager.idl and
+    mozilla/toolkit/xre/nsAppRunner.cpp to be able to use -register
+    instead of -list-global-items for extensions/components/chrome
+    registration through update-mozilla-firefox-chrome, thus not needing
+    Xvfb anymore (-register option doesn't require a X server).
+    (taken from CVS)
+  * Applied some more changes to
+    toolkit/mozapps/extensions/src/nsExtensionManager.js.in in order to
+    avoir overlayinfo deletion during extensions registration process.
+    (taken from CVS)
+  * Final changes to toolkit/mozapps/extensions/src/nsExtensionManager.js.in
+    to avoid registering out of date extensions so that firefox doesn't enter
+    a loop at startup when no profile was found, and to only write in the
+    installed-extensions-processed.txt file the list of actually installed
+    extensions. Note that for packaged extensions installing their files
+    directly into the chrome or components directories, that only means they
+    won't appear in the Extensions Manager. They will still be available in
+    the GUI.
+  * All these fixes improve the Extensions Manager. Closes: #259046.
+  * accessible/src/atk/nsAccessibleWrap.cpp,
+    accessible/src/atk/nsAccessibleWrap.h: fixed 32-bit abuse of gobject
+    (Steve Langasek). Closes: #259836.
+  * debian/control: Removed dependency upon xvfb.
+  * debian/update-mozilla-firefox-chrome:
+    + Removed use of Xvfb.
+    + Removed creation of a root default profile, but kept the fake home
+      hack to avoid creation of a .mozilla directory in root's home.
+    + Changed extensions handling so that the overall process is cleaner.
+      Extensions packages will have to move extensions {uid} directories
+      to /usr/lib/mozilla-firefox/extensions/, while the current location
+      is still supported for compatibility purpose (but is strongly not
+      recommended).
+    + Removed use of regxpcom and regchrome, since what they both do is
+      done by firefox-bin -register.
+  * debian/rules: force GnomeVFS support to be disabled. (Josselin Mouette)
+  * debian/README.Debian:
+    + Added a note about potential problems with packaged "old" extensions.
+    + Added a note about how to manually disable packaged extensions in user
+      profile.
+    + Removed some old notes that don't apply anymore.
+  * debian/mozilla-firefox-dom-inspector.install, debian/rules: Move
+    extensions files to /usr/lib/mozilla-firefox/extensions/ instead of
+    /usr/lib/mozilla-firefox/defaults/profile/extensions/.
+  * debian/mozilla-firefox.links: Move installed-extensions.txt symlink
+    from /usr/lib/mozilla-firefox/defaults/profile/extensions/ to
+    /usr/lib/mozilla-firefox/extensions/.
+  * debian/mozilla-firefox.prerm: More cleanup on removal of package.
+
+ -- Mike Hommey <mh@glandium.org>  Sun, 22 Aug 2004 21:43:47 +0900
+
+mozilla-firefox (0.9.3-2) unstable; urgency=low
+
+  * xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.s.m4: Comment out
+    NARGSAVE, like I did in 0.9.1-7, should fully fix #262571.
+  * debian/mozilla-firefox.preinst: Remove brace expansion
+    bashism. (Closes: #264200)
+  * debian/control: Depend on debianutils (>= 1.16) since we use mktemp
+    -d. (Closes: #263958)
+  * debian/mozilla-firefox-runner: Make -contentLocale COUNTRY, not
+    lang-COUNTRY. (Closes: #263940)
+
+ -- Eric Dorland <eric@debian.org>  Sun,  8 Aug 2004 23:41:02 -0400
+
+mozilla-firefox (0.9.3-1) unstable; urgency=low
+
+  * New upstream release. (Closes: #263193)
+  * debian/update-mozilla-firefox-chrome.8: Add manpage from Mark Suter
+    for update-mozilla-firefox-chrome.8. (Closes: #263149)
+  * debian/mozilla-firefox.manpages: Add update-mozilla-firefox-chrome.8.
+  * debian/control: Add build-deps on gcc-3.4 for amd64. (Closes: #262679)
+
+ -- Eric Dorland <eric@debian.org>  Wed,  4 Aug 2004 20:21:22 -0400
+
+mozilla-firefox (0.9.1-7) unstable; urgency=low
+
+  * debian/mozilla-firefox-runner:
+    - Reintroduce check for command-line arguments (I broke this last 
+      release). (Closes: #262692, #262462, #262537, #262588, #262727)
+    - Allow overriding of -contentLocale and -UILocale. (Closes: 
+      #240058)
+  * xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips.s: Comment out
+    NARGSAVE reassignment, it is defined elsewhere. (Closes: #262571)
+  * debian/rules: Force amd64 to build with gcc 3.4. (Closes: #262679)
+
+ -- Eric Dorland <eric@debian.org>  Mon,  2 Aug 2004 10:16:46 -0400
+
+mozilla-firefox (0.9.1-6) unstable; urgency=low
+
+  * widget/src/gtk2/keysym2ucs.c: Patch from Eugeniy Meshcheryakov to
+    allow mozilla firefox to enter a ghe with upturn. (Closes: #261543)
+  * debian/mozilla-firefox-runner: 
+    - Remove some mail and composer cruft. 
+    - Add warning if DISPLAY is not set. (Closes: #261465)
+
+ -- Eric Dorland <eric@debian.org>  Thu, 29 Jul 2004 22:49:59 -0400
+
+mozilla-firefox (0.9.1-5) unstable; urgency=low
+
+  * debian/control: Goodbye mozilla-firebird transition package.
+  * debian/mozilla-firefox-runner: Add -a firefox flag when running
+    firefox-bin. (Closes: #259237)
+  * debian/mozilla-firefox.desktop: Add GenericName field.
+  * debian/update-mozilla-firefox-chrome: Fix quoting problem with
+    {*}. (Closes: #257243)
+  * debian/rules: 
+    - Re-enable postscript printing support, since the security 
+      issues turned out to be bogus. (Closes: #257628)
+    - Disable SVG support, it's still too broken to be usable. 
+      (Closes: #259544)
+
+ -- Eric Dorland <eric@debian.org>  Sun, 18 Jul 2004 20:09:14 -0400
+
+mozilla-firefox (0.9.1-4) unstable; urgency=low
+
+  * The "Let's try unstable" release. There are still issues, but there
+    are issues with 0.8 as well, so no more point in waiting.
+  * debian/update-mozilla-firefox-chrome:
+    - Copy over empty Extensions.rdf file on update. (Closes: #257243)
+    - Increase sleep to 15 seconds, hopefully this will work on most 
+      people's machines. 
+  * My apologies to Mike Hommey for mispelling his name in last release.
+
+ -- Eric Dorland <eric@debian.org>  Sun, 11 Jul 2004 23:51:24 -0400
+
+mozilla-firefox (0.9.1-3) experimental; urgency=low
+
+  * Ok, I was wrong, we're still in experimental. I think we need to fix a
+    few more issues before getting this in unstable, like #257258, and
+    make sure the hacky extensions mechanism is more bullet-proof.
+  * debian/rules: --disable-installer, since we don't use it.
+  * debian/update-mozilla-firefox-chrome: 
+    - Wait 8 seconds instead of 5 for the hack, might help some 
+      people reporting problems.
+    - Remove ${LIBDIR}/extensions/{*}. I may move that to 
+      /var/lib/mozilla-firefox eventually, but let's leave it for now.
+  * debian/mozilla-firefox.png.uu: Make a nicer png icon, based on the
+    about box graphic.
+  * debian/mozilla-firefox.preinst: Remove old config files in
+    /etc/mozilla-firefox/pref. (Closes: #257711, 257557)
+  * browser/app/profile: firefox.js: Revert change to app.version,
+    apparently it breaks extensions. (Closes: #257941)
+
+ -- Eric Dorland <eric@debian.org>  Wed,  7 Jul 2004 21:26:55 -0400
+
+mozilla-firefox (0.9.1-2) experimental; urgency=low
+
+  * The "Mike Homey, lord of the bugs" release. Thanks to Mike for being a
+    huge help with bug triage. That's right, help with bugs and your name
+    could have a prestigious place in the changelog.
+  * I'd like my next release to be to unstable, so let me know about
+    profile transition bugs, etc.
+  * debian/control: Build-depend on libcairo1-dev. 
+  * debian/rules: Enable svg support using cairo renderer. (Closes:
+    #215990)
+  * debian/mozilla-firefox-xremote-client: Add -a firefox switch to make
+    the remote client find firefox only. Thanks Jonathan Black. (Closes:
+    #256967)
+  * debian/mozilla-firefox.desktop: Make comment Gnome HIG
+    compliant. (Closes: #257592)
+  * browser/app/profile/firefox.js: 
+    - app.version = 0.9.1.
+    - Disable app updates by default. We're debian, we handle updates.
+  * debian/update-mozilla-firefox-chrome: 
+    - Remove installed-extensions-processed.txt before regenerating. 
+      (Closes: #257243)
+    - Take some, but not all advice from Alexandru Fomin. Improve Xvfb 
+      and extension registration hacks. 
+
+ -- Eric Dorland <eric@debian.org>  Sun,  4 Jul 2004 16:58:17 -0400
+
+mozilla-firefox (0.9.1-1) experimental; urgency=low
+
+  * New upstream release.
+  * config/autoconf.mk.in: Alright, /usr/lib/firefox-0.9 was a bad idea,
+    use /usr/lib/mozilla-firefox. Change all the instances
+    /usr/lib/firefox-0.9 back to /usr/lib/mozilla-firefox. I feel
+    silly. (Closes: #256991)
+  * debian/mozilla-firefox-runner: Actually check for the existence of the
+    .mozilla/firefox directory before trying to clean it. 
+  * debian/update-mozilla-firefox-runner: 
+    - Call firefox-bin, not firefox you silly goose.  
+    - Use mozilla-firefox tempfile, not mozilla-browser.
+    - The horrible hackiness continues: For my previous hack to work, 
+      I need to preseed a profile directory in the home directory I
+      create. Now things should work. (Closes: #256812)
+
+ -- Eric Dorland <eric@debian.org>  Thu,  1 Jul 2004 17:16:29 -0400
+
+mozilla-firefox (0.9-1) experimental; urgency=low
+
+  * New upstream release. There may be regressions from 0.8. (Closes:
+    #254522)
+  * widget/src/gtk/nsGtkMozRemoteHelper.cpp,
+    widget/src/gtk2/nsGtkMozRemoteHelper.cpp,
+    widget/src/xremoteclient/XRemoteClient.cpp: Fix previously applied to
+    fix -remote behaviour undone. Mozilla now includes the program name in
+    the properties to distinguish between various Mozilla apps.
+  * xpcom/reflect/xptcall/src/md/unix/Makefile.in: remove extra endif.
+  * dom/public/idl/core/nsIDOMNSDocument.idl: Reintroduce referrer
+    attribute that got lost somehow.
+  * content/events/src/nsEventStateManager.cpp: Fix a strange broken
+    function call to GetContainer.
+  
+  * debian/rules: 
+    - Follow upstream and --enable-single-profile and 
+      --disable-profilesharing.
+    - Replace /usr/lib/mozilla-firefox with /usr/lib/firefox-0.9.
+    - --user-app-dir=.mozilla to jive with new location.
+    - Remove dom-inspector extension dir from the regular package. 
+  * debian/control: Depend on xvfb for insane hack below.
+  * debian/mozilla-firefox.install:
+    - Replace /usr/lib/mozilla-firefox with /usr/lib/firefox-0.9.
+    - Remove ipc dir, mozipcd.
+    - Add init.d, greprefs dirs.
+  * debian/mozilla-firefox.dirs:
+    - Add /var/lib/mozilla-firefox/extensions{,.d}
+  * debian/mozilla-firefox-dom-inspector.dirs: Add
+    /var/lib/mozilla-firefox/extensions.d.
+  * debian/mozilla-firefox-dom-inspector.install:
+    - Replace /usr/lib/mozilla-firefox with /usr/lib/firefox-0.9.
+    - Install dom-inspector extension dir.
+  * debian/mozilla-firefox.links:
+    - Replace /usr/lib/mozilla-firefox with /usr/lib/firefox-0.9.
+    - Link /usr/lib/mozilla-firefox to /usr/lib/firefox-0.9.
+    - Link installed-extensions.txt to our place in 
+      /var/lib/mozilla-firefox.
+  * debian/mozilla-firefox-runner: 
+    - Replace /usr/lib/mozilla-firefox with /usr/lib/firefox-0.9.
+    - Fix xprintorg typo. (Closes: #255706)
+    - Search .mozilla/firefox for XUL.mfasl files.
+  * debian/mozilla-firefox-xremote-client: Replace
+    /usr/lib/mozilla-firefox with /usr/lib/firefox-0.9.
+  * debian/update-mozilla-firefox-chrome: 
+    - Replace /usr/lib/mozilla-firefox with /usr/lib/firefox-0.9.
+    - Capture return values from reg* commands on error, stolen 
+      from mozilla source.
+    - Remove returns from check_running.
+    - Pull in snippets from /var/lib/mozilla-firefox/extensions.d 
+      to generate installed-extensions.txt for new extensions mechanism.  
+    - An insane hack, but necessary because of upstream: Launch a Xvfb 
+      to run firefox to generate the necessary extension metadata. I've
+      been told this will not be necessary in the next version. 
+
+ -- Eric Dorland <eric@debian.org>  Mon, 28 Jun 2004 23:40:59 -0400
+
+mozilla-firefox (0.8-12) unstable; urgency=low
+
+  * The "Last Chance Before 0.9" release.
+  * debian/mozilla-firefox-runner: Fix unescaped \n, thanks Olly
+    Betts. (Closes: #252436)
+  * debian/update-mozilla-firefox-chrome: Watch out for empty
+    LD_LIBRARY_PATH. Thanks George Cristian Birzan. (Closes: #254142)
+  * debian/README.Debian: Restructure and update a bit.
+  * debian/presubj: Add bug information from README.Debian for reportbug.
+  * debian/mozilla-firefox.install: Install the presubj. 
+
+ -- Eric Dorland <eric@debian.org>  Mon, 14 Jun 2004 19:39:27 -0400
+
+mozilla-firefox (0.8-11) unstable; urgency=low
+
+  * Apply amd64 fix from #249211. 
+  * debian/README.Debian: Shamelessly stole the java plugin installation
+    instructions from the mozilla package. (Closes: #243513)
+  * nsCommonWidget.cpp, nsCommonWidget.h, nsWindow.cpp: Apply patch (with
+    some hand massaging) from upstream bugzilla bug #209342 to fix initial
+    window placement. (Closes: #235209, 241519)
+  * nsprpub/pr/src/misc/prnetdb.c: Apply patch from Miquel van Smoorenburg
+    to prevent unless reverse DNS lookups. (Closes: #251978)
+  * debian/mozilla-firefox-runner: Apply patch from Jasper Spaans to fix
+    remote xprint printing. (Closes: #252072)
+
+ -- Eric Dorland <eric@debian.org>  Tue,  1 Jun 2004 23:12:36 -0400
+
+mozilla-firefox (0.8-10) unstable; urgency=low
+
+  * debian/mozilla-firefox.install: Don't install uuencoded file. (Closes:
+    #251441)
+  * debian/mozilla-firefox-runner: unset AUDIODEV which can cause
+    crashes. Thanks Christopher Armstrong. (Closes: #236231)
+  * update-mozilla-firefox-chrome: Port security fix from #249613 to
+    handle insecure tempfile creation.
+  * debian/rules: Following the advice of #247585 I'm disabling postscript
+    printing. Perhaps this will alleviate some of the other printing
+    problems.
+
+ -- Eric Dorland <eric@debian.org>  Sun, 30 May 2004 01:47:52 -0400
+
+mozilla-firefox (0.8-9) unstable; urgency=low
+
+  * debian/control: 
+    - Suggest latex-xft-fonts for MathML fonts. Thanks Michael 
+      JasonSmith. (Closes: #216925)
+    - Build depend on libx11-dev & libxp-dev instead of xlibs-dev to 
+      reflect new X packages.
+  * widget/src/gtk2/nsWindow.cpp: Apply patch from Peter Colberg to ignore
+    unused mouse buttons. (Closes: #244305)
+  * debian/README.Debian: Document the fact that the loopback interface
+    has to be up and unfiltered for things to work right.
+
+ -- Eric Dorland <eric@debian.org>  Wed,  5 May 2004 23:30:42 -0400
+
+mozilla-firefox (0.8-8) unstable; urgency=low
+
+  * security/nss/lib/freebl/unix_rand.c: Remove code that called netstat
+    to gain so entropy. It's pretty useless on a Linux system. Thanks
+    Wichert. (Closes: #241200)
+  * debian/README.Debian: Add note about changing the button order in the
+    dialog boxes. (Closes: #240261)
+  * debian/control: Add dummy package for mozilla-firebird to smooth
+    upgrades. (Closes: #235577)
+
+ -- Eric Dorland <eric@debian.org>  Sat,  3 Apr 2004 16:19:34 -0500
+
+mozilla-firefox (0.8-7) unstable; urgency=low
+
+  * debian/mozilla-firefox-runner: 
+    - Cleanup XUL.mfasl whenever firefox is run with no 
+      command-line. (Closes: #238717)
+    - Add patch from Laurent Buffler to add config to allow 
+      new tabs to be opened instead of new windows. (Closes: #239323)
+  * debian/mozilla-firefoxrc: Put the new FIREFOX_OPEN_IN variable in
+    there and document it's use.
+
+ -- Eric Dorland <eric@debian.org>  Sat, 27 Mar 2004 17:21:51 -0500
+
+mozilla-firefox (0.8-6) unstable; urgency=low
+
+  * debian/control: Build-depend on g++-3.3 (>= 3.3.3-4) to work around
+    broken 3.3.3-3 release. (Closes: #238318, #238241, #238441, #238523,
+    #238534)
+  * debian/rules: Install new small-firefox icon. 
+  * debian/mozilla-firefox{.png, .xpm, -small.xpm}: Use the new DFSG-free
+    icons, the old pretty ones are trademarked and not DSFG-free. I know,
+    it's stupid. Complain to the Mozilla Foundation, not me. (Closes:
+    #234869)
+
+ -- Eric Dorland <eric@debian.org>  Sun, 21 Mar 2004 22:09:16 -0500
+
+mozilla-firefox (0.8-5) unstable; urgency=low
+
+  * Rebuild with g++-3.3 3.3.3-2 to work around broken g++. (Closes:
+    #238318)
+
+ -- Eric Dorland <eric@debian.org>  Wed, 17 Mar 2004 21:38:58 -0500
+
+mozilla-firefox (0.8-4) unstable; urgency=low
+
+  * debian/README.Debian: 
+    - Tell people not to remove their ~/.firefox directory. Just move it
+      out of the way. (Closes: #235594)
+    - Add notes about the sound dsp. (Closes: #236678)
+  * debian/mozilla-firefox-runner: 
+    - Don't redirect stderr. (Closes: #236160)
+    - Add get_locale code from Aurelien Jarno (Closes: #235521)
+    - Fix dsp auto-detection code. (Closes: #236678)
+  * debian/rules: Add default locale file.
+  * debian/mozilla-firefox.dirs: Add locales dir. 
+
+  * browser/app/profile/all.js,
+    content/events/src/nsEventStateManager.cpp,
+    modules/libpref/src/init/all.js, widget/public/nsGUIEvent.h,
+    widget/src/gtk/nsWidget.cpp: Reapply extended mouse events patch from
+    Derek Upham. (Closes: #235385, #230876)
+  * browser/base/content/browser-sets.inc: Make ESC stop animations
+    again. (Closes: #235474)
+
+ -- Eric Dorland <eric@debian.org>  Tue, 16 Mar 2004 00:31:19 -0500
+
+mozilla-firefox (0.8-3) unstable; urgency=low
+
+  * debian/mozilla.firefox.menu: Change the case of
+    mozilla-Firefox. (Closes: #234982, #234755)
+  * debian/NEWS.Debian: Move to debian/mozilla-firefox.NEWS so that it
+    actually gets installed. (Closes: #234700)
+  * debian/update-mozilla-firefox-chrome: Setup dummy home directory to
+    capture silly .firefox directory. (Closes: #234855)
+  * debian/mozilla-firefox.png.uu, debian/mozilla-firefox.xpm: Use the
+    new, pretty mozilla-firefox icons. (Closes: #234869)
+  * debian/rules: Install the pretty icon in the right places. 
+
+ -- Eric Dorland <eric@debian.org>  Thu, 26 Feb 2004 21:10:27 -0500
+
+mozilla-firefox (0.8-2) unstable; urgency=low
+
+  * The "what he taketh, he giveth back" release.
+  * debian/rules:
+    - Disable the wallet extension, this really closes #222447.
+    - Remove some more cruft left over from the patch system.
+    - Reinstall the dom-inspector.
+  * debian/control: Add the dom-inspector back, now that it is supported
+    upstream.
+  * debian/mozilla-firefox-dom-inspector.{install,dirs,postinst,postrm}:
+    Bring these files back.
+  * docshell/base/nsWebShell.cpp: Only do keyword lookup on when DNS
+    entries don't exist. (Closes: #233916, #218033, #211524)
+
+ -- Eric Dorland <eric@debian.org>  Mon, 23 Feb 2004 21:48:03 -0500
+
+mozilla-firefox (0.8-1) unstable; urgency=low
+  
+  * The "Let's Change Our Name Every Other Day" release.
+  * New upstream release, mozilla-firebird has been renamed to
+    mozilla-firefox. Let's hope it lasts. (Closes: #231903, #222447)
+  * debian/mozilla-firebird.*: Renamed to debian/mozilla-firefox.*.
+
+  * debian/README.Debian: Update for firefox, remove blurb about the
+    inspector.
+  * debian/NEWS.Debian: Explain how to move your configs over. I may make
+    this automatic if enough people complain, but I'm loathe to muck
+    around in pople's home directories.
+
+  * debian/control:
+    - Rename the package.
+    - Tweak description to list Firefox's previous aliases.
+    - Remove conflicts on mozilla-firebird-dom-inspector.
+
+  * debian/rules: 
+    - s/firebird/firefox/g, s/MozillaFirebird/firebird/g.
+    - Comment out some old inspector code. 
+    - Remove unused patch subsystem.
+    - Disable gtktest. We don't need no stinking tests.
+    - Remove disable plaintext editor line, not sure why it's there.
+    - Disable LDAP support. We don't use it.
+    - Remove executable bit on *.so files.
+    - Remove useless preference files.
+    - Exclude the inspector files.
+    - Don't remove installed-chrome, we don't install it anymore.
+    - user-app-dir = .firefox. (Closes: #212301)
+    - export MOZILLA_OFFICIAL for the build ID. (Closes: #231133)
+
+  * debian/mozilla-firefox-runner: 
+    - s/firebird/firefox/g.
+    - Remove composer and editor functions.
+    - Use .firefox directory.
+
+  * debian/mozilla-firefox.install: 
+    - s/firebird/firefox/g, s/MozillaFirebird/firefox/g.
+    - Don't install timebombgen.
+    - Install icons directory.
+    - Don't install installed-chrome.txt, we just remove it anyway. 
+
+  * debian/mozilla-firefox.desktop, debian/mozilla-firefox.dirs,
+    debian/mozilla-firefox.manpages, debian/mozilla-firefox.links,
+    debian/mozilla-firefox.menu, debian/mozilla-firefox.mime,
+    debian/mozilla-firefoxrc, debian/mozilla-firefox.postinst,
+    debian/mozilla-firefox.prerm, debian/update-mozilla-firefox-chrome,
+    debian/mozilla-firefox.1, debian/mozilla-firefox-xremote-client:
+    s/firebird/firefox/g, s/MozillaFirebird/firefox/g.
+
+  * debian/mozilla-firefox.links: Link mozilla-firefox.1 to firefox.1.
+  
+  * debian/mozilla-firefox.preinst: Remove, at least with the rename I can
+    erase some of my previous blunders.
+
+  * debian/mozilla-firefox.{png.uu,xpm}: Use the package icon.
+
+  * browser/app/nsBrowserApp.cpp: Change package name to Firefox, so now
+    the ~/.firefox is used. (Closes: #196550)
+
+  * browser/app/profile/all.js: Merge in autoscroll fixes.
+  * browser/base/content/browser-sets.inc: Merge in upstream stop button
+    fix.
+  * modules/plugin/samples/default/unix/nullplugin.c: Merge in removal of
+    commented code.
+  * nsprpub/pr/include/md/_linux.cfg, nsprpub/pr/include/md/_linux.h,
+    security/coreconf/Linux.mk: Merge in hppa build fixes from upstream.
+  * config/autoconf.mk.in: Install into /usr/lib/mozilla-firefox now.
+  * content/base/src/nsDocumentViewer.cpp: Remove redundant stop patch
+    since it has been merged upstream.
+  * content/events/src/nsEventStateManager.cpp,
+    modules/libpref/src/init/all.js, widget/src/gtk/nsWidget.cpp: Revert
+    back to upstream version. There was a patch here to add support for
+    extended mouse buttons, but I'm removing it since I don't trust that
+    it works in the new version correctly. Send me another patch if you
+    want this functionality back.
+  * toolkit/components/passwordmgr/base/nsPasswordManager.cpp: Revert this
+    back to upstream, I'm not sure which patches I applied to this file,
+    likely something to try and fix the double password prompt.
+  * widget/src/xremoteclient/XRemoteClient.cpp,
+    widget/src/xremoteclient/XRemoteClient.h: Revert to upstream version,
+    I believe it does the right thing now, but the patch I used does not
+    apppear to have been used. Restore the properties to _FIREFOX_*
+    though.
+  * widget/src/gtk/nsGtkMozRemoteHelper.cpp,
+    widget/src/gtk2/nsGtkMozRemoteHelper.cpp: Change the _FIREBIRD_* to
+    _FIREFOX_* here as well.
+  * content/base/src/nsDocument.cpp: Comment out nsDocument::GetDomConfig,
+    needed to get things to compile.
+
+ -- Eric Dorland <eric@debian.org>  Sun, 15 Feb 2004 21:28:45 -0500
+
+mozilla-firebird (0.7-7) unstable; urgency=low
+
+  * debian/mozilla-firebird-runner: Open a new window when loading a
+    regular file. (Closes: #228853)
+
+ -- Eric Dorland <eric@debian.org>  Thu, 29 Jan 2004 22:12:30 -0500
+
+mozilla-firebird (0.7-6) unstable; urgency=medium
+
+  * The "Indian-giver-christmas" release.
+  * Urgency medium since we're closing some critical bugs that need to get
+    in before a freeze.
+  * Completely remove mozilla-firebird-dom-browser. No one stepped up to
+    help fix it's brokeness in 0.7 and I don't use it or particularly care
+    about it. So it is no more. If someone steps up to take responsibility
+    I might put it back, but otherwise it may RIP. (Closes: #222085)
+  * debian/mozilla-firebird-runner: Remove XUL.mfasl uncoditionally
+    now. There is a corner case where this file is corrupted on upgrade
+    when firebird was running. This is a total hack, and not an elegant
+    solution, but at least it fixes the problem. (Closes: #224779,
+    #224323)
+  * debian/control: Conflict against old mozilla-firebird-dom-inspector
+    since it doesn't work anymore.
+
+ -- Eric Dorland <eric@debian.org>  Thu, 25 Dec 2003 15:54:21 -0500
+
+mozilla-firebird (0.7-5) unstable; urgency=low
+
+  * browser/base/content/browser-sets.inc: Patch to make ESC stop actually
+    work. (Closes: #223382)
+  * debian/rules: Turn down optimizations on sparc. (Closes: #223760)
+
+ -- Eric Dorland <eric@debian.org>  Sun, 14 Dec 2003 23:01:59 -0500
+
+mozilla-firebird (0.7-4) unstable; urgency=low
+
+  * The "All of Takuo's hard work really pays off" release.
+  * toolkit/components/passwordmgr/base/nsPasswordManager.cpp: Patch from
+    upstream bugzilla (#220214) to fix double password prompt
+    problem. (Closes: #222696)
+  * xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.s.m4: Stolen
+    patch from mozilla package to make mozilla-firebird build on
+    mips. (Closes: #222743)
+  * content/base/src/nsDocumentViewer.cpp: Port yet another patch to allow
+    the ESC key to stop animated gifs. (Closes: #223382)
+
+ -- Eric Dorland <eric@debian.org>  Mon,  8 Dec 2003 23:59:16 -0500
+
+mozilla-firebird (0.7-3) unstable; urgency=low
+
+  * debian/control: Add dependency on psmisc since we use fuser. Thanks
+    Daniel Schröter.
+  * widget/src/xremoteclient/XRemoteClient.{cpp,h}: Apply patch from
+    bugzilla to fix -remote behaviour on modern WMs. Thanks Nikolai
+    Prokoschenko. (Closes: #197632)
+  * nsprpub/pr/src/misc/prdtoa.c: Apply fix from mozilla package (#215067)
+    to fix building on arm. This is a partial fix to #222743.
+  * debian/patches: Remove these. Put everything in CVS.
+
+ -- Eric Dorland <eric@debian.org>  Fri,  5 Dec 2003 20:03:46 -0500
+
+mozilla-firebird (0.7-2) unstable; urgency=low
+
+  * Apply excellent patch from Alexander Sack <asac@jwsdot.com> to fix the
+    issues with mozilla running and firebird not starting. (Closes:
+    #216264)
+  * browser/app/profile/all.js: Set the default of "general.autoScroll" to
+    false because it annoyes me. (Closes: #221661)
+
+ -- Eric Dorland <eric@debian.org>  Wed, 19 Nov 2003 20:59:55 -0500
+
+mozilla-firebird (0.7-1) unstable; urgency=low
+
+  * New upstream release. (Closes: #216019)
+  * debian/patches/dom-inspector.diff: Remove, and apply directly into my
+    CVS.
+  * debian/patches/pref.diff: Removed, doesn't seem applicable anymore.
+  * debian/rules: export MOZ_FIREBIRD=1.
+  * debian/control: 
+    - Change Chimera to Camino. (Closes: #220821)
+    - Fix typos in descriptions. (Closes: #218202)
+    - Add build-deps on m4. (Closes: #219681)
+
+ -- Eric Dorland <eric@debian.org>  Wed, 12 Nov 2003 23:01:35 -0500
+
+mozilla-firebird (0.6.1-8) unstable; urgency=low
+
+  * Apply patch to make forward and back buttons work on mice. (Closes:
+    #211606)
+  * debian/rules: Use -O optimization on alpha, so it will build
+    again. (Closes: #213603)
+  
+ -- Eric Dorland <eric@debian.org>  Fri,  3 Oct 2003 00:07:44 -0400
+
+mozilla-firebird (0.6.1-7) unstable; urgency=low
+
+  * Rebuild with the latest and greatest from unstable. This seems to fix
+    the problems with bookmarks people were having, at least for me. No
+    idea why. Please reopen if this doesn't fix it for you. (Closes:
+    #209339, #211706, #211286, #211146, #212011) 
+
+ -- Eric Dorland <eric@debian.org>  Mon, 22 Sep 2003 00:00:08 -0400
+
+mozilla-firebird (0.6.1-6) unstable; urgency=low
+
+  * Patch from Eric Wong <normalperson@yhbt.net> to make plugin requests
+    less annoying. (Closes: #196609)
+  * debian/rules: Stop building libart.
+  * debian/mozilla-firebird.links: Fix path to bookmarks file. (Partial
+    fix to #211286)
+
+ -- Eric Dorland <eric@debian.org>  Wed, 17 Sep 2003 20:22:56 -0400
+
+mozilla-firebird (0.6.1-5) unstable; urgency=low
+
+  * The "sorry Chris Gray" release.
+  * debian/rules: disable SVG. This was causing drag and drop to lock up
+    X and possibly fixes #208630. (Closes: #209371)
+  * debian/mozilla-firebird-runner: Remove XUL.mfasl if we have upgraded,
+    since it can cause problems. (Closes: #200073, #202130, #207351)
+
+ -- Eric Dorland <eric@debian.org>  Sat, 13 Sep 2003 20:15:37 -0400
+
+mozilla-firebird (0.6.1-4) unstable; urgency=low
+
+  * The "pleasing Chris Gray" release.
+  * other-licenses/libart_gpl: Add this library for svg.
+  * debian/rules: 
+    - Enable svg.
+    - Move bookmarks.html file into /etc. (Closes: #207398)
+  * debian/mozilla-firebird.links: Add links back to files moved to /etc.
+  * security/coreconf/Linux2.6.mk: Add this as a copy of Linux2.5.mk to
+    get mozilla-firebird to build on 2.6. (Closes: #207821)
+
+ -- Eric Dorland <eric@debian.org>  Sun, 31 Aug 2003 04:40:30 -0400
+
+mozilla-firebird (0.6.1-3) unstable; urgency=low
+
+  * debian/mozilla-firebird.prerm: Remove mozilla alternative on
+    remove. (Closes: #205310)
+  * debian/debsearch.{gif.uu,src}: Debian search plugin graciously
+    contributed by Fergus McKenzie-Kay <Linux@NerdIT.com>.
+  * debian/rules: 
+    - uudecode and clean up debsearch.gif.uu.
+    - Steal platform specific optimization code from mozilla 
+      package. Thanks Brian Nelson. (Closes: #206309) 
+  * debian/mozilla-firebird.install: Install the above files. 
+  * debian/control: Update Standards-Version to 3.6.1.
+
+ -- Eric Dorland <eric@debian.org>  Sun, 24 Aug 2003 19:09:11 -0400
+
+mozilla-firebird (0.6.1-2) unstable; urgency=low
+
+  * The "Stop Pestering Me Already!" release.
+  * debian/control: Only recommend xprt-xprintorg, don't require
+    it. (Closes: #204176)
+
+ -- Eric Dorland <eric@debian.org>  Sun, 10 Aug 2003 20:00:11 -0400
+
+mozilla-firebird (0.6.1-1) unstable; urgency=low
+
+  * New upstream release. (Closes: #203518, #201203)
+  * debian/control:
+    - Standards-Version to 3.6.0.
+    - Don't provide www-browser anymore. (Closes: #201035)
+    - Depend on xprt-xprintorg so printing will work. (Closes: #202418)
+  * debian/mozilla-firebird.preinst: Remove www-browser alternative.
+  * debian/mozilla-firebird.postinst: Don't install www-browser alternative.
+  * debian/mozilla-firebird.prerm: Don't remove www-browser alternative
+    anymore.
+  * debian/README.Debian: Added note about configuration breaking on
+    upgrade. (Closes: #202130)
+  * debian/patches/classic.diff: Removed. Not sure what it's point was.
+  * debian/rules: Add --disable-pedantic to the configure options.
+
+ -- Eric Dorland <eric@debian.org>  Sun,  3 Aug 2003 14:58:12 -0400
+
+mozilla-firebird (0.6-8) unstable; urgency=low
+
+  * debian/patches/alpha-build-fix.diff: Steal patch from mozilla to allow
+    building on alpha. (Closes: #198638)
+  * debian/patches/hppa-build-fix.diff: Steal patch from mozilla to allow
+    building on hppa, clean it up so it applies cleanly. (Closes: #199068)
+  * debian/mozilla-firebird.png.uu: Added uuencoded nice png icon.
+  * debian/rules: Add code to decode and clean up the new icon file.
+  * debian/mozilla-firebird.install: Install new icon.
+  * debian/mozilla-firebird.desktop: Use the new icon.
+
+ -- Eric Dorland <eric@debian.org>  Fri, 27 Jun 2003 23:21:56 -0400
+
+mozilla-firebird (0.6-7) unstable; urgency=low
+
+  * debian/mozilla-firebird.1: Stole the mozilla manpage for my own
+    nefarious purposes. (Closes: #196638)
+  * debian/mozilla-firebird.postrm: Add slave links to the
+    mozilla-firebird manpage. (Closes: #197145)
+  * debian/mozilla-firebird-xremote-client: Set up the environment
+    properly so it returns correct information. (Closes: #197632)
+  * debian/mozilla-firebird.xpm: Added icon from
+    http://iconpacks.mozdev.org/phoenix/iconshots/flame48true.png to have
+    a nice menu icon. (Closes: #197565)
+  * Updated the README.Debian with some helpful bug reporting tips.
+  * debian/rules: Replaced dh_installmanpages with dh_installman.
+
+ -- Eric Dorland <eric@debian.org>  Sun, 22 Jun 2003 15:15:37 -0400
+
+mozilla-firebird (0.6-6) unstable; urgency=low
+
+  * debian/mozilla-firebird.postinst: Add priority 0 alternative on
+    mozilla. (Closes: #196444)
+  * debian/control: Add build-depends on libxrender-dev, libmng-dev,
+    libpng12-dev, libjpeg62-dev.
+  * debian/rules: 
+    - Build with system jpeg, mng and png libs.
+    - Exclude inspector files from mozilla-firebird. 
+      (Closes: #196432, #196509)
+
+ -- Eric Dorland <eric@debian.org>  Sat,  7 Jun 2003 15:19:23 -0400
+
+mozilla-firebird (0.6-5) unstable; urgency=low
+
+  * The "Mike Hommey is my homey" release.
+  * Thanks to Mike Hommey <mh@glandium.org> for his excellent work on this
+    version (it's 99% his), which I've shamelessly stolen.
+  * Added a README.Debian file.
+  * Added a separate mozilla-firebird-dom-inspector package.
+  * debian/patches/dom-inspector.diff:
+    - add DOM Inspector to Tools menu. (note: DOM Inspector is still
+      not very well integrated with Firebird)
+    - remove modern skin references.
+  * debian/patches/xpinstall.diff: remove unneeded chrome registrations
+    from xpinstall/packager/unix/browser.jst.
+  * debian/patches/classic.diff: remove
+    themes/classic/global/win/preview.gif from jar file and modify
+    preview image reference in rdf file to Preview.png.
+  * debian/patches/pref.diff: remove preview image constraints in
+    browser/components/prefwindow/skin/pref.css file to avoid deformation
+    of preview image in classic theme.
+  * debian/mozilla-firebird.preinst: added #DEBHELPER#.
+  * debian/mozilla-firebird.install:
+    - Don't install the modern.jar and embed-sample.jar files.
+    - Remove files related to dom-inspector.
+  * debian/rules:
+    - enabling xinerama support.
+    - disabling build of chatzilla and venkman.
+    - moved /var/lib/mozilla-firebird/chrome.d/99default to
+      /var/lib/mozilla-firebird/chrome.d/00all
+    - remove references to embed-sample.jar in
+      /var/lib/mozilla-firebird/chrome.d/00all
+    - Add some comments.
+    - Change == to =, for more strict /bin/sh's.
+  * debian/control: Build-Depend on libidl-dev (>= 0.8.0) because the
+    configure script requires at least this version.
+  * debian/copyright: Make this a real debian copyright file. 
+  
+ -- Eric Dorland <eric@debian.org>  Thu,  5 Jun 2003 01:00:32 -0400
+
+mozilla-firebird (0.6-4) unstable; urgency=low
+
+  * debian/rules: Change -O2 to -O for building on powerpc.
+  * debian/mozilla-firebird.preinst: Delete
+    /usr/lib/mozilla-firebird/defaults/pref on upgrade to facilitate
+    transition to prefs in /etc. Thanks to all who reported this.
+
+ -- Eric Dorland <eric@debian.org>  Tue, 27 May 2003 21:45:06 -0400
+
+mozilla-firebird (0.6-3) unstable; urgency=low
+
+  * First attempt at a debian upload. (Closes: #163270)
+  * debian/rules:
+    + Small fix to Mike Hommey's chrome patch.
+    + Suggestion from Bernhard R. Link to install
+      /usr/lib/mozilla-firebird/defaults/pref to 
+      /etc/mozilla-firebird/pref
+    + Add dh_installmime call.
+  * debian/mozilla-firebird.mime: Install mime type handlers for firebird.
+  * debian/mozilla-firebird.links: Link
+    /usr/lib/mozilla-firebird/defaults/pref to /etc/mozilla-firebird/pref
+  * debian/mozilla-firebird.install: Don't install the inspector.jar.
+
+ -- Eric Dorland <eric@debian.org>  Mon, 26 May 2003 00:28:40 -0400
+
+mozilla-firebird (0.6-2) unstable; urgency=low
+
+  * debian/rules:
+    + Add --with-user-appdir=.mozilla-firebird, since it still 
+      defaults to .phoenix.
+    + Don't use the ${prefix} variable, use /usr, since ${prefix} 
+      doesn't seem to work.
+    + Use --without-system-nspr.
+  * debian/mozilla-firebird.install:
+    + Be picky about what chrome files we install, since there's 
+      quite a few we don't need, and a bunch of empty dirs.
+  * Excellent patch from Mike Hommey <mh@glandium.org> to add a
+    update-mozilla-firebird-chrome script.
+  
+ -- Eric Dorland <eric@debian.org>  Sat, 24 May 2003 13:00:44 -0400
+
+mozilla-firebird (0.6-1) unstable; urgency=low
+
+  * New upstream release.
+  * Renamed to mozilla-firebird.
+  * Changed phoenix to mozilla-firebird where appropriate.
+  * debian/mozilla-firebird.links: Add link mozilla-firebird to
+    MozillaFirebird.
+  * debian/control:
+    + Standars-Version to 3.5.10.0.
+    + Build-depend on gtk2 libs now.
+    + Build-depend on libidl-dev.
+    + Add Provides x-www-browser.
+  * debian/rules:
+    + Enable building with the gtk2 libs.
+    + Make mozilla-firebird-xremote-client executable in install target.
+  * debian/mozilla-firebird.desktop: Added gnome menu entry.
+  * debian/mozilla-firebird.{prerm,postinst}: Add alternatives to
+    www-browser and x-www-browser.
+
+ -- Eric Dorland <eric@debian.org>  Mon, 19 May 2003 20:43:39 -0400
+
+phoenix (0.5-4) unstable; urgency=low
+
+  * debian/control: Depend on fontconfig.
+  * debian/rules: Add source-tarball-from-cvs to build a orig tarball from
+    a checked out cvs tree. Now I can provide source package. And there
+    was much rejoicing.
+
+ -- Eric Dorland <eric@debian.org>  Fri, 17 Jan 2003 21:06:47 -0500
+
+phoenix (0.5-3) unstable; urgency=low
+
+  * debian/phoenix-xremote-client: Added to send remote commands to
+    phoenix. Just a wrapper that calls phoenix-bin -remote.
+  * debian/phoenix-runner: 
+    + Use phoenix-xremote-client.
+    + Replace MOZILLA_DSP with PHOENIX_DSP.
+  * debian/phoenixrc: phoenix-runner uses this file to determine what dsp
+    to start.
+  * debian/phoenix.install: 
+    + Install phoenix-xremote-client, and don't install
+	  mozilla-xremote-client.
+    + Install phoenixrc.
+
+ -- Eric Dorland <eric@debian.org>  Mon, 23 Dec 2002 02:52:21 -0500
+
+phoenix (0.5-2) unstable; urgency=low
+
+  * debian/control: 
+    + Add Provides: www-browser.
+    + Build-depend on libxft2-dev, libnspr-dev.
+  * debian/rules:
+    + Use xft and the system nspr.
+    + Install phoenix-runner.
+  * debian/phoenix-runner: Stolen from the mozilla package to run phoenix.
+
+ -- Eric Dorland <eric@debian.org>  Sat, 21 Dec 2002 02:03:11 -0500
+
+phoenix (0.5-1) unstable; urgency=low
+
+  * New upstream release.
+  * debian/phoenix.install: Fix paths to phoenix libs.
+  * debian/control: 
+    + Standards-Version to 3.5.8
+    + Improve build-deps.
+  * debian/rules: 
+    + Have configure options here, no more .mozconfig.
+    + Steal some patch code from Colin.
+  * debian/patches/mozappdir.diff: Change the mozappdir.
+  
+ -- Eric Dorland <eric@debian.org>  Mon,  9 Dec 2002 02:43:13 -0500
+
+phoenix (0.4-3) unstable; urgency=low
+
+  * debian/phoenix.menu: Add menu entry.
+  * Rebuild to fix libstdc++ dependency.
+  * .mozonfig: Disable more tests.
+
+ -- Eric Dorland <eric@debian.org>  Wed, 20 Nov 2002 19:13:18 -0500
+
+phoenix (0.4-2) unstable; urgency=low
+
+  * debian/control:
+    + Add build-depends.
+    + Fix section and description.
+  * .mozconfig:
+    + Use system zlib.
+
+ -- Eric Dorland <eric@debian.org>  Wed, 13 Nov 2002 19:03:52 -0500
+
+phoenix (0.4-1) unstable; urgency=low
+
+  * Initial release.
+  
+ -- Eric Dorland <eric@debian.org>  Mon, 11 Nov 2002 23:09:41 -0500
--- mozilla-firefox-1.0.4.orig/debian/presubj
+++ mozilla-firefox-1.0.4/debian/presubj
@@ -0,0 +1,17 @@
+*** Please submit non packaging issue (e.g. feature requests) bugs to
+the Debian BTS and the upstream bugzilla
+(http://bugzilla.mozilla.org/buglist.cgi?product=Firefox) and put a
+reference to the bugzilla bug in the Debian bug report, to ease bug
+triage for the maintainers. Thank you. ***
+
+If your Firefox installation pre-dates 1.0, you might have had problems
+Firefox not really cleanly supporting upgrade from one release to another.
+Please try moving around your ~/.mozilla/firefox directory to see if it
+helps with your issue.
+
+Firefox requires the loopback interface (lo) to be up and unfiltered
+to accept keyboard input and function correctly. Please make sure this
+is the case before filing any bugs.
+
+If you are seeing XML parsing errors, please make sure you kill all
+running Firefoxes and reload before filing any bugs. 
--- mozilla-firefox-1.0.4.orig/debian/compat
+++ mozilla-firefox-1.0.4/debian/compat
@@ -0,0 +1 @@
+4
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox-gnome-support.postinst
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox-gnome-support.postinst
@@ -0,0 +1,7 @@
+#!/bin/sh -e
+ 
+if [ "$1" = "configure" ] ; then
+    update-mozilla-firefox-chrome
+fi
+ 
+#DEBHELPER#
--- mozilla-firefox-1.0.4.orig/debian/update-mozilla-firefox-chrome.8
+++ mozilla-firefox-1.0.4/debian/update-mozilla-firefox-chrome.8
@@ -0,0 +1,14 @@
+.TH UPDATE-MOZILLA-FIREFOX-CHROME 8 
+.SH NAME
+update-mozilla-firefox-chrome \- maintenance script for Mozilla Firefox
+.SH SYNOPSIS
+.B update-mozilla-firefox-chrome [ -v ]
+.SH OPTIONS
+.TP
+\fB\-v\fR
+Display warning messages, if any.
+.SH DESCRIPTION
+Run as superuser to update the installation of Mozilla Firefox.
+This script is normally called by the package maintenance script; however, you may invoke it yourself if you've added chrome to Mozilla Firefox.
+.SH "SEE ALSO"
+.BR mozilla-firefox (1).
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox-dom-inspector.postinst
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox-dom-inspector.postinst
@@ -0,0 +1,7 @@
+#!/bin/sh -e
+ 
+if [ "$1" = "configure" ] ; then
+    update-mozilla-firefox-chrome
+fi
+ 
+#DEBHELPER#
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox.xpm
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox.xpm
@@ -0,0 +1,1144 @@
+/* XPM */
+static char * mozicon50_xpm[] = {
+"48 48 1093 2",
+"  	c None",
+". 	c #2099CF",
+"+ 	c #2CA7D9",
+"@ 	c #33AEDD",
+"# 	c #34B2E1",
+"$ 	c #35B8E5",
+"% 	c #2FBAE8",
+"& 	c #26B5E4",
+"* 	c #199FD6",
+"= 	c #177DB8",
+"- 	c #2C8FC4",
+"; 	c #43A0CE",
+"> 	c #55ADD6",
+", 	c #5CB5DD",
+"' 	c #61C4E8",
+") 	c #63CBED",
+"! 	c #64CFF1",
+"~ 	c #63D1F2",
+"{ 	c #5ECCEF",
+"] 	c #57C3E9",
+"^ 	c #4EB8E1",
+"/ 	c #3CABD9",
+"( 	c #2A9ED1",
+"_ 	c #1991C9",
+": 	c #0F7CBA",
+"< 	c #166EAC",
+"[ 	c #3387BC",
+"} 	c #4797C6",
+"| 	c #51A0CC",
+"1 	c #56A7D2",
+"2 	c #5BAED7",
+"3 	c #60B6DD",
+"4 	c #67CDEE",
+"5 	c #69D3F2",
+"6 	c #6BD4F4",
+"7 	c #69D3F4",
+"8 	c #63CDEF",
+"9 	c #5AC0E6",
+"0 	c #51B6DF",
+"a 	c #49ACD8",
+"b 	c #42A2D1",
+"c 	c #3898CA",
+"d 	c #298CC2",
+"e 	c #167EB9",
+"f 	c #0B5A9C",
+"g 	c #2674AE",
+"h 	c #3D87BA",
+"i 	c #4590C0",
+"j 	c #4B97C6",
+"k 	c #519FCB",
+"l 	c #58A6D1",
+"m 	c #5DADD5",
+"n 	c #62B3DA",
+"o 	c #69C3E6",
+"p 	c #6ED4F2",
+"q 	c #6FD6F4",
+"r 	c #6ED5F4",
+"s 	c #6AD3F2",
+"t 	c #5FC3E7",
+"u 	c #53B2DC",
+"v 	c #4BA8D5",
+"w 	c #439FCE",
+"x 	c #3B95C7",
+"y 	c #338BC0",
+"z 	c #2B82B9",
+"A 	c #1D76B1",
+"B 	c #0C69A9",
+"C 	c #10599A",
+"D 	c #2D71AA",
+"E 	c #377CB2",
+"F 	c #3D84B8",
+"G 	c #458DBE",
+"H 	c #4B95C4",
+"I 	c #529CC9",
+"J 	c #59A4CF",
+"K 	c #5FABD4",
+"L 	c #65B1D8",
+"M 	c #6BC2E4",
+"N 	c #71D5F3",
+"O 	c #73D6F3",
+"P 	c #72D5F3",
+"Q 	c #6DD1F0",
+"R 	c #5FBBE2",
+"S 	c #54ADD8",
+"T 	c #4CA4D2",
+"U 	c #439ACB",
+"V 	c #3B91C4",
+"W 	c #3487BD",
+"X 	c #2D7EB7",
+"Y 	c #2675AF",
+"Z 	c #1E6CA9",
+"` 	c #0F5FA0",
+" .	c #055296",
+"..	c #115394",
+"+.	c #2767A2",
+"@.	c #2F70A9",
+"#.	c #3679AF",
+"$.	c #3C81B5",
+"%.	c #448ABC",
+"&.	c #4A92C2",
+"*.	c #519AC7",
+"=.	c #58A2CD",
+"-.	c #5FA9D2",
+";.	c #65B0D7",
+">.	c #6EC8E9",
+",.	c #74D4F2",
+"'.	c #76D6F3",
+").	c #75D6F3",
+"!.	c #71D3F1",
+"~.	c #62BCE1",
+"{.	c #54A9D5",
+"].	c #4C9FCE",
+"^.	c #4396C8",
+"/.	c #3B8CC1",
+"(.	c #3483BA",
+"_.	c #2C7AB3",
+":.	c #2670AC",
+"<.	c #1F68A6",
+"[.	c #195F9F",
+"}.	c #0D5497",
+"|.	c #04488D",
+"1.	c #0F4A8D",
+"2.	c #1F5A98",
+"3.	c #2663A0",
+"4.	c #2D6DA6",
+"5.	c #3475AD",
+"6.	c #3B7EB3",
+"7.	c #4287B9",
+"8.	c #4990C1",
+"9.	c #51A4CF",
+"0.	c #569FCA",
+"a.	c #5DA6CF",
+"b.	c #66B5DB",
+"c.	c #6FD1F0",
+"d.	c #75D4F1",
+"e.	c #79D5F2",
+"f.	c #75D3F1",
+"g.	c #63BBE0",
+"h.	c #54A4D1",
+"i.	c #4B9BCB",
+"j.	c #4391C4",
+"k.	c #3B88BD",
+"l.	c #337FB6",
+"m.	c #2C76B0",
+"n.	c #266CA9",
+"o.	c #1F64A3",
+"p.	c #1A5B9C",
+"q.	c #145396",
+"r.	c #0A498E",
+"s.	c #034C8F",
+"t.	c #085293",
+"u.	c #164D8E",
+"v.	c #1D5695",
+"w.	c #24609C",
+"x.	c #2A69A3",
+"y.	c #3271AA",
+"z.	c #387AAF",
+"A.	c #429FCC",
+"B.	c #4CBFE4",
+"C.	c #52C4E8",
+"D.	c #57AFD7",
+"E.	c #5DB3DA",
+"F.	c #65C5E7",
+"G.	c #6DD0EE",
+"H.	c #72D2EF",
+"I.	c #78D4F0",
+"J.	c #7BD5F1",
+"K.	c #76D2EF",
+"L.	c #6AC5E6",
+"M.	c #55A5D1",
+"N.	c #4A95C6",
+"O.	c #428CC0",
+"P.	c #3A83B9",
+"Q.	c #337AB3",
+"R.	c #2C71AD",
+"S.	c #2568A6",
+"T.	c #1F5F9F",
+"U.	c #1D65A3",
+"V.	c #269ACA",
+"W.	c #1C84BA",
+"X.	c #0D7DB5",
+"Y.	c #0298CC",
+"Z.	c #0296CA",
+"`.	c #0C5998",
+" +	c #14498A",
+".+	c #1B609C",
+"++	c #2498C8",
+"@+	c #2977AF",
+"#+	c #2F75AC",
+"$+	c #3575AC",
+"%+	c #40ABD5",
+"&+	c #49BFE4",
+"*+	c #50C3E7",
+"=+	c #56C5E8",
+"-+	c #5DC8EA",
+";+	c #63CBEB",
+">+	c #69CEED",
+",+	c #6ED0EE",
+"'+	c #73D2EF",
+")+	c #77D3EF",
+"!+	c #72CEEC",
+"~+	c #5AA7D1",
+"{+	c #4F99C9",
+"]+	c #4891C3",
+"^+	c #4087BC",
+"/+	c #387EB5",
+"(+	c #3277B1",
+"_+	c #2B70AB",
+":+	c #2463A2",
+"<+	c #1E5B9C",
+"[+	c #185395",
+"}+	c #165496",
+"|+	c #10498D",
+"1+	c #105F9E",
+"2+	c #0A9ECF",
+"3+	c #0088C0",
+"4+	c #038DC3",
+"5+	c #0A4A8C",
+"6+	c #114E8E",
+"7+	c #1989BD",
+"8+	c #22AAD7",
+"9+	c #28A2D0",
+"0+	c #2C71A9",
+"a+	c #3380B5",
+"b+	c #3EB9E1",
+"c+	c #45BDE3",
+"d+	c #4CC0E5",
+"e+	c #53C3E7",
+"f+	c #59C6E8",
+"g+	c #5EC9EA",
+"h+	c #64CBEB",
+"i+	c #69CDEC",
+"j+	c #6ECFED",
+"k+	c #70D0ED",
+"l+	c #64BDE1",
+"m+	c #55A6D1",
+"n+	c #3D82B8",
+"o+	c #3D8BBE",
+"p+	c #49AFD8",
+"q+	c #378DBF",
+"r+	c #225F9E",
+"s+	c #1D5698",
+"t+	c #174E92",
+"u+	c #12468B",
+"v+	c #0E3F85",
+"w+	c #115F9D",
+"x+	c #15A2D1",
+"y+	c #0395C9",
+"z+	c #0088C1",
+"A+	c #0190C6",
+"B+	c #079ACC",
+"C+	c #0FA0D0",
+"D+	c #169ECF",
+"E+	c #1D99CC",
+"F+	c #25AAD7",
+"G+	c #2BA0CE",
+"H+	c #32AED8",
+"I+	c #3AB7DF",
+"J+	c #41BBE1",
+"K+	c #47BEE3",
+"L+	c #4EC1E5",
+"M+	c #53C4E7",
+"N+	c #5FC8E9",
+"O+	c #63CAEA",
+"P+	c #67CBEB",
+"Q+	c #69CBEA",
+"R+	c #62BCE0",
+"S+	c #5AAFD7",
+"T+	c #478DBF",
+"U+	c #4084B9",
+"V+	c #3A7CB4",
+"W+	c #3E8CBF",
+"X+	c #4DBADF",
+"Y+	c #3383B8",
+"Z+	c #215B9B",
+"`+	c #1B5295",
+" @	c #164A8E",
+".@	c #114288",
+"+@	c #0D3A82",
+"@@	c #0E4C8E",
+"#@	c #1380B7",
+"$@	c #0D96C9",
+"%@	c #0089C1",
+"&@	c #007BB8",
+"*@	c #0085BE",
+"=@	c #008CC4",
+"-@	c #0496C9",
+";@	c #0B9DCF",
+">@	c #1168AB",
+",@	c #174F99",
+"'@	c #21AAD7",
+")@	c #28AED9",
+"!@	c #2FB1DB",
+"~@	c #36B5DE",
+"{@	c #3CB8E0",
+"]@	c #42BBE2",
+"^@	c #49BEE4",
+"/@	c #54C3E6",
+"(@	c #59C5E7",
+"_@	c #5DC7E8",
+":@	c #5FC5E7",
+"<@	c #53A9D3",
+"[@	c #4B96C6",
+"}@	c #478FC2",
+"|@	c #4186BB",
+"1@	c #3C7FB5",
+"2@	c #3676AF",
+"3@	c #306EA9",
+"4@	c #3889BD",
+"5@	c #44AFD8",
+"6@	c #2F84B9",
+"7@	c #194D91",
+"8@	c #15458A",
+"9@	c #144D90",
+"0@	c #0C367E",
+"a@	c #0C4086",
+"b@	c #1797C8",
+"c@	c #1295C8",
+"d@	c #0487C0",
+"e@	c #0079B6",
+"f@	c #0081BC",
+"g@	c #0E9ACC",
+"h@	c #1597CA",
+"i@	c #1CA7D5",
+"j@	c #23ABD8",
+"k@	c #2AAFDA",
+"l@	c #31B2DC",
+"m@	c #37B5DE",
+"n@	c #3DB8E0",
+"o@	c #43BBE2",
+"p@	c #49BEE3",
+"q@	c #4EC0E4",
+"r@	c #53C2E5",
+"s@	c #57C4E6",
+"t@	c #4EAAD4",
+"u@	c #4696C5",
+"v@	c #438FC0",
+"w@	c #4088BC",
+"x@	c #3C80B6",
+"y@	c #3778B1",
+"z@	c #3270AB",
+"A@	c #2C68A5",
+"B@	c #3D9AC8",
+"C@	c #46BADF",
+"D@	c #3DB0D8",
+"E@	c #287CB2",
+"F@	c #164D90",
+"G@	c #299ECC",
+"H@	c #1B79B0",
+"I@	c #1A8CBF",
+"J@	c #199BCC",
+"K@	c #1392C6",
+"L@	c #0A86BE",
+"M@	c #0079B7",
+"N@	c #006AAC",
+"O@	c #0074B3",
+"P@	c #007CB9",
+"Q@	c #0083BE",
+"R@	c #008BC2",
+"S@	c #0393C8",
+"T@	c #099CCD",
+"U@	c #10A1D1",
+"V@	c #17A4D3",
+"W@	c #1EA8D6",
+"X@	c #25ABD8",
+"Y@	c #2BAFDA",
+"Z@	c #37B5DD",
+"`@	c #3DB8DF",
+" #	c #42BAE1",
+".#	c #48BCE2",
+"+#	c #4CBEE3",
+"@#	c #50C0E4",
+"##	c #48A8D3",
+"$#	c #3F8EC0",
+"%#	c #3C87BC",
+"&#	c #3A81B7",
+"*#	c #3679B1",
+"=#	c #3171AC",
+"-#	c #2D6AA6",
+";#	c #2862A0",
+">#	c #40A5D1",
+",#	c #43B8DE",
+"'#	c #3DB5DC",
+")#	c #38B1DA",
+"!#	c #2D9ECC",
+"~#	c #2B9FCE",
+"{#	c #246AAA",
+"]#	c #1F96C7",
+"^#	c #1996C9",
+"/#	c #138DC3",
+"(#	c #0E84BC",
+"_#	c #0175B4",
+":#	c #0068AC",
+"<#	c #0070B1",
+"[#	c #0077B5",
+"}#	c #007FBA",
+"|#	c #0086BF",
+"1#	c #018DC4",
+"2#	c #0596C9",
+"3#	c #0B9DCE",
+"4#	c #12A1D1",
+"5#	c #1897C8",
+"6#	c #1E96C7",
+"7#	c #25A0CE",
+"8#	c #2B90C2",
+"9#	c #31A4D0",
+"0#	c #37B4DD",
+"a#	c #3CB7DF",
+"b#	c #41B9E0",
+"c#	c #45BBE0",
+"d#	c #49BCE1",
+"e#	c #4BBBE0",
+"f#	c #419FCC",
+"g#	c #3C91C2",
+"h#	c #337AB1",
+"i#	c #3072AC",
+"j#	c #2C6BA7",
+"k#	c #2864A1",
+"l#	c #255F9E",
+"m#	c #3FAAD4",
+"n#	c #40B6DC",
+"o#	c #3AB3DB",
+"p#	c #35B0D8",
+"q#	c #2F86BD",
+"r#	c #29599F",
+"s#	c #237DB7",
+"t#	c #1E99CA",
+"u#	c #1892C5",
+"v#	c #1389C0",
+"w#	c #0E7FBA",
+"x#	c #0473B2",
+"y#	c #0065AA",
+"z#	c #0064A9",
+"A#	c #006BAD",
+"B#	c #0072B2",
+"C#	c #0080BC",
+"D#	c #0082BC",
+"E#	c #028DC4",
+"F#	c #0796C9",
+"G#	c #0D88BD",
+"H#	c #1372AB",
+"I#	c #1982B8",
+"J#	c #1F79B0",
+"K#	c #247BB1",
+"L#	c #2A86B9",
+"M#	c #31B1DA",
+"N#	c #36B3DC",
+"O#	c #3AB5DD",
+"P#	c #3FB7DE",
+"Q#	c #42B9DF",
+"R#	c #45BAE0",
+"S#	c #48BBE0",
+"T#	c #47B6DD",
+"U#	c #3689BC",
+"V#	c #2D72AB",
+"W#	c #2C73AC",
+"X#	c #2F7DB3",
+"Y#	c #399BC9",
+"Z#	c #3FB4DB",
+"`#	c #3CB3DA",
+" $	c #37B0D9",
+".$	c #32AED7",
+"+$	c #2CA8D3",
+"@$	c #277EB8",
+"#$	c #229CCC",
+"$$	c #1D95C8",
+"%$	c #188DC2",
+"&$	c #1384BD",
+"*$	c #0D7AB6",
+"=$	c #066FB0",
+"-$	c #0057A0",
+";$	c #005FA5",
+">$	c #0066AA",
+",$	c #006DAF",
+"'$	c #006EAC",
+")$	c #004C8E",
+"!$	c #005595",
+"~$	c #025999",
+"{$	c #085D9B",
+"]$	c #0D64A0",
+"^$	c #1369A4",
+"/$	c #196EA7",
+"($	c #1E73AA",
+"_$	c #2376AD",
+":$	c #2AA0CE",
+"<$	c #2FAFD9",
+"[$	c #34B1DB",
+"}$	c #38B3DC",
+"|$	c #3BB5DC",
+"1$	c #3EB6DD",
+"2$	c #40B7DD",
+"3$	c #42B7DD",
+"4$	c #43B7DE",
+"5$	c #43B7DD",
+"6$	c #40B5DC",
+"7$	c #3DB4DB",
+"8$	c #3AB2DA",
+"9$	c #33AED6",
+"0$	c #2EABD5",
+"a$	c #29A5D2",
+"b$	c #259ECD",
+"c$	c #2094C6",
+"d$	c #1C8DC2",
+"e$	c #1787BE",
+"f$	c #127EB9",
+"g$	c #0D75B3",
+"h$	c #076AAC",
+"i$	c #005FA6",
+"j$	c #00539D",
+"k$	c #005AA2",
+"l$	c #0060A6",
+"m$	c #0068AB",
+"n$	c #0063A5",
+"o$	c #004487",
+"p$	c #004386",
+"q$	c #004789",
+"r$	c #004B8D",
+"s$	c #045192",
+"t$	c #095997",
+"u$	c #0E5F9C",
+"v$	c #1365A0",
+"w$	c #1869A4",
+"x$	c #1D6EA7",
+"y$	c #2274AB",
+"z$	c #28A6D2",
+"A$	c #2DAED8",
+"B$	c #31AFD9",
+"C$	c #34B1DA",
+"D$	c #37B2DB",
+"E$	c #39B3DB",
+"F$	c #3BB4DB",
+"G$	c #3CB4DB",
+"H$	c #3BB3DA",
+"I$	c #38B1D9",
+"J$	c #35AFD8",
+"K$	c #32ADD6",
+"L$	c #2EAAD4",
+"M$	c #2BA5D1",
+"N$	c #2795C5",
+"O$	c #2374AA",
+"P$	c #1E5691",
+"Q$	c #1A4C89",
+"R$	c #156AA5",
+"S$	c #1078B5",
+"T$	c #0B6FAF",
+"U$	c #0665A9",
+"V$	c #004A97",
+"W$	c #004D9A",
+"X$	c #00509A",
+"Y$	c #00579F",
+"Z$	c #0062A7",
+"`$	c #00468A",
+" %	c #00387C",
+".%	c #003C7F",
+"+%	c #004083",
+"@%	c #044D8E",
+"#%	c #095493",
+"$%	c #0E5A98",
+"%%	c #13609C",
+"&%	c #18659F",
+"*%	c #1C6BA4",
+"=%	c #219FCD",
+"-%	c #25AAD5",
+";%	c #29ABD6",
+">%	c #2DADD7",
+",%	c #30AED8",
+"'%	c #32AFD8",
+")%	c #34B0D8",
+"!%	c #34AED7",
+"~%	c #30ABD4",
+"{%	c #2DA8D2",
+"]%	c #2BA3CF",
+"^%	c #289DCC",
+"/%	c #2494C5",
+"(%	c #20659E",
+"_%	c #1C4684",
+":%	c #183D7C",
+"<%	c #133B7A",
+"[%	c #0F5695",
+"}%	c #0A5FA1",
+"|%	c #055FA5",
+"1%	c #00559F",
+"2%	c #004D99",
+"3%	c #004896",
+"4%	c #002E74",
+"5%	c #003C82",
+"6%	c #004E94",
+"7%	c #003377",
+"8%	c #003175",
+"9%	c #003578",
+"0%	c #003B7F",
+"a%	c #003F82",
+"b%	c #014285",
+"c%	c #044889",
+"d%	c #094E8E",
+"e%	c #0D5493",
+"f%	c #125997",
+"g%	c #167FB4",
+"h%	c #1A96C7",
+"i%	c #1EA5D2",
+"j%	c #22A7D3",
+"k%	c #25A9D4",
+"l%	c #28AAD5",
+"m%	c #2AAAD5",
+"n%	c #2CABD6",
+"o%	c #2DACD6",
+"p%	c #2EACD5",
+"q%	c #2DA9D3",
+"r%	c #2CA6D1",
+"s%	c #299FCD",
+"t%	c #279ACA",
+"u%	c #2495C7",
+"v%	c #218FC3",
+"w%	c #1D86BC",
+"x%	c #1A4683",
+"y%	c #163574",
+"z%	c #112C6C",
+"A%	c #0D2464",
+"B%	c #082D6F",
+"C%	c #044E94",
+"D%	c #004F9A",
+"E%	c #004292",
+"F%	c #00347D",
+"G%	c #002266",
+"H%	c #002669",
+"I%	c #00286C",
+"J%	c #002B6F",
+"K%	c #002E72",
+"L%	c #003478",
+"M%	c #00377B",
+"N%	c #003A7E",
+"O%	c #013D80",
+"P%	c #044285",
+"Q%	c #084889",
+"R%	c #0D4D8D",
+"S%	c #115492",
+"T%	c #15609B",
+"U%	c #189ACB",
+"V%	c #1CA0CF",
+"W%	c #1FA2CF",
+"X%	c #21A3D1",
+"Y%	c #24A4D1",
+"Z%	c #25A5D1",
+"`%	c #27A4D1",
+" &	c #28A4D1",
+".&	c #28A0CE",
+"+&	c #289ECC",
+"@&	c #2596C8",
+"#&	c #2392C5",
+"$&	c #208DC2",
+"%&	c #1D87BD",
+"&&	c #1A75AE",
+"*&	c #173978",
+"=&	c #132E6D",
+"-&	c #0F2565",
+";&	c #0B1D5D",
+">&	c #071555",
+",&	c #021151",
+"'&	c #001F61",
+")&	c #00276D",
+"!&	c #003D8E",
+"~&	c #003B89",
+"{&	c #001E62",
+"]&	c #002063",
+"^&	c #002569",
+"/&	c #002D72",
+"(&	c #003074",
+"_&	c #003579",
+":&	c #033C7F",
+"<&	c #074183",
+"[&	c #0B4787",
+"}&	c #0F5392",
+"|&	c #1391C5",
+"1&	c #1695C8",
+"2&	c #1998CA",
+"3&	c #1C99CA",
+"4&	c #1E9ACB",
+"5&	c #209BCB",
+"6&	c #219BCB",
+"7&	c #229ACA",
+"8&	c #2399C9",
+"9&	c #2397C8",
+"0&	c #2394C6",
+"a&	c #2291C4",
+"b&	c #1E89C0",
+"c&	c #1C84BC",
+"d&	c #1A5B97",
+"e&	c #174C89",
+"f&	c #142D6C",
+"g&	c #102665",
+"h&	c #0C1E5D",
+"i&	c #081756",
+"j&	c #040F4F",
+"k&	c #000847",
+"l&	c #000541",
+"m&	c #00033D",
+"n&	c #00368A",
+"o&	c #00256E",
+"p&	c #00185A",
+"q&	c #001A5D",
+"r&	c #001D60",
+"s&	c #001F63",
+"t&	c #002568",
+"u&	c #00276B",
+"v&	c #00296D",
+"w&	c #002B70",
+"x&	c #003276",
+"y&	c #023579",
+"z&	c #063A7D",
+"A&	c #0A5997",
+"B&	c #0D87BF",
+"C&	c #108AC1",
+"D&	c #138CC3",
+"E&	c #168EC4",
+"F&	c #188FC4",
+"G&	c #1A90C4",
+"H&	c #1C90C4",
+"I&	c #1D8FC4",
+"J&	c #1D8EC3",
+"K&	c #1D8CC2",
+"L&	c #1D8AC0",
+"M&	c #1C87BE",
+"N&	c #1B83BC",
+"O&	c #1A7FB9",
+"P&	c #1864A0",
+"Q&	c #164987",
+"R&	c #132C6A",
+"S&	c #102564",
+"T&	c #0D1E5D",
+"U&	c #091756",
+"V&	c #06104E",
+"W&	c #020947",
+"X&	c #000441",
+"Y&	c #00023C",
+"Z&	c #000038",
+"`&	c #003086",
+" *	c #001A5E",
+".*	c #001354",
+"+*	c #001658",
+"@*	c #001D5F",
+"#*	c #001F62",
+"$*	c #002164",
+"%*	c #002367",
+"&*	c #002D71",
+"**	c #014C8E",
+"=*	c #0474B2",
+"-*	c #077CB9",
+";*	c #0B80BA",
+">*	c #0E82BB",
+",*	c #1083BC",
+"'*	c #1285BD",
+")*	c #1485BE",
+"!*	c #1686BD",
+"~*	c #1785BD",
+"{*	c #1884BC",
+"]*	c #1882BB",
+"^*	c #1880B9",
+"/*	c #187DB7",
+"(*	c #177AB6",
+"_*	c #1571AF",
+":*	c #143676",
+"<*	c #122968",
+"[*	c #0F2362",
+"}*	c #0D1D5C",
+"|*	c #0A1755",
+"1*	c #030A47",
+"2*	c #000239",
+"3*	c #002A82",
+"4*	c #00175D",
+"5*	c #00104F",
+"6*	c #001252",
+"7*	c #001454",
+"8*	c #001657",
+"9*	c #00195C",
+"0*	c #001C5E",
+"a*	c #001D61",
+"b*	c #002165",
+"c*	c #002366",
+"d*	c #002468",
+"e*	c #006CAE",
+"f*	c #006FB0",
+"g*	c #0271B1",
+"h*	c #0574B3",
+"i*	c #0877B4",
+"j*	c #0B78B5",
+"k*	c #0F7AB6",
+"l*	c #107AB7",
+"m*	c #127AB6",
+"n*	c #1279B5",
+"o*	c #1377B4",
+"p*	c #1375B3",
+"q*	c #1372B1",
+"r*	c #126FAF",
+"s*	c #115797",
+"t*	c #0F2766",
+"u*	c #0D2160",
+"v*	c #0B1B5A",
+"w*	c #091554",
+"x*	c #06104D",
+"y*	c #030A46",
+"z*	c #000540",
+"A*	c #000036",
+"B*	c #00237E",
+"C*	c #002980",
+"D*	c #002372",
+"E*	c #001A60",
+"F*	c #001659",
+"G*	c #001358",
+"H*	c #001A5F",
+"I*	c #002064",
+"J*	c #001B5E",
+"K*	c #005397",
+"L*	c #0065A9",
+"M*	c #0067AB",
+"N*	c #0069AC",
+"O*	c #026AAD",
+"P*	c #046CAE",
+"Q*	c #0768AB",
+"R*	c #0965A9",
+"S*	c #0A6EAF",
+"T*	c #0C6EAE",
+"U*	c #0D6DAE",
+"V*	c #0D6CAD",
+"W*	c #0D6AAB",
+"X*	c #0D67AA",
+"Y*	c #0D64A7",
+"Z*	c #0C498C",
+"`*	c #0A1E5E",
+" =	c #091856",
+".=	c #071350",
+"+=	c #050D4B",
+"@=	c #020844",
+"#=	c #00043F",
+"$=	c #00023B",
+"%=	c #000037",
+"&=	c #000035",
+"*=	c #000034",
+"==	c #001A77",
+"-=	c #00237D",
+";=	c #002881",
+">=	c #002D84",
+",=	c #00287F",
+"'=	c #000B6C",
+")=	c #00388A",
+"!=	c #003785",
+"~=	c #001556",
+"{=	c #001759",
+"]=	c #00195B",
+"^=	c #001C5F",
+"/=	c #001C60",
+"(=	c #004B91",
+"_=	c #004287",
+":=	c #00569C",
+"<=	c #0061A7",
+"[=	c #023187",
+"}=	c #033388",
+"|=	c #0563A7",
+"1=	c #0662A7",
+"2=	c #0762A7",
+"3=	c #0860A6",
+"4=	c #085EA4",
+"5=	c #085CA3",
+"6=	c #084388",
+"7=	c #071B5B",
+"8=	c #061453",
+"9=	c #04104D",
+"0=	c #030B48",
+"a=	c #010742",
+"b=	c #00033E",
+"c=	c #00013A",
+"d=	c #000033",
+"e=	c #000032",
+"f=	c #001C79",
+"g=	c #00217C",
+"h=	c #002780",
+"i=	c #002B83",
+"j=	c #003589",
+"k=	c #001D63",
+"l=	c #000F4F",
+"m=	c #000F4E",
+"n=	c #001050",
+"o=	c #001152",
+"p=	c #001353",
+"q=	c #001455",
+"r=	c #002F74",
+"s=	c #00529A",
+"t=	c #0058A1",
+"u=	c #00529D",
+"v=	c #0156A0",
+"w=	c #02569F",
+"x=	c #02549E",
+"y=	c #03529D",
+"z=	c #034F9A",
+"A=	c #032062",
+"B=	c #020F4E",
+"C=	c #010C49",
+"D=	c #000845",
+"E=	c #00033C",
+"F=	c #000138",
+"G=	c #000135",
+"H=	c #001474",
+"I=	c #001F7B",
+"J=	c #00247E",
+"K=	c #002D83",
+"L=	c #001051",
+"M=	c #000A46",
+"N=	c #000B48",
+"O=	c #000C4A",
+"P=	c #000D4B",
+"Q=	c #000E4D",
+"R=	c #001151",
+"S=	c #001253",
+"T=	c #00377E",
+"U=	c #004E9A",
+"V=	c #004C98",
+"W=	c #00408C",
+"X=	c #000946",
+"Y=	c #00053F",
+"Z=	c #000137",
+"`=	c #000031",
+" -	c #000030",
+".-	c #001373",
+"+-	c #001876",
+"@-	c #001D79",
+"#-	c #00267F",
+"$-	c #000D4D",
+"%-	c #000741",
+"&-	c #000843",
+"*-	c #000945",
+"=-	c #000A47",
+"--	c #000B49",
+";-	c #000D4C",
+">-	c #002F77",
+",-	c #00327A",
+"'-	c #002267",
+")-	c #002166",
+"!-	c #00256A",
+"~-	c #003D89",
+"{-	c #004393",
+"]-	c #003F90",
+"^-	c #003C8D",
+"/-	c #003382",
+"(-	c #003587",
+"_-	c #002069",
+":-	c #00033A",
+"<-	c #000136",
+"[-	c #00002F",
+"}-	c #000C6E",
+"|-	c #001171",
+"1-	c #001574",
+"2-	c #001E7A",
+"3-	c #00196A",
+"4-	c #00053E",
+"5-	c #000640",
+"6-	c #000742",
+"7-	c #00185B",
+"8-	c #003787",
+"9-	c #00398C",
+"0-	c #00378B",
+"a-	c #003388",
+"b-	c #002779",
+"c-	c #00063F",
+"d-	c #00002D",
+"e-	c #00096C",
+"f-	c #000D6F",
+"g-	c #001271",
+"h-	c #001675",
+"i-	c #001872",
+"j-	c #000338",
+"k-	c #00043A",
+"l-	c #00043B",
+"m-	c #00053D",
+"n-	c #000844",
+"o-	c #000944",
+"p-	c #002573",
+"q-	c #002E85",
+"r-	c #002C83",
+"s-	c #001E71",
+"t-	c #00002E",
+"u-	c #00002C",
+"v-	c #000266",
+"w-	c #00066A",
+"x-	c #000A6D",
+"y-	c #000E70",
+"z-	c #000C58",
+"A-	c #000643",
+"B-	c #000337",
+"C-	c #000236",
+"D-	c #000339",
+"E-	c #00053C",
+"F-	c #00063E",
+"G-	c #00073F",
+"H-	c #00145A",
+"I-	c #001C78",
+"J-	c #000743",
+"K-	c #00002A",
+"L-	c #00005F",
+"M-	c #000267",
+"N-	c #000A6C",
+"O-	c #000952",
+"P-	c #000131",
+"Q-	c #000132",
+"R-	c #000133",
+"S-	c #000134",
+"T-	c #000235",
+"U-	c #00196E",
+"V-	c #001D7A",
+"W-	c #001B78",
+"X-	c #001977",
+"Y-	c #001775",
+"Z-	c #001473",
+"`-	c #000E66",
+" ;	c #00002B",
+".;	c #000029",
+"+;	c #000053",
+"@;	c #00005E",
+"#;	c #000265",
+"$;	c #000464",
+"%;	c #000130",
+"&;	c #001160",
+"*;	c #001164",
+"=;	c #001674",
+"-;	c #001272",
+";;	c #001071",
+">;	c #000E6F",
+",;	c #000B6E",
+"';	c #00086C",
+");	c #00045F",
+"!;	c #000152",
+"~;	c #000046",
+"{;	c #000051",
+"];	c #00005A",
+"^;	c #00012F",
+"/;	c #000542",
+"(;	c #00106E",
+"_;	c #001070",
+":;	c #000F70",
+"<;	c #00086B",
+"[;	c #000367",
+"};	c #000163",
+"|;	c #00005B",
+"1;	c #000052",
+"2;	c #000047",
+"3;	c #000041",
+"4;	c #000028",
+"5;	c #000021",
+"6;	c #000025",
+"7;	c #00003E",
+"8;	c #00003A",
+"9;	c #00075A",
+"0;	c #00076B",
+"a;	c #000569",
+"b;	c #000368",
+"c;	c #000162",
+"d;	c #00005C",
+"e;	c #000054",
+"f;	c #00004C",
+"g;	c #000042",
+"h;	c #000039",
+"i;	c #000026",
+"j;	c #000023",
+"k;	c #000017",
+"l;	c #00001C",
+"m;	c #00004D",
+"n;	c #000055",
+"o;	c #000027",
+"p;	c #00003D",
+"q;	c #000058",
+"r;	c #00004E",
+"s;	c #000048",
+"t;	c #000019",
+"u;	c #000012",
+"v;	c #00001D",
+"w;	c #00001F",
+"x;	c #000044",
+"y;	c #000008",
+"z;	c #000018",
+"A;	c #000024",
+"B;	c #000015",
+"C;	c #000022",
+"D;	c #00000F",
+"E;	c #000004",
+"F;	c #000007",
+"G;	c #000009",
+"H;	c #00000C",
+"I;	c #00000D",
+"J;	c #00000E",
+"K;	c #00000A",
+"L;	c #000003",
+"M;	c #000000",
+"N;	c #000001",
+"O;	c #000005",
+"P;	c #00000B",
+"                                                                                                ",
+"                                                                                                ",
+"                                        . + @ # $ % & *                                         ",
+"                                = - ; > , ' ) ! ~ { ] ^ / ( _ :                                 ",
+"                            < [ } | 1 2 3 4 5 6 7 8 9 0 a b c d e                               ",
+"                        f g h i j k l m n o p q r s t u v w x y z A B                           ",
+"                      C D E F G H I J K L M N O P Q R S T U V W X Y Z `  .                      ",
+"                    ..+.@.#.$.%.&.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.[.}.|.                    ",
+"                  1.2.3.4.5.6.7.8.9.0.a.b.c.d.e.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.                  ",
+"                t.u.v.w.x.y.z.A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.                ",
+"              Z.`. +.+++@+#+$+%+&+*+=+-+;+>+,+'+)+!+~+{+]+^+/+(+_+:+<+[+}+|+1+2+                ",
+"            3+4+5+6+7+8+9+0+a+b+c+d+e+f+g+h+i+j+k+k+l+m+]+n+o+p+q+r+s+t+u+v+w+x+y+              ",
+"            z+A+B+C+D+E+F+G+H+I+J+K+L+M+f+N+O+P+Q+R+S+T+U+V+W+X+Y+Z+`+ @.@+@@@#@$@%@            ",
+"          &@*@=@-@;@>@,@'@)@!@~@{@]@^@L+/@(@_@:@<@[@}@|@1@2@3@4@5@6@7@8@9@0@a@b@c@d@            ",
+"          e@f@z+A+B+g@h@i@j@k@l@m@n@o@p@q@r@s@t@u@v@w@x@y@z@A@B@C@D@E@F@G@H@I@J@K@L@M@          ",
+"        N@O@P@Q@R@S@T@U@V@W@X@Y@l@Z@`@ #.#+#@###$#%#&#*#=#-#;#>#,#'#)#!#~#{#]#^#/#(#_#          ",
+"        :#<#[#}#|#1#2#3#4#5#6#7#8#9#0#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#        ",
+"        z#A#B#M@C#D#E#F#G#H#I#J#K#L#M#N#O#P#Q#R#S#T#U#V#W#X#Y#Z#`# $.$+$@$#$$$%$&$*$=$z#        ",
+"      -$;$>$,$O@'$)$!$~${$]$^$/$($_$:$<$[$}$|$1$2$3$4$5$3$6$7$8$ $9$0$a$b$c$d$e$f$g$h$i$        ",
+"      j$k$l$m$n$o$p$q$r$s$t$u$v$w$x$y$z$A$B$C$D$E$F$G$G$H$8$I$J$K$L$M$N$O$P$Q$R$S$T$U$k$V$      ",
+"      W$X$Y$Z$`$ %.%+%p$q$@%#%$%%%&%*%=%-%;%>%,%'%)%p#p#J$!%K$~%{%]%^%/%(%_%:%<%[%}%|%1%2%      ",
+"      3%4%5%6%7%8%9% %0%a%b%c%d%e%f%g%h%i%j%k%l%m%n%o%p%0$q%r%]%s%t%u%v%w%x%y%z%A%B%C%D%3%      ",
+"      E%F%G%H%I%J%K%8%L%M%N%O%P%Q%R%S%T%U%V%W%X%Y%Z%`% &9+.&+&V.@&#&$&%&&&*&=&-&;&>&,&'&)&      ",
+"      !&~&{&]&G%^&I%J%/&(&7%_& %:&<&[&}&|&1&2&3&4&5&6&7&8&9&0&a&$&b&c&d&e&f&g&h&i&j&k&l&m&      ",
+"      n&o&p&q&r&s&G%t&u&v&w&K%(&x&y&z&A&B&C&D&E&F&G&H&I&J&K&L&M&N&O&P&Q&R&S&T&U&V&W&X&Y&Z&      ",
+"      `& *.*+*p&q&@*#*$*%*^&u&v&J%&***=*-*;*>*,*'*)*!*~*{*]*^*/*(*_*:*<*[*}*|*V&1*l&Y&Z&2*      ",
+"      3*4*5*6*7*8*p&9*0*a*s&b*c*d*v&e*f*g*h*i*j**$k*l*m*n*o*p*q*r*s*t*u*v*w*x*y*z*Y&Z&A*z*      ",
+"      B*C*D*E*F*G*H*I*+*p&9*J*r&{&x&K*L*M*N*O*P*Q*R*S*T*U*V*W*X*Y*Z*`* =.=+=@=#=$=%=&=*=        ",
+"      ==-=;=>=,='=)=!=J*.*~=+*{=]=^=/=(=_=:=l$<=[=}=|=1=2=3=4=5=6=7=8=9=0=a=b=c=%=&=d=e=        ",
+"        f=g=h=i=3*j=k=l=m=n=o=p=q=~=8*r=^=b*s=t=j$u=-$v=w=x=y=z=A=B=C=D=z*E=F=A*&=d=e=G=        ",
+"        H===I=J=;=K=L=M=N=O=P=Q=l=n=R=6*S=.*T=D%D%D%U=2%V=V$3%W=J*L=X=Y=$=Z=&=*=e=`= -          ",
+"          .-+-@-g=#-$-%-&-*-M==---O=P=;-Q=m=>-,-'-)-!-~-{-E%]-^-/-(-_-:-<-*=d=e=`=[-[-          ",
+"          }-|-1-==2-3-4-4-5-%-6-&-*-X==-=-N=q&;-O=O=O=7-8-9-0-j=a-`&b-c-d=e=`= -[-d-$=          ",
+"            e-f-g-h-i-4-j-k-l-m-4-c-5-%-6-6-&-&-n-o-o-*-M=p-q-r-3*h=s-X=`= -[-t-u-u-            ",
+"            v-w-x-y-g-z-A-B-C-j-D-:-l-l-E-m-4-F-F-c-c-c-G-H-#-J=g=I=I-J-t-t-d-u-K-              ",
+"              L-M-w-N-f-O-P-Q-R-S-T-C-C-B-j-D-D-:-k-l-k-D=U-V-W-X-Y-Z-`-[- ; ;.;u-              ",
+"                +;@;#;$; ;u-d-t-[- -%;P-Q-R-R-S-B-z*&;*;Y-=;H=-;;;>;,;';);!;%=d-                ",
+"                  ~;{;];u-.;K- ; ;u-d-d-d-t-t-^;/;(;_;;;:;f-}-x-<;w-[;};|;1;2;                  ",
+"                  A*%=3;4;5;6;u-7;8;u-K- ; ; ; ;^;9;<;0;w-a;b;v-c;d;e;f;g;h;                    ",
+"                      i;j;k;l;d=m;1;n;d= ;i;o;o;o;o;p;@;d;q;+;r;s;3;h;`=K-                      ",
+"                        t;u;k;o;e=Z&%=5;*=l;v;v;v;w; ;x;3;p;Z&d=d-i;w;                          ",
+"                            y;u;z;v;5;A;A;B;u;u;u;j; ;.;i;C;v;z;u;D;                            ",
+"                                E;E;F;G;H;I;I;I;H;D;J;H;K;F;E;K;                                ",
+"                                      y;L;M;M;N;N;M;N;O;P;                                      ",
+"                                                                                                ",
+"                                                                                                ",
+"                                                                                                ",
+"                                                                                                "};
--- mozilla-firefox-1.0.4.orig/debian/theme/00classic
+++ mozilla-firefox-1.0.4/debian/theme/00classic
@@ -0,0 +1 @@
+theme,{972ce4c6-7e08-4474-a285-3208198ce6fd}
--- mozilla-firefox-1.0.4.orig/debian/theme/Uninstall
+++ mozilla-firefox-1.0.4/debian/theme/Uninstall
@@ -0,0 +1,4 @@
+register	global	skin	classic/1.0
+register	global	skin	classic/1.0
+register	global	skin	classic/1.0
+register	global	skin	classic/1.0
--- mozilla-firefox-1.0.4.orig/debian/rules
+++ mozilla-firefox-1.0.4/debian/rules
@@ -0,0 +1,237 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+SHELL=/bin/bash # I use bashisms
+
+# build phoenix
+export MOZ_PHOENIX=1
+export MOZ_FIREBIRD=1
+export MOZ_FIREFOX=1
+export BUILD_OFFICIAL=1 
+export MOZILLA_OFFICIAL=1
+#export MOZ_INTERNAL_LIBART_LGPL=1
+
+PHOENIX := mozilla-firefox
+PHOENIX_CVS := mozilla
+# things to remove from upstream tarball cause we don't need them
+UPSTREAM_REMOVE := debian mailnews themes/modern editor/ui \
+	editor/composer/src lib/mac
+DEBIAN_VERSION := $(shell dpkg-parsechangelog | sed -n 's/Version: *\(.*\)/\1/ p')
+UPSTREAM_VERSION := $(shell echo $(DEBIAN_VERSION) | sed 's/-.*$$//')
+LIB_DIR := /usr/lib/mozilla-firefox
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+	OPTFLAGS = -O0
+else
+	OPTFLAGS = -O2
+
+ifeq ($(DEB_BUILD_ARCH),ia64)
+	OPTFLAGS=-O
+endif
+
+ifeq ($(DEB_BUILD_ARCH),powerpc)
+	OPTFLAGS=-O
+endif
+
+ifeq ($(DEB_BUILD_ARCH),arm)
+	OPTFLAGS=-O
+endif
+
+endif
+
+OPTFLAGS += -DDEBIAN
+
+DEBUG_FLAG=
+ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
+	DEBUG_FLAG = --enable-debug
+endif
+
+ifeq ($(DEB_BUILD_ARCH),amd64)
+CC=gcc-3.4
+CXX=g++-3.4
+export CC CXX
+endif
+
+
+CONFIGURE_OPTIONS = \
+	--enable-default-toolkit=gtk2 \
+	--with-default-mozilla-five-home=$(LIB_DIR) \
+	--with-user-appdir=.mozilla \
+	--with-system-mng=/usr \
+	--with-system-png=/usr \
+	--with-system-jpeg=/usr \
+	--disable-mailnews \
+	--disable-composer \
+	--disable-ldap \
+	--enable-postscript \
+	--disable-installer \
+	--enable-xprint \
+	--enable-crypto \
+	--enable-strip-libs \
+	--disable-svg \
+	--enable-mathml \
+	--disable-tests \
+	--disable-gtktest \
+	--disable-debug \
+	--enable-xft \
+	--enable-optimize="-pipe -w $(OPTFLAGS)" \
+	--with-system-zlib=/usr \
+	--with-gssapi=/usr \
+	--without-system-nspr \
+	--enable-xinerama \
+	--enable-extensions=cookie,xml-rpc,xmlextras,pref,transformiix,universalchardet,webservices,inspector,gnomevfs,negotiateauth \
+	--disable-pedantic \
+	--disable-long-long-warning \
+	--enable-single-profile \
+	--disable-profilesharing \
+	--enable-gnomevfs \
+	$(DEBUG_FLAG)
+
+ifneq ($(DEB_BUILD_ARCH),mips)
+ifneq ($(DEB_BUILD_ARCH),mipsel)
+	CONFIGURE_OPTIONS += --enable-static --disable-shared
+endif
+endif
+
+configure: configure-stamp
+configure-stamp:
+	dh_testdir
+
+	./configure --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info $(CONFIGURE_OPTIONS)
+
+	touch configure-stamp
+
+build: configure-stamp build-stamp
+build-stamp:
+	dh_testdir
+
+	$(MAKE)
+
+	(cd debian && uudecode mozilla-firefox.png.uu \
+		&& uudecode debsearch.gif.uu)
+	touch build-stamp
+
+clean: 
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp debian/stamp-* \
+		debian/mozilla-firefox.png debian/debsearch.gif
+
+	-$(MAKE) distclean
+
+	dh_clean
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
+	chmod 755 debian/mozilla-firefox-xremote-client
+# Remove execute on javascript files
+	find debian/tmp -name '*.so' | xargs chmod -x 
+	chmod -x debian/tmp/$(LIB_DIR)/components/*.js
+
+# Exclude inspector for mozilla-firefox
+	dh_install -pmozilla-firefox '-X*inspector*' '-X*gnome*'
+	dh_install -pmozilla-firefox-dom-inspector
+	dh_install -pmozilla-firefox-gnome-support
+
+#Install helpers
+	install -m 755 debian/mozilla-firefox-runner \
+		debian/mozilla-firefox/usr/lib/mozilla-firefox/firefox
+	install -m 755 debian/update-mozilla-firefox-chrome \
+		debian/mozilla-firefox/usr/sbin/update-mozilla-firefox-chrome
+
+# Filter installed chrome
+	egrep -v 'inspector\.jar|embed-sample\.jar|classic\.jar' \
+		debian/tmp/$(LIB_DIR)/chrome/installed-chrome.txt \
+		> debian/mozilla-firefox/$(LIB_DIR)/chrome/installed-chrome.txt
+
+# Remove installed-extensions.txt
+	rm -rf 'debian/mozilla-firefox/$(LIB_DIR)/defaults/profile/extensions/installed-extensions.txt'
+
+# Move classic theme's install.rdf to final destination
+	mv debian/mozilla-firefox/$(LIB_DIR)/defaults/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf debian/mozilla-firefox/$(LIB_DIR)/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/
+# Remove unneeded extensions directory
+	rm -rf debian/mozilla-firefox/$(LIB_DIR)/defaults/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}
+
+# Remove unneeded configs
+	rm -f debian/mozilla-firefox/$(LIB_DIR)/defaults/pref/editor.js \
+		debian/mozilla-firefox/$(LIB_DIR)/defaults/pref/mailnews.js \
+		debian/mozilla-firefox/$(LIB_DIR)/defaults/pref/inspector.js \
+		debian/mozilla-firefox/$(LIB_DIR)/defaults/pref/firefox-l10n.js
+
+# Add Debian package version to preferences
+	echo // Debian package version \
+		> debian/mozilla-firefox/$(LIB_DIR)/defaults/pref/vendor.js
+	echo "pref(\"general.useragent.vendorComment\",\"Debian package $(DEBIAN_VERSION)\");" \
+		>> debian/mozilla-firefox/$(LIB_DIR)/defaults/pref/vendor.js
+
+# Move profiles into /etc
+	mv \
+	 debian/mozilla-firefox/$(LIB_DIR)/defaults/profile \
+	 debian/mozilla-firefox/etc/mozilla-firefox/
+
+
+#Move pretty icons into place
+	cp -f debian/mozilla-firefox.xpm \
+		debian/mozilla-firefox/$(LIB_DIR)/icons/default.xpm
+	cp -f debian/mozilla-firefox.xpm \
+		debian/mozilla-firefox/$(LIB_DIR)/icons/mozicon50.xpm
+	cp -f debian/mozilla-firefox-small.xpm \
+		debian/mozilla-firefox/$(LIB_DIR)/icons/mozicon16.xpm
+	cp -f debian/mozilla-firefox.xpm \
+		debian/mozilla-firefox/$(LIB_DIR)/chrome/icons/default/default.xpm
+
+# Build architecture-independent files here.
+binary-indep: build install
+
+
+# Build architecture-dependent files here.
+binary-arch: build install
+#	dh_testversion
+	dh_testdir
+	dh_testroot
+	dh_installdebconf	
+	dh_installdocs
+	dh_installexamples
+	dh_installmenu
+#	dh_installemacsen
+#	dh_installpam
+#	dh_installinit
+#	dh_installcron
+	dh_installman
+	dh_installinfo
+	dh_installmime
+#	dh_undocumented
+	dh_installchangelogs
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+#	dh_makeshlibs
+	dh_installdeb
+#	dh_perl
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+source-tarball-from-cvs: clean
+	cp -af ../$(PHOENIX_CVS) ../$(PHOENIX)-$(UPSTREAM_VERSION).orig
+	cd ../$(PHOENIX)-$(UPSTREAM_VERSION).orig ; rm -rf mailnews debian
+	cd ../$(PHOENIX)-$(UPSTREAM_VERSION).orig ; find . -depth \( -name CVS \
+		 -or -name .cvsignore \) -exec rm -rf '{}' \;
+	cd .. ; tar --remove-files -cf $(PHOENIX)_$(UPSTREAM_VERSION).orig.tar \
+		$(PHOENIX)-$(UPSTREAM_VERSION).orig 
+	rm -rf ../$(PHOENIX)-$(UPSTREAM_VERSION).orig
+	gzip -9 ../$(PHOENIX)_$(UPSTREAM_VERSION).orig.tar
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure source-tarball-from-cvs
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox-dom-inspector.preinst
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox-dom-inspector.preinst
@@ -0,0 +1,10 @@
+#!/bin/sh -e
+
+if [ "$1" = "upgrade" ]; then
+    # Remove old conf files 
+    if dpkg --compare-versions "$2" lt 1.0-2; then
+      rm -f /etc/mozilla-firefox/pref/inspector.js
+    fi
+fi
+
+#DEBHELPER#
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox.desktop
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox.desktop
@@ -0,0 +1,25 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=Mozilla Firefox
+Name[fr]=Mozilla Firefox
+Name[nb]=Mozilla Firefox
+Name[nn]=Mozilla Firefox
+Name[no]=Mozilla Firefox
+GenericName=Web Browser
+GenericName[fr]=Navigateur Web
+GenericName[nb]=Nettleser
+GenericName[nn]=Nettlesar
+GenericName[no]=Nettleser
+Comment=Browse the World Wide Web
+Comment[fr]=Navigue sur Internet
+Comment[nb]=Surf pÃ¥ nettet
+Comment[nn]=Surf pÃ¥ nettet
+Comment[no]=Surf pÃ¥ nettet
+Exec=firefox %u
+Terminal=false
+MultipleArgs=false
+Type=Application
+Icon=mozilla-firefox.png
+Categories=Application;Network
+MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;x-directory/webdav;x-directory/webdav-prefer-directory;image/gif;image/jpeg;image/png
+
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox-small.xpm
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox-small.xpm
@@ -0,0 +1,156 @@
+/* XPM */
+static char * mozicon16_xpm[] = {
+"16 16 137 2",
+"  	c None",
+". 	c #388BBF",
+"+ 	c #59ADD6",
+"@ 	c #68CEEF",
+"# 	c #62CCEE",
+"$ 	c #45AAD7",
+"% 	c #3578AF",
+"& 	c #4A93C3",
+"* 	c #5EA9D2",
+"= 	c #72D1EF",
+"- 	c #6DCCEC",
+"; 	c #4B9FCE",
+"> 	c #3483BA",
+", 	c #1E67A5",
+"' 	c #1B6BA5",
+") 	c #2F7AB0",
+"! 	c #48B9E0",
+"~ 	c #5CC2E5",
+"{ 	c #6ED0EE",
+"] 	c #6FC9E9",
+"^ 	c #4994C5",
+"/ 	c #3783B9",
+"( 	c #1E5D9D",
+"_ 	c #1463A1",
+": 	c #028DC4",
+"< 	c #128DC3",
+"[ 	c #27ABD7",
+"} 	c #3CB8E0",
+"| 	c #4EC0E5",
+"1 	c #5BC3E6",
+"2 	c #50A2CE",
+"3 	c #3B7EB5",
+"4 	c #3C93C4",
+"5 	c #2164A1",
+"6 	c #145A9A",
+"7 	c #0E8FC4",
+"8 	c #007EBA",
+"9 	c #0694C8",
+"0 	c #1896C7",
+"a 	c #2B99C9",
+"b 	c #3CB7DE",
+"c 	c #48B9DF",
+"d 	c #3E95C5",
+"e 	c #2E71AB",
+"f 	c #399DCA",
+"g 	c #34A9D4",
+"h 	c #2387BE",
+"i 	c #1388C0",
+"j 	c #0059A1",
+"k 	c #005C9E",
+"l 	c #00498B",
+"m 	c #095897",
+"n 	c #1869A3",
+"o 	c #289CCA",
+"p 	c #34B1DA",
+"q 	c #3BB3DB",
+"r 	c #3BB3DA",
+"s 	c #35AFD7",
+"t 	c #2BA2CF",
+"u 	c #1E6AA2",
+"v 	c #106AA7",
+"w 	c #0258A0",
+"x 	c #00357F",
+"y 	c #002D71",
+"z 	c #003175",
+"A 	c #013A7E",
+"B 	c #084889",
+"C 	c #1577AF",
+"D 	c #1FA1CF",
+"E 	c #26A3D1",
+"F 	c #28A2CF",
+"G 	c #269ACA",
+"H 	c #2088BE",
+"I 	c #174784",
+"J 	c #0B1F5F",
+"K 	c #012568",
+"L 	c #00206A",
+"M 	c #00185A",
+"N 	c #001F62",
+"O 	c #002569",
+"P 	c #002C70",
+"Q 	c #0567A7",
+"R 	c #0D81BB",
+"S 	c #1485BD",
+"T 	c #1883BC",
+"U 	c #177DB7",
+"V 	c #144A88",
+"W 	c #0C1D5C",
+"X 	c #030B47",
+"Y 	c #00023B",
+"Z 	c #00207A",
+"` 	c #002072",
+" .	c #00236B",
+"..	c #001556",
+"+.	c #001B5E",
+"@.	c #003D81",
+"#.	c #01599E",
+"$.	c #04559E",
+"%.	c #0761A6",
+"&.	c #085499",
+"*.	c #061958",
+"=.	c #020843",
+"-.	c #000137",
+";.	c #001C79",
+">.	c #00155D",
+",.	c #000945",
+"'.	c #000B49",
+").	c #000E4C",
+"!.	c #002367",
+"~.	c #002A6F",
+"{.	c #003E8B",
+"].	c #003787",
+"^.	c #00175C",
+"/.	c #000035",
+"(.	c #000030",
+"_.	c #000E67",
+":.	c #00043B",
+"<.	c #000339",
+"[.	c #00043C",
+"}.	c #00053E",
+"|.	c #00063F",
+"1.	c #000E4F",
+"2.	c #00247E",
+"3.	c #00166A",
+"4.	c #00002E",
+"5.	c #00014F",
+"6.	c #000029",
+"7.	c #00012F",
+"8.	c #000953",
+"9.	c #000E6E",
+"0.	c #000A6C",
+"a.	c #000563",
+"b.	c #00002F",
+"c.	c #00001D",
+"d.	c #000025",
+"e.	c #000040",
+"f.	c #000033",
+"                                ",
+"          . + @ # $             ",
+"        % & * = - ; > ,         ",
+"      ' ) ! ~ { ] ^ / ( _       ",
+"    : < [ } | 1 2 3 4 5 6 7     ",
+"    8 9 0 a b c d e f g h i     ",
+"  j k l m n o p q r s t u v w   ",
+"  x y z A B C D E F G H I J K   ",
+"  L M N O P Q R S T U V W X Y   ",
+"  Z `  ...+.@.#.$.%.&.*.=.-.    ",
+"    ;.>.,.'.).!.~.{.].^./.(.    ",
+"      _.:.<.[.}.|.1.2.3.4.      ",
+"      5.6.(.4.7.8.9.0.a.        ",
+"          b.b.c.d.e.f.          ",
+"                                ",
+"                                "};
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox.NEWS
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox.NEWS
@@ -0,0 +1,34 @@
+mozilla-firefox (1.0.3-2) unstable; urgency=high
+
+    SSLv2 and all 40-bit ciphers are disabled by default in this
+    release. The insecurities of SSLv2 are outlined in
+    http://www.eucybervote.org/Reports/MSI-WP2-D7V1-V1.0-02.htm. 40-bit
+    ciphers do not provide a realistic amount of security in this day
+    and age. SSLv2 can be reenabled from the Preferences dialog, and
+    the 40-bit ciphers from about:config (look under the
+    security.ssl.* keys).
+
+ -- Eric Dorland <eric@debian.org>  Mon, 18 Apr 2005 00:27:21 -0400
+
+mozilla-firefox (1.0-1) unstable; urgency=medium
+
+    A heavily patched extension manager has been introduced this
+    release by Mike Hommey. It is designed to work around the
+    deficiencies in the upstream's current offering. Unfortunately, the
+    registration process for extension and locale packages has now
+    changed in an incompatible way. The packages will install
+    correctly but won't actually be registered with
+    Firefox. Maintainers are aware of the issue and are working on new
+    packages that will work with this new mechanism. Please do not
+    file bugs on this issue.
+    
+ -- Eric Dorland <eric@debian.org>, Wed, 10 Nov 2004 00:16:15 -0500
+
+mozilla-firefox (0.8-1) unstable; urgency=low
+
+    The mozilla-firefox package no longer uses the ~/.phoenix
+    directory for it's configuration, but the ~/.firefox directory. To
+    migrate your config, just execute "mv ~/.phoenix ~/.firefox" which
+    should work in most cases.
+
+ -- Eric Dorland <eric@debian.org>, Fri Feb 20 00:01:54 2004
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox.png.uu
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox.png.uu
@@ -0,0 +1,146 @@
+begin 644 mozilla-firefox.png
+MB5!.1PT*&@H````-24A$4@```$````!`"`8```"J:7'>````!F)+1T0`_P#_
+M`/^@O:>3````"7!(67,```L3```+$P$`FIP8````!W1)344'U`8=!!(VV`_#
+M[0``&*Y)1$%4>-KMFWF,7==]WS_GW.7M\]ZLG(WD<+B9I$QM=F18LFI;L1"G
+M-EHD7H`T5ERT!EH@2(.@@.T4!5H!7=(B0`H42%P;@1T[:9JXDMO85BS9KA?)
+MUF)J,2DN0W)(:3B<?7_K/5O_./<M0U&VO,AQVKS!#^>^B_OFWN_W]_TMY]Q[
+MX>\^_W]_Q-_$29]XXNSPA0O+<F.C3K.IR&8CRN4<DY,5)B;*6V]\XW3S_QD"
+M'G[XJ>PW'I_=(S+QL:IQO_K,E4UN/3[ZCVJ6W*81&$`*03&`4@@K2]O?"!-]
+MZ9VWC28FT7\Z4(@N?>0C]RW_K2+@D4>>S7S^H1>FDCC\M7,KS;O=:.6^>1EC
+M!\I$(V6B?)8@"I"A1`0!A"$N##"`;BF2E2W$R@;%S1TF6O6%BE%?S=:;GWS_
+M>T]<^M5?><O"SRT!G_SDU^)GSR[>/;?=^MALPOUS<8[LOA&*I2R#I2SE0H9"
+M+B:;B\C$$4$F0D0!+@A0#IJ)H=94U.H)F_46V[46C4:"6MDBN[C&='7GI6/#
+M^4_<,E7YD]_^K5^:_[DAX#O?.1L\^O69>T^]M/Z[9[;5+ZZ5^RB.5!CM+S#8
+MEZ4OGR&,0\(H(,C$1$-E@BA$2`D"G`.M#4E3D;0422LA:2J:346UGK!1:[%5
+M;]&L-0F7-IANU*^\=:+PJ0^^Y\2?W'WWB6M_HP0\]/!34__M+Y_[R)6F_MVY
+M7([RGG[&!XOT]^7(9B*B."2,>BP3$O7W$10R2"D10F`=&&-I-1*:M29),^F0
+MT6HF)"U%LYFP56NQ64MH-9ID5C:Y4YK9$Z-]O_$'__F#C_^XUQ_\).!_[_>_
+M?-]G'SWWA:?J^CWU_CXF1RM,]A<H9"/"0!($DD!VQS"0!$(0.$=8R!)(@10"
+MB4`(D%*@&BU,2V.UP2@_6F5PVA`80\89,):ZE%Q-3/_RRO:'[SKY'GWQS)>^
+M_>-@D#\N^'_S[Q[^MY]]_.*C3S;,OOQ`D?V#1<K9$.$<6(NPZ>@<PCID.@KG
+MMP,A"($`1X`E!&AII#8(TV/:]GRW!,91$([^`*(PX&H4RV]OU![\!Q_^Q-<_
+M][EO[ON9$/`;_^Q3#_[18R_^JPN)E4/E'"/%+(%P8"S.6)QQ.&/!.IRUX/RV
+M<"DA`B0."03.R]!_=Z`T:`O:^-%XCZ--NNU)"9VE)`59`<U\+GCTVN8[/O._
+MGOWRQ_[UY_>_K@3\_??]_H-?>.[*Q]>B.!@L92EF0@_26)SUAK4XEY+0L]^E
+M"@@*640;M'`$PA$`<29$2@'&2[X#O+UM/"'.>'*$->1P9'&H*.*;2]437SMU
+MZ4L/_L?_O?]U(>"W/_8_'GQRK?'Q:B875O(9,E)@M<4:B[5^="8=M<4)`<4<
+M3@BL32\\$R%R&?\/G4.F"@AP"&MQB>X`=MJDBK+^M\;@M.V2D:HB=H[8.4PV
+MQPMCXR>^=6GC2W_V9Z\M',+7"OZ__N&C#_ZG[Z]_?./0_K#XTCR!<!ZX,3@3
+M8+7!!8$'&F61AR8(*D5D'"+6MW$;VY#/0E\!B\,YBVLG/P<."`)):;1":W8)
+MIS1H[4E(P\&UPT![,D4@*;[Q`'*XG_KR!CM-16W/((]OUDZ,/[_XR+ESL^\^
+M=FSZY9^X"GSZL]]XQZ>^M_B'YXY.Q1ECB!=6D5(@`TDP/N0;FD3YC"XE,I\E
+M.C!.$$FD$`3Y+$%_B;!<0$8A,JV_HJ<.6P=;"QMLSJ^1-!)THM'*8)3"*(U6
+M&J.,M[0RF)9";59Q4M`X/P>;.X1OV$>CD.7*<FVX^MQ53GWW?W[E)PJ!LV<O
+M37_YR;D_/C4TE!%Q@$@2K#%>Y@-EQ%VWP"W3<&@26\AZ192+&,!8AW$.`]C`
+MM[K&.;3U9JQ#68M*CXM+.:PR6*W!.:SV9=!I@Y""N)('UPX-OU]O5JD^?1ZU
+MM(Y9V227)(0"MJ=&^?JV_1>_\]$_O^<G(N`S?_[\/WE,1U.F7$`8AYU?P>9S
+MV%(.=_(0QCEL7P&#P&SL8#,QC`][\+WF'-I:M&F#MQZ\<2ACT<8B<Q&%T0K9
+M@1(R$_H>0!L*XP/LO>\VAF\_Z%-'2HHS72(P!A%'A(4LQ5`B!%R>W"-?6&E\
+MYK&O?F_RQ\H!?_!?OCC]J>\N/+!Q9#^DR<V^\\W8V/?O1@HO14".#T&Y`*4\
+M)@R0SJ*M1`J;2CW]DQ:LW^,$6.'+H3.6I-:DL=U@<VX5E2B,\E(780@"DNTZ
+MIIGL!MZC!F$-S6=G"`Y-D!&29B[BJ3`W_=!?SSP`_/L?20'GSU^,OO&]^7\^
+M4RA.$DA?VHSU'5KJ1?V5%VC]T:/HC1HF"K&#94PN1EO;\;SN&;5Q'04H8TF,
+M11E+=;/&XKEK+)V?9VMQP\>[-ABM,5JS=O8EEIZ9(1XHT7=X@GBPY$/#F&Z_
+M82QZ91.[4T=&$1E`6D=UN,*W7][YI__A]QZ>^)$(>/*IEVZ;M_)WDH'2KCIL
+MM<48B[$6>]=A;#&+*69W@?7;-C4?Y[HC^=32X[=7=UB]LD2CUO03H6:"5J:;
+M!+5/?$FM!5(P\*9#9$8JB##`:4-F<HCL@5%$&!`,ELG]PG%`$%A'Y(!`<C'*
+M'C@WN_Z/+U^>%:\Y!)XYO?@/3]M(@DMKK@5I<=)ZV4N!*68(?NT>C`!MK"]I
+M0B*P""$1.`06G$"XE&OA<$BL<U@AV+J^CFTIG$I[_T2G6=]_-\JK(#M2QDF)
+MM9;^-QTAW-//XF.G*-UV"#DV0'9M&YN-,4)BFQJL)<*1&$MKN,+5U:7?//7L
+MW*>!:S]4`8\^^N3^BVO-#S=+^;0=M9TV%).6(&70QG:E[79+7)O4XSTJ:'O>
+MJ\#O<T&`4H8DT2BE4<JDHR>A383,9SQISF&M(S,VP-#]=Y+9-P(+&X3/OXS<
+M:7:O5UNDL03.@A"<:;!G=:/^H=<4`C.7UMYZ;E.-(T77^VU+9V9M$I1.I6XL
+MNM%"+:VCM$7MU%&+ZZAZJRO[-.-WR-"6>*R"BT)L(#SX1*7@-3K-`48;"`),
+MFENL\U4ES.>P3\Y@S\SYUCN*.M6A?;V!GVNSD<GRS-G5=Y\]>[[P`PFX>/%B
+M-+]<_?4E&W1!I]U79X+20X#1QA-0K:,OS:&-02^NDERZAII?0<TM>8]:BS+&
+MDZ`MRAH2:[%12.'P&'W']Q&6\UWPJ5D@.SZ([,OWE%6+M0X+V-4=G)2XN]^`
+M"V6/P]+2:"S"6%P^9GZK];8K5]:F?F`.J%8;>V<7JF]/XB@%+D`*$!:D`2%`
+M:]A>Q0[T8;(QHM%$K&_ZI9U6XK-R*"$(8+,*C19.9G%"8ITA%`+C!(%PF/9Z
+M0!A0.#2!BT.2K;I/:OD,4:5`V%?`!;)37:QU?NZ1"7'W'O-S!=TMBV@_9W#:
+M=@DPCN<6ZFAC'P`^^JH$+"[N'+ZR7,L3]WDF>X'+M&>]^C+4&[BY"),N;8DX
+MA#A$*`.1Q)D`%_IY@EO9Q`6#N$R(=0(K!8$3&`&!$'YF*$"$DMST&#DZ<Z6.
+MW.VNTIIN:X.5TA/0:.%4"ESU*%;YZ3/:L.DD%V?7)F9F9N(C1XXD-R6@7D\.
+MSJZU8/@&X$*`-7!M'G:JWKO&X)(`$P8($_E%BR@$$T!H04L(#>ZE19S2N`/C
+M6.$\"<*O!AGA//AVLR3\S,BE#%@'KD-"VEH;Z\$G&GMM&;NVA5U8P24*F\WB
+M#DU[1:C=JE`R8'ZY5E%*98%7$C`S,Y-_^IFK4YO--(:D`)&2(`QLK,/**LA4
+MWD$`@9\1:F/`1/YW48"+0@@DF``7&-BI^V4M*0BMP$B!%*1+8EV>=WU2!;B>
+M[&^MP6B+5;XGL?4F=G$%M[F-:R4XO8Z5`6YXCR=`]>2N4')MJ2J!_<#I5Q"@
+ME,JO;]9/$@C_H]HV)`T8GP"1@;5U2!3MSA!C(?`9ND."#E/3G?5^F\O@*B6L
+ML81.8(0/@4"`Q!,ATE`0WO=I"+B4!+^8XM+I=Y<`@QWHQRZL8I,U;**P28([
+M?18;7\(5^W`CXS@1>#S6L55-[FTV]<F;$J"U9G.KB;/X'VQN0'4+HMB[8WW#
+MCT9"D(*W/A20?DU`=V(OP$4&P@!7R.&T]5+M[R.0PG,G=JN`5`FB`]YUEM7:
+MRVQ6^\61-@G&@=T[@;W\D@>?)%X)V]O86@,G(URV",*K<Z>N"ZU6$M\T"89A
+M.%2K)YAV&<D68'T9KE[V7I=!5_[6=HF0TN>+0&*U1+>]K[4G8&$%M[J!VS.(
+M/7D8&P9>1&D>\#E`^,[1I6L$/02TYR'.N,YJD]4I"5ICEM>PC49'`58E6*5P
+MM67<PCQ.!E`>@&R1ZIXAE-+![.RLF)Z>=KL($$),ZG;?KPS$>8AST-CQGI8I
+M6-L&'?ACI4SC78*46*W1@<:I`!=VS=::!$V%"ZVO!*GW.WFVAX3=!+15D)*@
+M?2C8I16_?6D6DRA,DG@"$H55J24)Z`2VU\%I3.$7D%(.6&LE8'81X)PK!%)X
+M\,I`?0=J6RG@'M"VQ^L=(D2J$.%)$`87R"[X(""0`:ZEL<H02(GM)$(/7K9S
+M@$M'BU]1-JZSJ.IT=U9J6P;[PO>QU5KJ>855"28=K?:&U;Z"64T8Y0A#V6^M
+M#5Y!`!`5<I+(&90VT&Q`JYEZ7:9@V^!3$[U$F/2[)\%IB5'"DY#+XLI]N(9"
+M!B(%WVNNNTSFND1T0L!V5YFMMKBSY[`KJ]A:'=MJ=3QN4OE;[4>,!N?!XPRE
+MK$!*PO9JW(TA4*N4L\JU-,0&ME=!JZZ7G4A#(04I4H^+&PD1:5V3."$QI2+N
+M^%%<%&.;"8&4Z>%=`CK-$/B;*ZX]]N8!3X*K-7`OS6&;3;]LIA*LTJGW=4I"
+MXG-0"ASGG92-Q'-!()M""'NS1FAM<K*T$AH_"_/S``U.IC<W4@6TU2!2-8@>
+M$E+@G7UA"`>FL'$&UU3(5/J!%#T$=+._0/B;)VTB;`\!;1+FK^,:#5P'N.YX
+MW&B%U0IKE)>]T_[:<1!$#`SDKPO!JI32W*P,OES(9QC*"ZXI#:4Q#Z:QX9DD
+M!=_V<I@V/NWOMI>,%%4<^F-:"B=\`V1%&@(=$GISP&X5M.\J]:J`M75LLXE3
+M"JLU3JMT`55US(-/S?\C!#%3^\H((;8.'CSX2@5(*76QF)&C_='5:]?-%%$`
+M?7NA/`&Z#JTZ5.M>^F.#7ATKU_Q)>D&+E(@@@""$,R_"OGTP-.QOATN)$6D[
+M#,BE342MA9@<1.:B3AGL5`/;)<&MK?J;)ZT$IY.4`(TU/@>X=L)SINOYU,*H
+MP(ECPTMA&-I7ZP-T'$?-PP>*ET]=69UR[0L(`XC[O-4V(930-P)6@6K"ZG4/
+MVO:`%_X6%RO+?KM>AY-9F+T$(WM@9!0G\$OF:U7$BW.(/>5T%2E-A+TYP#EH
+M-'&GGX?:#LYXX.W16NW/Y]HQ[WK`>[QC8Z,,CY1D&(;77XV`[2`(SK_UKK'X
+MH<<6:2D!+DC+D?,>'>GSA"0:%F:@NNX9%S>`I_<[OJ+,S\/B`BPMPG$+@R->
+M$:,57#D/VB"T2<M@J@+;0\+\'&QMI(NA&HS&6=,%;MM>W^UY'_\YIO8./-57
+MRD?.N1=N2L"A0X?LZ=.GE_?MZW=3>R(N+)IN0^(""%TZ#TCG_9M+/C?T@N\`
+MQX^DA%1WX.+9[G,9ERY`L9+^!H@#:&GO./P$J$.\=1[8SK8'JY*TKG?+6Q>\
+MNZD%83]WOW7O7"83KP=!4'O5]0`AQ'?Z^TOO/GFL?&KFY:4[G0U[DE"[#78^
+M#*SR%R1Z8K\-N$-&S[85W8:_5H6F\D2UFJEDT\0:A#W$I^=.$@@R4!Z&0C\L
+M78'ME9XR=R-XNDH0DO'Q26X].;H31='9*(H:KTI`%$4KN5SNVKWWC)NO?7/I
+MSO6&]MYWSO<`84J$E?Z"U'8/R-3SR*YGVVJ@APCP(*M5F#T#29L`_,1KXB"4
+MAFYHAP44AR`_F.(+86=E=YGK`-_M?1%4>-,=X\\.#Y>C.(Z?/GCPH'O5-<&C
+M1X_6,IG,]Z>GA]VM)TI+0FD?[[W6WM<WG4[:TX;#JIZQ9SN-5V_I_E8#7CH/
+M6RO0J$*SYFUGP^^O[O@P:RD_!4\4*.LMT>!"R%72,F=O2'B])A@<W,<[WKYO
+MIE0J;4DI+_W05>$P#+]5J93MN^Z;^&XYRRN!M]*1K"^)'0)N8D:_DB"C0#=A
+M9:Y+BE%=XFI;</X[,'<>FHD_7_N<B?+;]1W?F78\;F\84Y/]W/7FO=<.'=S3
+MRF:S3\5QO/-#"8BBZ'H^GW_VEEO&U^]Z<V5=ZINHH'U147^:@75WO*FIFQ"C
+M=JO%].Q7#5A_&:K;716T5)<(6009DQ;2'NM50<C8Z#3WOVOJR4JEHL(P?*Q7
+M_J]*P.'#AUT<QU\>&!@0O_S+^[X],1Z`;KV2A$1#-`GY(Y`=3Y.1[BE)[6WU
+M@U72SN8=<E)2C/+)KY?P1'>)(/LJ\O??HV@/][_KP%</'1JKYO/Y)Z(H6GK-
+M]P:C*+I:+!:?/G1H8N.][YW\6BZ;@-GQ)6@7"0[(0;+2TX28W:KH_=[9=Q,B
+MVMG<:?_L1FD:7/:5X-OGED.0V7<3!1B$R'+\^.$+]]UWX-K`P$`KCN-'#A\^
+M[%XS`4>.''&93.:AP<'!ZCWW3,V_[6UC7PR"*KCUE(A6-SG59T%O[59`+\B;
+M[;,W$F)`9J'O"!2/0/^;(!Q*P=\0`JU>%>R#\#B(@T`&T(!@SYXCUQ]XX-@3
+MX^.C8:%0>.3X\>-+/_+S`<>.'5L^<^;,E\;&QG[]?>^K+Z^NUJX___S%<6OK
+MX')@LMYZVLWN0R\]HWN5_>WR*'-0NLW_#U'P;E$V)93=[;#=/3GR5DB?]ID"
+MZO3W]YL/?>CVIZ:GQ^/^_OXKV6SVL1_[(:E\/O]8?W__P;U[)][RP`/-K]1J
+MS?MG9BY,.%=+8S"7GERE@I(W>0+7W?S)W'86-PW0SGO0:7]\9S9XPWR@W14Z
+M#2X!6JDU@2;%8K_^P`>./7S''?N:HZ.C]7P^_\='CARI_T3/"I\_?WZ@6JU^
+M='Y^?N_%BU>;G_C$L_=?OGQFPEJ;DD!ZUUG2?N@-QH!\"GXUE:9Z]<L(AD#N
+M]PIP/4].N51=G=R@4NL%WP(22J41_?[WW_GPV]]^6$]-3:F!@8%/WW+++?_G
+MI_*P]-FS9_?L[.Q\[-JU:\-7KLPEG_O<Z?M/GWYFPIA&&GL;*<@0B('#J3K"
+ME)`&<#G];^8FE^#2#G(:W%!/4M/I\3>";UL3L`P,'%`?_."=7[CKKFF]?_]^
+M/3`P\-]OO?761WZJ3XN?.W?NX-;6UF_-S\\/S<W-M_[JK\[?\<033]W:;"ZD
+M_ZJ1>IU4`5%*0)BJH`J,`@N=+NV5GWY@/`7=:ZJ'A"X!0F38O_^-BQ_XP.W?
+M/'%BK]V[=Z\9'!S\8JE4^LOIZ6G[4W]<_MRY<P>WM[=_<W%Q<<_\_+QYYIEK
+MQ:]\Y7OO7%@XW>?<5NK]&"CT@`_3"P[24ZZF'A<W/+(XD(:42`DR/=[7-Q``
+M^?PD=]SQIC/O><^1IR<G1W.3DY.J4JD\5"J5OGSPX$'UNKTO\.*++XXTF\U_
+MN;R\/';]^G5S[=JR^>I7+]WQW'-/WU:K7<6YY`;OM\.@G2#;TA4]U2/?DS/L
+M#R#`$8;#3$W=>OV^^TY\Y\2)L>;X^)@9&QNSI5+I+TZ>//G7/Y,7)LZ?/]_?
+M;#8_L+FY^?<6%A;4RLJ*N'IU53_^^.P=%RZ\>.OV]BS.[?2T&VWORY[V0_1T
+M<<$-'=V-1,3$\1[&QHXOO.4MQY^X_?;1G>'A`3DZ.AH/#P\O%HO%/SU^_/BI
+MG^D;([.SL[)>K]];J]5^975U=6!U=56NKZ_K^?DM?>K4]8,S,U>.+RU='=)Z
+M&=CN*8<_Z-2]QV0(@D'*Y0GV[IV>N?WV?=\_<F2H.C!0CH>&AMS(R(@LE\O?
+MBN/X+XX=.[;^-_;.T+ESYX9;K=9[:[7:/>OKZ_'Z^KK8VMJRFYM5O;Q<=^?.
+MK>R[?GWMC1L;*R-;6\LH50,46K=2-3BDC-*PR5`L]C,PL&=K:*C_V3>\861]
+M__[R5G]_0?;UE:)*I<+@X*"H5"I7LMGLYW.YW/=?2[)[W=\:FYF9$4JI2:74
+M+S4:C;=L;FYFM[:V],[.3E"KU6RKE=AZ/;'-IF)[.REN;R=]]7I"K6;)9`39
+M;$0N%U*I9!:+Q=#F\QF1SV?"7"Y'H5"PY7)95BJ5H%`HS&2SV<>B*'KNZ-&C
+M]9^[]P8O7KPHE%)#QIA[6ZW6'8U&XT"M5K/U>MTU&@V3)$FLE$)KG1ACG+56
+M"B&L$((@"&3D/S:?S^M<+A<7BT5;*!3J<1P_%T71M\(PO'STZ-&?VINEK^N;
+MHQ<N7,AJK2O.N;N54H/6VA-*J2&MM5!*66,,UEHAA'!22H(@$%$4B2B*5!`$
+M9Z,HF@_#\!0P%\=Q[="A0^YOW:NS[<_ERY>%UCK66@=`&`3!"##BG*L`B1!B
+KQSEW52FU$X8A412U#A\^;/B[S^O[^;\Z\7.<>GK+0@````!)14Y$KD)@@@``
+`
+end
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox.links
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox.links
@@ -0,0 +1,13 @@
+/usr/lib/mozilla-firefox/firefox /usr/bin/mozilla-firefox
+/usr/lib/mozilla-firefox/firefox /usr/bin/firefox
+/usr/share/man/man1/mozilla-firefox.1.gz /usr/share/man/man1/firefox.1.gz
+/var/lib/mozilla-firefox/chrome/overlayinfo /usr/lib/mozilla-firefox/chrome/overlayinfo
+/var/lib/mozilla-firefox/chrome/chrome.rdf /usr/lib/mozilla-firefox/chrome/chrome.rdf
+/var/lib/mozilla-firefox/extensions/installed-extensions.txt /usr/lib/mozilla-firefox/extensions/installed-extensions-processed.txt
+/var/lib/mozilla-firefox/extensions/Extensions.rdf /usr/lib/mozilla-firefox/extensions/Extensions.rdf
+/var/lib/mozilla-firefox/defaults.ini /usr/lib/mozilla-firefox/defaults.ini
+/var/lib/mozilla-firefox/components.ini /usr/lib/mozilla-firefox/components.ini
+/var/lib/mozilla-firefox/components/xpti.dat /usr/lib/mozilla-firefox/components/xpti.dat
+/var/lib/mozilla-firefox/components/compreg.dat /usr/lib/mozilla-firefox/components/compreg.dat
+/etc/mozilla-firefox/pref /usr/lib/mozilla-firefox/defaults/syspref
+/etc/mozilla-firefox/profile /usr/lib/mozilla-firefox/defaults/profile
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox.postinst
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox.postinst
@@ -0,0 +1,24 @@
+#!/bin/sh -e
+
+if [ "$1" = "configure" -o "$1" = "abort-upgrade" ] ; then
+    update-alternatives --install /usr/bin/x-www-browser \
+        x-www-browser /usr/bin/mozilla-firefox 70 \
+        --slave /usr/share/man/man1/x-www-browser.1.gz \
+        x-www-browser.1.gz /usr/share/man/man1/mozilla-firefox.1.gz
+    update-alternatives --install /usr/bin/mozilla mozilla \
+        /usr/bin/mozilla-firefox 0 \
+        --slave /usr/share/man/man1/mozilla.1.gz mozilla.1.gz \
+        /usr/share/man/man1/mozilla-firefox.1.gz
+fi
+
+if [ "$1" = "configure" ] ; then
+    update-mozilla-firefox-chrome
+fi
+
+if [ -x /usr/sbin/update-desktop-database ]; then
+    /usr/sbin/update-desktop-database
+fi
+
+#DEBHELPER#
+
+echo "Please restart any running Firefoxes, or you will experience problems."
\ No newline at end of file
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox.prerm
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox.prerm
@@ -0,0 +1,23 @@
+#!/bin/sh -e
+
+if [ "$1" = "remove" -o "$1" = "deconfigure" ] ; then
+    update-alternatives --remove x-www-browser /usr/bin/mozilla-firefox
+    update-alternatives --remove mozilla /usr/bin/mozilla-firefox
+fi
+
+if [ "$1" = "remove" ]; then
+    rm -rf /var/lib/mozilla-firefox/chrome/overlayinfo
+    rm -f /var/lib/mozilla-firefox/chrome/chrome.rdf
+    rm -f /var/lib/mozilla-firefox/defaults.ini
+    rm -f /var/lib/mozilla-firefox/components.ini
+    rm -f /var/lib/mozilla-firefox/components/xpti.dat
+    rm -f /var/lib/mozilla-firefox/components/compreg.dat
+    rm -f /var/lib/mozilla-firefox/extensions/installed-extensions.txt
+    rm -f /var/lib/mozilla-firefox/extensions/Extensions.rdf
+    rm -f /usr/lib/mozilla-firefox/defaults/profile/extensions/Extensions.rdf
+    if [ -d /var/lib/mozilla-firefox/ ]; then
+        find /var/lib/mozilla-firefox/ -type d -depth -empty -exec rmdir {} \;
+    fi
+fi
+
+#DEBHELPER#
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefoxrc
+++ mozilla-firefox-1.0.4/debian/mozilla-firefoxrc
@@ -0,0 +1,2 @@
+# which /dev/dsp wrapper to use
+FIREFOX_DSP="auto"
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox.mime
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox.mime
@@ -0,0 +1,5 @@
+text/html; /usr/bin/mozilla-firefox %s; description=HTML Text; test=test -n "$DISPLAY";  nametemplate=%s.html; priority=5
+text/xml; /usr/bin/mozilla-firefox %s; description=XML Text; test=test -n "$DISPLAY";  nametemplate=%s.xml; priority=5
+image/png;  /usr/bin/mozilla-firefox %s; description=PNG Image; test=test -n "$DISPLAY";  nametemplate=%s.png; priority=2
+image/jpeg;  /usr/bin/mozilla-firefox %s; description=JPEG Image; test=test -n "$DISPLAY";  nametemplate=%s.jpeg; priority=2
+image/gif;  /usr/bin/mozilla-firefox %s; description=GIF Image; test=test -n "$DISPLAY";  nametemplate=%s.gif; priority=2
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox.manpages
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox.manpages
@@ -0,0 +1,2 @@
+debian/mozilla-firefox.1
+debian/update-mozilla-firefox-chrome.8
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox.1
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox.1
@@ -0,0 +1,142 @@
+.TH MOZILLA\-FIREFOX 1 "November 4, 2004" mozilla\-firefox "Linux User's Manual"
+.SH NAME
+mozilla\-firefox - a Web browser for X11 derived from the Mozilla browser
+
+.SH SYNOPSIS
+.B mozilla\-firefox
+[\fIOPTIONS\fR] [\fIURL\fR]
+
+.B /usr/lib/mozilla\-firefox/firefox\-bin
+[\fIOPTIONS\fR] [\fIURL\fR]
+
+.SH DESCRIPTION
+\fBMozilla Firefox\fR is an open-source web browser, designed for
+standards compliance, performance and portability.
+
+.SH USAGE
+\fBmozilla\-firefox\fR is a simple shell script that will set up the
+environment for the actual executable, \fBfirefox\-bin\fR.
+
+.SH OPTIONS
+A summary of the options supported by \fBmozilla\-firefox\fR is included below.
+
+.SS "GTK options"
+\fB\-\-gdk\-debug=\fR\fIFLAGS\fR
+Gdk debugging flags to set
+.TP
+\fB\-\-gdk\-no\-debug=\fR\fIFLAGS\fR
+Gdk debugging flags to unset
+.TP
+\fB\-\-gtk\-debug=\fR\fIFLAGS\fR
+Gtk+ debugging flags to set
+.TP
+\fB\-\-gtk\-no\-debug=\fR\fIFLAGS\fR
+Gtk+ debugging flags to unset
+.TP
+\fB\-\-gtk\-module=\fR\fIMODULE\fR
+Load an additional Gtk module
+
+.SS "X11 options"
+.TP
+.BI \-\-display= DISPLAY
+X display to use
+.TP
+.B \-\-sync
+Make X calls synchronous
+.TP
+.B \-\-no\-xshm
+Don't use X shared memory extension
+.TP
+.BI \-\-xim\-preedit= STYLE
+.TP
+.BI \-\-xim\-status= STYLE
+.TP
+.B \-\-g\-fatal\-warnings
+Make all warnings fatal
+
+.SS "Mozilla options"
+.TP
+\fB\-height\fR \fIvalue\fR
+Set height of startup window to \fIvalue\fR pixels.
+.TP
+.B \-h, \-help
+Show summary of options.
+.TP
+.B \-installer
+Start with Mozilla 4.x migration window.
+.TP
+\fB\-width\fR \fIvalue\fR
+Set width of startup window to \fIvalue\fR pixels.
+.TP
+.B \-v, \-version
+Print Mozilla Firefox version.
+.TP
+\fB\-CreateProfile\fR \fIprofile\fR
+Create \fIprofile\fR.
+.TP
+\fB\-P\fR \fIprofile\fR
+Start with \fIprofile\fR.
+.TP
+.B \-ProfileManager
+Start with profile manager.
+.TP
+\fB\-UILocale\fR \fIlocale\fR
+Start with \fIlocale\fR resources as User Interface locale. By default, it is
+guessed from environment and available locales for Mozilla Firefox.
+.TP
+\fB\-ContentLocale\fR \fIlocale\fR
+Start with \fIlocale\fR resources as content locale. By default, it is
+guessed from environment and available locales for Mozilla Firefox.
+.TP
+\fB\-remote\fR \fIcommand\fR
+Execute \fIcommand\fR in an already running Mozilla Firefox process.
+For more info, see: \fIhttp://www.mozilla.org/unix/remote.html\fR
+.TP
+.B \-jsconsole
+Start with Javascript Console
+.TP
+\fB\-chrome\fR \fIurl\fR
+Load the specified chrome.
+.TP
+.B \-safe\-mode
+Starts Mozilla Firefox in safe mode, that is disabling all extensions and
+showing a bit more debugging messages.
+
+.SS "Debugger options"
+.TP
+.B \-g, \-debug
+Starts Mozilla Firefox through a debugger (gdb by default).
+.TP
+\fB\-\-debugger\fR \fIprogram\fR
+Use \fIprogram\fR as a debugger for Mozilla Firefox. Implies \fB\-debug\fR.
+
+.SH ENVIRONMENT
+\fIFIREFOX_DSP\fR - configures the /dev/dsp wrapper to use. Accepted values
+are "auto" (default), "arts", "esd" or "none".
+
+.SH FILES
+\fI/usr/bin/mozilla\-firefox\fR - shell script wrapping
+\fBfirefox\-bin\fR
+.br
+
+\fI/usr/lib/mozilla/firefox\-bin\fR - \fBmozilla\-firefox\fR
+executable
+.br
+
+\fI/etc/mozilla\-firefox/mozilla\-firefoxrc\fR - file containing environment
+variables to be passed to Mozilla Firefox.
+.br
+
+\fI${HOME}/.mozilla/firefox/rc\fR - file containing environment variables to
+be passed to Mozilla Firefox. Overrides \fI/etc/mozilla\-firefox/mozilla\-firefoxrc\fR
+
+.SH BUGS
+To report a bug, please visit \fIhttp://bugzilla.mozilla.org/\fR
+
+.SH "SEE ALSO"
+.BR mozilla(1)
+
+.SH AUTHORS
+.TP
+.B The Mozilla Organization
+.I http://www.mozilla.org/about.html
--- mozilla-firefox-1.0.4.orig/debian/update-mozilla-firefox-chrome
+++ mozilla-firefox-1.0.4/debian/update-mozilla-firefox-chrome
@@ -0,0 +1,139 @@
+#!/bin/sh
+
+set -e
+
+umask 022
+
+echo -n "Updating mozilla-firefox chrome registry..."
+
+if [ "$1" = "-v" ]; then
+    VERBOSE=1
+    echo
+fi
+
+unset MOZILLA_FIVE_HOME || :
+MOZILLA_FIVE_HOME=/usr/lib/mozilla-firefox
+export MOZILLA_FIVE_HOME
+
+# PATH
+PATH=/usr/lib/mozilla-firefox:$PATH
+export PATH
+
+# added /usr/lib : don't load your local library
+LD_LIBRARY_PATH=/usr/lib/mozilla-firefox${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
+export LD_LIBRARY_PATH
+
+# fake home to capture .firefox
+HOME=`mktemp -d /tmp/mozilla-firefox-pkg.XXXXXX`
+export HOME
+
+/sbin/ldconfig
+
+VARDIR=/var/lib/mozilla-firefox
+LIBDIR=/usr/lib/mozilla-firefox
+EXTDIR=${VARDIR}/extensions.d
+
+# cleaning VARDIR
+rm -fr ${VARDIR}/chrome ${VARDIR}/components ${VARDIR}/extensions/*
+
+# cleaning LIBDIR
+rm -rf ${LIBDIR}/chrome/overlayinfo
+rm -f  ${LIBDIR}/chrome/*.rdf
+rm -f  ${LIBDIR}/components/*.dat
+rm -f  ${LIBDIR}/components.ini
+rm -f  ${LIBDIR}/defaults.ini
+
+# create VARDIR
+install -d ${VARDIR}/chrome/overlayinfo
+install -d ${VARDIR}/components
+
+# create symlinks to LIBDIR
+ln -sf ${VARDIR}/chrome/overlayinfo ${LIBDIR}/chrome/overlayinfo
+ln -sf ${VARDIR}/extensions/installed-extensions.txt \
+    ${LIBDIR}/extensions
+
+# purge installed-extensions-processed.txt
+rm -f ${LIBDIR}/extensions/installed-extensions-processed.txt
+
+# reinitialize Extensions.rdf
+rm -f ${LIBDIR}/extensions/Extensions.rdf
+cat <<EOF > ${LIBDIR}/extensions/Extensions.rdf
+<?xml version="1.0"?>
+
+<RDF xmlns:em="http://www.mozilla.org/2004/em-rdf#"
+     xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+
+  <Seq about="urn:mozilla:extension:root"/>
+  <Seq about="urn:mozilla:theme:root"/>
+
+</RDF>
+EOF
+
+# gen installed-extensions.txt
+TMPFILE=`tempfile`
+for f in `echo ${EXTDIR}/* | sort`; do
+    while read line; do
+    	EXTUID=`echo ${line} | cut -f 2 -d ,`
+        EXTUIDDIR=${LIBDIR}/extensions/${EXTUID}
+        if [ -e ${EXTUIDDIR} ]; then
+	    if [ -e ${EXTUIDDIR}/install.rdf ]; then
+	        if grep ${EXTUID} ${EXTUIDDIR}/install.rdf 2>&1 > /dev/null; then
+	            echo $line >> ${TMPFILE}
+	        elif [ "${VERBOSE}" ]; then
+		    echo "W: ${f}: ${EXTUIDDIR}/install.rdf doesn't contain the UID." >& 2
+		fi
+	    elif [ "${VERBOSE}" ]; then
+	        echo "W: ${f}: ${EXTUIDDIR}/install.rdf doesn't exist." >&2
+	    fi
+	elif [ "${VERBOSE}" ]; then
+	    echo "W: ${f}: ${EXTUIDDIR} doesn't exist." >&2
+	fi
+    done < $f
+done
+
+mv ${TMPFILE} ${VARDIR}/extensions/installed-extensions.txt
+chmod 0644 ${VARDIR}/extensions/installed-extensions.txt
+
+if [ "$VERBOSE" ]; then
+    for f in `find ${LIBDIR}/extensions/ -name '{*}' -maxdepth 1`; do
+        if ! grep `basename $f` ${VARDIR}/extensions/installed-extensions.txt 2>&1 > /dev/null; then
+	    echo "W: `basename $f` not in ${VARDIR}/extensions/installed-extensions.txt" >&2
+	fi
+    done
+fi
+
+# gen
+firefox-bin -register >/dev/null 2>&1 || echo "E: Registration process existed with status: $?" >&2
+
+if [ -e ${LIBDIR}/extensions/installed-extensions.txt ]; then
+    echo "E: ${LIBDIR}/extensions/installed-extensions.txt still present. Registration might have gone wrong." >&2
+fi
+
+# move and link
+for file in ${LIBDIR}/components/*.dat; do
+  if [ -f "${file}" ]; then
+    mv ${file} ${VARDIR}/components/
+    ln -fs ${VARDIR}/components/`basename "${file}"` ${LIBDIR}/components/
+  fi
+done
+
+for file in ${LIBDIR}/chrome/*.rdf; do
+  if [ -f "${file}" ]; then
+    mv ${file} ${VARDIR}/chrome/
+    ln -fs ${VARDIR}/chrome/`basename "${file}"` ${LIBDIR}/chrome/
+  fi
+done
+
+mv ${LIBDIR}/defaults.ini ${VARDIR}/
+ln -fs ${VARDIR}/defaults.ini ${LIBDIR}/
+
+mv ${LIBDIR}/components.ini ${VARDIR}/
+ln -fs ${VARDIR}/components.ini ${LIBDIR}/
+
+mv ${LIBDIR}/extensions/Extensions.rdf ${VARDIR}/extensions/
+ln -fs ${VARDIR}/extensions/Extensions.rdf ${LIBDIR}/extensions/
+
+rm -fr ${HOME}
+
+# done
+echo done.
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox.dirs
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox.dirs
@@ -0,0 +1,7 @@
+var/lib/mozilla-firefox/extensions.d
+var/lib/mozilla-firefox/extensions
+usr/lib/mozilla-firefox/extensions
+usr/lib/mozilla-firefox/plugins
+usr/sbin
+etc/mozilla-firefox
+
--- mozilla-firefox-1.0.4.orig/debian/copyright
+++ mozilla-firefox-1.0.4/debian/copyright
@@ -0,0 +1,576 @@
+This package was debianized by Eric Dorland <eric@debian.org> on
+Thu, 05 Jun 2003 01:01:22 -0400
+
+It was downloaded from http://www.mozilla.org/projects/firebird
+
+Upstream Authors: Mozilla Project
+
+Copyright:
+
+                          MOZILLA PUBLIC LICENSE
+                                Version 1.1
+
+                              ---------------
+
+1. Definitions.
+
+     1.0.1. "Commercial Use" means distribution or otherwise making the
+     Covered Code available to a third party.
+
+     1.1. "Contributor" means each entity that creates or contributes to
+     the creation of Modifications.
+
+     1.2. "Contributor Version" means the combination of the Original
+     Code, prior Modifications used by a Contributor, and the Modifications
+     made by that particular Contributor.
+
+     1.3. "Covered Code" means the Original Code or Modifications or the
+     combination of the Original Code and Modifications, in each case
+     including portions thereof.
+
+     1.4. "Electronic Distribution Mechanism" means a mechanism generally
+     accepted in the software development community for the electronic
+     transfer of data.
+
+     1.5. "Executable" means Covered Code in any form other than Source
+     Code.
+
+     1.6. "Initial Developer" means the individual or entity identified
+     as the Initial Developer in the Source Code notice required by Exhibit
+     A.
+
+     1.7. "Larger Work" means a work which combines Covered Code or
+     portions thereof with code not governed by the terms of this License.
+
+     1.8. "License" means this document.
+
+     1.8.1. "Licensable" means having the right to grant, to the maximum
+     extent possible, whether at the time of the initial grant or
+     subsequently acquired, any and all of the rights conveyed herein.
+
+     1.9. "Modifications" means any addition to or deletion from the
+     substance or structure of either the Original Code or any previous
+     Modifications. When Covered Code is released as a series of files, a
+     Modification is:
+          A. Any addition to or deletion from the contents of a file
+          containing Original Code or previous Modifications.
+
+          B. Any new file that contains any part of the Original Code or
+          previous Modifications.
+
+     1.10. "Original Code" means Source Code of computer software code
+     which is described in the Source Code notice required by Exhibit A as
+     Original Code, and which, at the time of its release under this
+     License is not already Covered Code governed by this License.
+
+     1.10.1. "Patent Claims" means any patent claim(s), now owned or
+     hereafter acquired, including without limitation,  method, process,
+     and apparatus claims, in any patent Licensable by grantor.
+
+     1.11. "Source Code" means the preferred form of the Covered Code for
+     making modifications to it, including all modules it contains, plus
+     any associated interface definition files, scripts used to control
+     compilation and installation of an Executable, or source code
+     differential comparisons against either the Original Code or another
+     well known, available Covered Code of the Contributor's choice. The
+     Source Code can be in a compressed or archival form, provided the
+     appropriate decompression or de-archiving software is widely available
+     for no charge.
+
+     1.12. "You" (or "Your")  means an individual or a legal entity
+     exercising rights under, and complying with all of the terms of, this
+     License or a future version of this License issued under Section 6.1.
+     For legal entities, "You" includes any entity which controls, is
+     controlled by, or is under common control with You. For purposes of
+     this definition, "control" means (a) the power, direct or indirect,
+     to cause the direction or management of such entity, whether by
+     contract or otherwise, or (b) ownership of more than fifty percent
+     (50%) of the outstanding shares or beneficial ownership of such
+     entity.
+
+2. Source Code License.
+
+     2.1. The Initial Developer Grant.
+     The Initial Developer hereby grants You a world-wide, royalty-free,
+     non-exclusive license, subject to third party intellectual property
+     claims:
+          (a)  under intellectual property rights (other than patent or
+          trademark) Licensable by Initial Developer to use, reproduce,
+          modify, display, perform, sublicense and distribute the Original
+          Code (or portions thereof) with or without Modifications, and/or
+          as part of a Larger Work; and
+
+          (b) under Patents Claims infringed by the making, using or
+          selling of Original Code, to make, have made, use, practice,
+          sell, and offer for sale, and/or otherwise dispose of the
+          Original Code (or portions thereof).
+
+          (c) the licenses granted in this Section 2.1(a) and (b) are
+          effective on the date Initial Developer first distributes
+          Original Code under the terms of this License.
+
+          (d) Notwithstanding Section 2.1(b) above, no patent license is
+          granted: 1) for code that You delete from the Original Code; 2)
+          separate from the Original Code;  or 3) for infringements caused
+          by: i) the modification of the Original Code or ii) the
+          combination of the Original Code with other software or devices.
+
+     2.2. Contributor Grant.
+     Subject to third party intellectual property claims, each Contributor
+     hereby grants You a world-wide, royalty-free, non-exclusive license
+
+          (a)  under intellectual property rights (other than patent or
+          trademark) Licensable by Contributor, to use, reproduce, modify,
+          display, perform, sublicense and distribute the Modifications
+          created by such Contributor (or portions thereof) either on an
+          unmodified basis, with other Modifications, as Covered Code
+          and/or as part of a Larger Work; and
+
+          (b) under Patent Claims infringed by the making, using, or
+          selling of  Modifications made by that Contributor either alone
+          and/or in combination with its Contributor Version (or portions
+          of such combination), to make, use, sell, offer for sale, have
+          made, and/or otherwise dispose of: 1) Modifications made by that
+          Contributor (or portions thereof); and 2) the combination of
+          Modifications made by that Contributor with its Contributor
+          Version (or portions of such combination).
+
+          (c) the licenses granted in Sections 2.2(a) and 2.2(b) are
+          effective on the date Contributor first makes Commercial Use of
+          the Covered Code.
+
+          (d)    Notwithstanding Section 2.2(b) above, no patent license is
+          granted: 1) for any code that Contributor has deleted from the
+          Contributor Version; 2)  separate from the Contributor Version;
+          3)  for infringements caused by: i) third party modifications of
+          Contributor Version or ii)  the combination of Modifications made
+          by that Contributor with other software  (except as part of the
+          Contributor Version) or other devices; or 4) under Patent Claims
+          infringed by Covered Code in the absence of Modifications made by
+          that Contributor.
+
+3. Distribution Obligations.
+
+     3.1. Application of License.
+     The Modifications which You create or to which You contribute are
+     governed by the terms of this License, including without limitation
+     Section 2.2. The Source Code version of Covered Code may be
+     distributed only under the terms of this License or a future version
+     of this License released under Section 6.1, and You must include a
+     copy of this License with every copy of the Source Code You
+     distribute. You may not offer or impose any terms on any Source Code
+     version that alters or restricts the applicable version of this
+     License or the recipients' rights hereunder. However, You may include
+     an additional document offering the additional rights described in
+     Section 3.5.
+
+     3.2. Availability of Source Code.
+     Any Modification which You create or to which You contribute must be
+     made available in Source Code form under the terms of this License
+     either on the same media as an Executable version or via an accepted
+     Electronic Distribution Mechanism to anyone to whom you made an
+     Executable version available; and if made available via Electronic
+     Distribution Mechanism, must remain available for at least twelve (12)
+     months after the date it initially became available, or at least six
+     (6) months after a subsequent version of that particular Modification
+     has been made available to such recipients. You are responsible for
+     ensuring that the Source Code version remains available even if the
+     Electronic Distribution Mechanism is maintained by a third party.
+
+     3.3. Description of Modifications.
+     You must cause all Covered Code to which You contribute to contain a
+     file documenting the changes You made to create that Covered Code and
+     the date of any change. You must include a prominent statement that
+     the Modification is derived, directly or indirectly, from Original
+     Code provided by the Initial Developer and including the name of the
+     Initial Developer in (a) the Source Code, and (b) in any notice in an
+     Executable version or related documentation in which You describe the
+     origin or ownership of the Covered Code.
+
+     3.4. Intellectual Property Matters
+          (a) Third Party Claims.
+          If Contributor has knowledge that a license under a third party's
+          intellectual property rights is required to exercise the rights
+          granted by such Contributor under Sections 2.1 or 2.2,
+          Contributor must include a text file with the Source Code
+          distribution titled "LEGAL" which describes the claim and the
+          party making the claim in sufficient detail that a recipient will
+          know whom to contact. If Contributor obtains such knowledge after
+          the Modification is made available as described in Section 3.2,
+          Contributor shall promptly modify the LEGAL file in all copies
+          Contributor makes available thereafter and shall take other steps
+          (such as notifying appropriate mailing lists or newsgroups)
+          reasonably calculated to inform those who received the Covered
+          Code that new knowledge has been obtained.
+
+          (b) Contributor APIs.
+          If Contributor's Modifications include an application programming
+          interface and Contributor has knowledge of patent licenses which
+          are reasonably necessary to implement that API, Contributor must
+          also include this information in the LEGAL file.
+
+               (c)    Representations.
+          Contributor represents that, except as disclosed pursuant to
+          Section 3.4(a) above, Contributor believes that Contributor's
+          Modifications are Contributor's original creation(s) and/or
+          Contributor has sufficient rights to grant the rights conveyed by
+          this License.
+
+     3.5. Required Notices.
+     You must duplicate the notice in Exhibit A in each file of the Source
+     Code.  If it is not possible to put such notice in a particular Source
+     Code file due to its structure, then You must include such notice in a
+     location (such as a relevant directory) where a user would be likely
+     to look for such a notice.  If You created one or more Modification(s)
+     You may add your name as a Contributor to the notice described in
+     Exhibit A.  You must also duplicate this License in any documentation
+     for the Source Code where You describe recipients' rights or ownership
+     rights relating to Covered Code.  You may choose to offer, and to
+     charge a fee for, warranty, support, indemnity or liability
+     obligations to one or more recipients of Covered Code. However, You
+     may do so only on Your own behalf, and not on behalf of the Initial
+     Developer or any Contributor. You must make it absolutely clear than
+     any such warranty, support, indemnity or liability obligation is
+     offered by You alone, and You hereby agree to indemnify the Initial
+     Developer and every Contributor for any liability incurred by the
+     Initial Developer or such Contributor as a result of warranty,
+     support, indemnity or liability terms You offer.
+
+     3.6. Distribution of Executable Versions.
+     You may distribute Covered Code in Executable form only if the
+     requirements of Section 3.1-3.5 have been met for that Covered Code,
+     and if You include a notice stating that the Source Code version of
+     the Covered Code is available under the terms of this License,
+     including a description of how and where You have fulfilled the
+     obligations of Section 3.2. The notice must be conspicuously included
+     in any notice in an Executable version, related documentation or
+     collateral in which You describe recipients' rights relating to the
+     Covered Code. You may distribute the Executable version of Covered
+     Code or ownership rights under a license of Your choice, which may
+     contain terms different from this License, provided that You are in
+     compliance with the terms of this License and that the license for the
+     Executable version does not attempt to limit or alter the recipient's
+     rights in the Source Code version from the rights set forth in this
+     License. If You distribute the Executable version under a different
+     license You must make it absolutely clear that any terms which differ
+     from this License are offered by You alone, not by the Initial
+     Developer or any Contributor. You hereby agree to indemnify the
+     Initial Developer and every Contributor for any liability incurred by
+     the Initial Developer or such Contributor as a result of any such
+     terms You offer.
+
+     3.7. Larger Works.
+     You may create a Larger Work by combining Covered Code with other code
+     not governed by the terms of this License and distribute the Larger
+     Work as a single product. In such a case, You must make sure the
+     requirements of this License are fulfilled for the Covered Code.
+
+4. Inability to Comply Due to Statute or Regulation.
+
+     If it is impossible for You to comply with any of the terms of this
+     License with respect to some or all of the Covered Code due to
+     statute, judicial order, or regulation then You must: (a) comply with
+     the terms of this License to the maximum extent possible; and (b)
+     describe the limitations and the code they affect. Such description
+     must be included in the LEGAL file described in Section 3.4 and must
+     be included with all distributions of the Source Code. Except to the
+     extent prohibited by statute or regulation, such description must be
+     sufficiently detailed for a recipient of ordinary skill to be able to
+     understand it.
+
+5. Application of this License.
+
+     This License applies to code to which the Initial Developer has
+     attached the notice in Exhibit A and to related Covered Code.
+
+6. Versions of the License.
+
+     6.1. New Versions.
+     Netscape Communications Corporation ("Netscape") may publish revised
+     and/or new versions of the License from time to time. Each version
+     will be given a distinguishing version number.
+
+     6.2. Effect of New Versions.
+     Once Covered Code has been published under a particular version of the
+     License, You may always continue to use it under the terms of that
+     version. You may also choose to use such Covered Code under the terms
+     of any subsequent version of the License published by Netscape. No one
+     other than Netscape has the right to modify the terms applicable to
+     Covered Code created under this License.
+
+     6.3. Derivative Works.
+     If You create or use a modified version of this License (which you may
+     only do in order to apply it to code which is not already Covered Code
+     governed by this License), You must (a) rename Your license so that
+     the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
+     "MPL", "NPL" or any confusingly similar phrase do not appear in your
+     license (except to note that your license differs from this License)
+     and (b) otherwise make it clear that Your version of the license
+     contains terms which differ from the Mozilla Public License and
+     Netscape Public License. (Filling in the name of the Initial
+     Developer, Original Code or Contributor in the notice described in
+     Exhibit A shall not of themselves be deemed to be modifications of
+     this License.)
+
+7. DISCLAIMER OF WARRANTY.
+
+     COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
+     WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+     WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
+     DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
+     THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
+     IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
+     YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
+     COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
+     OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+     ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+8. TERMINATION.
+
+     8.1.  This License and the rights granted hereunder will terminate
+     automatically if You fail to comply with terms herein and fail to cure
+     such breach within 30 days of becoming aware of the breach. All
+     sublicenses to the Covered Code which are properly granted shall
+     survive any termination of this License. Provisions which, by their
+     nature, must remain in effect beyond the termination of this License
+     shall survive.
+
+     8.2.  If You initiate litigation by asserting a patent infringement
+     claim (excluding declatory judgment actions) against Initial Developer
+     or a Contributor (the Initial Developer or Contributor against whom
+     You file such action is referred to as "Participant")  alleging that:
+
+     (a)  such Participant's Contributor Version directly or indirectly
+     infringes any patent, then any and all rights granted by such
+     Participant to You under Sections 2.1 and/or 2.2 of this License
+     shall, upon 60 days notice from Participant terminate prospectively,
+     unless if within 60 days after receipt of notice You either: (i)
+     agree in writing to pay Participant a mutually agreeable reasonable
+     royalty for Your past and future use of Modifications made by such
+     Participant, or (ii) withdraw Your litigation claim with respect to
+     the Contributor Version against such Participant.  If within 60 days
+     of notice, a reasonable royalty and payment arrangement are not
+     mutually agreed upon in writing by the parties or the litigation claim
+     is not withdrawn, the rights granted by Participant to You under
+     Sections 2.1 and/or 2.2 automatically terminate at the expiration of
+     the 60 day notice period specified above.
+
+     (b)  any software, hardware, or device, other than such Participant's
+     Contributor Version, directly or indirectly infringes any patent, then
+     any rights granted to You by such Participant under Sections 2.1(b)
+     and 2.2(b) are revoked effective as of the date You first made, used,
+     sold, distributed, or had made, Modifications made by that
+     Participant.
+
+     8.3.  If You assert a patent infringement claim against Participant
+     alleging that such Participant's Contributor Version directly or
+     indirectly infringes any patent where such claim is resolved (such as
+     by license or settlement) prior to the initiation of patent
+     infringement litigation, then the reasonable value of the licenses
+     granted by such Participant under Sections 2.1 or 2.2 shall be taken
+     into account in determining the amount or value of any payment or
+     license.
+
+     8.4.  In the event of termination under Sections 8.1 or 8.2 above,
+     all end user license agreements (excluding distributors and resellers)
+     which have been validly granted by You or any distributor hereunder
+     prior to termination shall survive termination.
+
+9. LIMITATION OF LIABILITY.
+
+     UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+     (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
+     DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
+     OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
+     ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
+     CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
+     WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+     COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+     INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+     LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
+     RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
+     PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
+     EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
+     THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
+
+10. U.S. GOVERNMENT END USERS.
+
+     The Covered Code is a "commercial item," as that term is defined in
+     48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
+     software" and "commercial computer software documentation," as such
+     terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
+     C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
+     all U.S. Government End Users acquire Covered Code with only those
+     rights set forth herein.
+
+11. MISCELLANEOUS.
+
+     This License represents the complete agreement concerning subject
+     matter hereof. If any provision of this License is held to be
+     unenforceable, such provision shall be reformed only to the extent
+     necessary to make it enforceable. This License shall be governed by
+     California law provisions (except to the extent applicable law, if
+     any, provides otherwise), excluding its conflict-of-law provisions.
+     With respect to disputes in which at least one party is a citizen of,
+     or an entity chartered or registered to do business in the United
+     States of America, any litigation relating to this License shall be
+     subject to the jurisdiction of the Federal Courts of the Northern
+     District of California, with venue lying in Santa Clara County,
+     California, with the losing party responsible for costs, including
+     without limitation, court costs and reasonable attorneys' fees and
+     expenses. The application of the United Nations Convention on
+     Contracts for the International Sale of Goods is expressly excluded.
+     Any law or regulation which provides that the language of a contract
+     shall be construed against the drafter shall not apply to this
+     License.
+
+12. RESPONSIBILITY FOR CLAIMS.
+
+     As between Initial Developer and the Contributors, each party is
+     responsible for claims and damages arising, directly or indirectly,
+     out of its utilization of rights under this License and You agree to
+     work with Initial Developer and Contributors to distribute such
+     responsibility on an equitable basis. Nothing herein is intended or
+     shall be deemed to constitute any admission of liability.
+
+13. MULTIPLE-LICENSED CODE.
+
+     Initial Developer may designate portions of the Covered Code as
+     "Multiple-Licensed".  "Multiple-Licensed" means that the Initial
+     Developer permits you to utilize portions of the Covered Code under
+     Your choice of the NPL or the alternative licenses, if any, specified
+     by the Initial Developer in the file described in Exhibit A.
+
+EXHIBIT A -Mozilla Public License.
+
+     ``The contents of this file are subject to the Mozilla Public License
+     Version 1.1 (the "License"); you may not use this file except in
+     compliance with the License. You may obtain a copy of the License at
+     http://www.mozilla.org/MPL/
+
+     Software distributed under the License is distributed on an "AS IS"
+     basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+     License for the specific language governing rights and limitations
+     under the License.
+
+     The Original Code is ______________________________________.
+
+     The Initial Developer of the Original Code is ________________________.
+     Portions created by ______________________ are Copyright (C) ______
+     _______________________. All Rights Reserved.
+
+     Contributor(s): ______________________________________.
+
+     Alternatively, the contents of this file may be used under the terms
+     of the _____ license (the  "[___] License"), in which case the
+     provisions of [______] License are applicable instead of those
+     above.  If you wish to allow use of your version of this file only
+     under the terms of the [____] License and not to allow others to use
+     your version of this file under the MPL, indicate your decision by
+     deleting  the provisions above and replace  them with the notice and
+     other provisions required by the [___] License.  If you do not delete
+     the provisions above, a recipient may use your version of this file
+     under either the MPL or the [___] License."
+
+     [NOTE: The text of this Exhibit A may differ slightly from the text of
+     the notices in the Source Code files of the Original Code. You should
+     use the text of this Exhibit A rather than the text found in the
+     Original Code Source Code for Your Modifications.]
+
+     ----------------------------------------------------------------------
+
+     AMENDMENTS
+
+     The Netscape Public License Version 1.1 ("NPL") consists of the
+     Mozilla Public License Version 1.1 with the following Amendments,
+     including Exhibit A-Netscape Public License.  Files identified with
+     "Exhibit A-Netscape Public License" are governed by the Netscape
+     Public License Version 1.1.
+
+     Additional Terms applicable to the Netscape Public License.
+          I. Effect.
+          These additional terms described in this Netscape Public
+          License -- Amendments shall apply to the Mozilla Communicator
+          client code and to all Covered Code under this License.
+
+          II. "Netscape's Branded Code" means Covered Code that Netscape
+          distributes and/or permits others to distribute under one or more
+          trademark(s) which are controlled by Netscape but which are not
+          licensed for use under this License.
+
+          III. Netscape and logo.
+          This License does not grant any rights to use the trademarks
+          "Netscape", the "Netscape N and horizon" logo or the "Netscape
+          lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript",
+          "Smart Browsing" even if such marks are included in the Original
+          Code or Modifications.
+
+          IV. Inability to Comply Due to Contractual Obligation.
+          Prior to licensing the Original Code under this License, Netscape
+          has licensed third party code for use in Netscape's Branded Code.
+          To the extent that Netscape is limited contractually from making
+          such third party code available under this License, Netscape may
+          choose to reintegrate such code into Covered Code without being
+          required to distribute such code in Source Code form, even if
+          such code would otherwise be considered "Modifications" under
+          this License.
+
+          V. Use of Modifications and Covered Code by Initial Developer.
+               V.1. In General.
+               The obligations of Section 3 apply to Netscape, except to
+               the extent specified in this Amendment, Section V.2 and V.3.
+
+               V.2. Other Products.
+               Netscape may include Covered Code in products other than the
+               Netscape's Branded Code which are released by Netscape
+               during the two (2) years following the release date of the
+               Original Code, without such additional products becoming
+               subject to the terms of this License, and may license such
+               additional products on different terms from those contained
+               in this License.
+
+               V.3. Alternative Licensing.
+               Netscape may license the Source Code of Netscape's Branded
+               Code, including Modifications incorporated therein, without
+               such Netscape Branded Code becoming subject to the terms of
+               this License, and may license such Netscape Branded Code on
+               different terms from those contained in this License.
+
+          VI. Litigation.
+          Notwithstanding the limitations of Section 11 above, the
+          provisions regarding litigation in Section 11(a), (b) and (c) of
+          the License shall apply to all disputes relating to this License.
+
+     EXHIBIT A-Netscape Public License.
+
+          "The contents of this file are subject to the Netscape Public
+          License Version 1.1 (the "License"); you may not use this file
+          except in compliance with the License. You may obtain a copy of
+          the License at http://www.mozilla.org/NPL/
+
+          Software distributed under the License is distributed on an "AS
+          IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+          implied. See the License for the specific language governing
+          rights and limitations under the License.
+
+          The Original Code is Mozilla Communicator client code, released
+          March 31, 1998.
+
+          The Initial Developer of the Original Code is Netscape
+          Communications Corporation. Portions created by Netscape are
+          Copyright (C) 1998-1999 Netscape Communications Corporation. All
+          Rights Reserved.
+
+          Contributor(s): ______________________________________.
+
+          Alternatively, the contents of this file may be used under the
+          terms of the _____ license (the "[___] License"), in which case
+          the provisions of [______] License are applicable  instead of
+          those above.  If you wish to allow use of your version of this
+          file only under the terms of the [____] License and not to allow
+          others to use your version of this file under the NPL, indicate
+          your decision by deleting  the provisions above and replace  them
+          with the notice and other provisions required by the [___]
+          License.  If you do not delete the provisions above, a recipient
+          may use your version of this file under either the NPL or the
+          [___] License."
--- mozilla-firefox-1.0.4.orig/debian/debsearch.gif.uu
+++ mozilla-firefox-1.0.4/debian/debsearch.gif.uu
@@ -0,0 +1,12 @@
+begin 644 debsearch.gif
+M1TE&.#EA$``0`*4``/___^^_S]!(<,``0,@80-`H8-A@@.>OO\@04-]_G]!`
+M<-A8@."(H.>?K\`(0._'S\@@4/??W^_/W\@00-^'G]AH@/?G[^^_O_??[^^O
+MO]`P8-!`8.^OK]!0@-`X<,@84-A@<,@X4-AHD.^GO]A0@.>/K_?/W_______
+M____________________________________________________________
+M_________________________________R'^%4-R96%T960@=VET:"!4:&4@
+M1TE-4``L`````!``$`!`!GA`@%`8$`P(!<-A*+P@A@<#@`.P>"Q#R80R9%02
+M#T"`(&&22LQT>C%@I`,#P?#B&$J'&(`#*U0DF!8C?&I")%R$:48("8Q&"FD-
+M#F%J!A`11`.756X`FI)"&1I#&WQ4#QU,'T,1("$)(@N#0@^/B(0*D[9I)B(9
+$A$$`.P``
+`
+end
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox-gnome-support.postrm
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox-gnome-support.postrm
@@ -0,0 +1,11 @@
+#!/bin/sh -e
+ 
+case "$1" in
+    abort-install|purge|remove)
+        update-mozilla-firefox-chrome || true
+        ;;
+    *)
+        ;;
+esac
+ 
+#DEBHELPER#
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox.install
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox.install
@@ -0,0 +1,39 @@
+debian/tmp/usr/bin/firefox usr/bin
+debian/tmp/usr/lib/mozilla-firefox/*.so usr/lib/mozilla-firefox
+debian/tmp/usr/lib/mozilla-firefox/*.chk usr/lib/mozilla-firefox
+debian/tmp/usr/lib/mozilla-firefox/components usr/lib/mozilla-firefox
+debian/tmp/usr/lib/mozilla-firefox/defaults usr/lib/mozilla-firefox
+debian/tmp/usr/lib/mozilla-firefox/greprefs usr/lib/mozilla-firefox
+debian/tmp/usr/lib/mozilla-firefox/res usr/lib/mozilla-firefox
+debian/tmp/usr/lib/mozilla-firefox/searchplugins usr/lib/mozilla-firefox
+debian/tmp/usr/lib/mozilla-firefox/icons usr/lib/mozilla-firefox
+debian/tmp/usr/lib/mozilla-firefox/firefox-bin usr/lib/mozilla-firefox
+debian/mozilla-firefox-xremote-client usr/lib/mozilla-firefox
+debian/tmp/usr/lib/mozilla-firefox/regchrome usr/lib/mozilla-firefox
+debian/tmp/usr/lib/mozilla-firefox/regxpcom usr/lib/mozilla-firefox
+debian/tmp/usr/lib/mozilla-firefox/xp* usr/lib/mozilla-firefox
+debian/tmp/usr/lib/mozilla-firefox/run-mozilla.sh usr/lib/mozilla-firefox
+
+debian/tmp/usr/lib/mozilla-firefox/chrome/browser.jar usr/lib/mozilla-firefox/chrome
+debian/tmp/usr/lib/mozilla-firefox/chrome/comm.jar usr/lib/mozilla-firefox/chrome
+debian/tmp/usr/lib/mozilla-firefox/chrome/en-US.jar usr/lib/mozilla-firefox/chrome
+debian/tmp/usr/lib/mozilla-firefox/chrome/help.jar usr/lib/mozilla-firefox/chrome
+debian/tmp/usr/lib/mozilla-firefox/chrome/icons usr/lib/mozilla-firefox/chrome
+debian/tmp/usr/lib/mozilla-firefox/chrome/toolkit.jar usr/lib/mozilla-firefox/chrome
+debian/tmp/usr/lib/mozilla-firefox/chrome/pipnss.jar usr/lib/mozilla-firefox/chrome
+debian/tmp/usr/lib/mozilla-firefox/chrome/pippki.jar usr/lib/mozilla-firefox/chrome
+
+debian/mozilla-firefox.desktop usr/share/applications
+debian/mozilla-firefoxrc etc/mozilla-firefox
+debian/mozilla-firefox.xpm usr/share/pixmaps
+debian/mozilla-firefox.png usr/share/pixmaps
+debian/presubj usr/share/bug/mozilla-firefox
+
+debian/firefox.js etc/mozilla-firefox/pref
+
+debian/debsearch.gif usr/lib/mozilla-firefox/searchplugins
+debian/debsearch.src usr/lib/mozilla-firefox/searchplugins
+
+debian/tmp/usr/lib/mozilla-firefox/chrome/classic.jar usr/lib/mozilla-firefox/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/chrome
+debian/theme/00classic var/lib/mozilla-firefox/extensions.d
+debian/theme/Uninstall usr/lib/mozilla-firefox/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/uninstall
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox-dom-inspector.postrm
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox-dom-inspector.postrm
@@ -0,0 +1,11 @@
+#!/bin/sh -e
+ 
+case "$1" in
+    abort-install|purge|remove)
+        update-mozilla-firefox-chrome || true
+        ;;
+    *)
+        ;;
+esac
+ 
+#DEBHELPER#
--- mozilla-firefox-1.0.4.orig/debian/firefox.js
+++ mozilla-firefox-1.0.4/debian/firefox.js
@@ -0,0 +1,18 @@
+// This is the Debian specific preferences file for Mozilla Firefox
+// You can make any change in here, it is the purpose of this file.
+// You can, with this file and all files present in the
+// /etc/mozilla-firefox/pref directory, override any preference that is
+// present in /usr/lib/mozilla-firefox/defaults/pref directory.
+// While your changes will be kept on upgrade if you modify files in
+// /etc/mozilla-firefox/pref, please note that they won't be kept if you
+// do them in /usr/lib/mozilla-firefox/defaults/pref.
+
+pref("extensions.update.enabled", true);
+pref("extensions.update.autoUpdateEnabled", false);
+pref("extensions.update.autoUpdate", false);
+
+// Use LANG environment variable to choose locale
+pref("intl.locale.matchOS", true);
+
+// Disable default browser checking.
+pref("browser.shell.checkDefaultBrowser", false);
--- mozilla-firefox-1.0.4.orig/debian/mozilla-firefox-runner
+++ mozilla-firefox-1.0.4/debian/mozilla-firefox-runner
@@ -0,0 +1,378 @@
+#!/bin/sh
+#
+# The contents of this file are subject to the Netscape Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/NPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation.  Portions created by Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s): 
+#
+
+##
+## For silly people running firefox through sudo
+##
+if [ "${SUDO_USER}" ] && [ "${SUDO_USER}" != "${USER}" ]; then
+    SUDO_HOME=`getent passwd ${SUDO_USER} | cut -f6 -d:`
+    if [ "${SUDO_HOME}" = "${HOME}" ]; then
+        echo "You should really not run firefox through sudo WITHOUT the -H option." >&2
+        echo "Anyway, I'll do as if you did use the -H option." >&2
+        HOME=`getent passwd ${USER} | cut -f6 -d:`
+        if [ -z "${HOME}" ]; then
+            echo "Could not find the correct home directory. Please use the -H option of sudo." >&2.
+        fi
+    fi
+fi
+
+##
+## Variables
+##
+MOZ_DIST_BIN="/usr/lib/mozilla-firefox"
+MOZ_PROGRAM="/usr/lib/mozilla-firefox/firefox-bin"
+
+##
+## Load system and user properties
+##
+
+RUNTIME_FIREFOX_DSP="${FIREFOX_DSP}"
+
+if [ -f /etc/mozilla-firefox/mozilla-firefoxrc ]; then
+    . /etc/mozilla-firefox/mozilla-firefoxrc
+fi
+
+if [ -f "${HOME}/.mozilla/firefox/rc" ]; then
+    . "${HOME}/.mozilla/firefox/rc"
+elif [ -f "${HOME}/.mozilla-firefoxrc" ]; then
+    . "${HOME}/.mozilla-firefoxrc"
+    echo "Warning: a .mozilla-firefoxrc file has been found in your home directory" >&2
+    echo "While it is still supported, it is recommended to move it to" >&2
+    echo "\${HOME}/.mozilla/firefox/rc" >&2
+fi
+
+if [ "${RUNTIME_FIREFOX_DSP}" ]; then
+    FIREFOX_DSP="${RUNTIME_FIREFOX_DSP}"
+fi
+
+if [ -z "${FIREFOX_DSP}" ]; then
+    FIREFOX_DSP="auto"
+fi
+
+##
+## find /dev/dsp handler
+##
+
+if [ "${FIREFOX_DSP}" = "auto" ]; then
+    FIREFOX_DSP=
+    if pgrep -u `id -u` esd >/dev/null 2>&1; then 
+        FIREFOX_DSP=esddsp 
+    elif pgrep -u `id -u` arts >/dev/null 2>&1; then 
+        FIREFOX_DSP=artsdsp 
+    fi
+elif [ "${FIREFOX_DSP}" = "none" ]; then
+    FIREFOX_DSP=
+fi
+
+##
+## Set MOZILLA_FIVE_HOME
+##
+MOZILLA_FIVE_HOME="/usr/lib/mozilla-firefox"
+
+export MOZILLA_FIVE_HOME
+
+##
+## Set LD_LIBRARY_PATH
+##
+EXTENT_LD_LIB_PATH=/usr/lib/mozilla-firefox:/usr/lib/mozilla-firefox/plugins:/usr/lib/mozilla/plugins:/usr/lib
+if [ "${LD_LIBRARY_PATH}" ]; then
+    LD_LIBRARY_PATH=${EXTENT_LD_LIB_PATH}:${LD_LIBRARY_PATH}
+else
+    LD_LIBRARY_PATH=${EXTENT_LD_LIB_PATH}
+fi
+
+export LD_LIBRARY_PATH
+
+# Set XPSERVERLIST if not set yet for XPrint support, or complain.
+
+#if [ -z "${XPSERVERLIST}" ]; then
+#    if [ -x /etc/init.d/xprint ]; then
+#        XPSERVERLIST=`/etc/init.d/xprint get_xpserverlist`
+#        export XPSERVERLIST
+#    else
+#        echo -e "Warning: \${XPSERVERLIST} not set and /etc/init.d/xprint not found;\nprinting will not work.\nPlease install the xprt-xprintorg package" >&2
+#    fi  
+#fi
+
+verbose () {
+    if [ "${VERBOSE}" ]; then
+        echo $@
+    fi
+}
+
+echo_vars () {
+    if [ "${VERBOSE}" ]; then
+      for var in "$@"; do
+          echo "$var=`eval echo \\${$var}`"
+      done
+    fi
+}
+    
+# exec wrapper for verbosity
+exec_verbose () {
+    verbose Running: $@
+    exec "$@"
+}
+
+# exec wrapper for verbosity
+run_verbose () {
+    verbose Running: $@
+    "$@"
+}
+
+# Figure out if we need to ser LD_ASSUME_KERNEL for older versions of the JVM.
+set_jvm_vars () {
+
+    if [ ! -L /usr/lib/mozilla/plugins/libjavaplugin_oji.so ]; then
+        return;
+    fi
+
+    JVM_LINK=`readlink /usr/lib/mozilla/plugins/libjavaplugin_oji.so`
+
+    # is it relative?  if so append the full path
+
+    echo "${JVM_LINK}" | grep -e "^/" 2>&1 > /dev/null
+
+    if [ "$?" -ne 0 ]; then
+        JVM_LINK="/usr/lib/mozilla/plugins/${JVM_LINK}"
+    fi
+
+    JVM_BASE=`basename "${JVM_LINK}"`
+    JVM_DIR=`dirname "${JVM_LINK}"`
+    JVM_COMMAND="${JVM_DIR}/java"
+    if [ ! -r "${JVM_COMMAND}" ]; then
+        JVM_DIR="${JVM_DIR}/../../../bin/"
+        JVM_COMMAND="${JVM_DIR}/java"
+        # does the command exist?
+        if [ ! -r "${JVM_COMMAND}" ]; then
+            return
+        fi
+    fi
+
+    # export this temporarily - it seems to work with old and new
+    # versions of the JVM.
+    export LD_ASSUME_KERNEL=2.2.5
+
+    # get the version
+    JVM_VERSION=`${JVM_COMMAND} -version 2>&1 | grep version | cut -f 3 -d " " | sed -e 's/\"//g'`
+
+    unset LD_ASSUME_KERNEL
+
+    case "${JVM_VERSION}" in
+        (1.3.0*)
+        # bad JVM
+        export LD_ASSUME_KERNEL=2.2.5
+        ;;
+    esac
+
+    echo_vars JVM_DIR JVM_VERSION
+}
+
+clean_profile()
+{
+# Clean up the XUL.mfasl unconditionally on launch, since we have the
+# corner case of when firefox is running when upgraded. Need a
+# better solution or upstream fix.
+# Clean up the compatibility.ini as well, since we have a corner case of when
+# some components register protocols. Need a better solution or upstream fix.
+    if [ -f "${HOME}/.mozilla/firefox/profiles.ini" ]; then
+        sed -e '/Path=/! d' -e 's,Path=/,/,' -e "s,Path=,${HOME}/.mozilla/firefox/," "${HOME}/.mozilla/firefox/profiles.ini" \
+        | while read dir
+            do
+            rm -f "${dir}/XUL.mfasl"
+	    if [ "${dir}/compreg.dat" -ot "/usr/lib/mozilla-firefox/components.ini" ]; then
+	        rm -f "${dir}/compatibility.ini"
+	    fi
+        done
+    fi
+}
+
+# OK, here's where all the real work gets done
+
+# parse command line
+APPLICATION_ID=firefox
+REMOTE=0
+TRY_USE_EXIST=0
+VERBOSE=
+DEBUG=0
+DEBUGGER=
+first=1
+opt=
+for arg in "$@"; do
+    if [ ${first} -eq 1 ]; then
+        set dummy
+        first=0
+    fi
+
+    case "${arg}" in
+        -a | --display | -contentLocale | -UILocale | -remote | --debugger | -height | -width | -chrome | -P)
+            prev=${arg}
+            continue
+        ;;
+    esac
+    
+    if [ "${prev}" ]; then
+        case "${prev}" in
+            -a)
+                APPLICATION_ID="${arg}"
+                ;;
+            --display)
+                CMDLINE_DISPLAY="${arg}"
+                set "$@" --display "${arg}"
+                ;;
+            -remote)
+                REMOTE=1
+                set "$@" -remote "${arg}"
+                ;;
+            --debugger)
+                DEBUGGER="${arg}"
+                DEBUG=1
+                ;;
+            *)
+                set "$@" "${prev}" "${arg}"
+                ;;
+        esac
+        prev=
+    elif [ "${arg}" ]; then
+        case "$arg" in
+            --verbose | -V)
+                VERBOSE=1
+                ;;
+            --display=*)
+                CMDLINE_DISPLAY=`echo ${arg} | sed 's/^--display=//'`
+                set "$@" "${arg}"
+                ;;
+            -g | -debug)
+                DEBUG=1
+                ;;
+            -*)
+                set "$@" "${arg}"
+                ;;
+            *)
+                if [ -z "${opt}" ]; then
+                    opt="${arg}"
+                    # check to make sure that the url contains at least a :/ in it.
+                    echo ${opt} | grep -e ':/' 2>/dev/null > /dev/null
+                    RETURN_VAL=$?
+                    if [ "${RETURN_VAL}" -eq 1 ]; then
+                    # if it doesn't begin with a '/' and it exists when the pwd is
+                    # prepended to it then append the full path
+                        echo ${opt} | grep -e '^/' 2>/dev/null > /dev/null
+                        if [ "$?" -ne "0" ] && [ -e "`pwd`/${opt}" ]; then
+                            opt="`pwd`/${opt}"
+                        fi
+		        # Replace all spaces by %20 and prepend file:// if it is a valid file
+			if [ -e "${opt}" ]; then
+		          opt="file://`echo ${opt} | sed 's/ /%20/g'`"
+			fi
+                    fi
+                    set "$@" "${opt}"
+                else
+                    set "$@" "${arg}"
+                fi
+                ;;
+        esac
+    fi
+done
+
+if [ $# -ne 0 ]; then
+    shift
+fi
+OPTIONS="$@"
+
+if [ ${DEBUG} -eq 1 ]; then
+    if [ "${DEBUGGER}" = "" ]; then
+        DEBUGGER=gdb
+    fi
+    TMPFILE=`mktemp -t firefox_argsXXXXXX`
+    echo set args -a ${APPLICATION_ID} "$@" > ${TMPFILE}
+    case "${DEBUGGER}" in
+        gdb)
+            run_verbose gdb "${MOZ_PROGRAM}" -x ${TMPFILE}
+            ;;
+        ddd)
+            run_verbose ddd --debugger "gdb -x ${TMPFILE}" "${MOZ_PROGRAM}"
+            ;;
+        *)
+            run_verbose ${DEBUGGER} "${MOZ_PROGRAM}" "$@"
+            ;;
+    esac
+    rm ${TMPFILE}
+    exit
+fi
+
+if [ $# -eq 1 ] && [ "$1" = "${opt}" ]; then
+    TRY_USE_EXIST=1
+fi
+
+MOZ_PROGRAM="${MOZ_PROGRAM} -a ${APPLICATION_ID}"
+
+echo_vars FIREFOX_DSP APPLICATION_ID CMDLINE_DISPLAY DISPLAY REMOTE \
+          TRY_USE_EXIST OPTIONS DEBUG DEBUGGER
+
+# set our JVM vars
+set_jvm_vars
+
+PING_STATUS=1
+
+# No need to check if DISPLAY is not set, it will fail. But let's continue,
+# so that firefox gives the display error message itself.
+if [ "${DISPLAY}" ] || [ "${CMDLINE_DISPLAY}" ]; then
+    if [ -z "${CMDLINE_DISPLAY}" ]; then
+        CMDLINE_DISPLAY="${DISPLAY}"
+    fi
+    
+    # check to see if there's an already running instance or not
+    verbose "Running: ${MOZ_PROGRAM} -remote 'ping()'"
+    DISPLAY="${CMDLINE_DISPLAY}" ${MOZ_PROGRAM} -remote 'ping()' \
+        > /dev/null 2>&1
+    PING_STATUS=$?
+fi
+
+echo_vars PING_STATUS
+
+# Clean user profile if we are not trying to use the running instance and only
+# if the check was successful (status 2)
+if [ "${REMOTE}" -eq 0 ] && [ "${TRY_USE_EXIST}" -eq 0 ] && [ "${PING_STATUS}" -eq 2 ]; then
+    verbose "Cleaning user profile"
+    clean_profile
+fi
+
+# If there is no command line argument at all then try to open a new
+# window in an already running instance.
+if [ "${PING_STATUS}" -eq 0 ] && [ $# -eq 0 ]; then
+    exec_verbose ${MOZ_PROGRAM} -remote "xfeDoCommand(openBrowser)"
+fi
+
+# If we are trying to use existing instance, and it exists, and we're not having
+# a -remote command line argument, then open in window or tab accordingly.
+if [ "${REMOTE}" -eq 0 ] && [ "${TRY_USE_EXIST}" -eq 1 ] && [ "${PING_STATUS}" -eq 0 ]; then
+    # just pass it off if it looks like a url
+    exec_verbose ${MOZ_PROGRAM} -remote "openURL(${opt})"
+fi
+
+if type "${FIREFOX_DSP}" > /dev/null 2>&1; then
+    # echo "Using $FIREFOX_DSP."
+    MOZ_PROGRAM="${FIREFOX_DSP} ${MOZ_PROGRAM}"
+fi
+
+exec_verbose ${MOZ_PROGRAM} "$@"
--- mozilla-firefox-1.0.4.orig/debian/README.Debian
+++ mozilla-firefox-1.0.4/debian/README.Debian
@@ -0,0 +1,107 @@
+README for Debian
+=================
+
+*** Please submit non packaging issue (e.g. feature requests) bugs to
+the Debian BTS and the upstream bugzilla
+(http://bugzilla.mozilla.org/buglist.cgi?product=Firefox) and put a
+reference to the bugzilla bug in the Debian bug report, to ease bug
+triage for the maintainer. Thank you. ***
+
+Firefox is still in heavy development, and it does not fully support
+upgrading from one release to another. Moving your .mozilla/firefox
+directory out of the way should be your first course of action before
+filing a bug report. Please see #202130 for an excellent analysis. You
+may also want to try removing ~/.mozilla/firefox/default/*/XUL.mfasl.
+
+Firefox requires the loopback interface (lo) to be up and unfiltered
+to accept keyboard input and function correctly. Please make sure this
+is the case before filing any bugs.
+
+Application Update
+------------------
+
+From version 1.0-2 onwards, the automatic application update has been
+completely disabled at the source code level, since it makes no sense
+in the context of Debian.
+
+Automatic extensions update has also been disabled, but you can still
+enable it by either modifying the /etc/mozilla-firefox/pref/firefox.js
+file, in the user profile prefs.js, in about:config, or in the
+advanced preferences panel. You can also, while not re-enabling
+automatic updates, request extensions updates in the extensions
+manager dialog or in the advanced preferences panel
+
+Extensions
+----------
+
+From Firefox 0.9, "old" extensions are disabled at first run (i.e.
+when no profile was found). By old extensions, Firefox means extensions
+not following the new extensions guidelines described at:
+http://www.bengoodger.com/software/mb/extensions/packaging/extensions.html
+But even the ones following these guidelines can be considered old if the
+contents.rdf file in their chrome gives the attribute chrome:extension = 
+"true" in the package information.
+
+For packaged extensions, that will lead to a lock case where you can't
+enable the extension back, due to an Extensions Manager bug. In such case,
+edit the chrome/chrome.rdf file in your user profile (usually
+~/.mozilla/firefox/default.*/chrome/chrome.rdf) and remove the
+c:disabled="true" attributes from the extensions you want to enable back.
+
+Note that the mentioned Extensions Manager bug will prevent you to disable
+packaged extensions for you profile from Firefox GUI. You need to edit the
+chrome/chrome.rdf file in the opposite way, i.e. adding a c:disabled="true"
+attribute to the corresponding rdf:Description element.
+
+Sound
+-----
+
+By default, firefox detects and runs the correct dsp wrapper for esd
+or arts. If this is not the desired behaviour, edit
+/etc/mozilla-firefox/mozilla-firefoxrc or ~/.mozilla-firefoxrc and set
+the FIREFOX_DSP variable to:
+
+"auto": The default, auto-detection.
+
+"esddsp": Use esd.
+
+"artsdsp": Use arts.
+
+"none": Don't use any sound wrapper.
+
+
+using Java. (You should use plugin which compiled with gcc-3.2)
+----------
+ 
+Grab a binary Java distribution from http://java.sun.com/. Install the
+java-package package and do a make-jpkg on the file.
+
+Buttons
+-------
+
+Some people have complained that the button order in dialogs is
+non-intuitive (ie, they don't like it). To reverse the order, add the
+following to your chrome/userChrome.css file, under the
+~/.mozilla/firefox directory:
+
+.dialog-button-box { -moz-box-direction: reverse; -moz-box-pack: right; }
+.dialog-button-box spacer { display: none ! important; }
+
+Emacs keybindings
+-----------------
+
+Versions of Firfox before 1.0 supported Emacs style keybindings in
+text entry boxes. Version 1.0 now merely follows the GTK keybindings
+settings. To enable Emacs keybindings in GTK, follow the instructions
+at http://kb.mozillazine.org/Emacs_Keybindings_(Firefox).
+
+IDN Resolving
+-------------
+
+To enable IDN domain names, go to the about:config page and change
+network.enableIDN to true. There is a however some very bad spoofing
+that this option opens up. See
+http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=293975. Enable at
+your own risk.
+
+ -- Eric Dorland <eric@debian.org>, Tue Mar  1 02:00:11 2005
